TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Krishan Sahani
NA
33
8.4k
admin and user login issue both are access admin page
Jun 1 2017 2:50 AM
This is my Table structure
CREATE TABLE `user_table` (
`id` int(11) NOT NULL,
`username` varchar(50) DEFAULT NULL,
`email` varchar(50) DEFAULT NULL,
`password` varchar(50) DEFAULT NULL,
`type` varchar(50) DEFAULT NULL,
`status` varchar(50) DEFAULT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `user_table`
--
INSERT INTO `user_table` (`id`, `username`, `email`, `password`, `type`, `status`, `date`) VALUES
(11, 'krishan', '
[email protected]
', '1234', '1', '0', '2017-05-30 10:36:07'),
(14, 'krishan sahani', '
[email protected]
', '12345', '2', '0', '2017-05-31 07:16:08');
and this is my login code....thanks in advance..
session_start();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require('dtb.php');
if(isset($_POST['submit'] )) {
$username = $_POST['username'];
$password =$_POST['password'];
$result = mysqli_query($con,"SELECT username FROM user_table WHERE username = '$username' AND password = '$password' AND type='1'");
if(mysqli_num_rows($result) ==1) {
header("Location: dash.php");
exit;
}
$result = mysqli_query($con,"SELECT username FROM user_table WHERE username = '$username' AND password = '$password'");
if(mysqli_num_rows($result)==1) {
$_SESSION['username'] = $username;
header("Location: profile.php");
exit;
}
else {
?>
<h1 style="color:darkred;margin-left:30px;">Wrong Username and Password </h1>
<?php
}
}
?>
<html>
<h1>Log In</h1>
<head>
<link rel="stylesheet" type="text/css" href="style1.css">
</head>
<form action="" method="post">
<input type="text" name="username" placeholder="Username" required />
<input type="password" name="password" placeholder="Password" required />
<input name="submit" type="submit" value="Login" />
</form>
<p>Not registered yet? <a href='register1.php'>Register Here</a></p>
</html>
Reply
Answers (
2
)
i have array and i wants to take perfornics report creation
how make multidimnional array in single array