View Full Version : registration code not working

02-10-2010, 08:13 PM
hi . i need some help with my code. its a script i aquired not coded myself as am still a newbie. but i want to make it safer .so i took the php_register_globals_flag_on out of the htaccess file and now my registration dont work fully. it does not insert the date of birth in my database. i am presuming its something to do with the drop down boxes .i have been told to use GET and POST also which from what i can see its already like that .

can anyone help me please . there is various other things not working with the globals being off but one thing at a time . and registration is the most important.

here is my codes .


function registerform($ef)
$ue = $errl = $pe = $ce = "";
case 1:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Pls type your username";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 2:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Pls type your password";
$pe = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 3:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Pls type your password again";
$ce = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 4:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Username is invalid";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 5:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Password is invalid";
$pe = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 6:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Passwords dnt match";
$ce = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 7:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Username must be 4 characters or more";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 8:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Password must be 4 characters or more";
$pe = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 9:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Username is taken";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 10:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Unknown error pls try again l8r";

case 11:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Username must start with a letter from a-z";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 12:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Username is reserved for admins of the site";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 13:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> Please choose an appropriate username";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
case 14:
$errl = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/> U must enter an email address";
$ue = "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>";
echo "<p align=\"center\">";
$rform = "<form action=\"register.php\" method=\"post\"><p align=\"center\">";

$rform .= "$ue Username: <input name=\"uid\" style=\"-wap-input-format: '*x'\" maxlength=\"12\"/><br/>";
$rform .= "$pe Password: <input type=\"password\" name=\"pwd\" maxlength=\"10\"/><br/>";
$rform .= "$ce Password: <input type=\"password\" name=\"cpw\" maxlength=\"10\"/><br/>";
$rform .= "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"!\"/>Date Of Birth:<br/>";

$rform .= "<select name=\"day\" value=\"01\">";
$rform .= "<option value=\"01\">1</option>";
$rform .= "<option value=\"02\">2</option>";
$rform .= "<option value=\"03\">3</option>";
$rform .= "<option value=\"04\">4</option>";
$rform .= "<option value=\"05\">5</option>";
$rform .= "<option value=\"06\">6</option>";
$rform .= "<option value=\"07\">7</option>";
$rform .= "<option value=\"08\">8</option>";
$rform .= "<option value=\"09\">9</option>";
$rform .= "<option value=\"10\">10</option>";
$rform .= "<option value=\"11\">11</option>";
$rform .= "<option value=\"12\">12</option>";
$rform .= "<option value=\"13\">13</option>";
$rform .= "<option value=\"14\">14</option>";
$rform .= "<option value=\"15\">15</option>";
$rform .= "<option value=\"16\">16</option>";
$rform .= "<option value=\"17\">17</option>";
$rform .= "<option value=\"18\">18</option>";
$rform .= "<option value=\"19\">19</option>";
$rform .= "<option value=\"20\">20</option>";
$rform .= "<option value=\"21\">21</option>";
$rform .= "<option value=\"22\">22</option>";
$rform .= "<option value=\"23\">23</option>";
$rform .= "<option value=\"24\">24</option>";
$rform .= "<option value=\"25\">25</option>";
$rform .= "<option value=\"26\">26</option>";
$rform .= "<option value=\"27\">27</option>";
$rform .= "<option value=\"28\">28</option>";
$rform .= "<option value=\"29\">29</option>";
$rform .= "<option value=\"30\">30</option>";
$rform .= "<option value=\"31\">31</option>";
$rform .= "</select><br/>";
$rform .= "<select name=\"month\" value=\"01-\">";
$rform .= "<option value=\"01-\">Jan</option>";
$rform .= "<option value=\"02-\">Feb</option>";
$rform .= "<option value=\"03-\">Mar</option>";
$rform .= "<option value=\"04-\">Apr</option>";
$rform .= "<option value=\"05-\">May</option>";
$rform .= "<option value=\"06-\">Jun</option>";
$rform .= "<option value=\"07-\">Jul</option>";
$rform .= "<option value=\"08-\">Aug</option>";
$rform .= "<option value=\"09-\">Sep</option>";
$rform .= "<option value=\"10-\">Oct</option>";
$rform .= "<option value=\"11-\">Nov</option>";
$rform .= "<option value=\"12-\">Dec</option>";
$rform .= "</select><br/>";
$rform .= "<select name=\"year\" value=\"1992-\">";
$rform .= "<option value=\"1992-\">1992</option>";
$rform .= "<option value=\"1991-\">1991</option>";
$rform .= "<option value=\"1990-\">1990</option>";
$rform .= "<option value=\"1989-\">1989</option>";
$rform .= "<option value=\"1988-\">1988</option>";
$rform .= "<option value=\"1987-\">1987</option>";
$rform .= "<option value=\"1986-\">1986</option>";
$rform .= "<option value=\"1985-\">1985</option>";
$rform .= "<option value=\"1984-\">1984</option>";
$rform .= "<option value=\"1983-\">1983</option>";
$rform .= "<option value=\"1982-\">1982</option>";
$rform .= "<option value=\"1981-\">1981</option>";
$rform .= "<option value=\"1980-\">1980</option>";
$rform .= "<option value=\"1979-\">1979</option>";
$rform .= "<option value=\"1978-\">1978</option>";
$rform .= "<option value=\"1977-\">1977</option>";
$rform .= "<option value=\"1976-\">1976</option>";
$rform .= "<option value=\"1975-\">1975</option>";
$rform .= "<option value=\"1974-\">1974</option>";
$rform .= "<option value=\"1973-\">1973</option>";
$rform .= "<option value=\"1972-\">1972</option>";
$rform .= "<option value=\"1971-\">1971</option>";
$rform .= "<option value=\"1970-\">1970</option>";
$rform .= "<option value=\"1969-\">1969</option>";
$rform .= "<option value=\"1968-\">1968</option>";
$rform .= "<option value=\"1967-\">1967</option>";
$rform .= "<option value=\"1966-\">1966</option>";
$rform .= "<option value=\"1965-\">1965</option>";
$rform .= "<option value=\"1964-\">1964</option>";
$rform .= "<option value=\"1963-\">1963</option>";
$rform .= "<option value=\"1962-\">1962</option>";
$rform .= "<option value=\"1961-\">1961</option>";
$rform .= "<option value=\"1960-\">1960</option>";
$rform .= "<option value=\"1959-\">1959</option>";
$rform .= "<option value=\"1958-\">1958</option>";
$rform .= "<option value=\"1957-\">1957</option>";
$rform .= "<option value=\"1956-\">1956</option>";
$rform .= "<option value=\"1955-\">1955</option>";
$rform .= "<option value=\"1954-\">1954</option>";
$rform .= "<option value=\"1953-\">1953</option>";
$rform .= "<option value=\"1952-\">1952</option>";
$rform .= "<option value=\"1951-\">1951</option>";
$rform .= "<option value=\"1950-\">1950</option>";
$rform .= "<option value=\"1949-\">1949</option>";
$rform .= "<option value=\"1948-\">1948</option>";
$rform .= "<option value=\"1947-\">1947</option>";
$rform .= "<option value=\"1946-\">1946</option>";
$rform .= "<option value=\"1945-\">1945</option>";
$rform .= "<option value=\"1944-\">1944</option>";
$rform .= "<option value=\"1943-\">1943</option>";
$rform .= "<option value=\"1942-\">1942</option>";
$rform .= "<option value=\"1941-\">1941</option>";
$rform .= "<option value=\"1940-\">1940</option>";
$rform .= "<option value=\"1939-\">1939</option>";
$rform .= "</select><br/>";
$rform .= "Sex:<br/>";
$rform .= "<select name=\"usx\" value=\"M\">";
$rform .= "<option value=\"M\">Male</option>";
$rform .= "<option value=\"F\">Female</option>";
$rform .= "</select><br/>";
$rform .= "Country: <input name=\"ulc\" maxlength=\"100\"/><br/>";
$rform .= "Email visible by Staff: <input name=\"email\" maxlength=\"50\"/><br/>";

$rform .= "Refferred By: <input name=\"news\" maxlength=\"100\"/><br/>";

$rform .= "More about me: <input name=\"info\" maxlength=\"100\"/><br/>";
$rform .= "<input type=\"Submit\" name=\"Register\" Value=\"Register\"></form>";
$rform .= "<br/>$errl";

return $rform;

header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml');
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
<html xmlns="http://www.w3.org/1999/xhtml">
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
$cpw = $_POST["cpw"];
$email = $_POST["email"];
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];
include ("config.php");
include ("core.php");
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM dave_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$browser = explode("/",$HTTP_USER_AGENT);
$ubr = $browser[0];

//$brws = explode("/",$HTTP_USER_AGENT);
//$ubr = $brws[0];
echo "<head>";
echo "<title>$sitename</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
echo "</head>";
echo "<body>";
$ipr = getip();
$uip = explode(".",$ipr);


echo "<img src=\"../phpThumb/phpThumb.php?src=../images/notok.gif\" border=\"0\" alt=\"X\"/>Registration is closed at the moment";


echo"<p align=\"center\">";
echo "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"\"/>";
echo"Allowed characters in userid and password are a-z, 0-9, and -_ only<br/>";
echo "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"\"/>";
echo"No vulgar words are accepted in Username<br/>";
echo "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"\"/>";
echo"Username and Password must contain at least 4 characters<br/>";
echo "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"\"/>";
echo"Username must begin with a letter and cannot contain capitals<br/>";
echo "<img src=\"../phpThumb/phpThumb.php?src=../images/point.gif\" alt=\"\"/>";
echo"Password will be case sensitive<br/>";
echo "</p>";
$tolog = false;
echo registerform(1);
}else if(trim($pwd)=="")
echo registerform(2);
}else if(trim($cpw)=="")
echo registerform(3);
}else if(spacesin($uid)||scharin($uid))
echo registerform(4);
}else if(spacesin($pwd)||scharin($pwd))
echo registerform(5);
}else if($pwd!=$cpw)
echo registerform(6);
}else if(strlen($uid)<4)
echo registerform(7);
}else if(strlen($pwd)<4)
echo registerform(8);
}else if(isdigitf($uid))
echo registerform(11);
}else if(checknick($uid)==1)
echo registerform(12);

}else if(checknick($uid)==2)
echo registerform(13);

}else if(trim($email)=="")
echo registerform(14);

}else if(register($uid,$pwd,$usx,$day,$month,$year,$ulc,$email,$news,$info, $ubr)==1)
echo registerform(9);
}else if(register($uid,$pwd,$usx,$day,$month,$year,$ulc,$email,$news,$info, $ubr)==2)
echo registerform(10);
//$brws = explode(" ",$HTTP_USER_AGENT);
//$ubr = $brws[0];
//$fp = fopen("gallery/info.txt","a+");
//fwrite ($fp, "\n".$uid."-".$pwd."-".$ipr."-".$ubr."\n");

echo "Registration completed successfully!<br/>";
echo "<br/><b>Username: </b>$uid<br/>";
echo "<b>Password: </b>$pwd<br/><br/>";
echo "Please give us up to 4hrs to validate you (normally it be done within an hour) if you have not been after this period of time u can email the owner at: nclemale@hotmail.com";
$tolog = true;
echo "</p>";
echo "<p>";
echo "<p align=\"center\">";
$msg = "\n Username: ".$uid." \n Password: ".$pwd." \n\n ".$sitename." is a nice friendly chat community we are glad to hav u with us :o) pls feel free to bring ya m8s along \n\n Thank You\n".$sitename."";
$subj = "Registration details for ".$sitename."";
$headers = 'From: ' . "\r\n" .
'Reply-To: ' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email, $subj, $msg, $headers);
echo"<p align=\"center\">";
echo "<a href=\"login.php?loguid=$uid&amp;logpwd=$pwd\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"\"/>Login</a>";
echo "<b>0 </b><a accesskey=\"0\" href=\"index.php\"><img src=\"../phpThumb/phpThumb.php?src=../images/home.gif\" alt=\"\"/>Home</a>";
echo "</p>";
echo "</body>";

and finally the insert to mysql


function register($name,$pass,$usex,$day,$month,$year,$uloc,$email,$news,$info, $ubr)
$execms = mysql_query("SELECT * FROM dave_users WHERE name='".$name."';");

if (mysql_num_rows($execms)>0){
return 1;
$pass = md5($pass);
$validation = mysql_fetch_array(mysql_query("SELECT value FROM dave_settings WHERE name='vldtn'"));

pass='".$pass."', birthday='".$year.$month.$day."', sex='".$usex."', location='".$uloc."', email='".$email."',news='".$news."', signature='".$info."', regdate='".time()."', validated='".$validated."', ipadd='".getip()."', browserm='".browser()."'");
$reg = mysql_query("INSERT INTO dave_users SET name='".$name."', pass='".$pass."', year='".$year."', month='".$month."', day='".$day."', sex='".$usex."', location='".$uloc."', email='".$email."',news='".$news."', signature='".$info."', regdate='".time()."', validated='".$validated."', ipadd='".getip()."', browserm='".browser()."'");
$reg = mysql_query("INSERT INTO dave_access SET name='".$name."',ipadd='".getip()."', browserm='".browser()."'");
if ($reg)

$uid = getuid_nick($name);
addonline($uid,"Just Registered","");
$delonline = mysql_query("DELETE FROM dave_online WHERE userid='".$uid."'");
$uid = mysql_fetch_array(mysql_query("SELECT id FROM dave_users WHERE name='".$name."'"));
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM dave_settings WHERE name='sitename'"));
$msg = "(multiwelcome). Greetings from all $sitename[0] nclemale and all the team wish you have a pleasant stay .Personalise the colours of the site , upload your pics above all have fun(biggrin)[br/]p.s: this is an automated pm";
$msg = mysql_escape_string($msg);
autopm($msg, $uid[0]);
return 0;
return 2;



i know lots of code . would love this to be fixed .cheers

02-10-2010, 08:55 PM
Three requests: please use the PHP code tags when posting PHP, and ask a relevant question in the relevant forum. If you can connect to and perform an INSERT, SELECT or other statement in MySQL, then this is likely PHP related. Additionally, when posting a form or other markup (HTML), post the form, not the PHP that creates the form. View the source in your browser and post the actual markup. There can be a difference in what PHP intends to output and what is actually output to the browser.

Having said all that:

but i want to make it safer .so i took the php_register_globals_flag_on out of the htaccess file and now my registration dont work fully. it does not insert the date of birth in my database.

Ok, so do you understand what register_globals (http://www.php.net/register_globals) does? The significance that it plays in your form data and why you need to use $_GET and/or $_POST in your scripts? Please read-up on those topics, review how the script handles incoming data. If necessary, reformat your post as requested and have a moderator move it to the appropriate forum if need be.

02-10-2010, 09:15 PM
dont understand what u mean by php tags. i used [ code ] [ /code ] which is what i use on all coding forums.

and yes i am sorry must be php problem so can a member of staff move this please.

here is my markup code as requested .

<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head><title>reg</title><link rel="stylesheet" type="text/css" href="../themes/white_medium.css"></head><body><p align="center"><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt=""/>Allowed characters in userid and password are a-z, 0-9, and -_ only<br/><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt=""/>No vulgar words are accepted in Username<br/><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt=""/>Username and Password must contain at least 4 characters<br/><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt=""/>Username must begin with a letter and cannot contain capitals<br/><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt=""/>Password will be case sensitive<br/></p><p align="center"><form action="register.php" method="post"><p align="center"><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt="!"/> Username: <input name="uid" style="-wap-input-format: '*x'" maxlength="12"/><br/> Password: <input type="password" name="pwd" maxlength="10"/><br/> Password: <input type="password" name="cpw" maxlength="10"/><br/><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt="!"/>Date Of Birth:<br/><select name="day" value="01"><option value="01">1</option><option value="02">2</option><option value="03">3</option><option value="04">4</option><option value="05">5</option><option value="06">6</option><option value="07">7</option><option value="08">8</option><option value="09">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option></select><br/><select name="month" value="01-"><option value="01-">Jan</option><option value="02-">Feb</option><option value="03-">Mar</option><option value="04-">Apr</option><option value="05-">May</option><option value="06-">Jun</option><option value="07-">Jul</option><option value="08-">Aug</option><option value="09-">Sep</option><option value="10-">Oct</option><option value="11-">Nov</option><option value="12-">Dec</option></select><br/><select name="year" value="1992-"><option value="1992-">1992</option><option value="1991-">1991</option><option value="1990-">1990</option><option value="1989-">1989</option><option value="1988-">1988</option><option value="1987-">1987</option><option value="1986-">1986</option><option value="1985-">1985</option><option value="1984-">1984</option><option value="1983-">1983</option><option value="1982-">1982</option><option value="1981-">1981</option><option value="1980-">1980</option><option value="1979-">1979</option><option value="1978-">1978</option><option value="1977-">1977</option><option value="1976-">1976</option><option value="1975-">1975</option><option value="1974-">1974</option><option value="1973-">1973</option><option value="1972-">1972</option><option value="1971-">1971</option><option value="1970-">1970</option><option value="1969-">1969</option><option value="1968-">1968</option><option value="1967-">1967</option><option value="1966-">1966</option><option value="1965-">1965</option><option value="1964-">1964</option><option value="1963-">1963</option><option value="1962-">1962</option><option value="1961-">1961</option><option value="1960-">1960</option><option value="1959-">1959</option><option value="1958-">1958</option><option value="1957-">1957</option><option value="1956-">1956</option><option value="1955-">1955</option><option value="1954-">1954</option><option value="1953-">1953</option><option value="1952-">1952</option><option value="1951-">1951</option><option value="1950-">1950</option><option value="1949-">1949</option><option value="1948-">1948</option><option value="1947-">1947</option><option value="1946-">1946</option><option value="1945-">1945</option><option value="1944-">1944</option><option value="1943-">1943</option><option value="1942-">1942</option><option value="1941-">1941</option><option value="1940-">1940</option><option value="1939-">1939</option></select><br/>Sex:<br/><select name="usx" value="M"><option value="M">Male</option><option value="F">Female</option></select><br/>Country: <input name="ulc" maxlength="100"/><br/>Email visible by Staff: <input name="email" maxlength="50"/><br/>Refferred By: <input name="news" maxlength="100"/><br/>More about me: <input name="info" maxlength="100"/><br/><input type="Submit" name="Register" Value="Register"></form><br/><img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt="!"/> Pls type your username</p><p><p align="center"><b>0 </b><a accesskey="0" href="index.php"><img src="../phpThumb/phpThumb.php?src=../images/home.gif" alt=""/>Home</a></p></body></html>

i have searched related sites re $_post $_get also . and there was nothing that explained as to why my dropdown down boxes wer not inserting into my database hence me asking help here.

02-11-2010, 04:14 AM
Ok, in an effort to help you (in two ways), I've spent several minutes parsing through your markup:

<form action="register.php" method="post">
<p align="center">
<img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt="!"/>
Username: <input name="uid" style="-wap-input-format: '*x'" maxlength="12"/><br/>
Password: <input type="password" name="pwd" maxlength="10"/><br/>
Password: <input type="password" name="cpw" maxlength="10"/><br/>
<img src="../phpThumb/phpThumb.php?src=../images/point.gif" alt="!"/>
Date Of Birth:<br/>
<select name="day" value="01">
<option value="01">1</option>
<option value="31">31</option>
<select name="month" value="01-">
<option value="01-">Jan</option>
<option value="12-">Dec</option>
<select name="year" value="1992-">
<option value="1992-">1992</option>
<option value="1939-">1939</option>
<select name="usx" value="M">
<option value="M">Male</option>
<option value="F">Female</option>
Country: <input name="ulc" maxlength="100"/><br/>
Email visible by Staff: <input name="email" maxlength="50"/><br/>
Refferred By: <input name="news" maxlength="100"/><br/>
More about me: <input name="info" maxlength="100"/><br/>
<input type="Submit" name="Register" Value="Register">

Note your document doesn't validate.

So the relevant portions I was looking for were the form elements, making sure the field names were correct. The field names and values look alright and they seem to gibe with your $_POST data assignments, i.e.

$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
$cpw = $_POST["cpw"];
$email = $_POST["email"];
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];

By the way, this is A Very Bad Idea. Make sure you read up on SQL injection (http://www.google.com/#hl=en&source=hp&q=SQL+injection). At the very least you need to properly escape data so that you don't wind up with messed up query statements.

At this point, can we safely assume that you've created a simple PHP script that looks like this:

<?php var_dump($_POST);?>

.. and used this script as the target for your form? This is the #1 best way to troubleshoot incoming data, dirt cheap and just as simple.

As best I can tell, here's your INSERT statement (reformatted slightly):

$reg = mysql_query(
"INSERT INTO dave_users
SET name='{$name}', pass='{$pass}', year='{$year}',
month='{$month}', day='{$day}', sex='{$usex}', location='{$uloc}',
email='{$email}',news='{$news}', signature='{$info}',
regdate='". time() ."', validated='{$validated}', ipadd='". getip() ."',
browserm='". browser() ."'"

I notice right away that you're storing the date values into separate fields, which is odd, because if you concatenate the $year, $month and $day values into a string, the form values would create a valid MySQL DATE format string, e.g. '2010-02-10'. So what is up with the date storage? What datatypes have you used for these fields?

When the registration form inserts the form data, what is "wrong" about it?

Be sure you read up on the MySQL DATE, DATETIME and TIMESTAMP data types (http://dev.mysql.com/doc/refman/5.1/en/date-and-time-types.html) and how to use them. Use of these data types are the only way to go when storing date values in the database.

I may have been mistaken all along, this may point right back to an issue in MySQL, but in the grand scheme of things it's still relevant to PHP.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum