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:password@www.website.com/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
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

 

 

 

Link to comment
Share on other sites

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();
}
?>

 

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.