Phpdasar.php - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of Phpdasar.php.php

  1. <?php
  2.     if{ isset($_POST["login"]) } {
  3.  
  4.           $username = $_POST["username"];
  5.           $userneme = $_POST["password"];
  6.      
  7.           $result = mysqli_query($conn, "SELECT * FORM user HERE username = '$username'");
  8.  
  9.        //cek username
  10.       if ( mysqli_numr_row($result) === 1) {
  11.  
  12.        //cek passwor
  13.         $row = mysqli_fetch_assoc($result);
  14.        if ( password_verify($password, $row["password"]) } {
  15.              header("Location: Ucrp.html");
  16.                exit;
  17.          
  18.             }
  19.  
  20.         }
  21.  
  22.         $error = true;
  23.  
  24.  
  25. }
  26.  
  27. ?>
  28.  
  29. <!DOCTYPE html>
  30. <html>
  31. <head>
  32.     <title> Log-in_Sign-Up </title>
  33.    <link rel="stylesheet" href="Userlogin.css"
  34.   </head>
  35. <body>
  36.   <?php if( isset($error) ) : ?>
  37.     <p> style="color: red;  font-style: italic;">username / password salah</p>
  38.  
  39.        <form action="" method="post">
  40.       
  41.                <label for="Username">Username:</label>
  42.                <input type="text"   name="Username" id="Username"</input>
  43.                       <br>
  44.                <label for="Password">Password:</label>
  45.                <input type="Password" id="Password"</input>
  46.           <button type="submit">Log-In</button>
  47.        </form>
  48.    <a>Belum Mempunyai Akun?<a href="regis.php"> Sign-Up<a> Disini</a>
  49.            
  50.     
  51. </body>
  52. </html>     
  53.            
  54.  
File Description
  • Phpdasar.php
  • PHP Code
  • 02 Apr-2021
  • 1.26 Kb
You can Share it: