PDA

View Full Version : login page timeout



jabie5
04-27-2008, 09:22 PM
hi guy's , hope i can explain what i need.

on my website i have a login section which takes them to a members area, now is it possible for it to timeout if it is idle for 5 mins or they leave the area. then they would have to log back in. i searched the forum but could not really find an answer.

thanks johnny

Watdaflip
04-27-2008, 11:03 PM
What type of login are you using. A script login, or a password protected directory?

jabie5
04-28-2008, 02:25 PM
im using a php script supplied by someone from the forum

Watdaflip
04-29-2008, 01:07 AM
Post the code of the php script that processes the login. (the action of the login form). Also post the code you add to pages that are protected. I will add the couple lines of code to modify it so it times out after 5 minutes.

jabie5
04-30-2008, 12:31 PM
i dont have any code on my pages. i have created a site within a site. so when someone goes to my site and logs in the get to another site within my site , if that makes sense. it takes alot of time to build like that, if you can suggest an easier way ( like the what you wrote "code you add to pages that are protected" i will gladly try it

thanks johnny




here is the code i use

<?php
// Receiving variables
@$name = addslashes($_POST['name']);
@$email_address = addslashes($_POST['email_address']);
@$browse_Name = $_FILES['browse']['name'];
@$browse_Size = $_FILES['browse']['size'];
@$browse_Temp = $_FILES['browse']['tmp_name'];
@$browse_Mime_Type = $_FILES['browse']['type'];
function RecursiveMkdir($path)
{
if (!file_exists($path))
{
RecursiveMkdir(dirname($path));
mkdir($path, 0777);
}
}
// Validation
if( $browse_Size == 0)
{
header("Location: errorpage.html");
exit;
}
if( $browse_Size >50000000)
{
//delete file
unlink($browse_Temp);
header("Location: errorpage.html");
exit;
}
$uploadFile = "upload/".$browse_Name ;
if (!is_dir(dirname($uploadFile)))
{
@RecursiveMkdir(dirname($uploadFile));
}
else
{
@chmod(dirname($uploadFile), 0777);
}
@move_uploaded_file( $browse_Temp , $uploadFile);
chmod($uploadFile, 0644);
$browse_URL = "http://www.xxxxxxxx.co.uk/upload/".$browse_Name ;
//Sending Email to form owner
$pfw_header = "From: $email_address\n"
. "Reply-To: $email_address\n";
$pfw_subject = "A New File Has been Uploaded !";
$pfw_email_to = "xxxxx@xxxxx.co.uk";
$pfw_message = "Name: $name\n"
. "Email_address: $email_address\n"
. "File Link: $browse_URL\n"
. "\n";
*****($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
header("Location: thankyou_page.html");
?>






Please do the following:
1. The button , for which you have chosen type button simply "button", must be turned into a "submit" button. it's not important that you have named it "Upload now". The name can remain, but it must be a submit button.
2. You have created an "upload" folder. That's ok, the files will be uploaded there. BUT the form page, as well as this script that i'm sending you, must be published in "public_html", not in "public_html/upload"
3. The "action" fiels of your form must be set to "upload.php", This is how it invokes the script.
4. Please note that if the filenames are one word filenames, then the link that you receive in your email will be correct, and you will be able to open the file in IE by simply clicking on the link. If the file name has blanks in it, then the filename on the server is correct, but the link in the email only arrives to the blank space. In this case you should copy all the link and paste it in your browser to open the link. Of course, in all cases, you can also download the file using FTP
5. To work, the script needs your email address in your Vodahost account, not an external one. So, open the script in Notepad. Change the email address to be your email address on your Vodahost account. Go to Save As. Choose File Type "All Files". Save it as "upload.php". Upload it on your server, in your public_html directory.
Test the form and let me know.
I also sent the same message in your email
__________________

Watdaflip
04-30-2008, 07:46 PM
This code doesn't having anything to do with the login, its a script that uploads a file and emails you the location of the file on your site.

By site in site do you mean something like

http://yoursite.com/another_directory

Or you are using an iframe to include files onto the page you login to that is part of different sections of your site? (if this is the case its not a secure login system)

jabie5
04-30-2008, 08:38 PM
sorry about that i copied the wrong text file here it is

<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><script language="javascript" type="text/javascript">
var userFolder = "";
var HTMLextention = ".htm";
var inProgressMSG = "Attempting login...";
var userFailMSG = "Invalid username or password";
function login(){
var username= document.getElementById('username').value;
var password= document.getElementById('password').value;
username= username.toLowerCase();
password= password.toLowerCase();
var fullURL= "";
fullURL= userFolder + username + "~" + password + HTMLextention;
setTimeout("failEvents();", 15000);
document.getElementById('errorDisplay').value = inProgressMSG;
showMSG();
setTimeout("showMSG();", 5000);
verifWin.document.open();
verifWin.document.location.href = fullURL;
verifWin.document.close();
}
function passEvents(data){
var URL = data;
location.href=URL;
}
function failEvents(){
document.getElementById('errorDisplay').value = userFailMSG;
showMSG();
}
function showMSG() {
if ((document.getElementById("isShown_errorConsole").value)=="N") {
document.getElementById("errorConsole").style.display='';
document.getElementById("isShown_errorConsole").value="Y";}
else if ((document.getElementById("isShown_errorConsole").value)=="Y") {
document.getElementById("errorConsole").style.display='none';
document.getElementById("isShown_errorConsole").value="N";}
}
</script>
<table width="100" border="0" align="center" cellpadding="1" cellspacing="5" bordercolor="#FFFFFF" bgcolor="#9FB8FF">
<tr>
<td bgcolor="#9FB8FF" align="center"><b><font size="4" color="#FFFFFF">Authorization Required</font></b></td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><form action="javascript:login();" method="get" name="LoginScript" id="LoginScript">
<table border="0" cellspacing="10" cellpadding="0" width="60">
<tr>
<td> Username</td>
<td align="right"> <div align="center">
<input name="username" id="username" type="text" style="border:1px solid #828177;" value="" />
</div></td>
</tr>
<tr>
<td> Password</td>
<td align="right"> <div align="center">
<input name="password" id="password" type="password" style="border:1px solid #828177;" value="" />
</div></td>
</tr>
<tr>
<td><iframe name="verifWin" src="" width="1" height="1" frameborder="0" border="0"></iframe></td>
<td align="right"><div align="center">
<input name="submit" type="submit" style="border:1px solid #9FB8FF;color:#FFFFFF;background-color:#9FB8FF;" value="Login" />
</div></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><input type="hidden" id="isShown_errorConsole" value="Y" />
<span id="errorConsole" style="display:;">
<input type="button" id="errorDisplay" style="width:100%;background-color:#FFFFFF;border:0px;" value="Error: Please enable Javascript" />
</span><script language="javascript" type="text/javascript">showMSG();</script></td>
</table>


a site within a site i meant:: i have my main site which has restricted parts after they log in they gain access to the to the members site which is a folder within the first site .thats the only way i could think of doing it. technically the folder contains a copy of the site but with extra pages. i do hope that makes sense lol

but if you can help me put a bit of code on each members page or direct me in the right direction i would be grate full

thanks johnny