Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Can anyone help me on how to filter login and turn off autofill?
Old 03-03-2011, 11:23 PM Can anyone help me on how to filter login and turn off autofill?
drkeni9ma's Avatar
Skilled Talker

Posts: 66
Name: Anakin Skywalker
Trades: 0
Here's my PHP code:
Quote:
<?php
include("../connect.php");
ob_start();
if($_POST["mode"]=="admin")
{
admin_login();
}
else if($_GET["mode"]=="logout")
{
admin_logout();
}
else
{
main();
}
function admin_logout()
{
session_unset();
session_destroy();
$GLOBALS["msg"]="You are logged out";
main();
exit;
}
function main()
{
?>
<script src="config/jquery-latest.js"></script>
<script type="text/javascript" src="config/jquery.validate.js"></script>
<style type="text/css">
label.error { float: none; color: red; padding-left: .5em; vertical-align: top; }
</style>
<script>
$(document).ready(function(){
$("#form1").validate();
});
</script>
<table width="475" border="0" align="center" cellpadding="0" cellspacing="0" style="border:thin solid #000000;">
<tr>
<td align="center" style="border-bottom:thin solid #000000;"><h2>Welcome To Admin Panel</h2></td>
</tr>
<tr>
<td width="475">
<form id="form1" name="form1" id="form1" class="cmxform" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="mode" value="admin">
<table width="334" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td>&nbsp;</td>
<td><b><?php if(isset($GLOBALS["msg"])) { echo $GLOBALS["msg"]; }?></b></td>
</tr>


<form method="post" action="http://localhost/admin/admin.php">
<tr>
<td><b>Account Type:</td> <td><select name="accttype"></b>
<option value="1">Admin</option>
<option value="2">Team Manager</option>
<option value="3">Human Resources</option>
<option value="4">Employee</option> </td>
</select>
</tr>

</form>
<tr>
<td><b>User Name: </b></td>
<td>
<input type="text" name="username" class="required" />
</td>
</tr>
<tr>
<td><b>Password:</b></td>
<td>
<input type="password" name="password" class="required" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" name="login" value="login"/>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php
}
function admin_login()
{
$sql="select * from admin where username='".$_POST[username]."' and password='".$_POST[password]."'";

$query=mysql_query($sql);
$row=mysql_fetch_array($query);
$num=mysql_num_rows($query);
if($num==1)
{
$_SESSION["user_id"]=$row["username"];
header("location:admin.php");
exit;
}
else
if($num==2)
{
$_SESSION["user_id"]=$row["username"];
header("location:TM.php");
exit;
}
else
{
$GLOBALS["msg"]="<font color=red>Wrong Username or Password</font>";
main();
exit;
}
}
ob_end_flush();
?>
Question:
1) Why does the autofill from Username and Password doesn't turn off even if I turn it off on the browser?

2)How do I filter login? (example: when logged choosing the Team Managers from drop down menu, it will go to a certain page)
__________________
No. Leave them to me. I will deal with them myself. You don't know the power of the dark side!
drkeni9ma is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-04-2011, 07:24 AM Re: Can anyone help me on how to filter login and turn off autofill?
Skilled Talker

Posts: 54
Trades: 0
For turning off autofill feature of the textbox , set the autocomplete property of the textbox to False or NO.
For filtering user login, what you are trying to do means that you have only two team managers who have the same username and password which I dont think is the case.so what you can do is to create a pagename field in your users table and depending on the category of the user you are registering or creating save the name of the page you want the user to be redirected to when the user logs in. so after registering the user and the user logs in using the username and the password you retrieve the corresponding redirecting page name from the users table and then pass the page name to the header() function.hope it helps
kani alavi is offline
Reply With Quote
View Public Profile
 
Old 03-04-2011, 08:37 PM Re: Can anyone help me on how to filter login and turn off autofill?
drkeni9ma's Avatar
Skilled Talker

Posts: 66
Name: Anakin Skywalker
Trades: 0
seems that I can't find the text box property. Is it on the java script? co'z I've just downloaded the java script from the net.

Filtering user login: Is it possible to filter user_id ? I mean if user_id(1) logs in, he/she will be redirected to webpage(A). Then when user_id(2) logs in, he/she will be redirected to webpage(B). Is it possible in PHP? how?
__________________
No. Leave them to me. I will deal with them myself. You don't know the power of the dark side!
drkeni9ma is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Can anyone help me on how to filter login and turn off autofill?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.14179 seconds with 12 queries