Click here to Skip to main content
11,411,922 members (65,357 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP
Hi friends


please give solution for this error i have strugling for 2 days


i am getting this error in when i try to login server system... but my local (Xamp) system working fine

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/content/91/7287991/html/employeelogin/loginp.php on line 1

for this getting error i fixed white spaces cookies and escae functions also getting same error

plz give solution


index.php:-


<?php
include "index_header.php";
$failed=$_GET['failed'];?><script type="text/javascript"><!--function validate_login ( ){   valid = true;       if ( document.login.user.value == "" )       {              alert ( "Please fill the user name." );               valid = false;        }       else if ( document.login.pass.value == "" )             {                       alert ( "Please fill in the password." );                       valid = false;        }       return valid;}//--></script><br><br><?phpif(isset($failed)){?><div class="empty" style="text-align:center;padding:10px;">Invalid username or password</div><?php}?>   <form  name="login" method="post" action="loginp.php" onSubmit="return validate_login( );">          <table cellspacing="0" cellpadding="5" class="miniLogOn"> <tr> <td colspan="2"> <h1 class="welcome">Log on to Admin Dashboard</h1> <br /> </td> </tr>
 

 
                <tr ><th class="dlg" valign="top">Username:</th><td class="dlg" >
 

 
                     <input type="text" name="user" id="sPerson" size="30" class="dlgText" style="width:180px" value="" />
 
                    </td></tr><tr ><th class="dlg" valign="top">Password:</th><td class="dlg" >


loginp.php:------


<?phpinclude "db.php";phpinfo();$username=$_POST["user"];
 
$password=$_POST["pass"];
 
$p=$password;
 
$username=mysql_real_escape_string($username);
 
$password=mysql_real_escape_string($password);
 
//now md5 the password

if(!isset($username)){
 
include "error.php";
 
exit();
 
}
 
if(!isset($password)){
 
include "error.php";
 
exit();
 
}
 
$password=md5($password);
 
$mysqlqry="select username,id,name,email from users where username='".$username."'and password='".$password."'";
 
//echo $mysqlqry;

$result = mysql_query($mysqlqry);
 

 
//echo "Result is ".$result;

if (!$result)
{
 

 
    header("Location:login.php?failed=1");
 
    exit();
 
}
 
else{
 
    $affected=mysql_num_rows($result);
 
if($affected == 1){$row = mysql_fetch_array($result);
 
//$id=$row["userid"];

$emailid=$row["email"];
 
$name=$row["name"];
 
$id=$row["id"];
 
setcookie("lu",$id,time()+10*3600);
 
header("Location:dashboard.php");
 
}
 
else{
 
?>
 
<?php
 
    header("Location:login.php?failed=1");
 
}
 
}
 
?
>






DB.php:----

<?php
$dbcnx = mysql_connect("xyz.com", "xyz", "asd123");
if(!$dbcnx)
{
echo("<P>Unable to connect to the " . "database server at this time.</P>" . mysql_error());
exit();
}
if (! @mysql_select_db("sbsemployee") )
{
echo( "<P>Unable to locate the database at this time.</P>" );
exit();
}
 
?>


Thanks & Regards

Mallesh(Malleshsgd@gmail.com
Posted 4-Mar-13 20:24pm
Edited 4-Mar-13 20:26pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 268
1 Sergey Alexandrovich Kryukov 200
2 Sascha Lefévre 170
3 ProgramFOX 130
4 Maciej Los 110
0 Sergey Alexandrovich Kryukov 8,955
1 OriginalGriff 7,158
2 Maciej Los 3,480
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web01 | 2.8.150414.5 | Last Updated 5 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100