Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Jul 2004
    Location
    CB9
    Posts
    4,996
    Tokens
    0

    Latest Awards:

    Default What's wrong with this?

    PHP Code:
    <?
       ob_start
    (); // allows you to use cookies
       
    $conn mysql_connect("web10.mysql.000025.net","dan_user","abc123");
       
    mysql_select_db(DATABASE NAME) or die(mysql_error());
       
    //fill in the above lines where there are capital letters.
       
    $logged MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]' AND password = '$_COOKIE[pass]'");
       
    $logged mysql_fetch_array($logged);
       
    //the above lines get the user's information from the database.
    ?>
    That is what i have and this is what it is based around

    PHP Code:
     <? 
       ob_start
    (); // allows you to use cookies 
       
    $conn mysql_connect("localhost","DATABASE USERNAME","DATABASE PASSWORD"); 
       
    mysql_select_db(DATABASE NAME) or die(mysql_error()); 
       
    //fill in the above lines where there are capital letters. 
       
    $logged MYSQL_QUERY("SELECT * from users WHERE id='$_COOKIE[id]' AND password = '$_COOKIE[pass]'"); 
       
    $logged mysql_fetch_array($logged); 
       
    //the above lines get the user's information from the database. 
    ?>
    What am i doing wrong?

  2. #2
    Join Date
    Jun 2004
    Posts
    753
    Tokens
    0

    Default

    Keep it Localhost
    My sites

    Mangacars.co.uk

    Ppxgames.com

    Uploadforfree.NET (EXPIRED)

    PixelLoft.NET

    Css-Gyro.com

    Neonfusion.NET

    [Zainx / Lofty]

  3. #3
    Join Date
    Jul 2004
    Location
    CB9
    Posts
    4,996
    Tokens
    0

    Latest Awards:

    Default

    All my other db's use that host?

    Parse error: parse error, unexpected T_STRING in /usr/home/dan/public_html/config.php on line 4

    Thats all i get
    Last edited by tbh imo no m8; 25-04-2006 at 09:22 PM.

  4. #4
    Join Date
    Feb 2006
    Posts
    2,185
    Tokens
    0

    Latest Awards:

    Default

    lol why show us your password, all we need to do is find out your site your doing this too =]

  5. #5
    Join Date
    Jul 2004
    Location
    CB9
    Posts
    4,996
    Tokens
    0

    Latest Awards:

    Default

    Why what can you do? Anyway thats just my database password? See what is wrong?

  6. #6
    Join Date
    May 2005
    Location
    Cornwall
    Posts
    3,590
    Tokens
    2,900
    Habbo
    Feyod

    Latest Awards:

    Default

    Have you tested it with what zainx said?
    Occasionally visit and have a nose.

  7. #7
    Join Date
    Jul 2004
    Location
    CB9
    Posts
    4,996
    Tokens
    0

    Latest Awards:

    Default

    Yea i noticed what as wrong lol i didn;t edit this bit

    mysql_select_db(DATABASE NAME) or die(mysql_error());

    Now i have this

    PHP Code:
    Warning:  Cannot modify header information headers already sent by (output started at /usr/home/dan/public_html/index.php:2in /usr/home/dan/public_html/login.php on line 43

    Warning
    :  Cannot modify header information headers already sent by (output started at /usr/home/dan/public_html/index.php:2in /usr/home/dan/public_html/login.php on line 44
    Thank You
    You will be redirected 
    And this is the file for them lines

    PHP Code:
    setcookie("id"$user[id],time()+(60*60*24*5), "/""");
    setcookie("pass"$user[password],time()+(60*60*24*5), "/""");
    // the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
    Last edited by tbh imo no m8; 25-04-2006 at 09:53 PM.

  8. #8
    Join Date
    Apr 2006
    Location
    England
    Posts
    71
    Tokens
    0

    Default

    Dude, put this:

    PHP Code:
    <?
    ob_start
    ();
    include(
    'config.php');
    ?>
    AT THE VERY TOP OF YOUR FILE! LINE 1!
    It is so important you do that so the cookie information can be sent successfully.

    Then, remove

    PHP Code:
    ob_start();
    include(
    'config.php'); 
    from the original code.

  9. #9
    Join Date
    Jul 2004
    Location
    CB9
    Posts
    4,996
    Tokens
    0

    Latest Awards:

    Default

    Yea it works now i knew what was wrong .

  10. #10
    Join Date
    Feb 2006
    Location
    Coventry
    Posts
    2,096
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Arisham
    Dude, put this:

    PHP Code:
    <?
    ob_start
    ();
    include(
    'config.php');
    ?>
    AT THE VERY TOP OF YOUR FILE! LINE 1!
    It is so important you do that so the cookie information can be sent successfully.

    Then, remove

    PHP Code:
    ob_start();
    include(
    'config.php'); 
    from the original code.
    Exactly what he said.

Page 1 of 2 12 LastLast

Posting Permissions

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