Login ... help... please

    Date: 02/06/09 (WebDesign)    Keywords: php, database

    I know. I'm such a noob. I've been looking everywhere online for just a simple login and logout code.. I did find one but now it seems to only work for show. Whether I'm logged in or out it doesn't recognize it either way. It does, however, connect to the database at least and will recognize username and password.

    I just... need it to kill the session when you log out and then start it again when you log in.. My codes for members to see member only links is..



    $CookieData = unserialize(stripslashes($_COOKIE['phpbb2mysql_data']));
    $myID = $CookieData['userid'];
    echo "";
    ?>

    (id.php blah blah included on the overall header)

    letting me do...


    Member Linkage?

    Non member linkage!


    So that's what I'm working with as far as members only links, however, when I log in with my present login codes it doesn't...do this.

    Logout:
    include "include/session.php";
    session_unset();
    session_destroy();
    ?>
    echo "

    Successfully logged out.

    Login
    ";
    ?>

    Login:


    Login ID





     Password






    newsession:
    //error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR);
    $session['userid']=session_id();
    $session['username']=$name;
    //echo $session['username'];
    ?>

    session:
    session_start();
    session_register("session");
    ?>

    loginck:
    include "include/session.php";

    $dbservertype='mysql';
    $servername='xxxx.perfora.net';
    // username and password to log onto db server
    $dbusername='xxxx';
    $dbpassword='xxxx';
    // name of database
    $dbname='xxxx';

    ////////////////////////////////////////
    ////// DONOT EDIT BELOW /////////
    ///////////////////////////////////////
    connecttodb($servername,$dbname,$dbusername,$dbpassword);
    function connecttodb($servername,$dbname,$dbuser,$dbpassword)
    {
    global $link;
    $link=mysql_connect ("$servername","$dbuser","$dbpassword");
    if(!$link){die("Could not connect to MySQL");}
    mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
    }
    //////////////////////////////
    ?>
    $userid=mysql_real_escape_string($userid);
    $name=mysql_real_escape_string($name);
    $password=mysql_real_escape_string($password);

    if($rec=mysql_fetch_array(mysql_query("SELECT * FROM Signup WHERE username='$username' AND Password = '$password'"))){
    if(($rec['username']==$username)&&($rec['Password']==$password)){
    include "include/newsession.php";
    echo "

    Welcome back
    ";
    print "";

    }
    }
    else {

    session_unset();
    echo "Wrong Login. Use your correct Name and Password and Try
    ";

    }
    ?>




    What am I doing wrong? ;_; this is the only thing keeping me from putting my site up...
    I hope my problem makes sense -_-

    Source: http://community.livejournal.com/webdesign/1470111.html

« google ranking || wide data tables »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home