ive got 2 errors in my script but i dunno wat they are.
Here is error no.1:
An Error occurred in script '/web/sites/vhbu/0/156/51648/public/www2/test/register.php on line 14:
eregi() [function.eregi]: REG_ECTYPE
Error No.2
Fatal error: Call to undefined function escape_data() in /web/sites/vhbu/0/156/51648/public/www2/test/register.php on line 29
Here is my script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
require_once ('./mysql/config.inc.php');
$page_title = 'Register';
if (isset($_POST['submitted'])) {
require_once ('mysql/mysql_connect.php');
if (eregi ('^[[:alpha :]\.\' \-] {2,15}$',stripslashes(trim($_POST['first_name'])))) {
$fn = escape_data($_POST['first_name']);
} else {
$fn = FALSE;
echo '<p><font color="red" size="+1">Please enter your first name!</font></p>';
}
if (eregi ('^[[:alpha:]\.\' \-] {2,30}$' , stripslashes(trim($_POST['last_name'])))) {
$ln = escape_data($_POST['last_name']);
} else {
$ln = FALSE;
echo '<p><font color="red" size="+1">Please enter your last name!</font></p>';
}
if (eregi ('^[[:alnum:]] {4,20}$' , stripslashes(trim($_POST['password1'])))) {
}
if ($_POST['password1'] == $_POST['password2']) {
$p = escape_data($_POST['password1']);
} else {
$p = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid password!</font></p>';
}
if ($fn && $ln && $e && $p) {
$query = "SELECT user_id FROM users WHERE email='$e'";
$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());
if (mysql_num_rows($result) == 0) {
$a = md5(uniqid(rand(), true));
$query = "INSERT INTO users (email, pass, first_name, last_name, active, registration_date) VALUES ('$e', SHA('$p'), '$fn', '$ln', '$a', NOW()";
$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());
if (mysql_affected_rows() == 1) {
$body = "Thank you for regestering for Planet 1990's. To activate your account, please click on this link:";
$body .= "http://www2.hanwellvillage.com/activate.php?x=" . mysql_insert_id() . "&y=$a";
mail($_POST['email'], 'Registration Confirmation' , $body);
echo '<h3>Thank you for registering! A Confomation email has been sent to you address. Please click on the link in that email in order to activate your account.</h3>';
exit();
} else{
echo '<p><font color="red" size="+1">You could not register due to a system error. We apoligize for any inconvenience.</font></p>';
}
} else {
echo '<p><font color="red" size="+1">That email address has already been registered. If you have forgotten your password, use the link to habe your password sent to you.</font></p>';
}
} else {
echo '<p><font color="red" size="+1">Please try again</font></p>';
}
mysql_close();
}
?>
<h1>Register</h1>
<form action="register.php" method="post">
<fieldset>
<p><b>First Name:</b> <input type="text" name="first_name" size="30" maxlength="30" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>" /></p>
<p><b>Last Name:</b> <input type="text" name="last_name" size="30" maxlength="30" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>" /></p>
<p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email'] ?>" /></p>
<p><b>Password:</b> <input type="password" name="password1" size="25" maxlength="20" /><small>Use only letters and numbers. Must be between 4 and 20 charaters long.</small></p>
<p><b>Confirm Password:</b> <input type="password" name="password2" size="25" maxlength="20" /></p>
</fieldset>
<div align="center"><input type="submit" value="Register!" /></div>
<input type="hidden" name="submitted" value="TRUE" />
</form>
</body>
</html>