Jump to content

Recommended Posts

<?php

include("connection.php"):

session_start();

if(isset($_POST['submit']))

 {

 $uid=mysql_real_escape_string($_POST['userid']);

 $logpass=mysql_real_escape_string($_POST['password']);

  //$log=$uid;

  $row=mysql_query("select * from Hr where username='".$uid."' and password='".$logpass."'");

  $obj=mysql_fetch_object($row);

  if(($logpass==$obj->password)&&($logpass!="")&&($uid==$obj->username))

   {

$_SESSION["hrid"]=$_POST['userid'];

if(isset($_POST['keeplogin']))

{

setcookie("hrcookid","$uid",time() + 60);

setcookie("hrcookpass","$logpass",time() + 60);

}

else

{

 

setcookie("hrcookid","$uid",time() - 60);

setcookie("hrcookpass","$logpass",time() - 60);

}

 

   }

   else

   {

      $error="Invalid";

 $log=$_POST['userid'];

 $pass=$_POST['password'];

   }

   

}

    

 

if(isset($_COOKIE['hrcookid']))

   {

  $log= echo $_COOKIE['hrcookid'];

  $pass= echo $_COOKIE['hrcookpass'];

   }

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Prime Academy</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />

</head>

 

<body>

<div class="wrapper">

<div class="login-plate">

    <h2>Hr login</h2>

       <form name="login" id="hrlogin" method="post">

        <input type="text" name="userid" id="userid" value="<?php echo ((isset($_POST['userid'])|| isset($_COOKIE['hrcookid']))? $log : '')?>" onblur="if(this.value == '') { this.value='User Name'}" onfocus="if (this.value == 'User Name') {this.value=''}">

            <input type="password" name="password" value="<?php echo ((isset($_POST['password'])|| isset( $_COOKIE['hrcookpass']))? $pass : '')?>" onblur="if(this.value == '') { this.value='password0000'}" onfocus="if (this.value == 'password0000') {this.value=''}"><br />

            <input name="submit" type="submit" value="Login" />

            <div class="rememberme"><input name="keeplogin" <?php echo (isset($_COOKIE['hrcookpass'])? 'checked':'')?> value="" />Remember me</div>

        </form>

    </div>

<div class="clear-fx"></div>

</div>

</body>

</html>

 

Ther are some errors here.Can anyone tell me what is it????

 

login.html

Link to comment
https://forums.phpfreaks.com/topic/286601-website-login-page/
Share on other sites

 

 

Ther are some errors here. Can anyone tell me what is it????

Please dont just dump code here and expect someone to fix it.

 

You should at least explain what it is you're trying to do. Explain what the code should be doing, and post any error(s) your code is producing.

Link to comment
https://forums.phpfreaks.com/topic/286601-website-login-page/#findComment-1471033
Share on other sites

When I dump the code into Dreamweaver, it doesn't like the following lines:

include("connection.php"):
 $log= echo $_COOKIE['hrcookid'];
 $pass= echo $_COOKIE['hrcookpass'];

You're using a colon in the first line instead of a semi-colon. The other lines have an "echo" after the assignment operator.

Link to comment
https://forums.phpfreaks.com/topic/286601-website-login-page/#findComment-1471044
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.