07-29-2007
|
#1 (permalink)
|
|
Registered User
Join Date: Apr 2006
Posts: 3
|
PHP Member Script Registration Error
Hey,
I've followed the PHP Complete Membership Script tutorial, using the downloaded files, studying & making additions (such as, so i have to validate a user, as this is for my clan).
The register.php file is giving me problems. When i upload it to my webspace, nothing comes up.
Here is the URL: http://ets-clan.joolo.com/register.php
Here is the Register.php code:
PHP Code:
<?php
include 'config.php';
if(isset($_POST['submit']))
{
$first = addslashes(trim($_POST['firstname']));
$surname = addslashes(trim($_POST['surname']));
$username = addslashes(trim($_POST['username']));
$email = addslashes(trim($_POST['email']));
$pass = addslashes(trim($_POST['password']));
$conf = addslashes(trim($_POST['confirm']));
$ip = $_SERVER['REMOTE_ADDR'];
$date = date("d, m y");
if ( $_POST['password'] == $_POST['confirm'] )
{}else{
echo '<script>alert("Your passwords were not the same, please enter the same password in each field.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
$password = md5($pass);
if ((((( empty($first) ) || ( empty($surname) ) || ( empty($username) ) || ( empty($email) ) || ( empty($password) )))))
{
echo '<script>alert("One or more fields was left empty, please try again.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
if((!strstr($email , "@")) || (!strstr($email , ".")))
{
echo '<script>alert("You entered an invalid email address. Please try again.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
$q = mysql_query("SELECT * FROM Users WHERE Username = '$username'") or die(mysql_error());
if(mysql_num_rows($q) > 0)
{
echo '<script>alert("The username you entered is already in use, please try again.");</script>';
echo '<script>history.back(1);</script>';
exit;
}
$name = $first . ' ' . $surname;
$actkey = mt_rand(1, 500).'f78dj899dd';
$act = sha1($actkey);
$query = mysql_query("INSERT INTO Users (Username, Password, Name, Email, Date, IP, Actkey) VALUES ('$username','$password','$name','$email','$date','$ip','$act')") or die(mysql_error());
$send = mail(ETS-Clan@gmail.com , "Registration Confirmation" , " ".$username." has Registered with the [ETS] Clan.\n\nClick the link below to activate thier account:\nhttp://ets-clan.joolo.com/activate.php?id=".$act."\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: auto@mailer.com");
$send = mail(ETS-Clan@gmail.com , "Registration Confirmation" , " Thank you for registering with the [ETS] Clan.\n\nYour username and password is below.\n\nUser: ".$username."\nPass: ".$pass."\n\nYour Account must be first Activated by the Admin. This could take upto 48hrs, except in extreme circumstances (Vacationing,etc.).\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: ets-clan@gmail.com");
if(($query)&&($send))
{
echo ' <html>
<head>
<title>Success</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="success">
<p>Thank you for registering, the admin will soon recieve an email to confirm & activate your registration. No Personal Details are included in this email.</p>
<p><a href="login.php">Click here</a> to login once you have activated.</p>
</div>
</body>
</html>
';
} else {
echo '
<html>
<head>
<title>Error</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="error">
<p>We are sorry, there appears to be a problem with our script at the moment.</p>
<p>Your data was not lost. Username: '.$username.' | Password: '.$pass.' | Email: '.$email.' | Full name: '.$name.'</p>
<p>Please try again later.</p>
</div>
</body>
</html>
';
}
} else {
?>
<html>
<head>
<title>Register</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="head">the registration page</div>
<br>
<div id="main">
<p>Welcome to the registration, fill out the form below and hit Submit. All fields are required,so fill them all out! </p>
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">First name </td>
<td width="50%"><input name="firstname" type="text" id="firstname"></td>
</tr>
<tr>
<td>Surname</td>
<td><input name="surname" type="text" id="surname"></td>
</tr>
<tr>
<td>Email Address </td>
<td><input name="email" type="text" id="email"></td>
</tr>
<tr>
<td>Username</td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password"></td>
</tr>
<tr>
<td>Confirm Password </td>
<td><input name="confirm" type="password" id="confirm"></td>
</tr>
<tr>
<td>Register</td>
<td><input name="submit" type="submit" class="textBox" value="Submit"></td>
</tr>
</table>
</form>
Upon confirmation of your details, you will be sent an email containing your username, password and details on how to activate your account so as to be able to use this website. </div>
</div>
</body>
</html>
<? } mysql_close($l); ?>
Can any of you tell me what i'm doing wrong?
Thanks,
|
|
|
07-29-2007
|
#2 (permalink)
|
|
Registered User
Join Date: Aug 2004
Posts: 107
|
99% of the time a blank page is due to a missing : ; ( ) { } ' or "
I would change all the lines to I found the error....
These two lines
PHP Code:
$send = mail(ETS-Clan@gmail.com , "Registration Confirmation" , " ".$username." has Registered with the [ETS] Clan.\n\nClick the link below to activate thier account:\nhttp://ets-clan.joolo.com/activate.php?id=".$act."\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: auto@mailer.com"); $send = mail(ETS-Clan@gmail.com , "Registration Confirmation" , " Thank you for registering with the [ETS] Clan.\n\nYour username and password is below.\n\nUser: ".$username."\nPass: ".$pass."\n\nYour Account must be first Activated by the Admin. This could take upto 48hrs, except in extreme circumstances (Vacationing,etc.).\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: ets-clan@gmail.com");
You need to escape the email address like so
PHP Code:
$send = mail('ETS-Clan@gmail.com' , "Registration Confirmation" , " ".$username." has Registered with the [ETS] Clan.\n\nClick the link below to activate thier account:\nhttp://ets-clan.joolo.com/activate.php?id=".$act."\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: auto@mailer.com"); $send = mail('ETS-Clan@gmail.com' , "Registration Confirmation" , " Thank you for registering with the [ETS] Clan.\n\nYour username and password is below.\n\nUser: ".$username."\nPass: ".$pass."\n\nYour Account must be first Activated by the Admin. This could take upto 48hrs, except in extreme circumstances (Vacationing,etc.).\n\nPlease do not reply, this is an automated mailer.\n\nThanks", "FROM: ets-clan@gmail.com");
Last edited by Jolt; 07-29-2007 at 11:41 PM.
|
|
|
07-31-2007
|
#3 (permalink)
|
|
Registered User
Join Date: Apr 2006
Posts: 3
|
Awesome! Thanks for that, i guess i should look through my code more thoroughly. Also, Thanks for Picking up the email error, i would've missed it & been "WTF?" when the proper email didn't come through
EDIT: at first I could register, & it worked properly. Earlier today, i got my friend to register & he got the error message, saying "We are sorry, there appears to be a problem with our script at the moment." I have now tried to re-register & it gave me the error message! What does the Error Message Mean & how do i fix it?
Last edited by brooksaar; 08-03-2007 at 08:56 AM.
Reason: ERROR! ERROR! ERROR!
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +1. The time now is 05:28 AM. Content Relevant URLs by vBSEO 3.2.0
|