Error: Could not fetch http://thedevnet.com/wp-content/plugins/gd-star-rating/css/gdsr.css.php?t=0&s=a10i10m20k20c05r05%23121620243046%23121620243240%23s1pchristmas%23s1pcrystal%23s1pdarkness%23s1poxygen%23s1goxygen_gif%23s1pplain%23s1ppumpkin%23s1psoft%23s1pstarrating%23s1pstarscape%23t1pclassical%23t1pstarrating%23t1gstarrating_gif&ver=1.7.2 for caching. You might need to exclude this file in WP Minify options. The Developer Network – PHP Simple Script Security

PHP Simple Script Security

Alot of times you want to have your script only accessible to your eyes and not the whole world. Well I have a relatively simple approach to this matter with a simple PHP page protection security script. Just follow the steps below and you’ll have your scripts easily protected in no time. This snippet consists of a lockdown.php that you include into your scripts to protect them.

Snippet (step 1 – add into a file called lockdown.php):

  1. <?php
  2.  // Simple Lockdown Script (lockdown.php)
  3.  // make sure to add include_once('lockdown.php'); to every script
  4.  // you want to lockout
  5.  // more info on this script can be found:
  6.  // http://thedevnet.com/php/snippets/php-simple-script-security/
  7.  @ob_start();
  8.  @session_start();
  9.  
  10.  // md5 encode your password!
  11.  // visit this link to convert your password to md5
  12.  // http://thedevnet.com/tools/md5-password-generator/
  13.  $password = '5f4dcc3b5aa765d61d8327deb882cf99'; // default password is password
  14.  
  15.  if(!isset($_SESSION['jadmin']) && $_SESSION['jadmin'] != 1)
  16.   $loggedin = false;
  17.  else
  18.   $loggedin = true;
  19.  
  20.  
  21.  if(@$_GET['cmd'] == "login")
  22.  {
  23.   // you can find md5 password generators alot o
  24.   if(@md5($_POST['pass']) == $password)
  25.   {
  26.    $_SESSION['jadmin'] = 1;
  27.  
  28.    die(header("location:".$_SERVER['PHP_SELF']));
  29.    // die();
  30.   }
  31.  }
  32.  
  33.  // if not logged in then show the form and quit processing //
  34.  if(!$loggedin)
  35.  {
  36.   ?>
  37.   <form action="<?=$_SERVER['PHP_SELF']?>?&cmd=login" method="post">
  38.   <input type="password" name="pass">
  39.   <input type=submit>
  40.   </form>
  41.   <?
  42.   die();
  43.  }
  44.  
  45.  // if we made it to here then login was good.. continue loading protected script
  46.  
  47. ?>

Step 2 (throw the include into the scripts you want to protect):

  1. <?php include_once('lockdown.php'); ?>
GD Star Rating
loading...

Originally posted 2009-10-22 06:43:07.

Popularity: 3%

Posted by irbobo   @   29 January 2010

Related Posts

Like this post? Share it!

RSS Digg Twitter StumbleUpon Delicious Technorati Facebook

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

You must be logged in to post a comment.

Previous Post
« Zoom Crop Image
Next Post
Send SMS by Email. »
Powered by Wordpress   |   Lunated designed by ZenVerse