Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Location
    Milwaukee, Wisconsin
    Posts
    123
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Unhappy Arg whats Wrong With Meh Code???

    okay guys ive made a use register for my saite it seemed to work perfectly i mean i got it to set the database and what not but now when they loggin i getthe stupid parse error!!!
    heres the page if you need it: http://www.shadowgelert.com/myweb6
    here is the login pages html
    Code:
    <!doctype html public "-//W3C//DTD HTML 4.0 //EN">
    <html>
    <head>
    <?php $title = "Members Login"; ?>
    </head>
    <body>
    <form method="post" action="?page=login2">
    Enter your User Name <input type="text" name="Name" size="20"><br>
    Enter you Password <input type="password" name="Password" size="20"><br>
    <input type="submit" name="submit">
    </form>
    </body>
    </html>
    heres the code for the page after you would hit the loggin button
    Code:
    <?php 
    $title = "Logged In";
    include("common.php"); 
    
    if(!($link_id = mysql_connect($Host, $User, $Pass))) die(mysql_erorr()); 
    mysql_select_db($DB); 
    
    $sql = "SELECT ID FROM " . $Table . " WHERE Name='" . addslashes($_POST['Name']) . "' AND Password='" . md5($_POST['Password']) . "' LIMIT 1"; 
    if(!($result = mysql_query($sql))) die(mysql_error()); 
    
    if(mysql_num_rows($result) == 1) {
        setcookie("LoggedIn, TRUE, time()+(3600 * 24)); 
        echo"You Are Now Logged In"; 
    } else { 
        echo"Login failure"; 
    } 
    ?>
    I need help please

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Uhhhh so what's the parse error when logging in?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Location
    Milwaukee, Wisconsin
    Posts
    123
    Thanks
    1
    Thanked 0 Times in 0 Posts
    well i figuered out part of it
    setcookie("LoggedIn, TRUE, time()+(3600 * 24)); was suppoesed to be
    setcookie('LoggedIn', 'TRUE', time()+(3600 * 24));

    but i still get this new error:
    Warning: Cannot add header information - headers already sent by (output started at /home/stoodder/public_html/myweb6/index.php:8) in /home/stoodder/public_html/myweb6/login2.php on line 13

  • #4
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    You need to set the cookies before anything is sent to the browser, and as you didn't inlcude the source for common.php, I assume you send some html to the browser with that.

  • #5
    Regular Coder
    Join Date
    Oct 2002
    Location
    Milwaukee, Wisconsin
    Posts
    123
    Thanks
    1
    Thanked 0 Times in 0 Posts
    hmm uh i dont really get what your saying sory./.. buit common .php has my database info in it thats all. otherwise i use index,php as my template file then i have ?page=whatever page to include into index.php im not sure if that is what you meant though please word that better.. sorry im slow lol

  • #6
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    From what I understand, that error means that whatever you're trying to send to the client already exists, or that you're trying to set cookies/sessions after html has been sent, ie:

    <html>
    <head>
    <title>page</title>
    </head>
    <body>
    <?
    setcookie("LoggedIn, TRUE, time()+(3600 * 24));
    echo 'blah blah';
    ?>
    </body>
    </html>

  • #7
    Regular Coder
    Join Date
    Oct 2002
    Location
    Milwaukee, Wisconsin
    Posts
    123
    Thanks
    1
    Thanked 0 Times in 0 Posts
    hey thanx man i got it now


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •