Jump to content
Old threads will finally start getting archived ×
🚨🚨 GAME-CHANGING ANNOUNCEMENT FROM PHP FREAKS 🚨🚨 ×

DeepSeek 🤖

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DeepSeek 🤖's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. (Bump) I really need help
  2. The same as ||.
  3. I believe it is the same as &&; it means and.
  4. Eh; you could do a whole lot of if, elseif's... (You will have to make this yourself; however...) if time=<18:59 { echo "Up next - News & Weather" } Obviously that's not usable; but you get the idea.
  5. Umm...it matches perfectly? Now I'm having troubles with the if statement. The wrong password and correct password if's match; however if there is a wrong username nothing happens. Also; how can I set the cookies and redirect the user without getting a headers already send message? I've tried putting it in a function at the top of the page; however that didn't work.
  6. <?php include("base.php"); //Include MySQL connection $username = $_POST['username']; //Connect form username with strings $password = $_POST['password']; //Connect form password with strings $salt = "xia8u28jd0ajgfa"; //Define the salt string $salt2 = "oqipoaks42duaiu"; //Define the second salt string $password = md5($salt.$password.$salt2); //Encrypt the password $result = mysql_query("SELECT * FROM members WHERE username = '".$username."'"); //Open the members table while($row = mysql_fetch_array( $result )) { //Convert the members table into an array if ( $username != $row['username'] ) { //If user entered username doesn't equal the database username include("header.php"); //Print the message include("navigation.php"); echo "Invalid username or password!"; include("footer.php"); } else { if ( $row['password'] == $password ) { //Validate username and password setcookie('c_username', $username, time()+6000); //Set the username cookie setcookie('c_password', $password, time()+6000); //Set the cookie header("Location:index.php"); //Redirect to home page } else { include("header.php"); //Print the message include("navigation.php"); echo "<div class=\"content\"><p>Invalid username or password!<p></div>"; include("footer.php"); } } } ?> So this should work? It still does the same thing. " $username = $_POST['username']; //Connect form username with strings $password = $_POST['password']; //Connect form password with strings " shows that it has a value.
  7. Hi everyone, I'm trying to validate the password entered by the user with the password in the database. I've worked out that it checks the username fine (if the username doesn't exist it displays an error), however when it tries to validate the password with the mysql password it never works. The working 'example' is at http://scapersclearing.com/fansite/login.php; and this is the PHP (note base.php contains the database information and header.php, navigation.php and footer.php and all front-end). I'm planning on adding html entities and preventing SQL injection once this works. Username: Test - Password: password89 (md5 c1c2434f064da663997b1a2a233bf9f6) <?php include("base.php"); //Include MySQL connection $username = $_POST['username']; //Connect form username with strings $password = $_POST['password']; //Connect form password with strings $salt = "xia8u28jd0ajgfa"; //Define the salt string $salt2 = "oqipoaks42duaiu"; //Define the second salt string $password = md5($salt.$password.$salt2); //Encrypt the password $result = mysql_query("SELECT * FROM members WHERE username = '".$username."'"); //Open the members table while($row = mysql_fetch_array( $result )) { //Convert the members table into an array if ( $username != $row['username'] ) { //If user entered username doesn't equal the database username include("header.php"); //Print the message include("navigation.php"); echo "Invalid username or password!"; include("footer.php"); } else { $username = $username_new; $password = $password_new; if ( $row['password'] == $password_new ) { //Validate username and password setcookie('c_username', $username_new, time()+6000); //Set the username cookie setcookie('c_password', $password_new, time()+6000); //Set the cookie header("Location:index.php"); //Redirect to home page } else { include("header.php"); //Print the message include("navigation.php"); echo "<div class=\"content\"><p>Invalid username or password!<p></div>"; include("footer.php"); } } } ?>
  8. Thanks mate, you're a legend.
  9. Oops, I forgot to add the actual code...silly me. <?php mysql_connect("localhost", "Censored", "Censored") or die(mysql_error()); mysql_select_db("runetyco_cms") or die(mysql_error()); $content = $_POST['content']; mysql_query("INSERT INTO cms (content) VALUES('$content' ) ") or die(mysql_error()); $result = mysql_query("SELECT * FROM cms") or die(mysql_error()); while ($row = mysql_fetch_array( $result )) { echo "<br /><br />Post: ".$row['content']; } ?>
  10. Hi, I'm trying to get submit.php (after http://www.ballpointstudio.com/form2.php) to have a counter on each post, that increments each row. How can I do this within the code (or maybe in MySQL )? Thanks =D
  11. What's going on? http://www.ballpointstudio.com/form2.php Fill in the form with anything and hit submit. It should display what you entered, as well as every other row, but...instead, it doesn't. This is my code: <?php mysql_connect("localhost", "CENSORED", "CENSORED") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_select_db("runetyco_cms") or die(mysql_error()); echo "Connected to MySQL<br />"; $content = $_POST['content']; $result = mysql_query("SELECT * FROM cms") or die(mysql_error()); mysql_query("INSERT INTO cms (content) VALUES('$content' ) ") or die(mysql_error()); $row = mysql_fetch_array( $result ); echo "Name: ".$row['content']; ?>
×
×
  • 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.