Website URL
Error Message
(showing white nil page)
Other Information
(my website is not working, just showing white page)
(showing white nil page)
(my website is not working, just showing white page)
after login not working
Saying
is not helpful at all
You need to learn to debug your code
Hi indertiwana,
Post your code content from file login_process.php
for us to take a look for you. Thanks.
Cheers!
Hi indertiwana,
Please format your code when pasting here, as it’s not possible to interpret the line number as the same as the one shown in the error message.
<?php
session_start();
require_once 'dbconfiglogin.php';
if (isset($_POST['btn-login'])) {
//$user_name = $_POST['user_name'];
$user_email = trim($_POST['user_email']);
$user_password = trim($_POST['password']);
$password = md5($user_password);
try {
$stmt = $db_con->prepare("SELECT * FROM user_data WHERE email=:email");
$stmt->execute(array(":email" => $user_email));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$count = $stmt->rowCount();
if ($row['password'] == $password) {
echo "ok";
// log in $_SESSION['user_session'] = $row['email'];
} else {
echo "Email or password does not exist.";
// wrong details
}
} catch (PDOException $e) {
echo $e->getMessage();
}
}
The error should be regarding the line:
if ($row['password'] == $password) {
The value for the password in $row simply isn’t there, could be either there is no such column, or there are no rows returned. Check if you have the column in your database, or is there are any records. When nothing is returned, $row stores null.
Some improvement suggestions:
Cheers!
<?php include'dbconfig1.php';
?>
<?php
session_start();
$email= mysql_real_escape_string($_POST['email']);
$res=mysql_query("SELECT * FROM user_data WHERE email='$email'");
$row=mysql_fetch_array($res);
if(isset($_POST['btn-submit']))
{
$query="select * from user_data where email='$email'";
$result=mysql_query($query) or die(mysql_error());
if(mysql_num_rows($result))
{
$_SESSION['email'] = $row['email'];
header("Location: getemailid.php");
}
else
{
?>
<script>alert("No user exist with this email id");</script>
<?php }
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Forget Password</title>
<link rel="icon" href="images/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="css/adminlte.min.css">
<!-- Google Font: Source Sans Pro -->
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
<link href="css/login_style.css" rel="stylesheet">
<style>
body, html {
height: 100%;
margin: 0;
background-image: url(images/material-design-1080p-wallpaper_1.jpg);
width:100%;
background-repeat:no-repeat;/*we want to have one single image not a repeated one*/
background-size:cover;/*this sets the image to fullscreen covering the whole screen*/
background-attachment: fixed;
}
hr
{
background-color: #fff;
}
.bgimg {
height: 100%;
background-size: cover;
color: white;
font-size: 24px;
}
.topleft {
position: absolute;
top: 10px;
left: 16px;
}
.bottomleft {
position: absolute;
bottom: 0;
left: 16px;
}
.middle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
hr {
margin: auto;
width: 30%;
}
.center-block {
display: block;
margin-right: auto;
margin-left: auto;
width: 100%;
max-width: 300px;
height: auto;
margin-bottom:10px;
}
.form-group:focus {
border-color: inherit;
-webkit-box-shadow: none;
box-shadow: none;
outline: none;
}
::placeholder
{
color: peachpuff;
text-align: center;
font-size: 20px;
font-family: "open sans";
}
input[type='email']{
font-size: 18px;
width: 100%;
height: 30px;
}
::-webkit-scrollbar {
width: 01px;
height: 01px;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 01px rgba(0,0,0,0.5);
border-radius:01px;
-webkit-border-radius: 01px;
}
::-webkit-scrollbar-thumb {
background-color: #0c85d0;
outline: 01px solid slategrey;
-webkit-box-shadow: inset 0 0 1px rgba(0,0,0,0.5);
border-radius:01px;
-webkit-border-radius: 1px;
}
</style>
<body>
<div class="bgimg">
<div class="topleft">
<a href="index.php"><img src="images/logo (1).png" class="center-block img-rounded" ></a>
</div>
<div class="middle">
<h1>Forget Password</h1>
<hr>
<br>
<form class="form-group" name="getemail" method="post" >
<input type="email" autocomplete="off" autofocus class="form-group form-group-lg rounded-0" name="email" id="email" required="" style="background-color: transparent; border: 0; border-bottom:solid 1px #fff; color: #fff; outline: none;" placeholder="Enter Your Email">
<button class=" btn btn-primary" type="submit" name="btn-submit">
Next <i class="fa fa-angle-double-right"></i>
</button>
</form>
</div>
</div>
</body>
</html>
Please provide more information.
Just showing white blank page. Please help.
Hi indertiwana,
Your code corresponds to an older version of PHP, which is no longer supported here, you need to update the code according to PHP 8.2 standards. Specificially, the mysql_* functions to mysqli_* functions.
(notice the crossline)
An example is as follows:
<?php
include'dbconfig1.php';
session_start();
$mysql = new mysqli('hostname', 'username', 'password', 'database', 3306);
$email = mysqli_real_escape_string($mysql, $_POST['email']);
$res = mysqli_query($mysql, "SELECT * FROM user_data WHERE email='$email'");
$row = mysqli_fetch_array($res);
if(isset($_POST['btn-submit']))
{
$query = "select * from user_data where email='$email'";
$result = mysqli_query($mysql, $query) or die(mysqli_error($mysql));
if(mysqli_num_rows($result)){
$_SESSION['email'] = $row['email'];
header("Location: getemailid.php");
}else{
?>
<script>alert("No user exist with this email id");</script>
<?php }
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Forget Password</title>
<link rel="icon" href="images/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="css/adminlte.min.css">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
<link href="css/login_style.css" rel="stylesheet">
<style>
body, html{height:100%;margin:0;background-image:url(images/material-design-1080p-wallpaper_1.jpg);width:100%;background-repeat:no-repeat;background-size:cover;background-attachment:fixed;}
hr{background-color:#fff;}
.bgimg{height:100%;background-size:cover;color:white;font-size:24px;}
.topleft{position:absolute;top:10px;left:16px;}
.bottomleft{position:absolute;bottom:0;left:16px;}
.middle{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);text-align:center;}
hr{margin:auto;width:30%;}
.center-block{display:block;margin-right:auto;margin-left:auto;width:100%;max-width:300px;height:auto; margin-bottom:10px;}
.form-group:focus{border-color:inherit;-webkit-box-shadow:none;box-shadow:none;outline:none;}
::placeholder{color:peachpuff;text-align:center;font-size:20px;font-family:"open sans";}
input[type='email']{font-size:18px;width:100%;height:30px;}
::-webkit-scrollbar{width:01px;height:01px;}
::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 01px rgba(0,0,0,0.5);border-radius:01px;-webkit-border-radius:01px;}
::-webkit-scrollbar-thumb{background-color:#0c85d0;outline:01px solid slategrey;-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0.5);border-radius:01px;-webkit-border-radius:1px;}
</style>
<body>
<div class="bgimg">
<div class="topleft">
<a href="index.php"><img src="images/logo (1).png" class="center-block img-rounded" ></a>
</div>
<div class="middle">
<h1>Forget Password</h1>
<hr>
<br>
<form class="form-group" name="getemail" method="post" >
<input type="email" autocomplete="off" autofocus class="form-group form-group-lg rounded-0" name="email" id="email" required="" style="background-color: transparent; border: 0; border-bottom:solid 1px #fff; color: #fff; outline: none;" placeholder="Enter Your Email">
<button class=" btn btn-primary" type="submit" name="btn-submit">
Next <i class="fa fa-angle-double-right"></i>
</button>
</form>
</div>
</div>
</body>
</html>
Cheers!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.