Enhanced register page.

Post all your tuts or request for tuts here.
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Enhanced register page.

Post by Torniquet »

have you made sure that you have replaced the parts i wrapped in astrixes? e.g *table name* , *connection script name/location*


other than that i really dont know why it isnt working :s

mine runs perfectly fine without a hitch
New Site Coming Soon! Stay tuned :D
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Enhanced register page.

Post by hallsofvallhalla »

this video really is a video in itself and not a add on to my videos. I say this because it is setup different and this I think is where the error is coming from. he named his file register.php but if you are following my tuts then it is actually the reguser page. The register he is using is accepting Post variables from another page. That page is not shown so if you copy this and past it, it will not work.
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Enhanced register page.

Post by Torniquet »

its not accepting post variables from any other page than itself. when you hit submit, it is then sent to itself again and loops round.
New Site Coming Soon! Stay tuned :D
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Enhanced register page.

Post by hallsofvallhalla »

where?


where does it ask for unsername and password? Maybe I am missing it.
User avatar
Noctrine
Posts: 928
Joined: Thu Apr 23, 2009 9:57 pm

Re: Enhanced register page.

Post by Noctrine »

Valid email also requires you add a this isn't me, and unsubscribe button.
Jesse Dorsey
ProjectANI - Lead Developer Person
http://about.me/jessedorsey
darspire
Posts: 194
Joined: Sat Jul 25, 2009 9:21 pm

Re: Enhanced register page.

Post by darspire »

so if i copy and paste it to reguser it will be fine?
if you love something, let it go.
if it doesnt return.....hunt it down and kill it.
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Enhanced register page.

Post by hallsofvallhalla »

maybe as long as you have these fields to post on register

Code: Select all

   $username = $_POST['username'];
   $email1 = $_POST['email1'];
   $email2 = $_POST['email2'];
   $pass1 = $_POST['pass1'];
   $pass2 = $_POST['pass2'];
    $humancheck = $_POST['humancheck'];
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Enhanced register page.

Post by Torniquet »

ok my bad i think lol...

i have only copy n pasted out the PHP section of the script... not the accual HTML layout XD

here is the WHOLE script

Code: Select all

<?php

session_start();

if(!isset($_SESSION['id'])){
	
	if(isset($_COOKIE['idCookie'])){
		
		$id = $_COOKIE['idCookie'];
		$_SESSION['id'] = $id;
		header("Location: http://www.netrixnetwork.com/centralCommand.php");
		exit();
	}
}else if(isset($_SESSION['id'])){
	
	header("Location: http://www.netrixnetwork.com/centralCommand.php");
	exit();
}


if (isset ($_POST['username'])){
	
	$username = $_POST['username'];
	$email1 = $_POST['email1'];
	$email2 = $_POST['email2'];
	$pass1 = $_POST['pass1'];
	$pass2 = $_POST['pass2'];
    $humancheck = $_POST['humancheck'];
	
	$gender = $_POST['gender'];
	$species = $_POST['species'];
	$class = $_POST['class'];
	
	$username = stripslashes($username);
	$email1 = stripslashes($email1);
	$email2 = stripslashes($email2);
	$pass1 = stripslashes($pass1);
	$pass2 = stripslashes($pass2);
	
	$username = strip_tags($username);
	$email1 = strip_tags($email1);
	$email2 = strip_tags($email2);
	$pass1 = strip_tags($pass1);
	$pass2 = strip_tags($pass2);
	
	include_once "scripts/connect_to_mysql.php";
	$emailChecker = mysql_real_escape_string($email1);
	$emailChecker = eregi_replace("`", "", $emailChecker);
	$usernameChecker = mysql_real_escape_string($username);
	$usernameChecker = eregi_replace("`", "", $usernameChecker);
	
	
	$sql_email_check = mysql_query("SELECT email FROM stardrome_memberlist WHERE email='$emailChecker'");
	$email_check = mysql_num_rows($sql_email_check); 
	$sql_username_check = mysql_query("SELECT email FROM stardrome_memberlist WHERE username='$usernameChecker'");
	$username_check = mysql_num_rows($sql_username_check); 
	 
	if ((!$username) || (!$email1) || (!$email2) || (!$pass1) || (!$pass2)) { 
	
	$errorMsg = "ERROR: Missing Vital Information:<br /><br />";
	
	if(!$username){ 
	   $errorMsg .= " * Username<br />";
	} 
	
	if(!$pass1){ 
	   $errorMsg .= " * Password<br />";
	} 
	
	if(!$pass2){ 
	   $errorMsg .= " * Confirm Password<br />";
	} 
	
	if(!$email1){ 
	   $errorMsg .= " * Email<br />";
	} 
	
	if(!$email2){ 
	   $errorMsg .= ' * Confirm Email<br />';
	   
	}
	
	}
	
	else if (
			!strpos($email1,"@")||
			!strpos($email1,".")
			){
		$errorMsg = 'ERROR: Invalid Email Address.<b />';
	} else if (strlen($username) <= 3){
		$errorMsg = 'ERROR: Username length to short. <br />';
	} else if (strlen($pass1) <= 3){
		$errorMsg = 'ERROR: Password length to short. <br />';
	} else if ($email1 != $email2) {
			  $errorMsg = 'ERROR: Email Fields Mis Matched.<br />';
	} else if ($pass1 != $pass2) {
			  $errorMsg = 'ERROR: Password Fields Mis Matched.<br />';
	} else if ($humancheck != "") {
			 $errorMsg = 'ERROR: The Human Check field must be cleared to be sure you are human.<br />';		 
	} else if ($email_check > 0){ 
			  $errorMsg = "<u>ERROR:</u><br />Your Email Is Already Registered.<br />";
	} else if ($username_check > 0){
		$errorMsg = "<U>ERROR:</u>Username Already In Use.<br>";
	} else {
		
		$username = mysql_real_escape_string($username);
		$pass1 = mysql_real_escape_string($pass1);
		$email1 = mysql_real_escape_string($email1);
		
		$username = eregi_replace("`", "", $username);
		$pass1 = eregi_replace("`", "", $pass1);
		$email1 = eregi_replace("`", "", $email1);
		
		$db_password = md5($pass1);
		
		$sql = mysql_query("INSERT INTO stardrome_memberlist (username, password, email, sign_up_date) 
	 VALUES('$username','$db_password','$email1', now())")  
	 or die (mysql_error());
	 
	 $id = mysql_insert_id();
	 
	 $sql = mysql_query("INSERT INTO stardrome_playerinfo (id, gender, species, pclass, health, max_health, attack, defense, level, experience, level_experience, stat_points, gold) 
	 VALUES('$id','$gender','$species', '$class', '50', '50', '5', '5', '1', '0', '50', '0', '1000')")    
	 or die (mysql_error());
	 
	 mkdir("members/$id", 0755);
		
		
	$to = "$email1";
									   
  $from = "admin@netrixnetwork.com";
  $subject = "Complete Netrix Network registration";
  //Begin HTML Email Message
  $message = "Hi $username,

 Complete this step to activate your login identity at Netrix Network.

 Click the line below to activate when ready.

 http://www.netrixnetwork.com/activation.php?id=$id&sequence=$db_password
 If the URL above is not an active link, please copy and paste it into your browser address bar

 Login after successful activation using your:  
 Username: $username
 Password: $pass1

 See you on the site!
 admin@netrixnetwork.com";
 //end of message
  $headers  = "From: $from\r\n";
  $headers .= "Content-type: text\r\n";

  mail($to, $subject, $message, $headers);
  
 $msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $username, one last step to verify your email identity:</h4><br />
 In a moment you will be sent an Activation link to your email address.<br /><br />
 <br />
 <strong><font color=\"#990000\">VERY IMPORTANT:</font></strong> 
 If you check your email with your host providers default email application, there may be issues with seeing the email contents.  If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br />
 ";


 include_once 'msgToUser.php'; 

 exit();
 
	}

}else{
	 $errorMsg = "Fields marked with an [ * ] are required";
      $username = "";
	  $pass1 = "";
	  $pass2 = "";
	  $email1 = "";
	  $email2 = "";
	  

}

?>


<!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>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="StarDrome Home Page" />
<meta name="Keywords" content="MMORPG, MMOBG, star, drome, multiplayer, register, game, space, future, games, online" />
<title>.:StarDrome:. Register</title>
<link rel="icon" href="http://www.netrixnetwork.com/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://www.netrixnetwork.com/images/favicon.ico" type="image/x-icon" />
<style type="text/css">
<!--
#body {
	color: #FFF;
}
-->
</style>
</head>

<body bgcolor="#000000">
<table width="900" border="0" align="center">
  <tr>
    <td>
		<div id="header"></div>

	  <div id="rightnav"></div>

		<div id="body">
		  <form action="register.php" method="post" enctype="multipart/form-data">
		    <table width="100%" border="0">
		      <tr>
		        <td align="right"> </td>
		        <td> </td>
	          </tr>
		      <tr>
		        <td colspan="2" align="center"><span class="astrix"><?php print "$errorMsg"; ?></span></td>
	          </tr>
		      <tr>
		        <td align="right"> </td>
		        <td> </td>
	          </tr>
		      <tr>
		        <td width="50%" align="right"><label><span class="astrix">* </span>Username:</label></td>
		        <td width="50%"><input name="username"  type="text" class="formField" id="username" value="<?php print "$username"; ?>" maxlength="20" /> 
		          <span class="infotext">Between 4 - 20 Chars</span></td>
	          </tr>
		      <tr>
		        <td align="right"><label><span class="astrix">* </span>Password:</label></td>
		        <td><input name="pass1"  type="password" class="formField" id="pass1" value="<?php print "$pass1"; ?>" maxlength="16" />
	            <span class="infotext">Between 4 - 16 Chars</span></td>
	          </tr>
		      <tr>
		        <td align="right"><label><span class="astrix">* </span>Confirm Password:</label></td>
		        <td><input name="pass2"  type="password" class="formField" id="pass2" value="<?php print "$pass2"; ?>" maxlength="16" /></td>
	          </tr>
		      <tr>
		        <td align="right"><label><span class="astrix">* </span>Email:</label></td>
		        <td><input name="email1"  type="text" class="formField" id="email1" value="<?php print "$email1"; ?>" maxlength="50" /></td>
	          </tr>
		      <tr>
		        <td align="right"><label><span class="astrix">* </span>Confirm Email:</label></td>
		        <td><input name="email2"  type="text" class="formField" id="email2" value="<?php print "$email2"; ?>" maxlength="50" /></td>
	          </tr>
		      <tr>
		        <td align="right"><label><span class="astrix">* </span>Human Check:</label></td>
		        <td><input name="humancheck" type="text" class="formField" id="humancheck" value="Please Remove This!" /></td>
	          </tr>
		      <tr>
		        <td align="right">Gender:</td>
		        <td><p>
		          <label>
		            <input name="gender" type="radio" id="gender_0" value="Male" checked="checked" />
		            Male</label>
		          <br />
		          <label>
		            <input name="gender" type="radio" id="gender_1" value="Female" />
		            Female</label>
		          <br />
	            </p></td>
	          </tr>
		      <tr>
		        <td align="right">Species:</td>
		        <td><p>
		          <label>
<input name="species" type="radio" id="species_0" value="Human" checked="checked" />
Human</label>
		          <br />
		          <label>
		            <input type="radio" name="species" value="Alien" id="species_1" />
		            Alien</label>
		          <br />
	            </p></td>
	          </tr>
		      <tr>
		        <td align="right">Class:</td>
		        <td><p>
		          <label>
		            <input name="class" type="radio" id="class_0" value="Scouter" checked="checked" />
		            Scouter</label>
		          <br />
		          <label>
<input type="radio" name="class" value="Aviator" id="class_1" /> 
Aviator
</label><br />
		          <label>
		            <input type="radio" name="class" value="Hunter" id="class_2" />
		            Hunter</label>
		          <br />
	            </p></td>
	          </tr>
		      <tr>
		      <tr>
		      <tr>
		        <td> </td>
		        <td></td>
	          </tr>
		      <tr>
		        <td align="right"><input type="reset" name="Clear" id="Clear" value="Reset Form" /></td>
		        <td><input type="submit" name="submit" id="submit" value="Complete Registration" /></td>
	          </tr>
	        </table>
	      </form>
          
          <table width="100%" cellpadding="10px">
          	<tr>
            <td colspan="3">
            <br />
            </td>
            </tr>
          	<tr>
            <td colspan="3" align="center">
            Class Information.
            </td>
            </tr>
            <tr>
            <td width="33%" align="center">
            Scouter.
            </td>
            <td width="34%" align="center">
            Aviator.
            </td>
            <td width="33%" align="center">
            Hunter.
            </td>
            </tr>
            <tr>
            <td align="justify" valign="top">
            The Scouter class is trained to look out for the best chance they can to squeeze the last of the money from their opponant.
            </td>
            <td align="justify" valign="top">
            The Aviator class is the only class which gets the chance to gain a pilots licence. This gives them the ability to then purchase ships to fly off to other planetstaking a passanger with them if they desire to.</td>
            <td align="justify" valign="top">
            The Hunter class is the most brutal of the three classes. Because they are trained to fight, this class is perfect for gaining that little bit of extra experience from each fight they partake in.</td>
            </tr>
          </table>
		</div>

		<div id="footer"></div>
	</td>
  </tr>
</table>



</body>
</html>
apollogies on that :p

it never really occured to me to post that info :roll: ass you can see now hall the submit button directs you to the same page hehe
New Site Coming Soon! Stay tuned :D
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Enhanced register page.

Post by hallsofvallhalla »

;)
ModOps
Posts: 2
Joined: Thu Aug 20, 2009 3:33 pm

Re: Enhanced register page.

Post by ModOps »

Hey,

I was looking all over the internet for a tutorial like this, and came across this, all I can say is what an awsome tutorial it actually is.

However, I keep getting an error:

Code: Select all

Parse error: syntax error, unexpected T_ELSE in /home/a8265244/public_html/register.php on line 127
This is what is on line 127:

Code: Select all

 } else { 
I copied your codes, and it seems to work for everyone else. And I cannot see what is wrong with the code. Please help.

/Ollie
/Modern Operations
Post Reply

Return to “Tutorials”