Jump to content

justinba1010

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

justinba1010's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Notice: Undefined index: password in /opt/lampp/htdocs/game/register.php on line 46 INSERT INTO user (username, password) VALUES ('j','') When I changed it to <?php //Register 1.0.1 include("function.php"); connect(); $num = 0; if(isset($_POST['submit'])) { if($_POST['username'] == '' || $_POST['password1'] == '' || $_POST['password2'] == '') { $num = 1; echo "Please supply all fields;"; exit(); } elseif(strlen($_POST['username']) > 25) { $num = 1; echo "Username must be under 25 characters long;"; exit(); } elseif(strlen($_POST['password1']) > 16) { if(strlen($_POST['password2']) >16) { $num = 1; echo "Password are over 16 characters long;"; exit(); } $num = 1; echo "Passwords are not equal"; exit(); } elseif($_POST['password1'] !== $_POST['password2']) { $num = 1; echo "Passwords are not equal;"; exit(); } $username = $_POST['username']; safe($username); if($_POST['password1'] == $_POST['password2']) { $password = $_POST['password']; password($password); echo "INSERT INTO user (username, password) VALUES ('$username','$password')"; } } ?> <HTML> <form action="register.php" method="post"> Username:<input type="text" name="username"> <br> Password:<input type="password" name="password1"> <br> Password Check:<input type="password" name="password2"> <br> <input type="submit" name="submit" value="Register!"> </HTML>
  2. Well I think you need to open Terminal, and put chown -hR username /directory to be under a new owner Is that what you're looking for? Thats what I did to my debugger. chown -hR justin /opt/lampp/htdoc/
  3. <?php //Register 1.0.1 include("function.php"); connect(); $num = 0; if(isset($_POST['submit'])) { if($_POST['username'] == '' || $_POST['password1'] == '' || $_POST['password2'] == '') { $num = 1; echo "Please supply all fields;"; exit(); } elseif(strlen($_POST['username']) > 25) { $num = 1; echo "Username must be under 25 characters long;"; exit(); } elseif(strlen($_POST['password1']) > 16) { if(strlen($_POST['password2']) >16) { $num = 1; echo "Password are over 16 characters long;"; exit(); } $num = 1; echo "Passwords are not equal"; exit(); } elseif($_POST['password1'] != $_POST['password2']) { $num = 1; echo "Passwords are not equal;"; exit(); } } else { if(isset($_POST['submit'])) { $username = $_POST['username']; safe($username); if($_POST['password1'] = $_POST['password2']) { $password = $_POST['password']; password($password); echo "INSERT INTO user (username, password) VALUES ('$username','$password')"; } else { echo "Passwords are not equal; Double Take";//Yes Double Take is a military term exit(); } } } ?> <HTML> <form action="register.php" method="post"> Username:<input type="text" name="username"> <br> Password:<input type="password" name="password1"> <br> Password Check:<input type="password" name="password2"> <br> <input type="submit" name="submit" value="Register!"> </HTML> Here is where I put the code: if(isset($_POST['submit'])) { $username = $_POST['username']; safe($username); if($_POST['password1'] = $_POST['password2']) { $password = $_POST['password']; password($password); echo "INSERT INTO user (username, password) VALUES ('$username','$password')"; } else { echo "Passwords are not equal; Double Take";//Yes Double Take is a military term exit(); } I used it like that to narrow it down. And I still do not understand the issue, are there any other issues? [attachment deleted by admin]
  4. Thank you so much! Was a bit tired, really didn't do it good as others I did. Overthought a lot of it.
  5. /* Checks for inserted data * otherwise quits with exit command */ // MySQL Connect $con01 = mysql_connect("localhost","root",""); mysql_select_db("game"); if(isset($_POST['username'])&& isset($_POST['username'])) { $username = $_POST['username']; $username = stripslashes($username); $username = mysql_escape_string($username); $password = $_POST['password']; $password = stripslashes($password); $password = mysql_escape_string($password); $password = md5($password); } else exit("You haven't entered either a username and/or a password."); // Query $query = mysql_query("SELECT * FROM login WHERE username = '$username' AND password = '$password'")or exit("Couldn't find you in the login."); $edie = mysql_num_rows($query); while($row = mysql_fetch_assoc) { $dbVN = $row['vilnum']; } if($edie = 1&&$dbVN=0) { while($row = mysql_fetch_assoc($query)) { $dbuid = $row['uid']; } $query = mysql_query("SELECT * FROM villages WHERE uid = '0' AND type = '0' LIMIT 0,1"); while($row = mysql_fetch_assoc($query)) { $dbvid = $row['vid']; $dbx = $row['x']; $dby = $row['y']; } echo "$dbx<br>$dby<br>$dbvid"; } if(!$dbvid||!$dbx||!$dby) { exit; } // Updates $query = mysql_query("UPDATE villages SET uid = '$dbuid' AND vilnum = '1' WHERE vid = '$dbvid' AND x = '$dbx' AND y = '$dby'") or exit("Unknown Error #1"); $query = mysql_query("UPDATE login SET vilnum = '1' WHERE uid = '$dbuid'") or exit("Unknown Error #2"); ?> Well I tried them in phpmyadmin, they work there, but something is wrong here.
  6. So if I run that query through phpmyadmin it should give me what was wrong or what? As I don't know MySQL greatly as its new to me. I'll try that and keep you informed.
  7. Have been confused for a while on this one. I am doing a little mini game as I want to make a game for me and my friends. So what I did was make a login and register. <?php if (isset($_POST['faction'])) { $faction = $_POST['faction']; if ($_POST['username']&&$_POST['password']&&$_POST['email']) { $username = $_POST['username']; $username = stripslashes($username); $username = mysql_escape_string($username); $password = $_POST['password']; $password = stripslashes($password); $password = mysql_escape_string($password); $password = md5($password); $email = $_POST['email']; $email = stripslashes($email); $email = mysql_escape_string($email); mysql_connect("localhost","root",""); mysql_select_db("game"); $query = mysql_query("SELECT * FROM login WHERE username = '$username'"); $num = mysql_num_rows($query); if( $num == 0) { $query = mysql_query("INSERT INTO login(username,password,faction,email) VALUES('$username','$password','$faction','$email')"); } else { echo "That username is already taken."; exit(); } } else { echo "You are missing a required field."; exit(); } } else { echo "You haven't selected a faction."; exit(); } $query = mysql_query("SELECT * FROM map WHERE uid='0' AND type='0' ORDER BY vid ASC LIMIT 0,1"); while($row = mysql_fetch_assoc($query)); { $dbx = $row['x']; $dby = $row['y']; echo $dbx.$dby; } ?> It happens that the error is on line Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/game/registrationbackbone.php on line 45 Have been stumped on why.
×
×
  • 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.