Jump to content

PHP_Genius1877

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by PHP_Genius1877

  1. I am transferring all my files to my Linux. I am installing Node.js and npm. (It is at 73% right now) I will keep you updated.
  2. How do I do that? Sorry for all the questions @Barand I realize I am being something of a nuisance šŸ˜‚ But, I am new to programming.
  3. So I have the VS Code extension SQLTools, how do I make a MySQL database?
  4. I have VS Code on my Linux system. How do I make a free website? I have the files, but I need a url I.e. https://example.com/ to share with my friends.
  5. Unfortunately, no. I can only create new ones (HTML, CSS, JS) and delete them.
  6. I would just create the darn PHP file, but my code editor wonā€™t let me. There arenā€™t any other good code editors on iOS sadly
  7. Alright. I guess that answers my question. I do have one more. Is there a way to tell the HTML to require a specific password as I have illustrated below? <body> <center> <h1>Login</h1> </center> <form action="" method="GET"> <div class="container"> <label>Username:</label> <input type="text" placeholder="Enter Username" name="username" required> <!-- Require a specific username --> <label>Password:</label> <input type="password" placeholder="Enter Password" name="password" required> <!-- Require a specific password --> <button type="submit">Login</button> <input type="checkbox" checked="checked"> Remember me <button type="button" class="cancelbtn"> Cancel</button> <a href="">Forgot password?</a> </div> </form> </body> </html>
  8. Then how do I ā€œspecifically configure the server otherwiseā€?
  9. How do I get form action to specify when to take the user to the page? After they have logged in with the correct username and password <form action="./index_php.html">
  10. <!DOCTYPE html> <html> <head> <form action="./index_php.html"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Login Page</title> <style> <!-- My CSS here --> </style> </head> <body> <center> <h1>Login</h1> </center> <form action="" method="GET"> <div class="container"> <label>Username:</label> <input type="text" placeholder="Enter Username" name="username" required> <label>Password:</label> <input type="password" placeholder="Enter Password" name="password" required> <button type="submit">Login</button> <input type="checkbox" checked="checked"> Remember me <button type="button" class="cancelbtn"> Cancel</button> <a href="">Forgot password?</a> </div> </form> </body> </html> <?php $password = [ 'robert' => 'password1', 'mike' => 'password2', 'george' => 'password3', 'john' => 'password4' ]; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $pass = @$password [ $_POST['username'] ]; if (!isset($pass)) { echo "Invalid log in<br>"; } else { if ($_POST['password'] == $pass) { echo "Log in successful<br>"; } else { echo "Invalid username or password<br>"; } } } ?> This is my code in the login.html file, what am I doing wrong? I can still log in no matter what username or password I enter.
  11. My iOS (iPad) application only allows .html .css and .js files. Would you recommend any other editors for my platform? I also have a Linux desktop. I could transfer the files there.
  12. Ok so this is the PHP I am using: <?php $password = [ 'john' => 'password1', 'paul' => 'password2', 'george' => 'password3', 'robert' => 'password4' ]; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $pass = @$password [ $_POST['username'] ]; if (!isset($pass)) { echo "Invalid log in<br>"; } else { if ($_POST['password'] == $pass) { echo "Log in successful<br>"; } else { echo "Invalid username or password<br>"; } } } ?> And this is the HTML for the login form: <body> <center> <h1>Login</h1> </center> <form action="" method="POST"> <div class="container"> <label>Username:</label> <input type="text" placeholder="Enter Username" name="username" required> <label>Password:</label> <input type="password" placeholder="Enter Password" name="password" required> <button type="submit">Login</button> <input type="checkbox" checked="checked"> Remember me <button type="button" class="cancelbtn"> Cancel</button> <a href="">Forgot password?</a> </div> </form> </body> </html> I only have one problem. The PHP is showing up as text on the login page even though I put the <?php tagsā€¦ Any thoughts?
  13. Thank you for your reply! My application only allows .html .css and .js files. However I can write PHP in the HTML files. I was thinking the code would look something along the lines of this: <?php $user = 'admin'; $password = 'test'; if ($_POST['username'] == $user && $_POST['password'] == $password) { echo 'successfully logged in'; } else { echo 'you have entered the wrong username or password.'; } But, I am a beginner to PHP so it doesnā€™t work yet šŸ¤£
  14. Hello everyone! I am a new user and I have a simple question. How do I set a password for a user to log in to my site with PHP? I have no MySQL database just a iOS code/host app. I know this isnā€™t secure but only me and my friends are on the site. Any help is appreciated.
×
×
  • 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.