1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

script error

Discussion in 'PHP' started by nrodes, Nov 6, 2008.

  1. #1
    I have just made a log on script. It has several errors. I am not great with php.

    Heres my script:
    I know of this error:

    There might be other errors too.

    Thanks in advance.
     
    nrodes, Nov 6, 2008 IP
  2. dannywwww

    dannywwww Well-Known Member

    Messages:
    804
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #2
    You missed the } on the syntax, also you need the session_start(); before the script, since your using sessions :)

    <html>
    <head>
    <title>
    Logging In
    </title><script type="text/javascript">
    <!--
    function delayer(){
    window.location = "../javascriptredirect.php"
    }
    //-->
    </script>
    </head>
    <body onLoad="setTimeout('delayer()', 5000)" bgcolor="blue"><center><font size="36"><b><br>
    Logging in, please wait. If your browser does not auto matically redirect you, <a href="main.php">click here</a>.
    </font></center>
    </body>
    </html>
    
    <?php
    session_start(); ///////////You also need to start the session using session_start();
    //get input data
    $user=$_POST["username"];
    $pass=$_POST["password"];
    
    //encrypt username and pass
    $cuser=md5($user);
    $cpass=md5($pass);
    
    //make variables
    $ip = $_SERVER['REMOTE_ADDR'];
    $userplusip = $user . $ip;
    
    //include login file
    include($user . ".php");
    
    //make sure info matches and starts session
    if ($cuser==$realuser && $cpass==$realpass)
    {
    $_SESSION["auth_username"] = $user;
    $_SESSION["userplusip"] = $userplusip;
    } ////////////// Missed out this!
    
    ?> 
    PHP:
     
    dannywwww, Nov 6, 2008 IP
  3. ryandanielt

    ryandanielt Well-Known Member

    Messages:
    1,797
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    185
    #3
    This is a very basic way but its a really good try for a novice!
     
    ryandanielt, Nov 6, 2008 IP
  4. nrodes

    nrodes Peon

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks.
    the only problem is that it says this:
    and then fails the login
     
    nrodes, Nov 6, 2008 IP
  5. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #5
    <?php
    session_start(); ///////////You also need to start the session using session_start();
    ?>
    <html>
    <head>
    <title>
    Logging In
    </title><script type="text/javascript">
    <!--
    function delayer(){
    window.location = "../javascriptredirect.php"
    }
    //-->
    </script>
    </head>
    <body onLoad="setTimeout('delayer()', 5000)" bgcolor="blue"><center><font size="36"><b><br>
    Logging in, please wait. If your browser does not auto matically redirect you, <a href="main.php">click here</a>.
    </font></center>
    </body>
    </html>
    
    <?php
    //get input data
    $user=$_POST["username"];
    $pass=$_POST["password"];
    
    //encrypt username and pass
    $cuser=md5($user);
    $cpass=md5($pass);
    
    //make variables
    $ip = $_SERVER['REMOTE_ADDR'];
    $userplusip = $user . $ip;
    
    //include login file
    include($user . ".php");
    
    //make sure info matches and starts session
    if ($cuser==$realuser && $cpass==$realpass)
    {
    $_SESSION["auth_username"] = $user;
    $_SESSION["userplusip"] = $userplusip;
    } ////////////// Missed out this!
    
    ?>
    PHP:
    and check your form. It looks like your $_POST['username'] is empty.
     
    ads2help, Nov 6, 2008 IP
  6. nrodes

    nrodes Peon

    Messages:
    77
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I changed this but now it says:

    what does this mean?

    bdougan is the username im using to test
     
    nrodes, Nov 7, 2008 IP
  7. ads2help

    ads2help Peon

    Messages:
    2,142
    Likes Received:
    67
    Best Answers:
    1
    Trophy Points:
    0
    #7
    no such file exist. which mean bdougan.php does not exist
     
    ads2help, Nov 10, 2008 IP