getting back to everyone.....
Code: Select all
function s2dbadd($db, $badaim, $badicq, $badmsn, $badyim){ # step 2 db additions
include("/home/joshua/includes/fyd.altincs.php"); # includes file (precautionary measure)
# step 2 non-passed variables
$un=clean($_POST['un']); $pw=MD5($_POST['pw']); $email=clean($_POST['email']); $dobm=clean($_POST['month']); $dobd=clean($_POST['day']); $doby=clean($_POST['year']); $gender=clean($_POST['gender']); $sexpref=clean($_POST['sexpref']); $marstat=clean($_POST['marstat']); $country=clean($_POST['country']); $feet=clean($_POST['feet']); $inches=clean($_POST['inches']); $waist=clean($_POST['waist']); $eye=clean($_POST['eye']); $hair=clean($_POST['hair']); $weight=clean($_POST['weight']); $body=clean($_POST['body']); $education=clean($_POST['education']); $employment=clean($_POST['employment']); $religion=clean($_POST['religion']); $ethnicity=clean($_POST['ethnicity']); $city=clean($_POST['city']); $spt=clean($_POST['spt']); $selfcat=clean($_POST['selfcat']); $aim=clean($_POST['aim']); $icq=clean($_POST['icq']); $mirc=clean($_POST['mirc']); $msn=clean($_POST['msn']); $yim=clean($_POST['yim']); # || date of birth month/day/year, gender, sexual preference, marital status, country, height (feet/inches), waist, eye, hair, weight, body type, education level, employment status, religion, ethnicity, city, state/province/territory, selfcat || aim, icq, mirc, msn, yim
$llip=$_SERVER['REMOTE_ADDR']; $aff='Regular';# variables not in post but needed
$lld=gmdate("Y-m-d H:i:s", time()); # get the GMT date/time based on time() (which returns the GMT timestamp)
$enroll=gmdate("Y-m-d H:i:s", time()); # get the GMT date/time based on time() (which returns the GMT timestamp)
# set various elements in prep to enter into the db
if(isset($aim)&&$badaim){ $aim=NULL; } # set aim to a NULL entry if needed
if(isset($icq)&&$badicq){ $icq=NULL; } # set icq to a NULL entry if needed
if(isset($msn)&&$badmsn){ $msn=NULL; } # set msn to a NULL entry if needed
if(isset($yim)&&$badyim){ $yim=NULL; } # set yim to a NULL entry if needed
$height=(12*$feet)+$inches; # set height for storage
$dob=$doby.'-'.$dobm.'-'.$dobd; # set DOB
# make primary user table entry, retrieve uid
mysql_query("INSERT INTO users (username, password, email, last_login_ip, last_login_date, enroll, gender) VALUES ('$un', '$pw', '$email', '$llip', '$lld', '$enroll', '$gender')", $db); # sets the main user table
$query="INSERT INTO users (username, password, email, last_login_ip, last_login_date, enroll, gender) VALUES ('$un', '$pw', '$email', '$llip', '$lld', '$enroll', '$gender')";
$errno=mysql_errno($db); $err=mysql_error($db); echo "<p>debug: insert to user: $query<br />$errno <br />$err</p>";
$getuid=mysql_query("SELECT uid FROM users WHERE username='$un'", $db); # query for uid
$uid=mysql_fetch_array($getuid); # set the uid
# make stats table entry
mysql_query("INSERT INTO stats (uid, username, dob, affiliation, sex_pref, mar_stat, country, height, waist, eye_color, hair_color, weight, body_type, education, employment, religion, ethnic, city, spt, self_cat, aim, icq, mirc, msn, yim) VALUES ($uid, $username, $dob, $aff, $sexpref, $marstat, $country, $height, $waist, $eye, $hair, $weight, $body, $education, $employment, $religion, $ethnicity, $city, $spt, $selfcat, $aim, $icq, $mirc, $msn, $yim)", $db); #insert stats into stats table
# set uid into a cookie
$expire=time()+60*60; # set expiration an hour from now
setcookie(uid, md5($uid), $expire);
}