Jump to content

Jayden_Blade

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Jayden_Blade

  1. First.... THANKS ALOT! Second..... Now it is giving me errors lol here is the errors now date checkdatabase look upstarting email Warning: filter_var() expects parameter 2 to be long, string given in C:\Users\Jayden\Desktop\UniServerZ\www\regcheck.php on line 86 Email is incorrect Notice: Undefined index: fe383b22953805123e0c5461264bd33a in C:\Users\Jayden\Desktop\UniServerZ\www\regcheck.php on line 105 Notice: Undefined variable: hash in C:\Users\Jayden\Desktop\UniServerZ\www\regcheck.php on line 108 Notice: Undefined index: in C:\Users\Jayden\Desktop\UniServerZ\www\regcheck.php on line 108 Notice: Undefined variable: hash in C:\Users\Jayden\Desktop\UniServerZ\www\regcheck.php on line 125 <?php error_reporting(E_ALL); ini_set('display_errors', 1); if ($_POST) { $year2 = date('Y'); $year = (date('Y') - 18); $month = date('m'); $day = date('d'); $datecheck = mktime(0,0,0,$month,$day,$year); $yearcheck = mktime(0,0,0,$_POST['month'],$_POST['day'],$_POST['year']); #$birthday = ($_POST['month'],$_POST['day'],$_POST['year']); #echo "Month: $month, Year: $year, Day: $day, Check: $datecheck"; #echo $yearcheck; if( $datecheck >= $yearcheck){ echo"date check"; } else { header ('location: http://www.google.com'); } #$birthday= ($_POST['month'],$_POST['day'],$_POST['year']); $check = array('user','password1','password2','email1','email2','age','location','agree'); $break = false; foreach ($check as $key => $postcheck) { if (!$_POST[$postcheck] || strlen($_POST[$postcheck]) == 0) { $break = true; echo "spot = $postcheck<br />"; break; } } if ($break) { echo "Fields are blank"; exit; } else { //echo "<pre>";print_r($_POST);echo "</pre>"; } if( strlen( $_POST['user'] ) < 4 ) { $ERROR = TRUE; echo "Username Must Be More Than 4 Characters."; } if( strlen( $_POST['password1'] ) < 4 ) { $ERROR = TRUE; echo "Password Must Be More Than 4 Characters."; } if( $_POST['password1'] == $_POST['user'] ) { $ERROR = TRUE; echo"Username And Password Can Not Be The Same."; } if( $_POST['password1'] !== $_POST['password2'] ) { $ERROR = TRUE; echo"Passwords are not the same. Try again."; } if( $_POST['email1'] !== $_POST['email2'] ) { $ERROR = TRUE; echo"Emails are not the same. Try again."; } if( $_POST['agree'] != 'on') { $ERROR = TRUE; echo "You Must agree you are 18+ and agree to TOS to register."; } if( strlen( $_POST['human'] ) > 0 ) { $ERROR = TRUE; echo "Please Remove the text from the Human Checker Box to continue!"; } //if ($ERROR = TRUE) { //echo "Please try again!"; //} else { echo"database look up"; include( 'database.php' ); echo"starting email"; $username = mysql_real_escape_string( $_POST['user'] ); $password1 = md5( $_POST['password1'] ); $email1 = mysql_real_escape_string($_POST['email1']); if (!filter_var(trim($_POST['email1']), $email1)){ echo 'Email is incorrect'; // Return Error - Invalid Email $msg = 'The email you have entered is invalid, please try again.'; }else{ // Return Success - Valid Email $msg = 'Your account has been made, <br /> please verify it by clicking the activation link that has been send to your email.'; $hash = md5( rand(0,1000) ); // Generate random 32 character hash and assign it to a local variable. // Example output: f4552671f8909587cf485ea990207f3b } $sqlCheckForDuplicate = "SELECT username FROM user WHERE username = '$_POST[user]'"; if( mysql_num_rows( mysql_query( $sqlCheckForDuplicate ) ) == 0 ) { $sqlRegUser = "INSERT INTO user( username, password, email, agree, hash ) VALUES( '$_POST[user]', '$_POST[$password1]', '$_POST[email1]', '$_POST[agree]', '$_POST[$hash]' )"; error_reporting(E_ALL); $to = $email1; // Send email to our user $subject = 'Signup | Verification'; // Give the email a subject $message = ' Thanks for signing up! Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. ------------------------ Username: '.$username.' Password: '.$password1.' ------------------------ Please click this link to activate your account: http://www.yourwebsite.com/verify.php?email='.$email1.'&hash='.$hash.' '; // Our message above including the link $headers = 'From:[email protected]<script type="text/javascript"> /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute(\'data-cfemail\');if(a){s=\'\';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ </script>' . "\r\n"; // Set from headers mail($to, $subject, $message, $headers); // Send our email mysql_query($sqlRegUser) or die("user insert = <br />".mysql_error()); $sqlRegUsera = "INSERT INTO profiledata( username, age, sex, sexpref, maritalstatus, location, lookingfor, children, smoking, drinking, lastlog, sign_up_date ) VALUES( '$_POST[user]', '$_POST[age]', '$_POST[sex]', '$_POST[sexpref]', '$_POST[maritalstatus]', '$_POST[location]', '$_POST[lookingfor]', '$_POST[children]', '$_POST[smoking]', '$_POST[drinking]', now(), now() )"; mysql_query($sqlRegUsera) or die("profiledata insert = <br />".mysql_error()); $sqlRegUsera = "INSERT INTO aboutme( username, aboutme) VALUES( '$_POST[user]', '$_POST[aboutme]' )"; mysql_query($sqlRegUsera) or die("aboutme insert = <br />".mysql_error()); $sqlRegUsera = "INSERT INTO interests( username, interests ) VALUES( '$_POST[user]', '$_POST[interests]' )"; mysql_query($sqlRegUsera) or die("interests insert = <br />".mysql_error()); $sqlRegUserb = "INSERT INTO fetishes( username, fetishes ) VALUES( '$_POST[user]', '$_POST[fetishes]' )"; mysql_query($sqlRegUserb) or die("fetishes insert = <br />".mysql_error()); $sqlRegUserc = "INSERT INTO navigation( username ) VALUES '$_POST[user]' )"; $id = mysql_insert_id(); //echo $id; mkdir("members/$id", 0755); } else { echo "The Username You Have Chosen Is Already Being Used By Another User. Please Try Another One."; $formUsername = $username; } } } else { echo "You Could Not Be Registered Because Of Missing Data."; } ?>
  2. same thats a lot of retyping to "register" haha well looks like i get to pull out the php gun and hunt for hrs! lol wish me luck
  3. I fixed the semicolon. Still the same thing..... No oddly no errors...
  4. First Listen to Ch0cu3r... 2nd Verify myusername is correct in spelling and capitalization. Verify mypassword is correct in spelling and capitalization.
  5. <?php error_reporting(E_ALL); if ($_POST) { $year2 = date('Y'); $year = (date('Y') - 18); $month = date('m'); $day = date('d'); $datecheck = mktime(0,0,0,$month,$day,$year); $yearcheck = mktime(0,0,0,$_POST['month'],$_POST['day'],$_POST['year']); #$birthday = ($_POST['month'],$_POST['day'],$_POST['year']); #echo "Month: $month, Year: $year, Day: $day, Check: $datecheck"; #echo $yearcheck; if( $datecheck >= $yearcheck){ echo"date check"; } else { header ('location: http://www.google.com'); } #$birthday= ($_POST['month'],$_POST['day'],$_POST['year']); $check = array('user','password1','password2','email1','email2','age','location','agree'); $break = false; foreach ($check as $key => $postcheck) { if (!$_POST[$postcheck] || strlen($_POST[$postcheck]) == 0) { $break = true; echo "spot = $postcheck<br />"; break; } } if ($break) { echo "Fields are blank"; exit; } else { //echo "<pre>";print_r($_POST);echo "</pre>"; } if( strlen( $_POST['user'] ) < 4 ) { $ERROR = TRUE; echo "Username Must Be More Than 4 Characters."; } if( strlen( $_POST['password1'] ) < 4 ) { $ERROR = TRUE; echo "Password Must Be More Than 4 Characters."; } if( $_POST['password1'] == $_POST['user'] ) { $ERROR = TRUE; echo"Username And Password Can Not Be The Same."; } if( $_POST['password1'] !== $_POST['password2'] ) { $ERROR = TRUE; echo"Passwords are not the same. Try again."; } if( $_POST['email1'] !== $_POST['email2'] ) { $ERROR = TRUE; echo"Emails are not the same. Try again."; } if( $_POST['agree'] != 'on') { $ERROR = TRUE; echo "You Must agree you are 18+ and agree to TOS to register."; } if( strlen( $_POST['human'] ) > 0 ) { $ERROR = TRUE; echo "Please Remove the text from the Human Checker Box to continue!"; } if ($ERROR) { } else { echo"database look up" include( 'database.php' ); echo"starting email"; $username = mysql_real_escape_string( $_POST['user'] ); $password1 = md5( $_POST['password1'] ); $email1 = mysql_real_escape_string($_POST['email1']); if (!filter_var(trim($_POST['email']),, $email1)){ echo 'Email is incorrect'; // Return Error - Invalid Email $msg = 'The email you have entered is invalid, please try again.'; }else{ // Return Success - Valid Email $msg = 'Your account has been made, <br /> please verify it by clicking the activation link that has been send to your email.'; $hash = md5( rand(0,1000) ); // Generate random 32 character hash and assign it to a local variable. // Example output: f4552671f8909587cf485ea990207f3b } $sqlCheckForDuplicate = "SELECT username FROM user WHERE username = '$_POST[user]'"; if( mysql_num_rows( mysql_query( $sqlCheckForDuplicate ) ) == 0 ) { $sqlRegUser = "INSERT INTO user( username, password, email, agree, hash ) VALUES( '$_POST[user]', '$_POST[$password1]', '$_POST[email1]', '$_POST[agree]', '$_POST[$hash]' )"; error_reporting(E_ALL); $to = $email1; // Send email to our user $subject = 'Signup | Verification'; // Give the email a subject $message = ' Thanks for signing up! Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. ------------------------ Username: '.$name.' Password: '.$password1.' ------------------------ Please click this link to activate your account: http://www.yourwebsite.com/verify.php?email='.$email1.'&hash='.$hash.' '; // Our message above including the link $headers = 'From:[email protected]<script type="text/javascript"> /* <![CDATA[ */ (function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})(); /* ]]> */ </script>' . "\r\n"; // Set from headers mail($to, $subject, $message, $headers); // Send our email mysql_query($sqlRegUser) or die("user insert = <br />".mysql_error()); $sqlRegUsera = "INSERT INTO profiledata( username, age, sex, sexpref, maritalstatus, location, lookingfor, children, smoking, drinking, lastlog, sign_up_date ) VALUES( '$_POST[user]', '$_POST[age]', '$_POST[sex]', '$_POST[sexpref]', '$_POST[maritalstatus]', '$_POST[location]', '$_POST[lookingfor]', '$_POST[children]', '$_POST[smoking]', '$_POST[drinking]', '$_POST[lastlog]', now() )"; mysql_query($sqlRegUsera) or die("profiledata insert = <br />".mysql_error()); $sqlRegUsera = "INSERT INTO aboutme( username, aboutme) VALUES( '$_POST[user]', '$_POST[aboutme]' )"; mysql_query($sqlRegUsera) or die("aboutme insert = <br />".mysql_error()); $sqlRegUsera = "INSERT INTO interests( username, interests ) VALUES( '$_POST[user]', '$_POST[interests]' )"; mysql_query($sqlRegUsera) or die("interests insert = <br />".mysql_error()); $sqlRegUserb = "INSERT INTO fetishes( username, fetishes ) VALUES( '$_POST[user]', '$_POST[fetishes]' )"; mysql_query($sqlRegUserb) or die("fetishes insert = <br />".mysql_error()); $sqlRegUserc = "INSERT INTO navigation( username ) VALUES '$_POST[user]' )"; $id = mysql_insert_id(); //echo $id; mkdir("members/$id", 0755); } else { echo "The Username You Have Chosen Is Already Being Used By Another User. Please Try Another One."; $formUsername = $username; } } } else { echo "You Could Not Be Registered Because Of Missing Data."; } ?> First off I am still considered a noob when it comes to programming.... I am trying to create an email verification script inside my registration. What is wrong??? Please help! When I try to register it just sits at a blank page. It does NOT add anything to the tables. If I take ALL of the email verification scripts out it works again.
  6. GOT IT!!!!!!!!! thanks for the help!
  7. I am trying to view a different users profile. I am able to view mine. I did this 2 years ago.... I cant remember. Here is my php code. What do i have to put in url to see others profile? <?php /* DONE DONE DONE DONE DONE DONE DONE * How to display profile page. * Check if the user is viewing ANOTHER user's profile * and if so, display that profile, otherwise display the * user's own profile */ session_start(); if (!$_SESSION || !$_SESSION['login']) { //redirect to a login page header('Location: index.php'); exit; } //echo $username; //echo $userid; error_reporting(E_ALL); include ('database.php'); //Get userid that matches username in table to username in url //$exists = mysql_query("SELECT `username` FROM `user` WHERE `username`='$_GET[user]' LIMIT 1"); //$exists1 = mysql_fetch_assoc($exists); if ($_GET){ $result = mysql_query("SELECT `userid` FROM `user` WHERE `username`='$_GET[user]' LIMIT 1"); //returns the results from the mysql database in an associative array format $profileusername = mysql_fetch_assoc($result); // RE assigns $profileusername value to $profileID $profileID = $profileusername['userid']; //assigns $_GET username to $username $username = $_GET['user']; //} //elseif($username === $exists1);{ $resulta = mysql_query("SELECT `age`,`sex`,`sexpref`,`maritalstatus`,`location`,`lookingfor`,`children`,`smoking`,`drinking`,`lastlog`,`profileimagelocation` FROM `profiledata` WHERE `user`='$_GET[user]' LIMIT 1"); $userstats = mysql_fetch_array($resulta); $age = $userstats['age']; $sex = $userstats['sex']; $sexpref = $userstats['sexpref']; $maritalstatus = $userstats['maritalstatus']; $location = $userstats['location']; $lookingfor = $userstats['lookingfor']; $children = $userstats['children']; $smoking = $userstats['smoking']; $drinking = $userstats['drinking']; $lastlog = $userstats['lastlog']; $profileimage = $userstats['profileimagelocation']; //echo $age; $resultb = mysql_query("SELECT `interests` FROM `interests` WHERE `user`='$_GET[user]' LIMIT 1"); $userinterests = mysql_fetch_array($resultb); $interests = $userinterests['interests']; //echo $interests; $resultc = mysql_query("SELECT `aboutme` FROM `aboutme` WHERE `user`='$_GET[user]' LIMIT 1"); $useraboutme = mysql_fetch_array($resultc); $aboutme = $useraboutme['aboutme']; //echo $aboutme; $resultd = mysql_query("SELECT `fetishes` FROM `fetishes` WHERE `user`='$_GET[user]' LIMIT 1"); $userfetishes = mysql_fetch_array($resultd); $fetishes = $userfetishes['fetishes']; //echo $fetishes; //removes the resource and frees the database so it doesn't consume extra memory mysql_free_result($result); mysql_free_result($resulta); mysql_free_result($resultb); mysql_free_result($resultc); mysql_free_result($resultd); } else { ini_set('display_errors',1); error_reporting(E_ALL); //Get userid from the users table where the username matches the session username $result = mysql_query("SELECT `userid` FROM `user` WHERE `username`='$_SESSION[username]' LIMIT 1") or die("query failed 1".mysql_error()); //returns the results from the mysql database in an associative array format $profileusername = mysql_fetch_assoc($result); // RE assigns $profileusername value to $profileID $profileID = $profileusername['userid']; $username = $_SESSION['username']; //echo $username; //echo $profileID; $resulta = mysql_query("SELECT `age`,`sex`,`sexpref`,`maritalstatus`,`location`,`lookingfor`,`children`,`smoking`,`drinking`,`lastlog`,`profileimagelocation` FROM `profiledata` WHERE `username`='$_SESSION[username]'") or die("query failed 2".mysql_error()); $userstats = mysql_fetch_array($resulta); $age = $userstats['age']; $sex = $userstats['sex']; $sexpref = $userstats['sexpref']; $maritalstatus = $userstats['maritalstatus']; $location = $userstats['location']; $lookingfor = $userstats['lookingfor']; $children = $userstats['children']; $smoking = $userstats['smoking']; $drinking = $userstats['drinking']; $lastlog = $userstats['lastlog']; $profileimage = $userstats['profileimagelocation']; //echo $age; $resultb = mysql_query("SELECT `interests` FROM `interests` WHERE `username`='$_SESSION[username]'") or die("query failed 3".mysql_error()); $userinterests = mysql_fetch_array($resultb); $interests = $userinterests['interests']; //echo $interests; $resultc = mysql_query("SELECT `aboutme` FROM `aboutme` WHERE `username`='$_SESSION[username]'") or die("query failed 4".mysql_error()); $useraboutme = mysql_fetch_array($resultc); $aboutme = $useraboutme['aboutme']; $resultd = mysql_query("SELECT `fetishes` FROM `fetishes` WHERE `username`='$_SESSION[username]'") or die("query failed 5".mysql_error()); $userfetishes = mysql_fetch_array($resultd); $fetishes = $userfetishes['fetishes']; //echo $fetishes; //removes the resource and frees the database so it doesn't consume extra memory mysql_free_result($result); mysql_free_result($resulta); mysql_free_result($resultb); mysql_free_result($resultc); mysql_free_result($resultd); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.