Php cookie User Logon details and instance code, cookie User Logon

Source: Internet
Author: User

Php cookie User Logon details and instance code, cookie User Logon

Php cookie User Login implementation

HTML source code:

<Html> 

Php source code:

<?php  $now = getdate();  $storetime= $now["weekday"] . " " . $now["month"] ." " . $now["year"] ;  $storetime.=" Time : ";  if ($now["hours"] < 10) {   $storetime.= "0" . $now["hours"];  } else {   $storetime.= $now["hours"];  }   $storetime.= ":";  if ($now["minutes"]<10) {   $storetime.= "0" . $now["minutes"];  } else {   $storetime.= $now["minutes"];  }    $storetime.= ": ";  if ($now["seconds"] <10) {   $storetime.= "0" . $now["seconds"];  } else {   $storetime.= $now["seconds"];  }  if (isset($data)) {    $counter=++$data[l];    setcookie("data[0]",$storetime,time() + (60*60*24));    setcookie("data[l]", $counter,time() + (60*60*24)); setcookie("data[2]",$username,time() + (60*60*24));    echo "<b><center>Hi " . $data[2] . " ! !</center></b><br>\n";    echo "<b><center>Last Login Time :" .$data[0] . "</center></b><br>\n";    echo "<b><center>Current Date :" .$storetime. "</center></b><br>\n";    echo "<b><center>Page View Count :" . $data[l]. "</center></b><br>\n";    echo "<b><center>You have successfully logged in!</center></b>";    echo ("<b><contor>You can access this area without entering a password for the next 24 hours!</center></b>");  } else {  if (isset($username) && isset($password)) {   if ($password=="superpass") {     $counter=0;     setcookie("data[0]",$storetime,time() + (60*60*24));     setcookie("data[l]",$counter,time() + (60*60*24));     setcookie("data[2]",$username,time() + (60*60*24));     $url="Location: cookieimp.php";     header($url);   }else{     echo "

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.