Jump to content


Photo

reg forms


  • Please log in to reply
3 replies to this topic

#1 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 23 March 2006 - 08:16 PM

<?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

#2 shortj75

shortj75
  • Members
  • PipPipPip
  • Advanced Member
  • 118 posts
  • LocationPort Huron,mi

Posted 25 March 2006 - 08:12 AM

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

header("Location: your_next_page.php"); 

after this


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.";
and you will be redirected your desired next page after your email is sent
The Short One

hopfully this helps if it doesn't sorry
i won't write the code for you!!! you don't learn that way

#3 supanoob

supanoob
  • Members
  • PipPipPip
  • Advanced Member
  • 342 posts

Posted 25 March 2006 - 10:26 AM

thanks i will try this later :D

#4 norman100

norman100
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 25 March 2006 - 01:51 PM

[!--quoteo(post=358183:date=Mar 25 2006, 05:26 AM:name=supanoob)--][div class=\'quotetop\']QUOTE(supanoob @ Mar 25 2006, 05:26 AM) View Post[/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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users