Posted by Hyshiro Thu 1st Mar 2007 17:41 - Syntax is JavaScript - 30 views
Modification of posting from Hyshiro Thu 1st Mar 2007 17:30
Download | New Post | Modify | Diff | Diff | Hide line numbers
Description:
Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in
/home/hyshiro/public_html/login_form.inc on line 125

  1.   /* Program: login.php
  2.    * Desc:    Login program for the Members Only section of the pet store.
  3.    *          It provides two options: (1) login using an existing login name and
  4.    *          (2) enter a new login name. Login names and passwords are stored in mysql
  5.    */
  6.      session_start ();
  7.      include("conf.inc");
  8.      switch (@$_GET['do'])
  9.      {
  10.     case "login";
  11.       $connection = mysql_connect($host, $user, $password)
  12.         or die ("Couldn't connect to server.");
  13.       $db = mysql_select_db($database, $connection)
  14.         or die ("Couldn't select database.");
  15.      
  16.       $sql = "SELECT loginName FROM Member
  17.           WHERE loginName='$_POST[fusername]'";
  18.       $result = mysql_query($sql)
  19.         or die("Couldn't execute querry.");
  20.       $num = mysql_num_rows($result);
  21.       if ($num == 1) // login name was found
  22.       {
  23.          $sql = "SELECT loginName FROM Member
  24.              WHERE loginName='$_POST[fusername]'
  25.              AND password=md5('$_POST[fpassword]')";
  26.          $result2 = mysql_query($sql)
  27.             or die("Couldnt execute query 2.");
  28.          $num2 = mysql_num_rows($result2);
  29.          if ($num2 > 0) // password is correct
  30.          {
  31.         $_SESSION['auth']="yes";
  32.         $logname=$_POST['fusername'];
  33.         $_SESSION['logname'] = $logname;
  34.         $today = date("Y-m-d h:m:s");
  35.         $sql = "INSERT INTO Login (loginName,loginTime)
  36.             VALUES ('$logname','$today')";
  37.         mysql_query($sql) or die ("Can't execute query.");
  38.         header("Location: Member_page.php");
  39.          }
  40.          else // password is not correct
  41.          {
  42.         unset($_GET['do']);
  43.         $message="The Login Name, '$_POST[fusername]'
  44.               exists, but you have not entered the correct password, Please try
  45.         again.
    "
    ;
  46.         include("login_form.inc");
  47.          }
  48.     }
  49.     elseif ($num == 0) // login name not found
  50.     {
  51.        unset($_GET['do']);
  52.        $message = "The Login Name you entered does not exist!
  53.                Please try again.
    "
    ;
  54.        include("login_form.inc");
  55.     }
  56.       break;
  57.  
  58.       case "new";
  59.     foreach($_POST as $field => $value)
  60.     {
  61.       if ($field != "fax")
  62.       {
  63.         if ($value == "")
  64.         {
  65.           unset($_GET['do']);
  66.           $message_new = "Required information is missing.
  67.         Please try again.";
  68.           include("login_form.inc");
  69.           exit();
  70.         }
  71.       }
  72.       if (ereg("(Name)",$field))
  73.       {
  74.           if (!ereg("^[A-Za-z' -]{1,50}$",$value))
  75.         {
  76.           unset($_GET['do']);
  77.               $message_new = "$field is not a valid name.
  78.                   Please try again.";
  79.           include('login_form.inc');
  80.           exit();
  81.         }
  82.       }   
  83.       $$field = strip_tags(trim($value));
  84.     } // end foreach
  85.     if (!ereg("^[0-9]{5,5}(\-[0-9]{4,4})?$",$zip))
  86.     {
  87.         unset($_GET['do']);
  88.         $message_new = "$zip is not a valid phone number.
  89.                 Please try again.";
  90.         include("login_form.inc");
  91.         exit();
  92.     }
  93.     if (!ereg("^[0-9)(xX -]{7,20}$",$phone))
  94.     {
  95.       unset($_GET['do']);
  96.       $message_new = "$phone is not a valid phone number.
  97.                Please try again.";
  98.       include("login_form.inc");
  99.       exit();
  100.     }
  101.     if ($fax != "")
  102.     {
  103.       if (!ereg("^[0-9)(xX -]{7,20}$",$fax))
  104.       {
  105.         unset($_GET['do']);
  106.         $message_new = "$fax is not a valid phone number.
  107.                 Please try again.";
  108.         include("login_form.inc");
  109.         exit();
  110.       }
  111.     }
  112.     if (!ereg("^.+@.+\\..+$",$email))
  113.     {
  114.       unset($_GET['do']);
  115.       $message_new = "$email is not a valid email address.
  116.                Please try again.";
  117.       include("login_form.inc");
  118.       exit();
  119.     }
  120.     /* check to see if login name already exists */
  121.     $connection = mysql_connect($host,$user,$password)
  122.         or die ("Couldn't connect to server.");
  123.     $db = mysql_select_db($database, $connection)
  124.         or die ("Couldn't select database.");
  125.     $sql = "SELECT loginName FROM Member
  126.         WHERE loginName='$newname'";
  127.     $result = mysql_query($sql)
  128.         or die("Couldn't execute query.");
  129.     $num = mysql_numrows($result);
  130.     if ($num > 0)
  131.     {
  132.       unset($_GET['do']);
  133.       $message_new = "$newname already used.
  134.                Select another Member ID.";
  135.       include("login_form.inc");
  136.       exit();
  137.     }
  138.     else
  139.     {
  140.       $today = date("Y-m-d");
  141.       $sql = "INSERT INTO Member (loginName,createDate,password,firstName,lastName,
  142.             street,city,state,zip,phone,fax,email) VALUES
  143.           ('$newname','$today',md5('$newpass'),
  144.            '$firstName','$lastName','$street','$city',
  145.            '$state','$zip','$phone','$fax','$email')";
  146.       mysql_query($sql);
  147.       $_SESSION['auth']="yes";
  148.       $_SESSION['logname'] = $newname;
  149.  
  150.     /* send email to new member */
  151.     $emess = "A new Member Account has been setup. ";
  152.     $emess = "Your new Member ID and password are: ";
  153.     $emess = "\n\n\t$newname\n\t$newpass\n\n";
  154.     $emess = "We appreciate your interest BCSO";
  155.     $emess = " at www.bcso.co.uk! \n\n";
  156.     $emess = "If you have any questions or problems,";
  157.     $emess = " email ";
  158.     $ehead="From: ";
  159.     $subj = "Your new Member Account from BCSO";
  160.     $mailsend=mail("$email","$subj","$emess","$ehead");
  161.     header("Location: New_member.php");
  162.     }
  163.       break;
  164.  
  165.       default;
  166.        include("login_form.inc");
  167.     }
  168.   ?>
  169.  
  170.  
  171.  
  172.  
  173.  

PermaLink to this entry https://pastebin.co.uk/11242

The following amendments have been posted:

  1. Anonymous (Thu 1st Mar 2007 17:43)
Posted by Hyshiro Thu 1st Mar 2007 17:41 - Syntax is JavaScript - 30 views
Modification of posting from Hyshiro Thu 1st Mar 2007 17:30
Download | New Post | Modify | Diff | Diff | Hide line numbers

 

Comments: 0