<?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-12465301</id><updated>2011-12-14T19:00:43.252-08:00</updated><title type='text'>My php scripts!</title><subtitle type='html'>php scripts I use.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://myphpscripts.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://myphpscripts.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Costin</name><uri>http://www.blogger.com/profile/12900002144851128313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_OhU7J0Iv-ZQ/Sz6hb_oaqhI/AAAAAAAAEBE/dmai3j1oxIY/S220/97713c75f83c755297f3fa1cb2203222.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12465301.post-113313073522450660</id><published>2005-11-27T14:27:00.000-08:00</published><updated>2005-11-27T14:38:19.016-08:00</updated><title type='text'>PHPSESSID and GOOGLE</title><content type='html'>PHPSESSID suck when PHP will add a unique PHPSESSID query pair to you links. It's all about session.use_trans_sid that must be off if you want Google to eat your site alive. And guess what! It's easy to set it off.&lt;br /&gt;Just make a blank file with Notepad and rename it &lt;strong&gt;.htaccess&lt;/strong&gt;! Open this file, paste this code:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt; if module &gt;&lt;br /&gt;php_flag session.use_trans_sid off&lt;br /&gt;&lt; /if module &gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Note: Remove all spaces inside &lt; &gt;!!!!!&lt;br /&gt;... save file, upload it in your root directory.&lt;br /&gt;&lt;br /&gt;Have fun :P&lt;br /&gt;&lt;br /&gt;Source: &lt;a href="http://www.mt-dev.com/2002/06/why-you-should-disable-phps-session-use_trans_sid/"&gt;Why You Should Disable PHP’s session use_trans_sid&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ah. As a bonus ... if you want .htm and .html files to execute your php scripts please add this code in the same .htaccess file:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;AddType application/x-httpd-php .php .html .htm&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Dont forget to upload it! :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12465301-113313073522450660?l=myphpscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://myphpscripts.blogspot.com/2005/11/phpsessid-and-google.html' title='PHPSESSID and GOOGLE'/><link rel='replies' type='application/atom+xml' href='http://myphpscripts.blogspot.com/feeds/113313073522450660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12465301&amp;postID=113313073522450660' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/113313073522450660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/113313073522450660'/><link rel='alternate' type='text/html' href='http://myphpscripts.blogspot.com/2005/11/phpsessid-and-google.html' title='PHPSESSID and GOOGLE'/><author><name>Costin</name><uri>http://www.blogger.com/profile/12900002144851128313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_OhU7J0Iv-ZQ/Sz6hb_oaqhI/AAAAAAAAEBE/dmai3j1oxIY/S220/97713c75f83c755297f3fa1cb2203222.png'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12465301.post-113020964962443076</id><published>2005-10-24T20:01:00.000-07:00</published><updated>2005-10-24T20:10:09.700-07:00</updated><title type='text'>[PHP] Page Generation Time</title><content type='html'>This is a cool script that will help you see the number of seconds needed to load your pages.&lt;br /&gt;&lt;br /&gt;/* This part of the script goes at the top of your page */&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;$starttime = explode(' ', microtime());&lt;br /&gt;$starttime = $starttime[1] + $starttime[0];&lt;/blockquote&gt;&lt;br /&gt;/* This part of the script goes where you want load time to be displayed */&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;$mtime = explode(' ', microtime());&lt;br /&gt;$totaltime = $mtime[0] + $mtime[1] - $starttime;&lt;br /&gt;printf('Page loaded in %.3f seconds.', $totaltime);&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Credits:&lt;br /&gt;evidence / &lt;a href="http://www.sythe.org/image-vp175499.html"&gt;http://www.sythe.org/image-vp175499.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12465301-113020964962443076?l=myphpscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://myphpscripts.blogspot.com/2005/10/php-page-generation-time.html' title='[PHP] Page Generation Time'/><link rel='replies' type='application/atom+xml' href='http://myphpscripts.blogspot.com/feeds/113020964962443076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12465301&amp;postID=113020964962443076' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/113020964962443076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/113020964962443076'/><link rel='alternate' type='text/html' href='http://myphpscripts.blogspot.com/2005/10/php-page-generation-time.html' title='[PHP] Page Generation Time'/><author><name>Costin</name><uri>http://www.blogger.com/profile/12900002144851128313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_OhU7J0Iv-ZQ/Sz6hb_oaqhI/AAAAAAAAEBE/dmai3j1oxIY/S220/97713c75f83c755297f3fa1cb2203222.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12465301.post-111518286672644590</id><published>2005-05-03T21:42:00.000-07:00</published><updated>2005-05-03T22:04:02.776-07:00</updated><title type='text'>Connect to a MySQL database using PHP</title><content type='html'>Create a file named for example cfg_db_connect.php with the following code:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;function dbopen()&lt;br /&gt;{&lt;br /&gt;global $connect;&lt;br /&gt;global $mydbuser;&lt;br /&gt;global $mydbpassw;&lt;br /&gt;global $mymaindb;&lt;br /&gt;&lt;br /&gt;$connect = mysql_connect( "localhost", $mydbuser, $mydbpassw );&lt;br /&gt;if ( ! $connect ) die( "Can't connect to database." );&lt;br /&gt;mysql_select_db( $mymaindb, $connect) or die ( "Error:".mysql_error() );&lt;br /&gt;return $connect;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function dbclose($connect)&lt;br /&gt;{&lt;br /&gt;mysql_close($connect);&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// please change the values:&lt;br /&gt;&lt;br /&gt;$dbuser="MY_USER";&lt;br /&gt;$dbpassw="MY_PASSWORD";&lt;br /&gt;$maindb="MY_DATABASE";&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can use this function in any other file that need mysql connection:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;include ("cfg_db_connect.php");&lt;br /&gt;$connect=dbopen();&lt;br /&gt;$query="SELECT something FROM table WHERE condition";&lt;br /&gt;$request=mysql_query($query,$connect);&lt;br /&gt;dbclose($connect);&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12465301-111518286672644590?l=myphpscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://myphpscripts.blogspot.com' title='Connect to a MySQL database using PHP'/><link rel='replies' type='application/atom+xml' href='http://myphpscripts.blogspot.com/feeds/111518286672644590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12465301&amp;postID=111518286672644590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/111518286672644590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/111518286672644590'/><link rel='alternate' type='text/html' href='http://myphpscripts.blogspot.com/2005/05/connect-to-mysql-database-using-php.html' title='Connect to a MySQL database using PHP'/><author><name>Costin</name><uri>http://www.blogger.com/profile/12900002144851128313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_OhU7J0Iv-ZQ/Sz6hb_oaqhI/AAAAAAAAEBE/dmai3j1oxIY/S220/97713c75f83c755297f3fa1cb2203222.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12465301.post-111456649805234157</id><published>2005-04-26T18:22:00.000-07:00</published><updated>2005-05-05T09:05:55.563-07:00</updated><title type='text'>Non-alphanumeric characters in input fields!</title><content type='html'>&lt;p&gt;Let's say $mystring came from something like this:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;file1&lt;/strong&gt;.&lt;br /&gt;Input text field inside a form named mystring. Used form method: POST.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;file2&lt;/strong&gt;.&lt;br /&gt;&lt;code&gt;$mystring=$_POST['mystring'];&lt;br /&gt;function rvs ($argument)&lt;br /&gt;{&lt;br /&gt;return ereg_replace("[^a-zA-Z0-9]", "", $argument);&lt;br /&gt;}&lt;br /&gt;$result= rvs ($mystring);&lt;br /&gt;$a_1 = strlen($mystring);&lt;br /&gt;$a_2 = strlen($result);&lt;br /&gt;if($a_1 != $a_2)&lt;br /&gt;{&lt;br /&gt;echo "Error: Your input used non-alphanumeric characters!";&lt;br /&gt;exit;&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Look at this example for a better description of rvs() function:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function rvs ($argument)&lt;br /&gt;{&lt;br /&gt;return ereg_replace("[^a-zA-Z0-9]", "", $argument);&lt;br /&gt;}&lt;br /&gt;$example="Daniel - 20 years old - result 20%";&lt;br /&gt;$result = rvs ($example);&lt;br /&gt;echo $result;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This will print:&lt;br /&gt;&lt;code&gt;Daniel20yearsoldresult20&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Please post comments with a better way to do this ;).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12465301-111456649805234157?l=myphpscripts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://myphpscripts.blogspot.com/' title='Non-alphanumeric characters in input fields!'/><link rel='replies' type='application/atom+xml' href='http://myphpscripts.blogspot.com/feeds/111456649805234157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12465301&amp;postID=111456649805234157' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/111456649805234157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12465301/posts/default/111456649805234157'/><link rel='alternate' type='text/html' href='http://myphpscripts.blogspot.com/2005/04/non-alphanumeric-characters-in-input.html' title='Non-alphanumeric characters in input fields!'/><author><name>Costin</name><uri>http://www.blogger.com/profile/12900002144851128313</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://2.bp.blogspot.com/_OhU7J0Iv-ZQ/Sz6hb_oaqhI/AAAAAAAAEBE/dmai3j1oxIY/S220/97713c75f83c755297f3fa1cb2203222.png'/></author><thr:total>0</thr:total></entry></feed>
