+ Reply to Thread
Results 1 to 8 of 8

Thread: Login Form Help

  1. #1
    rs.top is offline x10Hosting Member rs.top is an unknown quantity at this point
    Join Date
    Oct 2008
    Posts
    52

    Login Form Help

    I am trying to ad a login for my site! Everything went fine except the log.php.... I keep getting

    Code:
    Parse error:  syntax error, unexpected T_STRING in /home/bigbucks/public_html/log.php on line 11
    here is the log.php

    Code:
    include ("functions.php");
    sqlcon();
    $user = $_POST['user']; 
    $pass = $_POST['pass'];
    $result = mysql_query("SELECT * FROM users WHERE username='$user' and password='$pass'");
    $count = mysql_num_rows($result);
    if($count == "1")
    (
        session_register("loggedin")
        header("location: check.php");         <<<Line 11
    ) else {
        echo "Could no log you in.";
    }
    ?>

  2. #2
    terryurden is offline x10Hosting Member terryurden is an unknown quantity at this point
    Join Date
    Oct 2008
    Posts
    5

    Re: Login Form Help

    look at line 10......

    ;

  3. #3
    rs.top is offline x10Hosting Member rs.top is an unknown quantity at this point
    Join Date
    Oct 2008
    Posts
    52

    Re: Login Form Help

    i had to take it out because it wouldn't work....id get that there is an unexpected ;

  4. #4
    mephis's Avatar
    mephis is offline x10Hosting Member mephis is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    39

    Re: Login Form Help

    well, after the if clause you're using ( instead of { and also closing with ) instead of }
    replace that, fix line 10 and you should be OK:
    PHP Code:
    if($count == "1")
    {
        
    session_register("loggedin");
        
    header("location: check.php");
    } else {
        echo 
    "Could no log you in.";

    Last edited by mephis; 11-23-2008 at 01:01 PM.

  5. #5
    tpounds is offline x10Hosting Member tpounds is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    36

    Re: Login Form Help

    Instead of scrpiting it, I suggest using MyBB. Even though its made for forums, you can use the log in form if you follow this tutorial: here

  6. #6
    freecrm's Avatar
    freecrm is offline x10 Elder freecrm is an unknown quantity at this point
    Join Date
    May 2008
    Location
    UK
    Posts
    629

    Re: Login Form Help

    Quote Originally Posted by tpounds View Post
    Instead of scrpiting it, I suggest using MyBB. Even though its made for forums, you can use the log in form if you follow this tutorial: here
    Why do this when this is so close? Mephis has correctly posted the correction needed.

  7. #7
    lblue is offline x10Hosting Member lblue is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    3

    Re: Login Form Help

    Semi colon missing on the line above?

  8. #8
    phpasks is offline x10 Sophmore phpasks is an unknown quantity at this point
    Join Date
    Apr 2008
    Posts
    145

    Re: Login Form Help

    Quote Originally Posted by rs.top View Post
    I am trying to ad a login for my site! Everything went fine except the log.php.... I keep getting

    Code:
    Parse error:  syntax error, unexpected T_STRING in /home/bigbucks/public_html/log.php on line 11
    here is the log.php

    Code:
    include ("functions.php");
    sqlcon();
    $user = $_POST['user']; 
    $pass = $_POST['pass'];
    $result = mysql_query("SELECT * FROM users WHERE username='$user' and password='$pass'");
    $count = mysql_num_rows($result);
    if($count == "1")
    (
      /*   session_register("loggedin")
        header("location: check.php");         <<<Line 11
    */
      session_register("loggedin");
         header("location: check.php");         <<<Line 11
    exit;
     ) else {
        echo "Could no log you in.";
    }
    ?>
    Now Your code work fine

    You can redirect any page to another page at that time after redirect exit use.
    Asif Khalyani
    http://www.phpasks.com

+ Reply to Thread

Similar Threads

  1. Unable to login properly,
    By icefire in forum Free Hosting
    Replies: 3
    Last Post: 02-06-2008, 10:17 PM
  2. Design a free form
    By gateway in forum Off Topic
    Replies: 1
    Last Post: 10-19-2007, 05:49 PM
  3. The previous way of login?
    By halchalgroups in forum Free Hosting
    Replies: 1
    Last Post: 09-22-2007, 02:07 AM
  4. My php Form tutorial
    By WinGate in forum Tutorials
    Replies: 0
    Last Post: 08-20-2007, 08:14 PM
  5. Frontpage Form Problem
    By geek2009 in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 07-03-2007, 10:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers