Release Register script with email function

10/08/2010 12:54 Elite Pets#1
this a register script that i added email function to next i will add recovery question and recovery answer then i will post it =-p and it lets you make 5 accounts per ip address to change it to more just change >= 5 to how many you would like i have the other made already just gotta test it and see if it works long as your account tables has pwd this script will work just fine then. you will also need the attatchment

i just never seen register script here with email function so i made this

ohh and also i got vote reward script half made that can send vote reward item to your invetory =-p


Code:
<?php
	require_once './inc/class.captcha.php';
	// Configurations
	$myhost="localhost";
	$mypass="****"; 		//your server login password
	$myuser="****"; 		//your server login username
	$mydbacc="account";		//your server account database
	$mydbdata="my";			//your server my database name
	$serveraddress="add your ip here"; 	//your server ip
	$serverport=5816;		//your server connection port
	$mydb="my";			//your server my database
        $servername = "elite pets online";   //Put your servername here.
        $link = "your website here";   //Put your website link here

	// Dont Edit after this
	mysql_connect($myhost,$myuser,$mypass);
	mysql_select_db($mydb);
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="./inc/md5.js"></script>
<style type="text/css">
</style></head>
<DIV align="center"><b class="h2">
</b>
<br />
<table width="299" height="22" border="0" align="center">
  <tr>


<form method="post" action="register.php?id=register">
<table align="center">
<tr><td>Login Id:</td></tr>
<tr><td><input type="text"  name="id" ></td></tr>

<tr><td>Email:</td></tr>
<tr><td><input type="pwd" name="pwd"></td></tr>

<tr><td>Password:</td></tr>
<tr><td><input type="password" name="pass"></td></tr>
<tr><td>Retype Password:</td></tr>
<tr><td><input type="password" name="retpass"></td></tr>
<tr><td align="center">
<input type="hidden" name="hash"><input type="submit" onClick="hash.value = login(pass.value)" value="Register" name="reg">
</td></tr>
</table>
</form>

<?php
If($_POST['reg']){
mysql_select_db($myaccount);
$id = trim($_POST['id']);
$pwd = trim($_POST['pwd']);
$pass = trim($_POST['pass']);
$passretype=trim($_POST['retpass']);
$hash=$_POST['hash'];
$ip = $_SERVER['REMOTE_ADDR'];

$res = mysql_query("select * from account where netbar_ip = '".$ip."' order by id desc");
If(mysql_num_rows($res) == 0){
echo "Players are allowed only to have three accounts. &nbsp;";
}else{
If(empty($id)){
echo "You left the Login Id blank, Its a required field";
}else{
If(empty($pass)){
echo "You left the password field blank, Its a required field";
}else{
If($pass != $passretype){
echo "Sorry your passwords do not match";
}else{
If(!ereg("^[0-9a-zA-Z]{4,12}$",$id)){
echo "Only letters or numbers, between 4 and 12 letters for a username";
}else{
If(!ereg("^[0-9a-zA-Z]{4,12}$",$pass)){
echo "Only letters or numbers, between 4 and 12 letters for a password";
}else{
$sql= mysql_query("select * from account where name = '".$id."' order by id desc");
If(mysql_num_rows($res) >= 5){
mysql_query("insert into account (name,pwd,Password,Reg_date,netbar_ip) values ('".$id."','".$pwd."','".$hash."','".date("y-m-d H:i:s", time())."','".$ip."')");
echo "Account created successfully. Please log into the game. ";
}else{
echo "Sorry that account is unavailable";
}//end seventh else
}//end sixth else
}//end fifth else
}//end fourth else
}//end third else
}//end second else
}//end first else
}//end post
?>
10/08/2010 14:05 ~Sword~Stalker~.#2
not a big deal or a hard thing to do but nice :P
10/08/2010 17:04 Eurion#3
Sorry this is one of the worst copy and edits I've ever seen.


Lets break down your errors

Fist Error: You are using a form POST with a form GET

Second error: The php codes you have are taken from multiple releases and just combined. This is a bad habit as you don't learn anything. You have way too many typical if/else statements, use google and look up if/elseif. It will save you alot of lines of code in the long run.


Third error: Your email script isn't even an email check. All it does is take a user inputted message and puts it into the database. So it will take anything from a user. examples would be, I enter none, nothing, blank it will accept all of those as being valid.


There are many other issues with this code, but that's all ill give info on.

Suggestion: Anyone who uses this, beware of the flaws.


To the original poster:

Lesson of the day, if you're going to release codes at least make sure you understand what you're doing.
10/08/2010 20:54 .Ash#4
Quote:
Originally Posted by Eurion View Post
This is a bad habit as you don't learn anything. You have way too many typical if/else statements, use google and look up if/elseif. It will save you alot of lines of code in the long run.
Agrees you with 100%.


Stay away from Goto's lol there dangerous..