Click here to Skip to main content
15,879,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:-


XML
<?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:------


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:----

XML
<?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
Updated 4-Mar-13 19:26pm
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900