PHP Admin Login

Discussion in 'PHP' started by webber09, May 13, 2010.

  1. #1
    Hi everyone,

    Does anyone know where i could get hold of a php admin log in area THAT DOES NOT USE MYSQL!!! I do not have access to a MySQL database currently but need to have a very secure login system to protect customers details.

    Thanks everyone.
     
    webber09, May 13, 2010 IP
  2. looking4vps

    looking4vps Peon

    Messages:
    1,495
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    are you using control panel of any kind?
     
    looking4vps, May 13, 2010 IP
  3. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #3
    i would like one so i can set up the username and password for the log in's, but other than that all i need it for is to protect a folder and all the files inside on the server from being viewed by anyone
     
    webber09, May 13, 2010 IP
  4. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #4
    See attached file below...

    Description: Silentum LoginSys is terrific if you're looking for a simple, easy-to-install login system for your site. You assign the user name and password you want to use, then upload the two PHP files to your site, login, and you're done. This script can protect as many pages as you want by transferring a small piece of code onto each page, and can also be used as a great message board login system. A cookie is used to denote whether or not someone is logged in. No MySQL is required
     
    MyVodaFone, May 13, 2010 IP
  5. roopajyothi

    roopajyothi Active Member

    Messages:
    1,302
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    80
    #5
    I have created a simple login script

    Index.php

    
    
    <?php
    
    //###################################################################
    
    // Simple Login By Roopa
    
    //###################################################################
    require_once('common.php');
    
    $error = '0';
    
    if (isset($_POST['submitBtn'])){
    	// Get user input
    	$username = isset($_POST['username']) ? $_POST['username'] : '';
    	$password = isset($_POST['password']) ? $_POST['password'] : '';
            
    	// Try to login the user
    	$error = loginUser($username,$password);
    }
    
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head profile="http://gmpg.org/xfn/11">
    <title>Login</title>
    <link href="style/style.css" rel="stylesheet" type="text/css" />
    
    
    
    </head>
    
    <body>
    
    
    <div id="pagecenter">
    <br/><br/><br/><br/><br/><br/><br/><br/>
    <div id="main">
    <?php if ($error != '') {?>
          <div class="caption">Administrator login</div>
          <div id="icon">&nbsp;</div>
          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="loginform">
            <table width="100%">
              <tr><td>Username:</td><td> <input class="text" name="username" type="text"/></td></tr>
              <tr><td>Password:</td><td> <input class="text" name="password" type="password"/></td></tr>
              <tr><td colspan="2" align="center"><p align='right'><input class="text" type="submit" name="submitBtn" value="Login" /></p></td></tr>
    		  <tr><td></td></tr>
            </table>  
          </form>
          
          
          
    <?php 
    }   
        if (isset($_POST['submitBtn'])){
    
    ?>
          <div class="caption">Login result:</div>
          <div id="icon2">&nbsp;</div>
          <div id="result">
            <table width="100%"><tr><td><br/>
    <?php
    	if ($error == '') {
    		echo "Welcome Admin, $username! <br/>You are now logged in!<br/><br/>";
    		
    		}
    	else echo $error;
    
    ?>
    		<br/><br/><br/></td></tr></table>
    	</div>
    <?php            
        }
    ?>
    	    </div>
    </div>
    </body>
    <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
    
    </html>
    
    
    PHP:



    Logout.php


    
    <?php
    //###################################################################
    
    // Simple Logn By roopa
    
    
    //###################################################################
    	require_once('common.php');
    	logoutUser();
    	header('Location: index.php');
    ?>	
    
    
    PHP:



    register.php


    
    <?php
    //###################################################################
    
    //#### - Simple Login By roopa
    
    //###################################################################
    	require_once('common.php');
    
    	if (isset($_POST['submitBtn'])){
    		// Get user input
    		$username  = isset($_POST['username']) ? $_POST['username'] : '';
    		$password1 = isset($_POST['password1']) ? $_POST['password1'] : '';
    		$password2 = isset($_POST['password2']) ? $_POST['password2'] : '';
            
    		// Try to register the user
    		$error = registerUser($username,$password1,$password2);
    	}	
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
    <html>
    <head>
       <title>Admin Panel register</title>
    
    </head>
    <body>
        <div id="main">
    <?php if ((!isset($_POST['submitBtn'])) || ($error != '')) {?>
          <div class="caption">Register user</div>
          <div id="icon">&nbsp;</div>
          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="registerform">
            <table width="100%">
              <tr><td>Username:</td><td> <input class="text" name="username" type="text"  /></td></tr>
              <tr><td>Password:</td><td> <input class="text" name="password1" type="password" /></td></tr>
              <tr><td>Confirm password:</td><td> <input class="text" name="password2" type="password" /></td></tr>
              <tr><td colspan="2" align="center"><input class="text" type="submit" name="submitBtn" value="Register" /></td></tr>
            </table>  
          </form>
         
    <?php 
    }   
        if (isset($_POST['submitBtn'])){
    
    ?>
          <div class="caption">Registration result:</div>
          <div id="icon2">&nbsp;</div>
          <div id="result">
            <table width="100%"><tr><td><br/>
    <?php
    	if ($error == '') {
    		echo " User: $username was registered successfully!<br/><br/>";
    		echo ' <a href="index.php">You can login here</a>';
    		
    	}
    	else echo $error;
    
    ?>
    		<br/><br/><br/></td></tr></table>
    	</div>
    <?php            
        }
    ?>
    	<p align='right'>
    	<b>Back to <a href='index.php'>Login</a></b></div>
        </p>
    	
    </body>   
    
    
    
    PHP:

    Create a empty text file and place it the same directory where this three files are located


    That's it!

    Comploetely safe since it uses an MD5 hash Based algorithm to save pass!
    Also CHMOD the userpwd.txt to 0640

    Thats it!
     
    roopajyothi, May 13, 2010 IP
  6. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #6
    thanks all... i have tested both of theses and have used roopa's script... thx!
     
    webber09, May 14, 2010 IP
  7. extremephp

    extremephp Peon

    Messages:
    1,290
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Wow.. Roopa Rocks..! :)

    Your script was Awsome.. And Yeah... Cool One..

    I liked the Codes and they way you code it. Am using your in my site too ;)

    Thanks
     
    extremephp, May 14, 2010 IP
  8. webber09

    webber09 Active Member

    Messages:
    131
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    71
    #8
    roopa i have just used this script on my new site and am getting an error. i need to make the common.php file ... but where does is go and what goes inside it?
     
    webber09, Oct 10, 2010 IP