Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Loading a function automatically...

    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>

  • #2
    Regular Coder dswimboy's Avatar
    Join Date
    Nov 2003
    Location
    mostly in Ann Arbor
    Posts
    458
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?
    "There is more than one way to do it."

  • #3
    New Coder
    Join Date
    Aug 2003
    Location
    Singapore
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by redlorry920
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •