Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'cms-104862.mysql.binero.se'; // Host name Normally 'LocalHost'
- $user = '104862_qz66468'; // MySQL login username
- $pass = 'olw12345'; // MySQL login password
- $database = '104862-cms'; // Database name
- $table = 'answer1'; // Members name
- mysql_connect($host, $user, $pass);
- mysql_select_db($database);
- $answer = mysql_real_escape_string($_POST['answer']);
- $result = mysql_query("SELECT * FROM $table WHERE answer = '$answer'
- ");
- if(mysql_num_rows($result))
- {
- // Login
- session_start();
- $_SESSION['username'] = htmlspecialchars($username); // htmlspecialchars() sanitises XSS
- header('Location: ../index.php');
- }
- else
- {
- // Invalid username/password
- echo '<p><strong>Error:</strong> Invalid answer.</p>';
- }
- // Redirect
- echo '<p><strong><a href="q.php">Try again</a></strong></p>';
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement