<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1528136810151451844</id><updated>2012-02-16T04:20:14.487-08:00</updated><category term='search'/><category term='engine'/><category term='encryption'/><category term='encrypt'/><category term='login'/><category term='php'/><category term='friendly'/><category term='user'/><category term='database'/><category term='optimization'/><category term='calender'/><title type='text'>Developers' Island</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://macrosoftsolutions.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://macrosoftsolutions.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sumit Joshi</name><uri>http://www.blogger.com/profile/04400433661422337963</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://4.bp.blogspot.com/_WophflfOXyQ/Sh5dBdb22UI/AAAAAAAAAAM/frn3XRYrDD4/S220/joshisumitnet.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1528136810151451844.post-371031164556770896</id><published>2009-06-04T05:03:00.000-07:00</published><updated>2009-06-04T05:09:37.960-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='calender'/><title type='text'>Calender in PHP</title><content type='html'>&lt;?php&lt;br /&gt;# PHP Calendar : written by Sumit Joshi&lt;br /&gt;&lt;br /&gt;function generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array())&lt;br /&gt;{&lt;br /&gt;  $first_of_month = gmmktime(0,0,0,$month,1,$year);&lt;br /&gt;  #remember that mktime will automatically correct if invalid dates are entered&lt;br /&gt;  #for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998&lt;br /&gt;  # this provides a built in "rounding" feature to generate_calendar()&lt;br /&gt;&lt;br /&gt;  $day_names = array();&lt;br /&gt;  #generate all the day names according to the current locale&lt;br /&gt;  for($n=0,$t=(3+$first_day)*86400; $n&lt;7; $n++,$t+=86400) &lt;br /&gt;  #January 4, 1970 was a Sunday&lt;br /&gt;    $day_names[$n] = ucfirst(gmstrftime('%A',$t)); #%A means full textual day name&lt;br /&gt;&lt;br /&gt;  list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));&lt;br /&gt;  $weekday = ($weekday + 7 - $first_day) % 7; &lt;br /&gt;  #adjust for $first_day&lt;br /&gt;  $title   = htmlentities(ucfirst($month_name)).'&amp;nbsp;'.$year;  &lt;br /&gt;  #note that some locales don't capitalize month and day names&lt;br /&gt;&lt;br /&gt; #Begin calendar. Uses a real &lt;caption&gt;. &lt;br /&gt; @list($p, $pl) = each($pn); @list($n, $nl) = each($pn); &lt;br /&gt; #previous and next links, if applicable&lt;br /&gt; if($p) &lt;br /&gt;  $p = '&lt;span class="calendar-prev"&gt;'.($pl ? '&lt;a &lt;br /&gt;    href="'.htmlspecialchars($pl).'"&gt;'.$p.'&lt;/a&gt;' : $p).'&lt;/span&gt;&amp;nbsp;';&lt;br /&gt; if($n) &lt;br /&gt;  $n = '&amp;nbsp;&lt;span class="calendar-next"&gt;'.($nl ? '&lt;a &lt;br /&gt;   href="'.htmlspecialchars($nl).'"&gt;'.$n.'&lt;/a&gt;' : $n).'&lt;/span&gt;';&lt;br /&gt; $calendar = '&lt;table class="calendar"&gt;'."\n".&lt;br /&gt;  '&lt;caption class="calendar-month"&gt;'.$p.($month_href ? '&lt;a href="'.htmlspecialchars($month_href).'"&gt;'.$title.'&lt;/a&gt;' : $title).$n."&lt;/caption&gt;\n&lt;tr&gt;";&lt;br /&gt;&lt;br /&gt;if($day_name_length)&lt;br /&gt;{ &lt;br /&gt; #if the day names should be shown ($day_name_length &gt; 0)&lt;br /&gt; #if day_name_length is &gt;3, the full name of the day will be printed&lt;br /&gt; foreach($day_names as $d)&lt;br /&gt;  $calendar .= '&lt;th abbr="'.htmlentities($d).'"&gt;'.htmlentities($day_name_length &lt; 4 &lt;br /&gt;  ?substr($d,0,$day_name_length) : $d).'&lt;/th&gt;';&lt;br /&gt;  $calendar .= "&lt;/tr&gt;\n&lt;tr&gt;";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if($weekday &gt; 0) &lt;br /&gt;  $calendar .= '&lt;td colspan="'.$weekday.'"&gt;&amp;nbsp;&lt;/td&gt;'; #initial 'empty' days&lt;br /&gt;for($day=1,$days_in_month=gmdate('t',$first_of_month); $day&lt;=$days_in_month; $day++,$weekday++)&lt;br /&gt;{&lt;br /&gt; if($weekday == 7)&lt;br /&gt; {&lt;br /&gt; $weekday   = 0; #start a new week&lt;br /&gt; $calendar .= "&lt;/tr&gt;\n&lt;tr&gt;";&lt;br /&gt; }&lt;br /&gt; if(isset($days[$day]) and is_array($days[$day]))&lt;br /&gt; {&lt;br /&gt;  @list($link, $classes, $content) = $days[$day];&lt;br /&gt;   if(is_null($content))  &lt;br /&gt;     $content  = $day;&lt;br /&gt;     $calendar .= '&lt;td'.($classes ? ' class="'.htmlspecialchars($classes).'"&gt;' : &lt;br /&gt;         '&gt;').&lt;br /&gt;    ($link ? '&lt;a href="'.htmlspecialchars($link).'"&gt;'.$content.'&lt;/a&gt;' : &lt;br /&gt;    $content).'&lt;/td&gt;';&lt;br /&gt; }&lt;br /&gt; else &lt;br /&gt;    $calendar .= "&lt;td&gt;$day&lt;/td&gt;";&lt;br /&gt;}&lt;br /&gt; if($weekday != 7) &lt;br /&gt;   $calendar .= '&lt;td colspan="'.(7-$weekday).'"&gt;&amp;nbsp;&lt;/td&gt;'; &lt;br /&gt;   #remaining "empty" days&lt;br /&gt;   return $calendar."&lt;/tr&gt;\n&lt;/table&gt;\n";&lt;br /&gt;}&lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1528136810151451844-371031164556770896?l=macrosoftsolutions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://macrosoftsolutions.blogspot.com/feeds/371031164556770896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/06/calender-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/371031164556770896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/371031164556770896'/><link rel='alternate' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/06/calender-in-php.html' title='Calender in PHP'/><author><name>Sumit Joshi</name><uri>http://www.blogger.com/profile/04400433661422337963</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://4.bp.blogspot.com/_WophflfOXyQ/Sh5dBdb22UI/AAAAAAAAAAM/frn3XRYrDD4/S220/joshisumitnet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1528136810151451844.post-7791695677948412673</id><published>2009-06-04T04:49:00.000-07:00</published><updated>2009-06-04T04:56:35.948-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='friendly'/><category scheme='http://www.blogger.com/atom/ns#' term='engine'/><category scheme='http://www.blogger.com/atom/ns#' term='search'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='optimization'/><title type='text'>Search Engine Optimization(Friendly) PHP Script</title><content type='html'>PHP pages have a reputation of being more difficult (or at least different) to SEO than static HTML pages. Here?s an overview of the major issues encountered when trying to optimize PHP script for search engines. While this focuses on PHP much of it is still relevant to SEO'ing dynamic pages in general.&lt;br /&gt;PHP Speed&lt;br /&gt;&lt;br /&gt;  While page size does affect load time, spiders run on servers connected to high bandwidth networks, so download time is less important than the latency of the PHP script?s execution time. If a search engine spider follows a link on a site and is forced to wait too long for the server to process the PHP code behind that page, it may label your page as unresponsive.&lt;br /&gt;&lt;br /&gt;  The biggest delays in a PHP script typically are the database and loop code. Avoid making "SELECT * calls", instead explicitly name all the columns you want to retrieve, and if you are using MySQL, test your queries using the EXPLAIN statement. To optimize loops consider using duplicated code instead of loops that don't repeat very many times, also use as many static values, such as count($array) values inside the loop as you can, generating their values before the loop once.&lt;br /&gt;URL Cleanliness&lt;br /&gt;&lt;br /&gt;  A major goal in SEO'ing your PHP pages, is to make them look and act like static pages. If you have a large site you can use Apache to fake static looking URLs, or, with a smaller site, you can simply keep your GET variables to a useful minimum. In either case, however, never allow a spider to see links with different URL?s to the same content. If the URL is different, the page should be too.&lt;br /&gt;&lt;br /&gt;  One of the major problems most webmasters have with getting their dynamic pages to index is URL cleanliness. Since many dynamic pages are created with GET variables, lots of pages have URLs that look like:&lt;br /&gt;Page.php?var=lkdjdfhv&amp;var2=345&amp;var3=kfjdks&lt;br /&gt;&lt;br /&gt;  Most of the search engines will be able to follow this link, because it has 3 or under get variables (a good rule of thumb is to keep the number of GET variables passed in the URL to under 3), but any more than 3 variables and you will run into problems. Try using less GET variables, and make them more relevant, rather that useless id numbers use titles, and other keyword rich bits of text. &lt;br /&gt;  This is an example of a better URL:&lt;br /&gt;     Page.php?var=category&amp;var2=topic&lt;br /&gt;&lt;br /&gt;  If the page requires more variables you may want to consider combining the variables by delimiting them with a hyphen or another unused character, and then splitting the variable in the target page.&lt;br /&gt;Disabling Trans_sid&lt;br /&gt;&lt;br /&gt;  Possibly the biggest cause of webmaster frustration when SEO?ing php pages is PHP?s tendency to add session id numbers to links if cookies are rejected by the browser (Search engine spiders reject cookies). This will happen by default if your PHP installation was compiled with the ?enable-trans-sid option (and this is the default from version 4.2 onward), and it creates links with an additional, long nonsense looking GET variable. &lt;br /&gt;  In addition to making the links clunky this gives spiders different URLs with the same content, which makes them less likely to treat the pages individually, and possibly not even index them at all. A quick way to fix this is to disable the trans-id feature, if you have access, in php.ini by setting ?session.use_trans_sid? to false. If you don?t have access to change php.ini you can add this line to the .htaccess file in your root directory:&lt;br /&gt;&lt;IfModule mod_php4.c&gt; php_flag session.use_trans_sid off &lt;/IfModule&gt;&lt;br /&gt;Masking dymamic URLs&lt;br /&gt;&lt;br /&gt;  However the mere presence of a question mark in the URL will introduce a delay in google?s indexing of the page. This from Mike Grehan?s Interview with Daniel Dulitz of Google:&lt;br /&gt;&lt;br /&gt;    ?So the mere presence of a question mark in the URL doesn't throw us for a loop at all. We will crawl those pages more slowly than we do with pages without question marks in the URL. Purely because they've identified themselves as being dynamic and we certainly don't want to bring anyone's site down because we're hitting the database too hard.?&lt;br /&gt;&lt;br /&gt;  Small sites will not need to worry much about this delay as it means your server is hit every few minutes, not a few times a second, but for larger sites this can slow down your site?s inclusion into the index.&lt;br /&gt;Making dynamic pages look static without mod_rewrite&lt;br /&gt;&lt;br /&gt;  A way to mask bulky dynamic page URLs (and avoid the question mark delay) is Apache?s ForceType in combination with a PHP command to interpret URLs like: www.example.com/books/computers.html as referring to a page called ?books? which is executed as a PHP script (I usually make a link on the linux server from ?books.php? to ?book? to make editing the script easier). The function will return an array of the additional values, including the category ?computers?. This can be accomplished by inserting a line like this into the .htaccess file in the root of your web documents directory:&lt;br /&gt;&lt;Files *Directory Handle Name Here*&gt; ForceType application/x-httpd-php &lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;  *Directory Handle Name Here* should be replaced with the alias name you are giving to the fake directory you are creating. In this example:&lt;br /&gt;www.example.com/books/computers.html&lt;br /&gt;&lt;br /&gt;your .htaccess line would look like this:&lt;br /&gt;&lt;Files books&gt;ForceType application/x-httpd-php&lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;  You can then log into your server and create a link to the file ?books? or whatever directory alias you have choosen. This is done with the linux command "ln", or link, like this:&lt;br /&gt;$ Ln books.php books&lt;br /&gt;&lt;br /&gt;  This creates a link between the existing PHP script books.php and the non-existant ?books?. This way all requests for the directory "books" will be given to books.php, ie www.example.com/books/computers.html would be handled by books.php&lt;br /&gt;&lt;br /&gt;  Inside books.php you can use this function (available here) to extract values from the static-looking request URI?s:&lt;br /&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;function processURI() &lt;br /&gt;{&lt;br /&gt;    $request = explode("/",$_SERVER["REQUEST_URI"]);&lt;br /&gt;    $count = count($request);     &lt;br /&gt;    for ($i = 1 ; $i &lt; $count ; $i++) {              &lt;br /&gt;        $values["arg".$i] = $request[$i];   &lt;br /&gt;    }&lt;br /&gt;    return $values;   &lt;br /&gt;}&lt;br /&gt;?&gt;&lt;br /&gt;1&lt;br /&gt;&lt;br /&gt;So the above example of: www.example.com/books/computer.html would be processed like this:&lt;br /&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;$vals = processURI();&lt;br /&gt;$_GET[$vals[1]] = str_replace(".html", "", $vals[2]);&lt;br /&gt;?&gt;&lt;br /&gt;1&lt;br /&gt;&lt;br /&gt;With this, $_GET['books'] would equal "computer" similar to www.example.com/index.php?books=computer&lt;br /&gt;PHP?s SEO Advantages&lt;br /&gt;&lt;br /&gt;  A great advantage to using dynamic pages as opposed to static pages is the ability to create content that is constantly changing and updated in real time. RSS headlines, randomly circulating content and other automatically ?fresh? content can boost your ranks in Google, and many other engines.&lt;br /&gt;&lt;br /&gt;  Another advantage to using PHP is that you can make simple modifications to many scripts to create relevant and fresh page titles. Since this is the most important on page factor in SEO special attention should be given to creating title tags that accurately reflect the page?s current content. Any html templates or used in PHP pages can be altered to contain this line:&lt;br /&gt;&lt;!--&lt; title &gt;--&gt;&lt;br /&gt;  &lt;?=$page_title?&gt;&lt;br /&gt;&lt;!-- &lt; / title &gt;--&gt;&lt;br /&gt;&lt;br /&gt;  With this, $page_title can be set to a keyword rich test describing the page. Title text is also important in improving the click-through from SERP?s, so be sure that the title tags doesn?t read like spam, but more like a human created title.&lt;br /&gt;&lt;br /&gt;You can contact me at macrosoftsolutions@ymail.com&lt;br /&gt;Also see our website &lt;a href="http://www.themacrosoft.com"&gt;http://www.themacrosoft.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1528136810151451844-7791695677948412673?l=macrosoftsolutions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://macrosoftsolutions.blogspot.com/feeds/7791695677948412673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/06/search-engine-optimizationfriendly-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/7791695677948412673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/7791695677948412673'/><link rel='alternate' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/06/search-engine-optimizationfriendly-php.html' title='Search Engine Optimization(Friendly) PHP Script'/><author><name>Sumit Joshi</name><uri>http://www.blogger.com/profile/04400433661422337963</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://4.bp.blogspot.com/_WophflfOXyQ/Sh5dBdb22UI/AAAAAAAAAAM/frn3XRYrDD4/S220/joshisumitnet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1528136810151451844.post-8349714567016250900</id><published>2009-06-04T04:36:00.000-07:00</published><updated>2009-06-04T04:39:53.498-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='login'/><category scheme='http://www.blogger.com/atom/ns#' term='encrypt'/><category scheme='http://www.blogger.com/atom/ns#' term='user'/><category scheme='http://www.blogger.com/atom/ns#' term='encryption'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>PHP Login Page with Entryption</title><content type='html'>One of the most popular uses of PHP is to secure acess to various portions of a website based on a user's login name and password. This is a failry simple thing to do and in this tutorial I will show you how to construct a PHP login form using the functions in PHP.&lt;br /&gt;&lt;br /&gt;  The first step to building a simple user authentication system is to create the table in your database that stores the login information. In this script we use one mysql table called"'logins", and the login name and password fields are stored in a hashed (md5) and encrypted state for security reasons. The function that issues the SQL command to create this table looks like this:&lt;br /&gt;function MakeTableLogins($database, $host, $db_user, $db_pass) &lt;br /&gt;{&lt;br /&gt;  //create the logins table&lt;br /&gt;  $linkID = mysql_connect($host, $db_user, $db_pass);&lt;br /&gt;  mysql_select_db($database, $linkID);&lt;br /&gt;  mysql_query("create table logins (user char(32), pasword char(32))", $linkID);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;  This should be called by passing the name of the database, database server host and the username password for that database server.&lt;br /&gt;&lt;br /&gt;  We only use one way encryption because our script never needs to know the actual plaintext of the username or password, its only must decide if the supplied information matches the information from the table. This is done by performing the same hash/encrypt routine on the inputted data and then comparing those values to the database. The function this script uses to return the encrypted data looks like this:&lt;br /&gt;&lt;br /&gt;function Encrypt($string) &lt;br /&gt;{&lt;br /&gt;  //hash then encrypt a string&lt;br /&gt;  $crypted = crypt(md5($string), md5($string));&lt;br /&gt;  return $crypted;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The next thing our script will have to be able to do is to add the requried users records to the table. We cannot do this by hand because the data is encrypted so there is a function that handles this also:&lt;br /&gt;&lt;br /&gt;function AddUser($database, $host, $db_user, $db_pass, $username, $password) &lt;br /&gt;{ &lt;br /&gt;  //add user to table logins&lt;br /&gt;  $linkID = mysql_connect($host, $db_user, $db_pass);&lt;br /&gt;  mysql_select_db($database, $linkID);&lt;br /&gt;  $password = encrypt($password);&lt;br /&gt;  $username = encrypt($username);&lt;br /&gt;  mysql_query("insert into logins values ('$username', '$password')", $linkID);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The next and final piece to our script is the actual login function. This function is passed arguments of the database login information, and the username and password the user supplied. The function returns true if the user information matches the data in the table exactly and false if they do no match.&lt;br /&gt;&lt;br /&gt;function Login($database, $host, $db_user, $db_pass, $user, $password) &lt;br /&gt;{ &lt;br /&gt;  //attempt to login false if invalid true if correct&lt;br /&gt;  $auth = false;&lt;br /&gt;  $user = Encrypt($user);&lt;br /&gt;&lt;br /&gt;  $linkID = mysql_connect($host, $db_user, $db_pass);&lt;br /&gt;  mysql_select_db("$database", $linkID);&lt;br /&gt;  $result = mysql_query("select password from logins where user = '$user'", $linkID);&lt;br /&gt;  $pass = mysql_fetch_row($result);&lt;br /&gt;  mysql_close($linkID);&lt;br /&gt;&lt;br /&gt;  if ($pass[0] === (Encrypt($password))) &lt;br /&gt;  {&lt;br /&gt;    $auth = true;&lt;br /&gt;  }&lt;br /&gt;  return $auth;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1528136810151451844-8349714567016250900?l=macrosoftsolutions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://macrosoftsolutions.blogspot.com/feeds/8349714567016250900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/06/php-login-page-with-entryption.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/8349714567016250900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/8349714567016250900'/><link rel='alternate' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/06/php-login-page-with-entryption.html' title='PHP Login Page with Entryption'/><author><name>Sumit Joshi</name><uri>http://www.blogger.com/profile/04400433661422337963</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://4.bp.blogspot.com/_WophflfOXyQ/Sh5dBdb22UI/AAAAAAAAAAM/frn3XRYrDD4/S220/joshisumitnet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1528136810151451844.post-6101159268414162484</id><published>2009-05-28T07:40:00.001-07:00</published><updated>2009-05-28T07:42:37.937-07:00</updated><title type='text'>Encryption and Decryption function in PHP</title><content type='html'>&lt;?php&lt;br /&gt;/*&lt;br /&gt;Description : A function with a very simple but powerful xor method to encrypt&lt;br /&gt;              and/or decrypt a string with an unknown key. Implicitly the key is&lt;br /&gt;              defined by the string itself in a character by character way.&lt;br /&gt;              There are 4 items to compose the unknown key for the character&lt;br /&gt;              in the algorithm&lt;br /&gt;              1.- The ascii code of every character of the string itself&lt;br /&gt;              2.- The position in the string of the character to encrypt&lt;br /&gt;              3.- The length of the string that include the character&lt;br /&gt;              4.- Any special formula added by the programmer to the algorithm&lt;br /&gt;                  to calculate the key to use&lt;br /&gt;*/&lt;br /&gt;FUNCTION ENCRYPT_DECRYPT($Str_Message) &lt;br /&gt;{&lt;br /&gt;//Function : encrypt/decrypt a string message v.1.0  without a known key&lt;br /&gt;//Author   : Sumit Joshi&lt;br /&gt;//Email    : joshisumitnet@yahoo.com&lt;br /&gt;//Date     : 28-May-2009&lt;br /&gt;    $Len_Str_Message=STRLEN($Str_Message);&lt;br /&gt;    $Str_Encrypted_Message="";&lt;br /&gt;    FOR ($Position = 0;$Position&lt;$Len_Str_Message;$Position++)&lt;br /&gt;    {&lt;br /&gt;        // long code of the function to explain the algoritm&lt;br /&gt;        //this function can be tailored by the programmer modifyng the formula&lt;br /&gt;        //to calculate the key to use for every character in the string.&lt;br /&gt;        $Key_To_Use = (($Len_Str_Message+$Position)+1); // (+5 or *3 or ^2)&lt;br /&gt;        //after that we need a module division because can´t be greater than 255&lt;br /&gt;        $Key_To_Use = (255+$Key_To_Use) % 255;&lt;br /&gt;        $Byte_To_Be_Encrypted = SUBSTR($Str_Message, $Position, 1);&lt;br /&gt;        $Ascii_Num_Byte_To_Encrypt = ORD($Byte_To_Be_Encrypted);&lt;br /&gt;        $Xored_Byte = $Ascii_Num_Byte_To_Encrypt ^ $Key_To_Use;  //xor operation&lt;br /&gt;        $Encrypted_Byte = CHR($Xored_Byte);&lt;br /&gt;        $Str_Encrypted_Message .= $Encrypted_Byte;&lt;br /&gt;       &lt;br /&gt;        //short code of  the function once explained&lt;br /&gt;        //$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));&lt;br /&gt;    }&lt;br /&gt;    RETURN $Str_Encrypted_Message;&lt;br /&gt;} &lt;br /&gt;//end function&lt;br /&gt;&lt;br /&gt;//Usage of above function &lt;br /&gt;&lt;br /&gt;$Str_Test="This is a sample text which shows an Encryped and Decrypted code.";&lt;br /&gt;ECHO $Str_Test."&lt;br&gt;";&lt;br /&gt;$Str_Test2 = ENCRYPT_DECRYPT($Str_Test);&lt;br /&gt;ECHO $Str_Test2."&lt;br&gt;&lt;br&gt;";&lt;br /&gt;$Str_Test3 = ENCRYPT_DECRYPT($Str_Test2);&lt;br /&gt;ECHO "&lt;br&gt;".$Str_Test3."&lt;br&gt;"; &lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1528136810151451844-6101159268414162484?l=macrosoftsolutions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://macrosoftsolutions.blogspot.com/feeds/6101159268414162484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/05/php-description-function-with-very.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/6101159268414162484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/6101159268414162484'/><link rel='alternate' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/05/php-description-function-with-very.html' title='Encryption and Decryption function in PHP'/><author><name>Sumit Joshi</name><uri>http://www.blogger.com/profile/04400433661422337963</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://4.bp.blogspot.com/_WophflfOXyQ/Sh5dBdb22UI/AAAAAAAAAAM/frn3XRYrDD4/S220/joshisumitnet.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1528136810151451844.post-4535240660344408181</id><published>2009-05-28T02:33:00.000-07:00</published><updated>2009-05-28T02:40:54.800-07:00</updated><title type='text'>Convert Digits to Word in C#.NET 2008</title><content type='html'>//This methos converts Digits to Words&lt;br /&gt;//Implementation is to just copy this method and use it.&lt;br /&gt;//Pass any number and will get string in return.&lt;br /&gt;//Example:   120345&lt;br /&gt;//Output is :One Lac(s) Twenty Thousands Fourty Five Only&lt;br /&gt;&lt;br /&gt;private string DigitToWord(long n)&lt;br /&gt;{&lt;br /&gt;   string[] list = new string[] { "One", "Two", "Three", "Four", "Five", "Six",  "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Ninteen", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninty" };&lt;br /&gt;   string[] pos = new string[] { "Arab", "Crore", "Lac(s)", "Thousand", "Hundred" };&lt;br /&gt;   int[] arr = new int[10];&lt;br /&gt;   int i = 0, j, k, count, opt = 1;&lt;br /&gt;   string strWord = "";&lt;br /&gt;   count = 0;&lt;br /&gt;   if (n == 0)&lt;br /&gt;      strWord = "zero";&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;      j = 0;&lt;br /&gt;      while (n != 0)&lt;br /&gt;      {&lt;br /&gt;         arr[j] = (int)n % 10;&lt;br /&gt;         n = n / 10;&lt;br /&gt;         count++;&lt;br /&gt;         j++;&lt;br /&gt;      }&lt;br /&gt;      for (i = count - 1; i &gt;= 0; i--)&lt;br /&gt;      {&lt;br /&gt;         k = (9 - i) / 2;&lt;br /&gt;         j = arr[i];&lt;br /&gt;         if (j == 0)&lt;br /&gt;            continue;&lt;br /&gt;         else&lt;br /&gt;         {&lt;br /&gt;            if (i &gt; 2)&lt;br /&gt;            {&lt;br /&gt;               if (i % 2 != 0)&lt;br /&gt;               {&lt;br /&gt;                  strWord += " " + list[j - 1];&lt;br /&gt;                  strWord += " " + pos[k];&lt;br /&gt;               }&lt;br /&gt;               if (i % 2 == 0)&lt;br /&gt;               {&lt;br /&gt;                   if (j &lt; 2)&lt;br /&gt;                      arr[i - 1] = (j * 10) + arr[i - 1];&lt;br /&gt;                   else if (j != 1)&lt;br /&gt;                      strWord += " " + list[17 + j];&lt;br /&gt;               }&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;               if (i == 2)&lt;br /&gt;                   strWord += " " + list[j - 1] + " hundred ";&lt;br /&gt;               else if (i == 1)&lt;br /&gt;               {&lt;br /&gt;                   if (j == 1)&lt;br /&gt;                      arr[i - 1] = (j * 10) + arr[i - 1];&lt;br /&gt;                   else if (j != 1)&lt;br /&gt;                      strWord += " " + list[17 + j];&lt;br /&gt;               }&lt;br /&gt;               else if (i == 0)&lt;br /&gt;                   strWord += " " + list[j - 1];&lt;br /&gt;            }&lt;br /&gt;         }&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;   return (strWord + " Only");&lt;br /&gt;}&lt;br /&gt;//End of Method&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1528136810151451844-4535240660344408181?l=macrosoftsolutions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://macrosoftsolutions.blogspot.com/feeds/4535240660344408181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/05/convert-digits-to-word-in-cnet-2008.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/4535240660344408181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1528136810151451844/posts/default/4535240660344408181'/><link rel='alternate' type='text/html' href='http://macrosoftsolutions.blogspot.com/2009/05/convert-digits-to-word-in-cnet-2008.html' title='Convert Digits to Word in C#.NET 2008'/><author><name>Sumit Joshi</name><uri>http://www.blogger.com/profile/04400433661422337963</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://4.bp.blogspot.com/_WophflfOXyQ/Sh5dBdb22UI/AAAAAAAAAAM/frn3XRYrDD4/S220/joshisumitnet.jpg'/></author><thr:total>0</thr:total></entry></feed>
