|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: |
<?php
session_start();
if (empty($_GET['email']) || empty($_GET['email_confirm'])
|| empty($_GET['password'])
|| empty($_GET['password_confirm']))
exit("<p>You must enter values in all fields of the Registration form! Click your browser's Back button to return to the previous page.</p>");
else if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_GET['email']))
exit("<p>You must enter a valid e-mail address! Click your browser's Back button to return to the previous page.</p>");
else if ($_GET['email'] != $_GET['email_confirm'])
exit("<p>You did not enter the same e-mail address! Click your browser's Back button to return to the previous page.</p>");
else if ($_GET['password'] != $_GET['password_confirm'])
exit("<p>You did not enter the same password! Click your browser's Back button to return to the previous page.</p>");
else if (strlen($_GET['password']) < 5 || strlen($_GET['password']) > 10)
exit("<p>Your password must be between 5 and 10 characters! Click your browser's Back button to return to the previous page.</p>");
$DBConnect = @mysql_connect("localhost", "root")
Or die("<p>Unable to connect to the database server.</p>"
. "<p>Error code " . mysql_connect_errno()
. ": " . mysql_connect_error()) . "</p>";
// select and create database
$DBName = "songorganizer";
if (!@mysql_select_db($DBName)) {
$SQLstring = "CREATE DATABASE $DBName";
$QueryResult = @mysql_query($SQLstring)
Or die("<p>Unable to execute the query.</p>"
. "<p>Error code " . mysql_errno($DBConnect)
. ": " . mysql_error($DBConnect)) . "</p>";
echo "<p>You entered your first song!</p>";
mysql_select_db($DBName);
}
$TableName = "registered_users";
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysql_query($SQLstring);
if (!$QueryResult) {
$SQLstring = "CREATE TABLE $TableName (ID SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY, email VARCHAR(40), password VARCHAR(10))";
$QueryResult = @mysql_query($SQLstring)
Or die("<p>Unable to create the table.</p>"
. "<p>Error code " . mysql_errno($DBConnect)
. ": " . mysql_error($DBConnect)) . "</p>";
}
$TableName = "registered_users";
$Email = addslashes($_GET['email']);
$Password = addslashes($_GET['password']);
$SQLstring = "SELECT * FROM $TableName";
$QueryResult = @mysql_query($DBConnect, $SQLstring);
if (mysql_num_rows($QueryResult) > 0) {
$Row = mysql_fetch_row($QueryResult);
do {
if (in_array($Email, $Row))
exit("<p>Hi, the e-mail address you entered is already
registered! Click your browser's Back button to
return to the previous page.</p>");
$Row = mysql_fetch_row($QueryResult);
} while ($Row);
mysql_free_result($QueryResult);
}
$SQLstring = "INSERT INTO $TableName VALUES(NULL, '$Email',
'$Password')";
$QueryResult = @mysql_query($DBConnect, $SQLstring)
Or die("<p>Unable to execute the query.</p>"
. "<p>Error code " . mysql_errno($DBConnect)
. ": " . mysql_error($DBConnect)) . "</p>";
$_SESSION['ID'] = mysql_insert_id($DBConnect);
mysql_close($DBConnect);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>The Song Organizer Site</title><img src="Butterfly/images/header.gif" width="875" height="50" alt="" title="" border="0" align="right" />
<link rel="stylesheet" href="php_styles.css" type="text/css" />
<meta http-equiv="content-type"
content="text/html; charset=iso-8859-1" />
</head>
<body>
<h1>Song Organizer</h1>
<h2>User Registration</h2>
<p>Your new user ID is <strong>
<?= $_SESSION['userID'] ?></strong>.</p>
<p><a href="UpdateContactInfo.php">Enter Contact Information</a></p>
</body>
</html>
|
Advertisement
| Hall of Fame |