Jump to content

Thesus

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Thesus's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. When you check the database for the name and password, and if that person has never postd before and has no information stored, it automatically assumes the name and password are incorrect and doesn't alow you to post. So the first query checks if the name is, infact there, and if it isn't it allows you to post and stores your password for the 2nd query for future postage. :D And thanks, I'll try, and hopefully it'll work. :p
  2. Well I'm trying to create a forum and have been doing so for a while, I just can never verify the user's password correctly. If they haven't been inserted into the database, it automatically assumes the names and password do not match. I thought I finally figured it out with this simplified-down code, but currently to no avail I just get a blank page. Help's very, very, very much appreciated. :P (Just to note aswell, this isn't a register/login forum. It's where you use a name and password, and that's it- no login) [code] <?php $host="db1.awardspace.com"; $username="thesus_dantee"; $password="*********"; $db_name="thesus_dantee"; $tbl_name="regulars"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $name1 = $_POST['name']; $password1 = $_POST['password']; $name = addslashes('$name1'); $password = addslashes('$password1'); $check = "SELECT name FROM $tbl_name WHERE name='$name'"; $query = mysql_query($check); if($query == 0){ $sql = "INSERT INTO $tbl_name(name, password)VALUES('$name', '$password')"; $result = mysql_query($sql); echo "Successfully Posted!"; } else { $check2 = "SELECT * FROM $tbl_name WHERE name='$name' AND password='$password'"; $query2 = mysql_query($check2); $count = mysql_num_rows($query2); if($count == 1){ $sql2="INSERT INTO $tbl_name(name, password)VALUES('$name', '$password')"; $result2=mysql_query($sql2); echo "Sucessfully Posted!"; } } ?> [/code]
×
×
  • 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.