Articles

Metasploit Framework Windows Tutorial
Remote Desktop Connection
Windows Processes That May Be Dangerous
How-To use NetCat a Tutorial
Common Linux Commands
Common Ports
Netcat Commands
HTTP Response Codes
War-Google Hack Terms
Wardriving
Avoiding Social Engineering and Phishing Attacks
Intrusion Detection on Linux
Linux Intrusion Detection
Penetration Testing Guide
Penetration Testing Tools
Social Engineering Fundamentals, Part I: Hacker Tactics
Social engineering (computer security)
The Psychology of Social Engineering

The Archives

General GSO
GovernmentSecurity.org News & Suggestions
In The News
Open Topic
General Security Information
Trash Can
Exploit & Vulnerability Mailing List Archives
Trial Member Forum
Product and Program Reviews GSO Tutorials
System Security
Windows Systems
Beginners Section
Linux & Unix Systems
File Downloads
Exploit Research & Discussion Trojan & Virus Errata
Networking Security / Firewall / IDS / VPN / Routers
System Hardening
E-Mail Security
Wifi Security
Trial Member Uploads
Upload discovered Trojans & Mal ware
GSO Programming Section
C , C++ , VC++
Visual Basic.NET
Perl /CGI
Java/Javascript
PHP/XML/ASP/HTML
Assembly + Other
The Cork Board
Network Security Consultant Directory
Network Security Jobs
The Archives
Encryption Information
General Network Security
Internet Anonymity
HTTP Protocol Security
Linux Security
MS IIS Information
Exploit Articles
Programming / Tool Design
GSO Software Projects
Public Downloads
Microsoft Security Questions and Papers

Norse
HI, I am trying to make a web site and I want to make a login so that users can login to the web site befor they can access some of the pages but I am mot sure on how to go about doing some thing like this if any one could point me in the right direction that would be great thank you.
Digital_Spirit
Well, if you are using a LAMP Host meaning the host runs: Linux, Apache, MySql, and Php, then I recommend checking out: http://phpfreaks.com

They have a complete tutorial on creating a login system as well as many
other topics.
DiabloPatch
or if you want to keep it simple make a basic http verification with the .htaccess file in apache. and make sure after x amount of times the ip get's blocked.
Norse
OK cool thanks for the link and the advice it really is a big help.
guinn3ss
Hi, this is a way to Start for you , (if you are using LAMP),
I use the database to store info about users, if you want to manage them later it could by usefull.


1- form.html
CODE

<html>
<head>
 <title>Connexion au site</title>
</head>
<body>
 <form method="post" action="verifLogin.php">
  <table border="0" width="400" align="center">
   <tr>
    <td width="200"><b>Your login</b></td>
    <td width="200">
     <input type="text" name="login">
    </td>
   </tr>
   <tr>
    <td width="200"><b>Your password<b></td>
    <td width="200">
     <input type="password" name="pass">
    </td>
   </tr>
   <tr>
    <td colspan="2">
     <input type="submit" name="submit" value="login">
    </td>
   </tr>
  </table>
 </form>
</body>
</html>


2- verif_login.php
CODE

<?php
// start sessions
session_start();
//crypt password with md5
$passe = md5($pass);

$loginOK = false;  // cf Astuce
 echo 'Welcome '.$login.'<br>';

if ( isset($_POST) && (!empty($_POST['login'])) && (!empty($_POST['pass'])) ) {
 extract($_POST);  //
 require ('config.php');
 $sql = "SELECT * FROM logme WHERE user = '".addslashes($login)."'";
 $req = mysql_query($sql) or die('Error SQL : <br />'.$sql);
 // check user in database
 if (mysql_num_rows($req) > 0) {
    $data = mysql_fetch_assoc($req);
   // check password
   if ($passe == $data['pass']) {
     $loginOK = true;
   echo 'good password<br>';
   }  else { echo '<br>bad password<br>';
             //echo $data['pass'];
             echo '<br><a href=/otro/logout.php>go back</a><br>';}
 }
}
// if login and password are ok, save them into a session
if ($loginOK) {
              $_SESSION['pseudo'] = $data['user'];
              $_SESSION['mail'] = $data['mail'];
              $_SESSION['etat'] = $data['etat'];
                                echo '<br>oki session register!!<br>';
 if ($_SESSION['etat'] == "ok")  { echo 'user ok';
                                   echo '<br><a href=/otro/logout.php>log out</a><br>';
                                   }
      else { echo 'sorry, you are not actived'; }
}
else {
 echo 'Error, come back later !<br><br>
<a href=/otro/logout.php>home</a><br>';
}
?>


3 - config.php
CODE


<?

   $dbhost = "127.0.0.1";  
   $user = "";          
   $password = "";          
   $usebdd = "test";        

   if (! @$connexion = mysql_connect($dbhost, $user, $password))
   {
       print("Unable to connect to ".$dbhost);
       print("<br>");
       exit;
   }
   
   // Selection de la BDD
   $db = mysql_select_db ($usebdd, $connexion) or die ("probleme de connexion à la base");
   
?>


and then create the database:

CODE

--
-- Table structure for table `logme`
--

CREATE TABLE `logme` (
 `id_user` bigint(100) NOT NULL auto_increment,
 `user` varchar(20) NOT NULL default '',
 `pass` varchar(100) NOT NULL default '',
 `mail` varchar(50) NOT NULL default '',
 `etat` varchar(5) NOT NULL default '',
 PRIMARY KEY  (`id_user`)
) TYPE=MyISAM AUTO_INCREMENT=3;

--
-- Dumping data for table `logme`
--



Sorry for my bad english and i Hope this will help you


ps: use php freak tutorial to complete the script wink.gif
realmasterX
Her u can find another good Script:
System Security » System Hardening
wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2005 Invision Power Services, Inc.