Jump to content

Newb Question: Auto login script


ndondo

Recommended Posts

Is it possible to have a script something like this

<this is a script>

http://username:[email protected]/index.php

<this is a script>

 

save it somewhere, and when user run the script it will automatically show the content we want to display?

 

let's say the index.php / main joomla page require visitor to login before they can view the site contet? ( I use joomla CMS)

Link to comment
https://forums.phpfreaks.com/topic/94937-newb-question-auto-login-script/
Share on other sites

for example

 

I have a website

 

www.accounting.com/index.php

 

before anyone can see the content in accounting.com

they have to enter username and password...

 

I also have accounting.exe (Visual basic Program) and inside accounting.exe program, there is a support window, and What I would like to do is for user with accouting.exe program to be able to see the content of www.acconting.com/index.php, without user name and password

 

so essentially what I am trying to do is maybe to have a function hidden in the program, that will call the script on the server..so that it will log in for me.

 

so I need to know if it's possible to have a script that will silently pass the username and password ..

the script can be on the server or on the client it doesn't really matter

 

 

 

well with out using a sql database you can do this:

 

login.php


<?php
session_start();
if(isset($_POST['submit'])){

if($_POST['username']=="USERNAME HERE" && $_POST[password]=="YOUR PASSWORD HERE" ){
session_register('login');
$_SESSION['login']="true";
header("location: index.php");
}else{
echo "invalid user or pass";
}



}
?>

<html>
<form method='post'>
<table>
<TR>
<TD>User Name:</TD>
<TD><input type='text' name='username'></TD>
</TR>
<TR>
<TD>Password:</TD>
<TD><input type='text' name='password'></TD>
</TR>
<TR>
<TD colspan='2'><input type='submit' value='Login' name='submit'></TD>
</TR>       
</table>
</form>
</html>

 

 

and on your index.php page include this at the top

<?php
session_start();
if($_SESSION['login']!="true"){
header("location: login.php");
exit();
}
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.