A PHP + MYSQL user verification

zhaozj2021-02-12  153

A PHP MySQL user verification // mysql database sets create Table Users

ID Tinyint (10) Not null,

User varchar (10) Not null,

Password varchar (10) Not null,

Status varchar (50) Not null

);

INSERT INTO USERS VALUES ('1', 'Webmaster'); 1234 ',' ');

User verification failed! "; exit;} else {$ dbc = mysql_connect "Localhost", "root", "root"; // change to your host, user name, password $ res = mysql_select_db ("Webmaster", $ dbc); // Turn WebMaster to your database name $ res = mysql_query ( "select status from users where user = '$ PHP_AUTH_USER' and password = '$ PHP_AUTH_PW'", $ dbc); $ count = mysql_num_rows ($ res); mysql_free_result ($ res); mysql_close ($ dbc);

IF (! $ count) {header ("www-automate: Basic realm = /" User Login / ""; HEADER ('Http/1.0 401 Unauthorized '); Echo' Please enter the correct username and password! '; exit; }

}

Login_FileManager (); echo "Login success!" / / Here you can add your code?>

转载请注明原文地址:https://www.9cbs.com/read-6245.html

New Post(0)