Click to See Complete Forum and Search --> : script


Tony Hansen
02-10-2005, 05:18 AM
Hollo
Can anyone help me ??

I need a script so that when a user logged in on one of my pages, he canīt log in again for 24 hours.

zingmatter
02-10-2005, 06:40 AM
The best option is to record when he logs in in a sessions table(assuming he has to sign in) and (if you're using ASP), if he tries to log in again then check the sessions table for his user id. If it there then just do

if (datediff("H", hour(Time), hour(previous_log_in_time)) < 24 then
'//reject user logon
else
'//allow logon
end if


You could set a cookie - though it's pretty easy to get round or even save the ip address if they don't actually have to log in. Also not perfect.

Hope this helps

Tony Hansen
02-10-2005, 01:13 PM
I donīt use ASP. Iīm new at this, trying to learn..
I use this script:

<center><form name=login>
<table border=1 cellpadding=3>

<!-- Original: Dion -->
<!-- Web Site: http://www.iinet.net.au/~biab/ -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->


<tr><td colspan=2 align=center><font size="+2"><b>Endast medlemmar!</b></font></td></tr>
<tr><td>Username:</td><td><select name=memlist>
<option value='x'>
<option value='Medlem|58726|OFLNHNGI'>Medlem
<option value='Admin|37111|NIDMHODF'>Admin
</select></td></tr>
<tr><td>Password:</td><td><input type=password size=10 maxlength=8 name=pass></td></tr>
<tr><td colspan=2 align=center><input type=button value="Login" onclick="check(this.form)"></td>
</tr>
</table>
</form>
&nbsp;