Jump to content

vajona

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by vajona

  1. Thank you so much guys. It is working now. To bad you don't live around me id take you out for food to properly thank you.
  2. update: i changed my script to $mysql = "SELECT * FROM users WHERE `email`=".$_SESSION['email'].""; and when i echo it out i get SELECT * FROM users WHERE `id`=name@blah.edu when i go to PHPMYADMIN and run it as a query i get #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@blah.edu LIMIT 0, 30' at line 1 however; if i simply put " " around the email in the query window SELECT * FROM users WHERE `email` = "name@blah.edu" gives me the correct value which is greater than 0 so my question now is how do i get it to look like that when i echo it out. i really hope that makes sense also i would like to thank you for helping. i know it's like pulling teeth. i am trying my hardest to learn everything i can about how to script.
  3. SELECT id,firstname FROM users WHERE 'id'='name@blah.edu' i received the logged in email.
  4. Are you asking me if the session tests email=pass to have access to a page? if so than yes it does.
  5. If i change to $sql = "SELECT * FROM users WHERE `id`='specific number'"; it works. why isn't the session working here?
  6. Ya, i am really confused because the results for the id for that session isn't 0.
  7. true, why would it log me out though? it's the same session i have been using
  8. well every time i use only sql or mysql it logs me out.
  9. Changed to `id` , but I'm still getting the error.
  10. I'm not sure what i have done wrong here... all it says is "Query was empty" <?php SESSION_START(); ?> //some html <?php if($_SESSION['email']){ $mysql = "SELECT id,firstname FROM users WHERE 'id'='".$_SESSION['email']."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ session_destroy(); echo"Please <a href=\"/index.html\">Login</a> or <a href=\"/register.php\">Join Us.</a>"; }else{ $row = mysql_fetch_assoc($res); echo "welcome back, <a href=\"./index.php?act=profile&id=".$row['id']."\">".$row['firstname']."</a>\n"; } }else { echo"Please <a href=\"/index.html\">Login</a> or <a href=\"/register.php\">Join Us.</a>"; } ?>
  11. better yet. tell me if there is anything wrong with this as to why it wouldn't be posting data to the database... <?php $submit = $_POST['submit']; //form data $firstname = strip_tags($_POST['firstname']); $lastname = strtolower( strip_tags($_POST['lastname'])); $password = strip_tags($_POST['password']); $repeatpassword = strip_tags($_POST['repeatpassword']); $date = date("Y-m-d"); $email = strip_tags($_POST['email']); $state = strip_tags($_POST['state']); $school = strip_tags($_POST['school']); if ($submit) { //open database $connect = mysql_connect("localhost","USERNAME","PASSWORD")or die("Coundn't connect!"); mysql_select_db("DBNAME") or die("couldn't find db"); //select database $namecheck = mysql_query("SELECT email FROM users WHERE email='$email'"); $count = mysql_num_rows($namecheck); if ($count!=0) { die("Email already registered"); } // email is okay if (stristr($email, '.edu')) { //check for existance if ($firstname&&$lastname&&$password&&$repeatpassword&&$email&&$state&&$school) { if($password==$repeatpassword) { //check char length of lastname and firstname if (strlen($lastname)>25||strlen($firstname)>25) { echo "<b>Lenth of lastname or firstname is too long</b>!"; } else { //check password length if (strlen($password)>25||strlen($password)<6) { echo "<b>Password must be between 6 and 25 characters</b>"; } else { //register the user! // encrypt password $password = md5($password); $repeatpassword = md5($repeatpassword); //generate random number for activation process $random = rand(23456789,98765432); $queryreg = mysql_query(" INSERT INTO users VALUES ('','$firstname','$lastname','$password','$email','$state','$school','$date','$random','0') "); $lastid = mysql_insert_id(); //send activation email $to = $email; $subject = "Activate your account!"; $headers = "From: HEADER"; $server = "localhost"; $port = "465"; $email = "EMAIL ADDRESS"; $password = "PASSWORD"; ini_set("SMTP", $server); $body = " Hello $firstname,\n\n You need to activate your account with the link below: http://www.MYWEBSITE.com/activate.php?id=$lastid&code=$random\n\n Thanks! "; //function to send email mail($to, $subject, $body, $headers); die(" <b>Thank you for registering! Please check your email to activate your account.</b>"); } } } else echo "<b>Your passwords do not match!</b>"; } else echo "<b>Please fill in <u>All</u> Fields!</b>"; } else echo "<b>You must enter your school email to register.</b>"; } ?>
  12. yes i backed my site up and i restored it also. and yes i have a cpanel
  13. I installed phpbb to my site; however i didn't like it so i deleted it. Now my register.php (which hasn't been changed and worked before the phpbb install) will not post data to my database. If someone can help me fix this problem id be most thankful.
  14. nvm i believe i have it figured out.
  15. i am trying to set up a website for a school function. i have the register page up and running but i would like to make it so only people with a school email address may register. i.e name@school.edu I have looked through a lot of forms, but have yet to find the answer. Everything that i have found doesn't work. Thanks
×
×
  • 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.