Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
- $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error());
- /*
- $ID = $_POST['username'];
- $Password = $_POST['password'];
- */
- function SignIn()
- {
- session_start(); //starting the session for user profile page
- if(!empty($_POST['username'])) //checking the 'user' name which is from Sign-In.html, is it empty or have some text
- {
- $query = mysql_query("SELECT * FROM UserName where userName = '$_POST[username]' AND pass = '$_POST[password]'"); #or die(mysql_error());
- $row = mysql_fetch_array($query) or die(mysql_error());
- if(!empty($row['userName']) AND !empty($row['pass']))
- {
- $_SESSION['userName'] = $row['pass'];
- echo "Successful Login";
- header('Location: control.html');
- die();
- }
- else
- {
- $_SESSION['userName'] != $row['pass'];
- echo "Incorrect Password";
- header('Location: index2.html');
- die();
- }
- }
- }
- if(isset($_POST['login']))
- {
- SignIn();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement