is there any JAVASCRIPT thru the text fields like USERNAME ans Password can be saved is Remember Me is Checked..
is there any JAVASCRIPT thru the text fields like USERNAME ans Password can be saved is Remember Me is Checked..
I think that it would be easier to do in PHP considering that not all browsers, and people support javascript.
Jeremy | jfein.net
hmm tell me how to do it in both ways..
I could tell you how to do it in PHP.
I can also make an example for you if you please.
Jeremy | jfein.net
yeah sure please.. go ahead..
Ok, here it is. I spent around 10 minutes on this simple code(See example below):
In some of the cookie values you'll see some random stuff, its for the security.PHP Code:<?php
if(isset($_POST['submit'])){
if(!empty($_POST[username]) || !empty($_POST[password])){
if($_POST[jeef8ih]){
setcookie('ee13ee', $_POST[username], 60 * 60 * 24 * 60 + time());
}
if($_POST[opppkld]){
setcookie('aa765d', $_POST[password], 60 * 60 * 24 * 60 + time());
}
} else {
}
header('Location: '.$_SERVER[PHP_SELF]);
}
$textInput[1] = (($_COOKIE[ee13ee] == true) ? '<input type="text" name="username" value="'.$_COOKIE[ee13ee].'" />' : '<input type="text" name="username" />');
$textInput[2] = (($_COOKIE[aa765d] == true) ? '<input type="password" name="password" value="'.$_COOKIE[aa765d].'" />' : '<input type="password" name="password" />');
$form = <<< FORM
<form action="$_SERVER[PHP_SELF]" method="post">
<div style="padding:10px;background:lightyellow;border:1px solid gray;">
<span>Username: $textInput[1]<input type="checkbox" name="jeef8ih" />Remember?</span><br />
<span>Password: $textInput[2]<input type="checkbox" name="opppkld" />Remember?</span><br />
<input type="submit" name="submit" value="Login!" />
<b style="color:red;">Note: This is not a real login, it will just remember your details. It will remember your details for two months.</b>
FORM;
echo $form;
?>
Please note that this is not an actual login script, but just a script to remember login details(can be used with text boxes, and more)
If you need me to explain this I will.
Example: http://niler.net/examples/rememberMe.php
Last edited by Nile; 05-30-2008 at 03:14 AM. Reason: example
Jeremy | jfein.net
how about saving both with one Required check? and Forget Me Button and can i put my own customised text fields in them?
Ok, what about this? Example Below.
http://niler.net/examples/rememberMe[2].phpPHP Code:<?php
if(isset($_POST['submit'])){
if(!empty($_POST[username]) || !empty($_POST[password])){
if($_POST[jeef8ih]){
setcookie('ee13ee', $_POST[username], 60 * 60 * 24 * 60 + time());
setcookie('aa765d', $_POST[password], 60 * 60 * 24 * 60 + time());
}
} else {
}
header('Location: '.$_SERVER[PHP_SELF]);
}
if(isset($_POST['forget'])){
setcookie('ee13ee', "", 60 * 60 * 24 * 60 + time());
setcookie('aa765d', "", 60 * 60 * 24 * 60 + time());
header('Location: '.$_SERVER[PHP_SELF]);
}
$textInput[1] = (($_COOKIE[ee13ee] == true) ? '<input type="text" name="username" value="'.$_COOKIE[ee13ee].'" />' : '<input type="text" name="username" />');
$textInput[2] = (($_COOKIE[aa765d] == true) ? '<input type="password" name="password" value="'.$_COOKIE[aa765d].'" />' : '<input type="password" name="password" />');
$form = <<< FORM
<form action="$_SERVER[PHP_SELF]" method="post">
<div style="padding:10px;background:lightyellow;border:1px solid gray;">
<span>Username: $textInput[1]</span><br />
<span>Password: $textInput[2]</span>
<input type="checkbox" name="jeef8ih" />Remember?<br /><input type="submit" name="submit" value="Login!" /><input type="submit" name="forget" value="Forget Me" />
<b style="color:red;"><br />Note: This is not a real login, it will just remember your details. It will remember your details for two months. You can also overwrite it.</b>
FORM;
echo $form;
?>
If you gimme your login code I can plug this one in for you.
Jeremy | jfein.net
here is my HTML code i don't think so it can be fixed in Php..
Code:<center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="100%"> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="259" height="5"> <tr> <td width="259" bgcolor="#EBF3F9" height="170"> <form method="POST" action="go.php" name="login"> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="240"> <tr> <td width="100%"><b> <font face="Arial" size="2" color="#3D3643"><br> Username</font></b></td> </tr> <tr> <td width="100%"> <input type="text" name="username" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5"></td> </tr> <tr> <td width="100%"> </td> </tr> <tr> <td width="100%"><b> <font face="Arial" size="2" color="#3D3643">Password</font></b></td> </tr> <tr> <td width="100%"> <input type="password" name="password" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5"></td> </tr> <tr> <td width="100%"> </td> </tr> <tr> <td width="100%"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="230"> <tr> <td width="50%"> <p align="left"> <label><input type="checkbox" name="C1" value="ON"><font size="1" face="Verdana">Remember Me<br> <a href="forget">Forget Me</a></font></label></td> <td width="50%"> <p align="right"> <input type="submit" value="Log In" style="font-size: 12pt; color: #000000; border: 1px solid #006699; padding-top: 2; padding-bottom: 5; background-color: #C1DAEC"></td> </tr> </table> </td> </tr> </table> </center> </div> <input type="hidden" name="action" value="dologin"> </form> <br></td> </tr> </table> </center> </div> </td> </tr> </table>
Ok, go.php:
On the page you shows me:PHP Code:<?php
if(isset($_POST['submit'])){
if(!empty($_POST[username]) || !empty($_POST[password])){
if($_POST[jeef8ih]){
setcookie('ee13ee', $_POST[username], 60 * 60 * 24 * 60 + time());
setcookie('aa765d', $_POST[password], 60 * 60 * 24 * 60 + time());
}
} else {
}
}
if(isset($_POST['forget'])){
setcookie('ee13ee', "", 60 * 60 * 24 * 60 + time());
setcookie('aa765d', "", 60 * 60 * 24 * 60 + time());
//your code goes here
}
See if that works. Although I think it will, tell me.Code:<?php $textInput[1] = (($_COOKIE[ee13ee] == true) ? '<input type="text" name="username" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5" value="'.$_COOKIE[ee13ee].'">' : '<input type="text" name="username" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5" />'); $textInput[2] = (($_COOKIE[aa765d] == true) ? '<input type="password" name="password" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5" value="'.$_COOKIE[aa765d].'">' : '<input type="password" name="password" size="22" style="font-size: 20; padding-top: 2; padding-bottom: 5">'); $form = <<< FORM <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"> <tr> <td width="100%"> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="259" height="5"> <tr> <td width="259" bgcolor="#EBF3F9" height="170"> <form method="POST" action="go.php" name="login"> <div align="center"> <center> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="240"> <tr> <td width="100%"><b> <font face="Arial" size="2" color="#3D3643"><br> Username</font></b></td> </tr> <tr> <td width="100%"> $textInput[1]</td> </tr> <tr> <td width="100%"> </td> </tr> <tr> <td width="100%"><b> <font face="Arial" size="2" color="#3D3643">Password</font></b></td> </tr> <tr> <td width="100%"> $textInput[2]</td> </tr> <tr> <td width="100%"> </td> </tr> <tr> <td width="100%"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="230"> <tr> <td width="50%"> <p align="left"> <label><input type="checkbox" name="jeef8ih" /><font size="1" face="Verdana">Remember Me?</font><br /><input type="submit" name="forget" value="Forget Me" /> <a href="forget">Forget Me</a></font></label></td> <td width="50%"> <p align="right"> <input type="submit" name="submit" value="Login!" /></td> </tr> </table> </td> </tr> </table> </center> </div> <input type="hidden" name="action" value="dologin"> </form> <br></td> </tr> </table> </center> </div> </td> </tr> </table> FORM; echo $form; ?>
Jeremy | jfein.net
Bookmarks