-1

hello,
I need the coding of only selected users allow the certain pages and they don't have a permission in admin section in php.
Please reply ASAP.

Votes + Comments
unclear
3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by vidjin
0

hello,

I need the coding of only selected users allow the certain pages and they don't have a permission in admin section in php.
Please reply ASAP.

index.php
<?php session_start(); ?><html>
<Head>

<body bgcolor="#000000">
<div class="container">
<center>
<h3 style="color:white;">The internal database webpage</h3>
<div class="heading" align="center" style="position:absolute; background-color:#CCC;height:20px; width:304px; margin-left: 360px; left: 5px; top: 150px;">
<center><b><u><marquee>Login form</marquee></u></b></div>
<form method="post" action="check.php">

<div id="login" style="position: absolute; height:20 0px; width:301px; background-color: #CCC; margin-left: 360px; left: 8px; top: 180px;">
<input type="hidden" name="user_type" id="user_type" />
<table width="265" border="0" height="173">
<tr>
<td width="94" height="53">Username</td>
<td width="196"><input type="text" name="username" id="username" /></td>
</tr>
<tr>
<td height="42">password</td>
<td><input type="password" name="password" id="password" /></td>
</tr>
<tr>
<td style="margin-left:20px;"><img src="checked_out.png" height="38" width="38" /></td>
<td><input type="submit" name="submit" value="login" />
<input type="reset" name="reset" value="reset" /></td>
</tr>
<tr> <td colspan="2" style="font-weight:bold;"><?php

if(isset($_SESSION))
{
echo"Wrong Username and Password";
unset($_SESSION);
}

?>
</td>
</tr>

</table>

</div>

</form>

</body>
</html>


check.php

<?php
session_start();
$username=$_POST;
$password=$_POST;
$user_type=$_POST;

$db=mysql_connect("localhost","root","");
mysql_select_db("sss1",$db);

$qry="Select * from login where username='$username' and password='$password'";

mysql_query($qry);

$q=mysql_affected_rows();
if($q==1)
{
$_SESSION=1;

header("Location:home.php");
}
else
{
$_SESSION=0;
header("Location:index.php");

}


mysql_close($db);

?>

database:sss1
table:login
id username password user_type
1 admin admin super admin
2 a a user
3 b b user
4 c c user

0

I don't know what you need. You say you want code, then you post code, albeit without code tags.

I need the coding of only selected users allow the certain pages and they don't have a permission in admin section in php.

permission in admin section? what does that mean?

0

First you need to set ACCESS Roles in your database and retrieve them upon login, check what roles you've assigned them and redirect the user to the suitable destination.

Block and redirect a user which doesn't have access to a page by storing access info in session variables.

That's how it's done.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.