...

View Full Version : Loading a function automatically...



redlorry920
05-03-2004, 07:51 PM
I currently have a .php file which receives two variables uname/pass from a link. What I want is for the user to be automatically logged on to their hosting account once this window appears.

Currently the username/password populates the user/pass text boxes and the operator presses the submit button to login. I want to bypass this so that the user does not ahve press the button. i.e. when the window loads, they are logged straight in.

Hope this makes sense, I am new to JavaScript! Here's the code:

<HTML><HEAD><TITLE>Extra Services</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<link href="../index_files/main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
</style>
<script type="text/javascript">
function set_target() {
var username, password;
username = document.forms.login_form.user.value;
password = document.forms.login_form.pass.value;
document.forms.login_form.action = 'https://' + '64.91.230.245' + ':2083' + '/login';
}
</script>
</HEAD>
<BODY>
<form name="login_form" method="post" onsubmit="set_target();">
<table align="center">
<tr>
<td>
<span class="login_text">Username:</span>
</td>
<td>
<input name="user" class="input" type="text" value="<?php
print $uname;
?>" style="width:125;height:18" />
</td>
</tr>
<tr>
<td>
<span class="login_text">Password:</span>
</td>
<td>
<input name="pass" class="input" type="password" value="<?php
print $pass;
?>" style="width:125;height:18" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input class="input" type="submit" value="Login" style="width:200;height:18" onmouseout="blur(this);" />
</td>
</tr>
</table>
</form>
</BODY>

dswimboy
05-03-2004, 10:33 PM
first of all, you should never display login info in a URL. this is not secure. second of all, if the user is just clicking submit, why do they have to visit the page at all?

what do you know about cookies?

Kylena
05-04-2004, 08:28 AM
I currently have a .php file which receives two variables uname/pass from a link. What I want is for the user to be automatically logged on to their hosting account once this window appears.

Currently the username/password populates the user/pass text boxes and the operator presses the submit button to login. I want to bypass this so that the user does not ahve press the button. i.e. when the window loads, they are logged straight in.


As you're using php, this forum's also using php. Maybe a cookie would be a better option then having to display the number of characters in a password that the user is using. This makes it even easier for a would-be hacker who had just happened to pass by. It could be worse if the PC is shared and the user is logged in but forgot to log out & other security problems.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum