Jump to content

reg forms


supanoob

Recommended Posts

<?php
require_once('header.php');

{
include_once('regform.php');
}
if (!$_POST['username'] || !$_POST['email'] || !$_Password['password'])
{
echo 'Sorry, you did not fill in all fields fields.';

die();
}

if ($_POST['username'] && $_POST['email'] && $_POST['password'])
{

$user=$_POST['username'];
$email=$_POST['email'];
$password=$_POST['password'];

$username= trim($username);
$email=trim($email);
$password=trim($password);

//check length of strings
if (strlen($username) < 5 || strlen($username) > 10)
{
echo 'Sorry, username must be between 5 and 10 characters long';
include_once('signupform.php');
include_once('footer.php');
die();
}

// check username
$query="select * from users where user='$username'";
$result=mysql_query($query);
if (!$result)
{
die (mysql_error());
}

$num_rows=mysql_num_rows($result);
if ($num_rows > 0)
{
echo "Sorry, username $username is taken.";
include_once('signupform.php');
include_once('footer.php');
die();
}

//check email
$query="select * from users where email='$email'";
$result=mysql_query($query);
if (!$result)
{
die (mysql_error());
}

$num_rows=mysql_num_rows($result);
if ($num_rows > 0)
{
echo 'Sorry, that email address already has an account with us.';
include_once('signupform.php');
include_once('footer.php');
die();
}


$query="insert into logs (account, type) values ('$email', 'signup')";
$result=mysql_query($query);
if (!$result)
{
die (mysql_error());
}
$from = "From: webmaster@twottk.com";
$subject="The War Of The Three Kingdoms - login details";
$body = "Your Login Details are below \n\n
Your Username is : $username\n
Your Password is $password\n\n
If you did not signup to our website, please simply ignore this email. Please do not reply to this email.\n
Thanks, \n";
mail ($email, $subject, $body, $from);

echo "You have signed up as $username! An email containing your login details has been sent to $email. Please keep this in case you forget your password. If you do not recieve this email within the next half hour, please check the spam filters on your inbox. Contact me at <a href=mailto:webmaster@twottk.com>webmaster@twottk.com</a> if you have any problems. Thank you.";
}

?>

all it does is takes you back to the same page when i click submit :S

www.twottk.com/game/signup2.php

well yeah see for yourselves any advice would be great thabnks
Link to comment
Share on other sites

you do not have set to redirect the user after the registration is completed add

[code]
header("Location: your_next_page.php");
[/code]

after this

[code]

echo "You have signed up as $username! An email containing your login details has been sent to $email. Please keep this in case you forget your password. If you do not recieve this email within the next half hour, please check the spam filters on your inbox. Contact me at <a href=mailto:webmaster@twottk.com>webmaster@twottk.com</a> if you have any problems. Thank you.";
[/code]
and you will be redirected your desired next page after your email is sent
Link to comment
Share on other sites

[!--quoteo(post=358183:date=Mar 25 2006, 05:26 AM:name=supanoob)--][div class=\'quotetop\']QUOTE(supanoob @ Mar 25 2006, 05:26 AM) [snapback]358183[/snapback][/div][div class=\'quotemain\'][!--quotec--]
thanks i will try this later :d
[/quote]

<?php
require_once('header.php');

{
include_once('regform.php');
}

////////////////////////////////////////////////////////////////////////////////////////////
if (!$_POST['username'] || !$_POST['email'] || !$_Password['password'])

{

echo 'Sorry, you did not fill in all fields fields.';

}

//////////////////////////////////////////////////////////////////////////////////////////////



$_Password try changing this too $_POST['password'];

Also you will get a t_boolean, there is a parse error in your "OR" STATEMENT



if (!$_POST['username'] )|| (!$_POST['email']) || (!$_Password['password']))

{

echo 'Sorry, you did not fill in all fields fields.';

}



try the above im a bit limited for time right now but i will check back later
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.