Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Inialize session
- session_start();
- // Include database connection settings
- include('config.inc');
- $usr = mysql_real_escape_string($_POST['****ID']);
- // Retrieve email address and message from database according to user's input
- $query = "SELECT * FROM users WHERE username = '$usr'";
- $result = mysql_query($query) or die(mysql_error());
- // Put the id numbers in array $row
- $row = mysql_fetch_array($result) or die(mysql_error());
- // Test for ID match
- if (mysql_num_rows($result) == 1)
- {
- echo 'The email address of ';
- echo $usr;
- echo ' is: ';
- echo $row['email'];
- echo '<p>Message: ';
- echo $row['firstname'];
- }
- else
- {
- echo 'Sorry it appears that ';
- echo '$usr';
- echo ' has not registered yet. Why dont you tell him about ****Jacker?';
- }
- // Executing outside if..else blocks for testing
- echo 'Sorry, it appears that ';
- echo '$usr';
- echo ' has not registered yet. Why dont you tell him about ****Jacker?';
- ?>
- $row = mysql_fetch_array($result) or die(mysql_error());
Add Comment
Please, Sign In to add comment