Jump to content

Login form , need help


Infern0

Recommended Posts

Hello, guys i hope you will help me with this cause i'm a complete newbie.

First 2 words about the goal :

I want to make a PHP script to autologin in one webpage and to get statistics in every 2 minutes. The account is mine so i dont want to scam or anything , just want to automate it cause this info i need in realtime, and refreshed often.

The page login page code looks like this :

 

<dl>
                    <dt>Username:</dt>
                    <dd><input type="text" name="user" size="20" value="" class="input_text" /></dd>
                    <dt>Password:</dt>
                    <dd><input type="password" name="passwrd" value="" size="20" class="input_password" /></dd>
                </dl>
                <dl>
                    <dt>Minutes to stay logged in:</dt>

                    <dd><input type="text" name="cookielength" size="4" maxlength="4" value="60" class="input_text" /></dd>
                    <dt>Always stay logged in:</dt>
                    <dd><input type="checkbox" name="cookieneverexp" class="input_check" onclick="this.form.cookielength.disabled = this.checked;" /></dd>
                </dl>
                <p><input type="submit" value="Login" class="button_submit" /></p>

 

and i try login like that :

 

 

 

$_login_url = 'URL of the login'; // url to login 
$_user = 'myusername'; // username for login
$_pass = 'mypass'; // password..
$start = microtime(true);
    file_get_contents(
    $_login_url,
    false,
    stream_context_create(
        array(
          'http' => array(
            'method'  => 'POST',
            'header'  => 'Content-type: application/x-www-form-urlencoded',
            'content' => http_build_query(
            array(
                'user' => $_user,
                'passwrd' => $_pass,
                'cookielength' => '-1',
    //what here ???? 'Login',
                )
              ),
            )
          )
        )
    );
    
      $search['from'] = 'Set-Cookie: ';
      $search['to'] = ';';
      $cookie = array();

 

//the problem is that i cant login to go to the statistics page, cause site requires login for view.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.