Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define('DB_HOST', 'cs2s');
- define('DB_NAME', 'marcussampson');
- define('DB_USER','marcus.sampson');
- define('DB_PASSWORD','compsci1');
- $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL server");
- $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL server");
- function SignIn()
- {
- session_start();
- if(!empty($_POST['username']))
- {
- $query = mysql_query("SELECT * FROM Users where username = '$_POST[username]' AND password = '$_POST[password]'") or die(mysql_error());
- $row = mysql_fetch_array($query);
- if(!empty($row['username']) AND !empty($row['password']))
- {
- $_SESSION['username'] = $row['password'];
- echo "You have successfully logged in to the Yorkshire Air Museum database system.";
- echo "<script>setTimeout(\"location.href = 'database.html';\",1500);</script>";
- }
- else
- {
- echo "Combination of username and password not found on the system, please try again.";
- echo "<script>setTimeout(\"location.href = 'index.html';\",1500);</script>";
- }
- }
- }
- if(isset($_POST['submit']))
- {
- SignIn();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement