Thursday, January 7, 2010

PHP Variable stat check table

begin:vcard
fn:Suyash Jain
n:Jain;Suyash
org:Net4India Ltd.;Network Operations
adr:Infantry Road;;1st Floor,Empire Infantry,No.29;Bangalore;Karnataka;560080;INDIA
email;internet:suyash.j@net4.in
title:Asst. Manager
tel;work:08041130404
tel;fax:08041276604
tel;cell:9844643008
note;quoted-printable:24x7 Support=0D=0A=
=0D=0A=

x-mozilla-html:TRUE
url:http://www.net4.in
version:2.1
end:vcard

TEST Not Set NULL Zero FALSE Numeric Value Empty String
Comparison Table
isset() bool(false) bool(false) bool(true) bool(true) bool(true) bool(true)
empty() bool(true) bool(true) bool(true) bool(true) bool(false) bool(true)
is_null() bool(true) bool(true) bool(false) bool(false) bool(false) bool(false)
== bool(true) bool(true) bool(true) bool(true) bool(false) bool(true)
=== bool(false) bool(false) bool(false) bool(true) bool(false) bool(false)
--

Thanks & Regards

Suyash Jain
Asst. Manager-Network Operations
Net4India Ltd.
No. 29 (Old No. 10), First Floor,
Empire Infantry, Infantry Road,
Bangalore - 560 001
INDIA

  + 91-80- 41130404  / Direct + 91-80-40800405
  + 91-80- 4127 6604
   +91-9844643008
  http://www.net4.in
BS/ISO/IEC 27001 Certified Company/ ISO 9001
This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.

Schools.khazanaplus.com sitemap

http://schools.khazanaplus.com/index.php?City_ID=30&action=Go
http://schools.khazanaplus.com/index.php?City_ID=576&action=Go
http://schools.khazanaplus.com/index.php?City_ID=638&action=Go
http://schools.khazanaplus.com/index.php?City_ID=1&action=Go
http://schools.khazanaplus.com/index.php?City_ID=1&action=Go
http://schools.khazanaplus.com/index.php?City_ID=25&action=Go
http://schools.khazanaplus.com/index.php?City_ID=32&action=Go
http://schools.khazanaplus.com/index.php?City_ID=641&action=Go
http://schools.khazanaplus.com/index.php?City_ID=782&action=Go
http://schools.khazanaplus.com/index.php?City_ID=38&action=Go
http://schools.khazanaplus.com/index.php?City_ID=40&action=Go
http://schools.khazanaplus.com/index.php?City_ID=39&action=Go
http://schools.khazanaplus.com/index.php?City_ID=639&action=Go
http://schools.khazanaplus.com/index.php?City_ID=33&action=Go
http://schools.khazanaplus.com/index.php?City_ID=711&action=Go
http://schools.khazanaplus.com/index.php?City_ID=251&action=Go
http://schools.khazanaplus.com/index.php?City_ID=708&action=Go
http://schools.khazanaplus.com/index.php?City_ID=577&action=Go
http://schools.khazanaplus.com/index.php?City_ID=612&action=Go
http://schools.khazanaplus.com/index.php?City_ID=699&action=Go
http://schools.khazanaplus.com/index.php?City_ID=668&action=Go
http://schools.khazanaplus.com/index.php?City_ID=567&action=Go
http://schools.khazanaplus.com/index.php?City_ID=570&action=Go
http://schools.khazanaplus.com/index.php?City_ID=580&action=Go
http://schools.khazanaplus.com/index.php?City_ID=770&action=Go
http://schools.khazanaplus.com/index.php?City_ID=625&action=Go
http://schools.khazanaplus.com/index.php?City_ID=712&action=Go
http://schools.khazanaplus.com/index.php?City_ID=1&action=Go
http://schools.khazanaplus.com/index.php?City_ID=754&action=Go
http://schools.khazanaplus.com/index.php?City_ID=36&action=Go
http://schools.khazanaplus.com/index.php?City_ID=568&action=Go
http://schools.khazanaplus.com/index.php?City_ID=615&action=Go
http://schools.khazanaplus.com/index.php?City_ID=27&action=Go
http://schools.khazanaplus.com/index.php?City_ID=781&action=Go
http://schools.khazanaplus.com/listbyarea.php?area='3rd block
koramangala'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='4th Block
Koramangala '&city=1
http://schools.khazanaplus.com/listbyarea.php?area='6th Block
Koramangala '&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Arkere Mico
Layout'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Ayyappa Nagar / K.
R. Puram'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='BEML Layout'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='C. V. Ramana
Nagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='C.V. Raman Nagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Doddanakundi'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='HBR Layout'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Konena Agrahara'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='L. B. Shastri
Nagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Marathahalli'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Nobo Naga'r&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Rama Murthy
Nagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Sadashiv Nagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Shantinagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Udaya Nagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Vignana Nagar'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Wilson Garden'&city=1
http://schools.khazanaplus.com/listbyarea.php?area='Yelahanka'&city=1
http://schools.khazanaplus.com/submitschool.php

Schools.khazanaplus.com sitemap

http://schools.khazanaplus.com/index.php?City_ID=30&action=Go
http://schools.khazanaplus.com/index.php?City_ID=576&action=Go
http://schools.khazanaplus.com/index.php?City_ID=638&action=Go
http://schools.khazanaplus.com/index.php?City_ID=1&action=Go
http://schools.khazanaplus.com/index.php?City_ID=1&action=Go
http://schools.khazanaplus.com/index.php?City_ID=25&action=Go
http://schools.khazanaplus.com/index.php?City_ID=32&action=Go
http://schools.khazanaplus.com/index.php?City_ID=641&action=Go
http://schools.khazanaplus.com/index.php?City_ID=782&action=Go
http://schools.khazanaplus.com/index.php?City_ID=38&action=Go
http://schools.khazanaplus.com/index.php?City_ID=40&action=Go
http://schools.khazanaplus.com/index.php?City_ID=39&action=Go
http://schools.khazanaplus.com/index.php?City_ID=639&action=Go
http://schools.khazanaplus.com/index.php?City_ID=33&action=Go
http://schools.khazanaplus.com/index.php?City_ID=711&action=Go
http://schools.khazanaplus.com/index.php?City_ID=251&action=Go
http://schools.khazanaplus.com/index.php?City_ID=708&action=Go
http://schools.khazanaplus.com/index.php?City_ID=577&action=Go
http://schools.khazanaplus.com/index.php?City_ID=612&action=Go
http://schools.khazanaplus.com/index.php?City_ID=699&action=Go
http://schools.khazanaplus.com/index.php?City_ID=668&action=Go
http://schools.khazanaplus.com/index.php?City_ID=567&action=Go
http://schools.khazanaplus.com/index.php?City_ID=570&action=Go
http://schools.khazanaplus.com/index.php?City_ID=580&action=Go
http://schools.khazanaplus.com/index.php?City_ID=770&action=Go
http://schools.khazanaplus.com/index.php?City_ID=625&action=Go
http://schools.khazanaplus.com/index.php?City_ID=712&action=Go
http://schools.khazanaplus.com/index.php?City_ID=1&action=Go
http://schools.khazanaplus.com/index.php?City_ID=754&action=Go
http://schools.khazanaplus.com/index.php?City_ID=36&action=Go
http://schools.khazanaplus.com/index.php?City_ID=568&action=Go
http://schools.khazanaplus.com/index.php?City_ID=615&action=Go
http://schools.khazanaplus.com/index.php?City_ID=27&action=Go
http://schools.khazanaplus.com/index.php?City_ID=781&action=Go
http://schools.khazanaplus.com/listbyarea.php?area=3rd block koramangala&city=1
http://schools.khazanaplus.com/listbyarea.php?area=4th Block Koramangala&city=1
http://schools.khazanaplus.com/listbyarea.php?area=6th Block Koramangala&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Arkere Mico Layout&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Ayyappa Nagar / K. R. Puram&city=1
http://schools.khazanaplus.com/listbyarea.php?area=BEML Layout&city=1
http://schools.khazanaplus.com/listbyarea.php?area=C. V. Ramana Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=C.V. Raman Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Doddanakundi&city=1
http://schools.khazanaplus.com/listbyarea.php?area=HBR Layout&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Konena Agrahara&city=1
http://schools.khazanaplus.com/listbyarea.php?area=L. B. Shastri Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Marathahalli&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Nobo Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Rama Murthy Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Sadashiv Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Shantinagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Udaya Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Vignana Nagar&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Wilson Garden&city=1
http://schools.khazanaplus.com/listbyarea.php?area=Yelahanka&city=1
http://schools.khazanaplus.com/submitschool.php

Thursday, July 23, 2009

Random Password Generation in Perl

sub randomPassword {
my $password;
my $_rand;

my $password_length = $_[0];
    if (!$password_length) {
        $password_length = 10;
    }

my @chars = split(" ",
    "a b c d e f g h i j k l m n o
    p q r s t u v w x y z - _ % #
    0 1 2 3 4 5 6 7 8 9");

srand;
 
for (my $i=0; $i <= $password_length ;$i++) {
    $_rand = int(rand 41);
    $password .= $chars[$_rand];
}
return $password;
}

Monday, June 8, 2009

Password Generation in Perl

#!/usr/bin/perl
 
 ## ***************************************************************************
 #
 #  genpass v1.0 (06.2007) Password Generation Program
 #  Copyright (C) 2007 Jon Brown
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
 #  the Free Software Foundation; either version 2 of the License, or
 #  (at your option) any later version.
 #
 #  To read the full text go to [url="http://www.gnu.org/licenses/gpl.txt"]http://www.gnu.org/licenses/gpl.txt[/url]
 #
 #  This program is distributed in the hope that it will be useful,
 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #  GNU General Public License for more details.
 #
 #  You should have received a copy of the GNU General Public License
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 ## ***************************************************************************
 
 use strict;
 use warnings;
 use Getopt::Long;
 Getopt::Long::Configure ("bundling");
 
 ## PARSE AND SET COMMAND-LINE OPTIONS
 ## -----------------------------------------------------
 my %flags=('symbols', 0, 'numbers', 0, 'uppercase', 0, 'lowercase', 0, 'confusable', 0, 'help', 0, 'qty', 1,
'version', 0);
 
 GetOptions( 's|S|symbols' => \$flags{symbols},
         'n|N|numbers' => \$flags{numbers},
         'u|U|uppercase' => \$flags{uppercase},
         'l|L|lowercase' => \$flags{lowercase},
         'c|C|confusable' => \$flags{confusable},
         'q|Q:i' => \$flags{qty},
         'help' => \$flags{help},
         'ver|version' => \$flags{version} );
 
 # Set password characters, excluding those flagged on the command-line
 my $pwdchars = join( '', map {chr} ( 0x21 .. 0x7e ));
     $pwdchars =~ s/\d+//    if ( $flags{numbers} );
     $pwdchars =~ s/[A-Z]+// if ( $flags{uppercase} );
     $pwdchars =~ s/[a-z]+// if ( $flags{lowercase} );
     $pwdchars =~ s/[_\W]+//g if ( $flags{symbols} );
     $pwdchars =~ tr/1Il0O//d  if ( $flags{confusable} );
 
 # If user triggered the --help option flag, display and exit
 if ($flags{help}) {           
     &DisplayUsage();   
     exit();
 }
 elsif ($flags{version}) {
     &DisplayVersion();
     exit();
 }
 
 ## START VALIDATE INPUT
 ## -----------------------------------------------------
 my $kill=0;        # flag to stop the script if input is invalid (or --help is used)
 my @errmsg;        # error message descriptions
 
 # If -q option was used to set a quantity of passwords, make sure it contains at
 # least a value of 1 so that a password can be generated
 if ($flags{qty} == 0 || $flags{qty} < 0) {
     $flags{qty}=1;
 }
 
 # Check that user hasn't excluded all character-types, warn user, kill script
 if ( length($pwdchars) == 0) {
     push @errmsg, "** 0x1: At least 1 character-type must be included";   
     $kill=1;
 }
 
 # Check that user has passed only 1 argument (LENGTH) other than options flags, warn user, kill script
 if ($#ARGV > 0 || $#ARGV < 0) {
     push @errmsg, "** 0x2: Incorrect number of arguments passed";
     $kill=1;
 }
 
 # Check for only numeric input in LENGTH argument, warn user, kill script
 if ($ARGV[0] !~ /^[0-9]+$/) {
         push @errmsg, "** 0x3: Invalid input. LENGTH argument must be a numeric value";
         $kill=1;
 }
 
 # If any of the above validation tests triggered the $kill flag...
 if ($kill == 1) {                    
     print "\n** GENPASS ERROR ---------------------------------------------------------";
     print "\n** ".@errmsg." Error(s) found";      # display number of errors   
     foreach my $err (@errmsg) {             # display error messages
         print "\n".$err;
     }
     print "\n**\n** Type genpass --help for command usage\n";
     print "** -----------------------------------------------------------------------\n\n";
     exit();                         # exit script
 }
 ## END VALIDATE INPUT
 
 ## START MAIN SCRIPT
 ## -----------------------------------------------------
 # From 1 to qty
 
 for ( 1..$flags{qty} ) {
     print &GenPass( $ARGV[0] )."\n";
 }
 exit();
 
 ## END MAIN SCRIPT
 
 ## FUNCTION DEFINITIONS
 ## -----------------------------------------------------
 sub GenPass() {
     my ($pwdlen) = @_;
     my $limit = length( $pwdchars );
     my $pwd = '';
    
     for ( 0..$pwdlen-1 ) {
             $pwd .= substr( $pwdchars, rand( $limit ), 1 );
     }
 
     return $pwd;
 }
 
 # use Here-Documents to display usage text
 sub DisplayUsage {

     print "
 
   Usage: genpass [-snulcqX] LENGTH
   Generate secure passwords LENGTH characters long.
    
     -s, --symbols\tExclude symbols.
     -n, --numbers\tExclude numbers.
     -u, --uppercase\tExclude uppercase letters.
     -l, --lowercase\tExclude lowercase letters.
 
     -c, --confusable\tExclude confusable characters like: l,I,1,0,O
        
     -qX\t\t\tCreate X number of passwords.
        
     --help\t\tDisplay Usage information.
     --ver, --version\tDisplay version and license information.
        
   Report bugs, comments, and questions to jbrown_home\@yahoo.ca
    
 ";
 }
 
 # use Here-Documents to display version text
 sub DisplayVersion {
 print "
   genpass v1.0 (06.2007) Copyright 2007 Jon Brown
 
   This is free software.  You may redistribute copies of it under the terms of
   the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
   There is NO WARRANTY, to the extent permitted by law.
 
   Written by Jon Scott Brown
 ";
 }
 __END__

Sunday, December 14, 2008

Special Character replacement in PHP

$code_entities_match = array('
','--','&quot;','!','@','#','$','%','^','&','*','(',')','_','+','{','}','|',':','"','<','>','?','[',']','\\',';',"'",',','.','/','*','+','~','`','=');

$parent_linkid=str_replace($code_entities_match,"",$parent_linkid);

Thursday, November 13, 2008

Apache SSL Parser

$log='x.x.x.x - - [13/Nov/2008:18:57:54 +0530] "GET
/bigboos2/include/html/menu/menu_tpl.js HTTP/1.1" 304 -
"https://x.x.x.x/bigboos2/dashboard.cgi" "Mozilla/5.0 (X11; U; Linux
i686; en-US; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11"';


$log=~/(\d+.\d+.\d+.\d+)\s+-\s+(\w+)*[-]*\s+\[\d+\/\w+\/\d+:\d+:\d+:\d+\s+[-+]\d+]\s+"(.*)HTTP\/\d+.\d+"\s+(\d+)\s+[\d+
-]\s+"(.*)"\s+"(\w+)(.*)"/g;

print "IP:$1\n";
print "User:$2\n";
print "Request:$3\n";
print "Code:$4\n";
print "Refer:$5\n";
print "Agent:$6$7\n";