Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php login help

Status
Not open for further replies.

fireburner69

Programmer
Aug 22, 2002
108
GR
I have a php forum and it has a post method login.

I would like to ask if there is any posibility to make a html that will automaticaly login myself into the forum just by simple open that html that i have created?
Or to make a php that simple call the code with my username and password filled already inside!

?


Thanx for yout time
 
Sounds to me like you need to set a cookie. ______________________________________________________________________
TANSTAAFL!
 
well actualy is there a way not to set a cookie? just to make a php that i will start and automatic get inside the forum? the forum makes a cookie! but after that if something change like ip i can not login again with a bypass that i have found!

So i really need to make it with a php with my acount info inside so i can login automatic!

is there any way? to make these!
 
I suppose you could have PHP produce an HTML page with a form on it that submits to the login app by the POST method.

But for that matter, you could do it with straight HTML, too. ______________________________________________________________________
TANSTAAFL!
 
IF I TOLD you that these is the code can you make anything out of it!


if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && !$userdata['session_logged_in'] )

{

$username = isset($HTTP_POST_VARS['username']) ? $HTTP_POST_VARS['username'] : '';

$password = isset($HTTP_POST_VARS['password']) ? $HTTP_POST_VARS['password'] : '';



$sql = "SELECT user_id, username, user_password, user_active, user_level

FROM " . USERS_TABLE . "

WHERE username = '" . str_replace("\'", "''", $username) . "'";

if ( !($result = $db->sql_query($sql)) )

{

message_die(GENERAL_ERROR, 'Error in obtaining userdata', '', __LINE__, __FILE__, $sql);

}



if( $row = $db->sql_fetchrow($result) )

{

if( $row['user_level'] != ADMIN && $board_config['board_disable'] )

{

header($header_location . append_sid("index.$phpEx", true));

exit;

}

else

{

if( md5($password) == $row['user_password'] && $row['user_active'] )

{

$autologin = ( isset($HTTP_POST_VARS['autologin']) ) ? TRUE : 0;



$session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin);



if( $session_id )

{

if( !empty($HTTP_POST_VARS['redirect']) )

{

header($header_location . append_sid($HTTP_POST_VARS['redirect'], true));

exit;

}

else

{

header($header_location . append_sid("index.$phpEx", true));

exit;

}

}

else

{

message_die(CRITICAL_ERROR, "Couldn't start session : login", "", __LINE__, __FILE__);

}

}

else

{

$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : '';



$template->assign_vars(array(

'META' => '<meta http-equiv=&quot;refresh&quot; content=&quot;3;url=' . append_sid(&quot;login.$phpEx?redirect=$redirect&quot;) . '&quot;>')

);



$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], '<a href=&quot;' . append_sid(&quot;login.$phpEx?redirect=$redirect&quot;) . '&quot;>', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href=&quot;' . append_sid(&quot;index.$phpEx&quot;) . '&quot;>', '</a>');



message_die(GENERAL_MESSAGE, $message);

}

}

}

else

{

$redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : &quot;&quot;;



$template->assign_vars(array(

'META' => '<meta http-equiv=&quot;refresh&quot; content=&quot;3;url=' . append_sid(&quot;login.$phpEx?redirect=$redirect&quot;) . '&quot;>')

);



$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], '<a href=&quot;' . append_sid(&quot;login.$phpEx?redirect=$redirect&quot;) . '&quot;>', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href=&quot;' . append_sid(&quot;index.$phpEx&quot;) . '&quot;>', '</a>');



message_die(GENERAL_MESSAGE, $message);

}

}

else if( ( isset($HTTP_GET_VARS['logout']) || isset($HTTP_POST_VARS['logout']) ) && $userdata['session_logged_in'] )

{

if( $userdata['session_logged_in'] )

{

session_end($userdata['session_id'], $userdata['user_id']);

}



if( !empty($HTTP_POST_VARS['redirect']) )

{

header($header_location . append_sid($HTTP_POST_VARS['redirect'], true));

exit;

}

else

{

header($header_location . append_sid(&quot;index.$phpEx&quot;, true));

exit;





is there a possibility to make a html by just entering these html to make my automaticaly login into the forum?


For example if the username and password is demo1

what would be the html look like?


thanx for your time again!
 
The form which submits to a web server does not have to come from that same webserver.

If you create a form which submits by POST method to the script you've excerpted above, and that form contains two inputs called &quot;username&quot; and &quot;password&quot;, the login script should let you right in. ______________________________________________________________________
TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top