Advertisement
plas71k

add.php decoded - part1

Nov 17th, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.15 KB | None | 0 0
  1. <?php
  2. function checkemail( $email )
  3. {
  4.     $isValid = true;
  5.     $atIndex = strrpos( $email, "@" );
  6.     if ( is_bool( $atIndex ) && !$atIndex )
  7.     {
  8.         $isValid = false;
  9.     }
  10.     else
  11.     {
  12.         $domain = substr( $email, $atIndex + 1 );
  13.         $local = substr( $email, 0, $atIndex );
  14.         $localLen = strlen( $local );
  15.         $domainLen = strlen( $domain );
  16.         if ( $localLen < 1 || 64 < $localLen )
  17.         {
  18.             $isValid = false;
  19.         }
  20.         else if ( $domainLen < 1 || 255 < $domainLen )
  21.         {
  22.             $isValid = false;
  23.         }
  24.         else if ( $local[0] == "." || $local[$localLen - 1] == "." )
  25.         {
  26.             $isValid = false;
  27.         }
  28.         else if ( preg_match( "/\\.\\./", $local ) )
  29.         {
  30.             $isValid = false;
  31.         }
  32.         else if ( !preg_match( "/^[A-Za-z0-9\\-\\.]+\$/", $domain ) )
  33.         {
  34.             $isValid = false;
  35.         }
  36.         else if ( preg_match( "/\\.\\./", $domain ) )
  37.         {
  38.             $isValid = false;
  39.         }
  40.         else if ( !preg_match( "/^(\\\\.|[A-Za-z0-9!#%&`_=\\/\$'*+?^{}|~.-])+\$/", str_replace( "\\\\", "", $local ) ) && !preg_match( "/^\"(\\\\\"|[^\"])+\"\$/", str_replace( "\\\\", "", $local ) ) )
  41.         {
  42.             $isValid = false;
  43.         }
  44.         if ( $isValid && !( checkdnsrr( $domain, "MX" ) || checkdnsrr( $domain, "A" ) ) )
  45.         {
  46.             $isValid = false;
  47.         }
  48.     }
  49.     return $isValid;
  50. }
  51.  
  52. header( "Cache-Control: no-cache" );
  53. header( "Expires: -1" );
  54. $add = 1;
  55. if ( !$add && $disable )
  56. {
  57.     echo "<form name=adduser method=post action=\"add_user.php\"><table><input type=hidden name=add value=1><!--<input type=hidden name=ip value=";
  58.     echo $ip;
  59.     echo ">--><tr><td>Username :</td><td> <input type=text name=username /></td></tr><tr><td>Password : </td><td><input type=text name=password /></td></tr><tr><td>Jobs Allowed : </td><td><input type=text name=jobs_allowed /></td></tr><tr><td>Account Type : </td><td>";
  60.     echo "<S";
  61.     echo "elect name=type><option value=0>Free</option><option value=1>\$5 Paid</option></select></td></tr><!--<tr><td>User ID :</td><td> <input type=text name=userids />";
  62.     echo "<s";
  63.     echo "mall>(seperated by ; in same sequence for aboce usernames, seperated by ;)</small></td><t/r><tr><td>Password : </td><td><input type=text name=password />";
  64.     echo "<s";
  65.     echo "mall>(Must be same for all Usernames Given above)</small></td></tr><tr><td>Keywords To Post For : </td><td><input type=text name=keywords />";
  66.     echo "<s";
  67.     echo "mall>(seperated by ;)</small></td></tr><tr><td>Forum Type :</td><td> ";
  68.     echo "<s";
  69.     echo "elect name=forumtype>  <option name=phpbb3 value=phpbb3>phpBB 3</option> <option name=smf value=smf>SMF</option> <option name=vbulletin value=vbulletin>vBulletin</option> </select></td></tr><tr><td>Number of Posts to Make :</td><td><input type=text name=numofposts value=20></td></tr>--><tr><td></td><td><input type=Submit value=Feed Job></td></tr></table></form>";
  70.     echo "";
  71. }
  72. else if ( $add )
  73. {
  74.     include_once( "./connect.php" );
  75.     $sql = "SELECT * FROM `users`;";
  76.     if ( !( $res = mysql_query( $sql, $link ) ) )
  77.     {
  78.         exit( mysql_error( )."<- this time" );
  79.     }
  80.     $count = mysql_num_rows( $res );
  81.     $email = $_POST['email'];
  82.     $password = $_POST['password'];
  83.     $jobs_allowed = $_POST['jobs_allowed'];
  84.     $type = $_POST['type'];
  85.     if ( checkemail( $email ) )
  86.     {
  87.         $go = 1;
  88.     }
  89.     else
  90.     {
  91.         $go = 0;
  92.         header( "Location: index.php?err=bademail" );
  93.         echo "<br>Bad Email Address";
  94.         exit( );
  95.     }
  96.     if ( strlen( $password ) < 5 )
  97.     {
  98.         header( "Location: index.php?err=badpassword" );
  99.         exit( );
  100.     }
  101.     if ( $type != 1 )
  102.     {
  103.         $type = 0;
  104.     }
  105.     switch ( $type )
  106.     {
  107.     case "0" :
  108.         $data = array( "0", "3", "30" );
  109.         break;
  110.     case "1" :
  111.         $data = array( "1", "8", "300" );
  112.     }
  113. //========================================PAYMENT==============================================//
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement