What's new

PHP Bakit kaya ayaw mag log in? [Solve]

Status
Not open for further replies.

ribbit

Established
good afternoon mga ka phcorner. na format po kasi pc ko dahil nasira yung os po, ngayon na buckup ko naman po yung database at mismong code pero ngayon po ayaw pumasok sa log in.

eto yung error ko :
1653033256319.png


eto po yung code ko sa log in called login_run.php
PHP:
<?php

require('connection.php');

if (isset($_POST['submit'])) {
    $usern = $_POST['usern'];
    $passw = $_POST['passw'];
  
    $query = "SELECT * FROM users WHERE usern='$usern' AND passw='".md5($passw)."' AND verify_status=1 ";
    $result = mysqli_query($con, $query);
    $row = mysqli_fetch_array($result);

    if (mysqli_num_rows($result) > 0 ) {
        $_SESSION["usern"] = $usern;
        session_start();


        $user_type = strtoupper($row['user_type']);
        switch ($user_type) {
            case 'ADMIN':
                header("Location: admin/index.php");
                /* echo $user_type ; */
                break;

            default:
                header("Location: index.php");
                /* echo $user_type ; */
        }
        $_SESSION["usern"] = $usern;
    } else {
        var_dump($usern);
        var_dump($passw);
        echo "<h2>You enetr the worng Username/Passowrd or The account is not been authenticated.</h2>";
        echo nl2br("<h3><a href='login.php'>Click here</a> to go back to Log-in page.</h3");
    }
} else {
    echo "your a beast";
}

eto din po yung database ko called obs:
1653033632931.png


gumamit din pala ako nang .md5 pang encrypt nang password po. salamat
 

Attachments

Status
Not open for further replies.
Top