Integrating existed php systems with your site ..

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PhpLover1984
    New Member
    • Jan 2008
    • 19

    Integrating existed php systems with your site ..

    Hello everybody,
    I am testing locally a php website which contains login control, so I'de like to integrate this login control with phpbb forums and at the end I want to have just one table for users and not two and if someone log in successfully into my system than he has not to log in again for the forums.

    Can you pleas give me some tips to solve this problem and eventually advice or comment on my programming style and used technics in my php website? :)

    I use this script to register new users:
    Register:

    [PHP] <?php
    // make a connection and open it
    $con = mysql_connect(" localhost", "root", "");
    if (!$con) {
    die('Could not connect: ' . mysql_error());
    }

    // select a database
    mysql_select_db ("MyDB", $con);
    // declare some variables ....
    $userName = $_POST['username'];
    $passwordHash = md5($_POST['password']);

    // excute an insert query
    $sql = "INSERT INTO tblUsers (username,passw oord) VALUES ('$userName,'$p asswordHash')";
    mysql_query($sq l);

    // close the db connection
    mysql_close($co n);
    ?>
    [/PHP]

    Log in:

    [PHP] // Make connection and select a DB
    $username= $_POST['username'];
    $passwordHash = md5($_POST['password']);

    $result = mysql_query("SE LECT username FROM tblUsers WHERE username = '$username' AND passwoord = '$passwordHash' " , $con);
    $raw= mysql_fetch_arr ay($result);

    if (mysql_affected _rows() < 1)
    {
    /* Access denied */
    echo ('Sorry, your username or password was incorrect!');
    }
    else
    {
    echo('Welcome back %s!', $_POST['username']);
    }

    // Close connection
    [/PHP]


    ps; I am not a programmer, but programming is just a hobby and I don't make this site for any commercial benefits.

    Thank you in advance
  • truezplaya
    New Member
    • Jul 2007
    • 115

    #2
    I'm not going to say that i am an expert by any means of the imagination but it might be an idea to look in to sessions in php if you don't know much about them. This may be the solution to your problem. I am pretty new to this myself ! If this isn't i am sure someone will tell you it's a great site to get help on.
    Truez

    Comment

    • PhpLover1984
      New Member
      • Jan 2008
      • 19

      #3
      the session you need it to control if the user is logged in or you can use it to save some informations on the site ..


      but my question is about using one table for users for all already open source developed systems like forums (phpbb), blogs (wordpress), chat, quiz, contact form, games, ...

      you get it?

      thanks anyway

      have a nice day

      Comment

      Working...