Php login code. Php login code is a complete php login code instance. from the database to the html and php programs, the entire process is written step by step, it is a very good entry-level php login code. this is a complete php login code instance. He wrote the entire process from the database to the html and php programs step by step, it is a very good entry-level php login code.
Php logon code
This is a complete php login code instance. He wrote the entire process step by step from the database tutorial to the html and php programs. it is a very good entry-level login php code.
*/
Session_start ();
/* Get post */
If (! Function_exists ("getpost") {function getpost () {if (count ($ _ post) {foreach ($ _ post as $ key => $ value) {global $ {$ key };$ {$ key }=$ value ;}}}}
/* Get */
If (! Function_exists ("getget") {function getget () {if (count ($ _ get) {foreach ($ _ get as $ key => $ value) {global $ {$ key };$ $ key = ($ value );}}}}
/* SQL escape string */
If (! Function_exists ("escapeit ")){
Function escapeit ($ text ){
If (get_magic_quotes_gpc () $ text = strips tutorial lashes ($ text );
If (! Is_numeric ($ text) $ text = mysql tutorial _ real_escape_string ($ text );
Return $ text;
}}
Getpost (); // Get post data
// Login
$ Rs = $ db-> query ("select * from 'backend _ user' where binary 'login' = '". escapeit ($ login ). "'and binary 'password' = '". md5 ($ password ). "'");
If (mysql_num_rows ($ rs)> 0 ){
$ Row = $ db-> fetch_array ($ rs );
$ _ Session ["smartinfo_sysid"] = $ row ["user_id"];
$ _ Session ["smartinfo_syslogin"] = $ row ["login"];
$ Db-> query ("update 'backend _ user' set 'Last _ logon' = '". date ("y-m-d h: I: s "). "'where' ID' = '". $ row ["id"]. "'");
Header ("location: index2.php ");
} Else {
Header ("location: index. php? Status = fail ");
}
// Functions used
?>
Html code
Database
--
-- Table structure 'backend _ user'
--
Create table if not exists 'backend _ user '(
'User _ id' int (11) not null auto_increment,
'Group _ id' int (11) not null default '0 ',
'Login' varchar (255) not null default '',
'Password' varchar (255) not null default '',
'Last _ logon 'datetime not null default' 0000-00-00 00:00:00 ',
Primary key ('User _ id ')
) Engine = myisam default charset = utf8 auto_increment = 2;
--
-- Export the data 'backend _ user' in the table'
--
Insert into 'backend _ user' ('User _ id', 'group _ id', 'login', 'password', 'Last _ logon') values
(1, 0, 'admin', 'e10adc3949ba59abbe56e057f20f883e ', '2017-00-00 00:00:00 ');
...