<?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:blogger='http://schemas.google.com/blogger/2008' 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-1141247975054932064</id><updated>2025-06-06T06:10:19.072-07:00</updated><category term="Tutorials"/><category term="PHP"/><category term="CSS"/><category term="Blogging"/><category term="Javascript"/><category term="Demos"/><category term="SEO"/><category term="Design"/><category term="Hosting"/><category term="Reviews"/><category term="Domain"/><category term="Hacking"/><category term="Mysql"/><category term=".htaccess"/><category term="Ajax"/><category term="Photoshop"/><category term="Projects"/><category term="Security"/><category term="apache"/><category term="server"/><title type='text'>TheCodePress</title><subtitle type='html'>Learn web design and development, tutorials, tips and tricks :: TheCodePress</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default?start-index=26&amp;max-results=25'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>30</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-4996843157038343879</id><published>2014-03-18T06:07:00.000-07:00</published><updated>2014-03-18T06:15:02.689-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Security"/><title type='text'>Cross site request forgery (CSRF) Protection in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Nowadays almost every website applies CSRF protection in their forms to make it more secure and safe. In this post i&#39;ll be first create a Class called Security and then we&#39;ll be making some methods to achieve the goal of making a Cross Site Request Forgery secure forms. Because of Cross site request forgery vulnerability an attacker can simply submit or process the form on behalf of the user without knowing of the users. This kinds of attacks are mainly done on E-commerce websites to place bogus orders.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;b&gt;Creating the Class:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=3CrVGx0s&quot;&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;Using the Class:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=h274vEG0&quot;&gt;&lt;/script&gt;
&lt;/div&gt;
What we are doing here is first creating the class and then creating the &#39;Static&#39; methods. The first thing what we have done is to get the token and then to inject it into our HTML using hidden input field. We have chosen hidden input type because we don&#39;t want the token (hash) to be displayed on our webpage.&lt;br /&gt;
We are also saving the token in the session so that we can verify it when user submits the form.&lt;br /&gt;
&lt;br /&gt;
To verify the token we have build up a method called &#39;checkToken()&#39; which firsts checks whether the token in set or not and then checks whether the token submitted by the user matches the token saved in our session. If it is then it first unset the session and then it returns a boolean value TRUE. If not then it returns FALSE.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note:&lt;/b&gt;&lt;br /&gt;
Make sure you before using the Class you use session_start() function to start the session.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/4996843157038343879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2014/03/csrf-protection.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4996843157038343879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4996843157038343879'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2014/03/csrf-protection.html' title='Cross site request forgery (CSRF) Protection in PHP'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-392716609931544792</id><published>2014-02-22T05:00:00.000-08:00</published><updated>2014-02-22T05:00:47.879-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Validating file extension in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
While making a file uploading or sharing system many do mistakes while adding the extension checking functionality and because of that many users are able to upload vulnerable files such as upload a PHP or Javascript or any other file. To prevent it what we do is to make a list of allowed extensions. When the user will upload the file then we&#39;ll retrieve the file extension and check whether that file extension is in our list or not. This makes a beautiful layer of security and it&#39;s important to do it.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;lead&quot;&gt;&lt;b&gt;
What mistakes many do?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
The mistakes what many people do is to check the MIME type. It&#39;s not recommended to compare the MIME type. Because MIME type can be changed.&lt;br /&gt;
For example, let&#39;s take that a user has uploaded a PHP file which contains some terrible code that can produce a DDOS attack on your website. So if he has successfully uploaded that file and shared the URL to access it. If 10 users click on the same URL, then probably your website will go down. This will happen because of the server got crashed or if your host is strict against bandwidth then obviously the host will shut your website down.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;lead&quot;&gt;&lt;b&gt;
What&#39;s the best option to protect against this problems?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
The best option is to add a file extension check. So whenever a user tries to upload any file our script will first check for the extension. If the extension is in the list then the file can go for other checks like size etc. But if it&#39;s not in the list then we&#39;ll show an error to the user to notify him about it.&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;a class=&quot;btn btn-warning btn-lg disabled&quot; href=&quot;https://www.blogger.com/blogger.g?blogID=1141247975054932064#&quot; target=&quot;_blank&quot;&gt;Live Demo&lt;/a&gt; &lt;a class=&quot;btn btn-primary btn-lg&quot; href=&quot;https://app.box.com/s/bkw33mok2hnjchwmpasi&quot; target=&quot;_blank&quot;&gt;Download Now&lt;/a&gt;
&lt;/center&gt;
&lt;br /&gt;
&lt;b&gt;Here&#39;s the function:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=UDwY8dJG&quot;&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;b&gt;Example usage:&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=BQM4dkuT&quot;&gt;&lt;/script&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/392716609931544792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2014/02/file-extension-php.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/392716609931544792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/392716609931544792'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2014/02/file-extension-php.html' title='Validating file extension in PHP'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-3762624101124097043</id><published>2014-01-14T10:59:00.000-08:00</published><updated>2014-02-26T16:59:52.651-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Projects"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Validating and Embedding Youtube and Vimeo video dynamically using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;
&lt;img height=&quot;226&quot; src=&quot;http://blogs.oregonstate.edu/instructionaldesign/files/2011/03/YouTube-vs-Vimeo.jpg&quot; style=&quot;-webkit-user-select: none;&quot; width=&quot;320&quot; /&gt;&lt;/div&gt;
This function will help you to embed Youtube and Vimeo video dynamically. I made this for a project and now sharing it with you guys to use it in your projects or applications.&lt;br /&gt;
At the moment it&#39;s supporting Youtube and Vimeo URLs but soon i&#39;ll be adding support for other websites like Daliymotion etc.. When it will be completed i&#39;ll also share it with you through Github so follow me on Github&lt;a href=&quot;https://github.com/thecodepress&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;https://github.com/thecodepress&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here&#39;s the function:&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;function v_embed($url) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$video = Array();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$url = &quot;video://&quot;.$url;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;if(strpos($url, &quot;youtube&quot;)==true) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $host_pos = strpos($url, &quot;youtube&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $video[&quot;host&quot;] = &quot;youtube&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}else if(strpos($url, &quot;vimeo&quot;)==true) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $host_pos = strpos($url, &quot;vimeo&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $video[&quot;host&quot;] = &quot;vimeo&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $error = true;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;if($video[&quot;host&quot;]==&quot;youtube&quot;) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $video[&quot;id&quot;] = substr($url, strpos($url, &quot;watch?v=&quot;)+8);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}else if($video[&quot;host&quot;]==&quot;vimeo&quot;) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $video[&quot;id&quot;] = substr($url, strpos($url, &quot;.com/&quot;)+5);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; $error = true;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;if(isset($error)) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return false;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; return $video;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Example Usage:&lt;/b&gt;&lt;br /&gt;
After pasting the code it&#39;s looking non-indented so it&#39;s suggested to download the source files of this tutorial which contain the example.&lt;br /&gt;
&lt;br /&gt;
Don&#39;t forget it&#39;s just a small piece of code which is used for a project..so if you find any changes then you can comment it below or if you want you can use it anywhere. Soon a repository will be available on Github which will support many other video platforms.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://app.box.com/s/o4irzv3kq1cuvhhhi8ll&quot; target=&quot;_blank&quot;&gt;DOWNLOAD SOURCE FILES&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;br /&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/3762624101124097043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2014/01/validating-and-embedding-youtube-and.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/3762624101124097043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/3762624101124097043'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2014/01/validating-and-embedding-youtube-and.html' title='Validating and Embedding Youtube and Vimeo video dynamically using PHP'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-4452392275378086263</id><published>2014-01-14T09:20:00.000-08:00</published><updated>2014-02-26T16:59:52.659-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term=".htaccess"/><category scheme="http://www.blogger.com/atom/ns#" term="apache"/><category scheme="http://www.blogger.com/atom/ns#" term="server"/><title type='text'>Making URLs SEO friendly using .htaccess</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;
&lt;img src=&quot;http://i1-news.softpedia-static.com/images/news2/Apache-htaccess-Guide-2.png&quot; style=&quot;-webkit-user-select: none;&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
Making URLs SEO friendly is tried by many web developers and they use .htaccess to achieve it. Before proceeding to use .htaccess method you should enable Rewrite Module on your server. By default it&#39;s enabled.&lt;br /&gt;
&lt;br /&gt;
By using this method you can remove the extension of a file and make it accessible without it&#39;s extension.&lt;br /&gt;
For example: http://www.example.com/example.php to http://www.example.com/example&lt;br /&gt;
&lt;br /&gt;
That&#39;s quite interesting to have pretty URLs for search engines to index. Because the crawler index it according to the keyword.&lt;br /&gt;
&lt;br /&gt;
Here the code which you have save in the root directory of your server.&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;RewriteEngine on&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;RewriteCond %{REQUEST_FILENAME} !-d&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;RewriteCond %{REQUEST_FILENAME}\.php -f&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;RewriteRule ^(.*)$ $1.php&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;https://app.box.com/s/ut7086nl6r5x8ynn8tmk&quot; target=&quot;_blank&quot;&gt;DOWNLOAD SOURCE FILES&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/4452392275378086263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2014/01/making-urls-seo-friendly-using-htaccess.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4452392275378086263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4452392275378086263'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2014/01/making-urls-seo-friendly-using-htaccess.html' title='Making URLs SEO friendly using .htaccess'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-5642406587237796836</id><published>2014-01-14T08:58:00.000-08:00</published><updated>2014-02-26T16:59:52.686-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Using Gmail’s SMTP as your SMTP Server with a PHP example.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://1.bp.blogspot.com/-ItotSe5VZDo/UtVr8Yz7JCI/AAAAAAAAAE4/4ixvTFwNPOI/s1600/email.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;212&quot; src=&quot;http://1.bp.blogspot.com/-ItotSe5VZDo/UtVr8Yz7JCI/AAAAAAAAAE4/4ixvTFwNPOI/s320/email.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;Introduction:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Gmail provides amazing features for developers; they provide developers to use their SMTP server to send emails from the application. In this article we’ll be configuring Gmail’s SMTP server for our application, we’ll also use an open source project called &lt;a href=&quot;https://github.com/PHPMailer/PHPMailer&quot; target=&quot;_blank&quot;&gt;PHPmailer &lt;/a&gt;to send email from our Application.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;b&gt;Advantages:&lt;/b&gt;&lt;br /&gt;
Using Gmail’s SMTP servers for your application assures you that your email is sent, whereas sometimes when we use our own SMTP server we face problems like getting blocked or marked as spam by the automated spam filtering features. Another benefit I’ll like to mention here is if you use Gmail’s SMTP server then the emails which are sent from your application will be stored in Gmail’s Database. Another reason for using Gmail’s SMTP is that it’s not using Port 25 because there are many ISPs who are blocking the emails sent using Port 25.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Points to be noted:&lt;/b&gt;&lt;br /&gt;
Before starting to configure the Gmail’s SMTP server, it’s important for you to know that Gmail’s SMTP server only allows 99 emails per day. It means that you can only send 99 emails every day. The limit before was 250 emails per day, but because of high usage the limit decreased and came from 250 to 99 emails per day. Second point to note is that Gmail’s SMTP server requires authentication before sending emails. So make sure you have the password of the email which you’ll be using to send emails.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Configuration:&lt;/b&gt;&lt;br /&gt;
First you’ll need to login into Gmail account. After logging in navigate the settings button at the top right corner of your browser.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://2.bp.blogspot.com/-EOcywE9D0go/UtVotS1MXlI/AAAAAAAAAEQ/DlKmLxveLxk/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;http://2.bp.blogspot.com/-EOcywE9D0go/UtVotS1MXlI/AAAAAAAAAEQ/DlKmLxveLxk/s320/1.png&quot; width=&quot;262&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
Now click on Settings, after clicking you’ll see a page like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://3.bp.blogspot.com/-2ubmxriur1U/UtVo8cBPNII/AAAAAAAAAEY/hCVqw1Jwsrk/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;213&quot; src=&quot;http://3.bp.blogspot.com/-2ubmxriur1U/UtVo8cBPNII/AAAAAAAAAEY/hCVqw1Jwsrk/s400/2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Now click on Forwarding and POP/IMAP then you’ll see a like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://4.bp.blogspot.com/-ve6UjFsbY3U/UtVpRNE_FqI/AAAAAAAAAEg/Wekwc_pQ8k0/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;http://4.bp.blogspot.com/-ve6UjFsbY3U/UtVpRNE_FqI/AAAAAAAAAEg/Wekwc_pQ8k0/s400/3.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
Now just make sure all the setting which is shown above is the same for your account. If not then you can do it, it’s damn easy to do.&lt;/div&gt;
&lt;div&gt;
Below are the SMTP information which you’ll need to use in your application.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SMTP Server:&lt;/b&gt; smtp.gmail.com&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SMTP Port:&lt;/b&gt; 465&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SMTP Username:&lt;/b&gt; (your gmail email address, eg: example@gmail.com)&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SMTP Password:&lt;/b&gt; (your gmail account password)&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;SMTP TLS/SSL:&lt;/b&gt; yes&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;Example Application:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
Let us make an example PHP application which sends email using Gmail’s SMTP server.&lt;/div&gt;
&lt;div&gt;
In this example we’ll be using PHPmailer which is an open source project you can know more about it on their official Github. Here’s the PHP code:&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;function mail_sender($to, $subject, $body) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;require_once &#39;class.phpmailer.php&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$from = &quot;YOU_EMAIL_ADDRESS&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail = new PHPMailer();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;IsSMTP(true);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;SMTPAuth = true;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;Mailer = &quot;smtp&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;Host = &quot;tls://smtp.gmail.com&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;Port = 465;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;Username = &quot;YOUR_EMAIL_ADDRESS&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;Password = &quot;YOU_PASSWORD&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;SetFrom($from, &#39;YOUR_NAME&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;AddReplyTo($from,&#39;RECEIVERS_NAME&#39;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;Subject = $subject;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;MsgHTML($body);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$address = $to;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$mail-&amp;gt;AddAddress($address, $to);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;if($mail-&amp;gt;Send()) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return true;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}else {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;return false;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Above we have created a function called mail_sender, this function will help us to send email without writing the SMTP details again and again. We have saved this function in a PHP file called mailer.php.&lt;/div&gt;
&lt;div&gt;
Now we are going to use this function.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;require_once &#39;mailer.php&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$to = &quot;RECEIVERS_EMAIL_ADDRESS&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$subject = &quot;Test Mail Subject&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;$body = &quot;Hi&amp;lt;br/&amp;gt;Test Mail&amp;lt;br/&amp;gt;Localhost Test&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;if(mail_sender($to, $subject, $body)) {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo &#39;Sent!&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}else {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo &#39;Error!&#39;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #e69138;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When the email is sent then it will look something like this:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://4.bp.blogspot.com/-vOshD2UsL4A/UtVqE9MeP6I/AAAAAAAAAEs/KoQ5-LsvGjE/s1600/4.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;220&quot; src=&quot;http://4.bp.blogspot.com/-vOshD2UsL4A/UtVqE9MeP6I/AAAAAAAAAEs/KoQ5-LsvGjE/s400/4.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
If you have followed all the steps and done everything thing properly then surely you’ll send an Email. If you have got any errors or problem then first thing you should do is to check whether you have configure the Forwarding and POP/IMAP properly. If still you find any problem then check that the details you used in your application is correct. If still you receive any error then comment below.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;
&lt;a href=&quot;https://app.box.com/s/rj04sm7rkpywp23wf2kq&quot; target=&quot;_blank&quot;&gt;DOWNLOAD SOURCE FILES&lt;/a&gt;&lt;/h2&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/5642406587237796836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2014/01/using-gmails-smtp-as-your-smtp-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5642406587237796836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5642406587237796836'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2014/01/using-gmails-smtp-as-your-smtp-server.html' title='Using Gmail’s SMTP as your SMTP Server with a PHP example.'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-ItotSe5VZDo/UtVr8Yz7JCI/AAAAAAAAAE4/4ixvTFwNPOI/s72-c/email.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-1047783845026810164</id><published>2013-11-09T11:07:00.001-08:00</published><updated>2014-02-26T16:59:52.627-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Design"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Reviews"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Creating custom HTML tags which support all Major Browsers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;&quot;&gt;
&lt;a href=&quot;http://4.bp.blogspot.com/-Rdz-xUFs2HM/Un6JRX3-aLI/AAAAAAAAADE/VaD0ZyAVPfU/s1600/custom_tags.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;238&quot; src=&quot;http://4.bp.blogspot.com/-Rdz-xUFs2HM/Un6JRX3-aLI/AAAAAAAAADE/VaD0ZyAVPfU/s320/custom_tags.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;Do you know that we can create custom HTML elements/tags? when i got to know about it i was like WOW! that will be kinda awesome and hard. But later when i researched about it i found it&#39;s really easy for anyone to create custom HTML elements. You don&#39;t need to do thousands of lines of coding.&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For creating a HTML element/tag you just need to write the name of it like the standard HTML element/tag.&lt;br /&gt;
For example:&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;&amp;lt;computer brand=&quot;Acer&quot; price=&quot;28,900&quot; ratings=&quot;4&quot; id=&quot;pc&quot;&amp;gt;Acer Aspire R7&amp;lt;/computer&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;you are done by creating a custom HTML element. But this will only support all major browsers, excluding Internet Explorer.&lt;br /&gt;
&lt;br /&gt;
To make the custom HTML tag work with Internet Explorer you&#39;ll just need to write a single line of Javascript.&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp;document.createElement(&quot;computer&quot;);&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
this will create an HTML element named as &quot;computer&quot;.&lt;br /&gt;
Another point to note is, by default a custom element has a display inline. But you can change that with CSS.&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp;#pc {&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; display:block;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=chandeepsblogtips&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;chandeepsblogtips&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
To learn more:&amp;nbsp;&lt;a href=&quot;http://www.x-tags.org/&quot;&gt;http://www.x-tags.org/&lt;/a&gt;&lt;/div&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/1047783845026810164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/11/creating-custom-html-tags-which-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/1047783845026810164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/1047783845026810164'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/11/creating-custom-html-tags-which-support.html' title='Creating custom HTML tags which support all Major Browsers'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-Rdz-xUFs2HM/Un6JRX3-aLI/AAAAAAAAADE/VaD0ZyAVPfU/s72-c/custom_tags.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-4717795900931133112</id><published>2013-11-07T10:48:00.001-08:00</published><updated>2014-02-26T16:59:52.668-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Using Header function in PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;
&lt;img height=&quot;195&quot; src=&quot;http://www.thetechnicalstuff.com/wp-content/uploads/2012/04/php-logo-php2s.png&quot; style=&quot;-webkit-user-select: none;&quot; width=&quot;320&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
Header function in PHP is quite powerful function. You have came across with such situations like: if some condition is false then the user should re-directed on the Index page of your website or may be after some seconds he should. Also Header function is useful while send the Content type of your webpage.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP:&lt;/b&gt; Re-directing to a webpage using Header Function.&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&amp;nbsp; &amp;nbsp;if(isset($_GET[&#39;id&#39;])) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Further Code..&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; header(&quot;Location: index.php&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP:&lt;/b&gt; Re-directing to a webpage after 10 seconds using Header Function.&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&amp;nbsp; &amp;nbsp;if(isset($_GET[&#39;id&#39;])) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//Further code...&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}else {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;header(&quot;Refresh: 10; url=index.php&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP:&lt;/b&gt; Header Function to output a PDF file.&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&amp;nbsp; &amp;nbsp;header(&#39;Content-type: application/pdf&#39;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP:&lt;/b&gt; Header Function to convert PHP file into Text File.&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&amp;nbsp; &amp;nbsp;header(&#39;Content-Type: text/plain&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &quot;This is just a text file...we have converted a PHP file into a Plain Text File.&quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP:&lt;/b&gt; Header Function to convert PHP file into XML.&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&amp;nbsp; &amp;nbsp;header(&quot;Content-type: text/xml&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &quot;&amp;lt;?xml version=&#39;1.0&#39; encoding=&#39;ISO-8859-1&#39;?&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &quot;&amp;lt;person&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &quot;&amp;lt;name&amp;gt;Ashwin Pathak&amp;lt;/name&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &quot;&amp;lt;age&amp;gt;14&amp;lt;/age&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &quot;&amp;lt;twitter&amp;gt;@TheCodePress&amp;lt;/twitter&amp;gt;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;echo &quot;&amp;lt;/person&amp;gt;&quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Their are many other header functions you&#39;ll discover it by searching.&lt;br /&gt;
&lt;br /&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/4717795900931133112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/11/using-header-function-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4717795900931133112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4717795900931133112'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/11/using-header-function-in-php.html' title='Using Header function in PHP'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-6074460670517860624</id><published>2013-10-21T10:38:00.001-07:00</published><updated>2014-02-26T16:59:52.693-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="Hacking"/><category scheme="http://www.blogger.com/atom/ns#" term="Hosting"/><category scheme="http://www.blogger.com/atom/ns#" term="Mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Preventing PHP websites from SQL injections</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;
&lt;img height=&quot;222&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmy08cI_rThMfE9Qg4Iq0j0G0yBmWCjuWxKm49jWh72pdeyCv506dEhS0XZQ1dhhRstIys5hcl5SYpJhInta8wpTpmZxN78zV4rFMYon96103Fjw7YF3Pr77MnnVYxmx0y_CkT7-tahwZs/s320/SQL-Injection-Attack.jpg&quot; style=&quot;-webkit-user-select: none;&quot; width=&quot;320&quot; /&gt;&lt;/div&gt;
SQL injections are another pain for developers. If you have created a users database then you might save the users: name and password. But what if any hackers breaks the security of your website and get in to your users account unethically. So this might make your users not to trust on you and soon many others will leave your website.&lt;br /&gt;
&lt;b&gt;What is SQL injection:&lt;/b&gt;&lt;br /&gt;
SQL injection is a way of breaking the websites SQL query and customize it according to the hacker.&lt;br /&gt;
For example, if your website query for user to login is:&lt;br /&gt;
&lt;i&gt;$u = &quot;Ashwin&quot;;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;$p = &quot;TheCodePress&quot;;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;mysql_query(&lt;/i&gt;&lt;i&gt;&quot;SELECT * FROM users WHERE uname=&#39;$u&#39; AND upass=&#39;$p&#39; &quot;);&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
But if i&#39;m a hacker then i&#39;ll simply do something like this to break the security of your login system:&lt;br /&gt;
&lt;i&gt;$u = &quot;Ashwin&#39; -- &quot;;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;$p = &quot;Hacked&quot;;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;mysql_query(&lt;/i&gt;&lt;i&gt;&quot;SELECT * FROM users WHERE uname=&#39;$u&#39; AND upass=&#39;$p&#39; &quot;);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;b&gt;
So, what i have done ?&lt;/b&gt;&lt;br /&gt;
I have simply entered my correct username but after that i have added &#39; -- and this means comment in SQL.&lt;br /&gt;
So we have commented the rest of the portion of the query. That means we now don&#39;t need to enter password, we&#39;ll directly login into the website.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How to Solve this problem:&lt;/b&gt;&lt;br /&gt;
Well, the best way to do it without using any library or API is to use in built PHP functions. Such as &lt;i&gt;mysql_real_escape_string();&lt;/i&gt; and &lt;i&gt;htmlentities();&lt;/i&gt;&lt;br /&gt;
If you are using mysql_real_escape_string function then all the vulnerable symbols will be parse, but it will parse safely.&lt;br /&gt;
&lt;br /&gt;
PHP Code: So the code will be something like this:&lt;br /&gt;
&lt;i&gt;$u = mysql_real_escape_string(&quot;Ashwin&#39; -- &quot;);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;$p =&amp;nbsp;&lt;/i&gt;&lt;i&gt;mysql_real_escape_string(&lt;/i&gt;&lt;i&gt;&quot;Hacked&quot;);&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;mysql_query(&quot;SELECT * FROM users WHERE uname=&#39;$u&#39; AND upass=&#39;$p&#39; &quot;);&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;Is their any other better way to do it?&lt;/b&gt;&lt;br /&gt;
Yes, you can use the Library such as PDO or MYSQLI.&lt;br /&gt;
If you are more familiar with object oriented programming (OOP) then i&#39;ll prefer you to go with PDO.&lt;br /&gt;
Soon, i&#39;ll be too writing tutorials about PDO and Mysqli. You can learn it now on PHP manual.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/6074460670517860624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/10/preventing-php-websites-from-sql.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/6074460670517860624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/6074460670517860624'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/10/preventing-php-websites-from-sql.html' title='Preventing PHP websites from SQL injections'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmy08cI_rThMfE9Qg4Iq0j0G0yBmWCjuWxKm49jWh72pdeyCv506dEhS0XZQ1dhhRstIys5hcl5SYpJhInta8wpTpmZxN78zV4rFMYon96103Fjw7YF3Pr77MnnVYxmx0y_CkT7-tahwZs/s72-c/SQL-Injection-Attack.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-7219860497068382758</id><published>2013-10-16T10:46:00.000-07:00</published><updated>2014-02-26T16:59:52.699-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="Hacking"/><category scheme="http://www.blogger.com/atom/ns#" term="Hosting"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="SEO"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Protecting your website from Vulnerable Script Tags and Codes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;
&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGRakZU2F8jqnvjXCV9GknKa0HGr6QgJGSv4sY1Clm2HCR1MRvM54OQ6sU9Az4Bz4RaAnQ74LUcI3w7nQUIbAU1fX9I-ievXOr3wNJxXan4LNZpk9Vz4RMhV1Fu_ynWzPf3wCsdB9Up3w/s1600/XSS+Vulnerability+Tutorial+BreakTheSec.png&quot; style=&quot;-webkit-user-select: none;&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
It&#39;s really important for you to protect your website from hackers, but without removing any features from your website.&lt;br /&gt;
In this post we are going to understand how to solve the problem of XSS - Cross Site Scripting problems.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;What is XSS:&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;Cross-site scripting (XSS) is a type of computer security vulnerability typically found in Web applications. XSS enables attackers to inject client-side script into Web pages viewed by other users. A cross-site scripting vulnerability may be used by attackers to bypass access controls such as the same origin policy.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 19.1875px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;i&gt; -Source Wikipedia&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;background-color: white; line-height: 19.1875px;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white; font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;Now to prevent our website from XSS attack, we are going to use a PHP function called:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #9fc5e8;&quot;&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;htmlentities&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;This function of PHP will help your website to parse all harmful tags safely.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;For example, if you have a website which displays comments submitted by the user and that comment system is XSS vulnerable, then if a user will enter some comment like this:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;b&gt;Javascript Code:&lt;/b&gt;&lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;window.location = &quot;http://www.google.com&quot;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;and now this comment is stored in your website&#39;s comment database. So whenever any user will meet the page where this comment is loaded from your database. Then the user will re-directed to the specified website.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;So to prevent this problem we are going to use PHP function:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #9fc5e8;&quot;&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;htmlentities&lt;/span&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;This function will replace all the &amp;lt; &amp;gt; / &quot; &#39; = &amp;amp; and other symbols to a non-vulnerable signs. Like to display and in your website we use HTML Entities: &amp;amp;amp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;So in the similar way we are going to covert the vulnerable symbols in to non vulnerable HTML Entities.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;You&#39;ll just need to wrap&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;htmlentities&lt;/span&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;() to the variable from which you POST the comment to the database.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;b&gt;PHP Code:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&amp;nbsp; &amp;nbsp;$comment =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;htmlentities&lt;/span&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;($_POST[&#39;comment_area&#39;]);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;?&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;So that&#39;s how you can protect your website from XSS. In the next post we&#39;ll be discussing about how to prevent our website from getting hacked using SQL-injections.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;About the javascript code, if we parse it using the&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;htmlentities&lt;/span&gt;&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;() function then this is the safe result and this can be added in our database.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;b&gt;Result:&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&amp;amp;lt;script type=&amp;amp;quot;text/javascript&amp;amp;quot;&amp;amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;window.location = &amp;amp;quot;http://www.google.com&amp;amp;quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;line-height: 19.1875px;&quot;&gt;&amp;amp;lt;/script&amp;amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
What we have done:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP Code:&lt;/b&gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$comment =&lt;br /&gt;
&amp;lt;&amp;lt;&amp;lt;comment&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;window.location = &quot;http://www.google.com&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
comment;&lt;br /&gt;
&lt;br /&gt;
echo htmlentities($comment);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=chandeepsblogtips&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;chandeepsblogtips&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/7219860497068382758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/10/protecting-your-website-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/7219860497068382758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/7219860497068382758'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/10/protecting-your-website-from.html' title='Protecting your website from Vulnerable Script Tags and Codes'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGRakZU2F8jqnvjXCV9GknKa0HGr6QgJGSv4sY1Clm2HCR1MRvM54OQ6sU9Az4Bz4RaAnQ74LUcI3w7nQUIbAU1fX9I-ievXOr3wNJxXan4LNZpk9Vz4RMhV1Fu_ynWzPf3wCsdB9Up3w/s72-c/XSS+Vulnerability+Tutorial+BreakTheSec.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-144291792152824109</id><published>2013-10-14T10:45:00.001-07:00</published><updated>2014-02-26T16:59:52.633-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="SEO"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Counting your website&#39;s loading time using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;
&lt;img height=&quot;200&quot; id=&quot;irc_mi&quot; src=&quot;http://blue-pencil-editing.com/wordpress/wp-content/uploads/2012/07/stopwatch.jpg&quot; style=&quot;margin-top: 60px;&quot; width=&quot;133&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
Counting your website&#39;s loading time is very useful and helpful for you to know that you need to make it more efficient or not.&lt;br /&gt;
Here, in this tutorial we are going to use PHP &lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;microtime()&lt;/span&gt; function to get the time and we&#39;ll be formatting it using &lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;number_format()&lt;/span&gt; function.&lt;br /&gt;
&lt;b&gt;PHP code:&lt;/b&gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$mt = microtime(true);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $format_time = number_format(microtime(true) - $mt, 2).&quot; Seconds&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo $format_time;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are trying this code block on your on a blank page then probably you&#39;ll get 0.00 Seconds in results.&lt;br /&gt;
So to test it on a blank page follow this block of code:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;PHP code:&lt;/b&gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$mt = microtime(true);&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;file_get_contents(&quot;http://www.thecodepress.info&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $format_time = number_format(microtime(true) - $mt, 2).&quot; Seconds&quot;;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;echo $format_time;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I&#39;ll always recommend you to use this but if you don&#39;t want to display it on your website then you can do something like commenting it something like this:&lt;br /&gt;
&lt;br /&gt;
echo &quot;&amp;lt;!--&quot;.$format_time.&quot;--&amp;gt;&quot;;&lt;br /&gt;
&lt;br /&gt;
So after using that method the seconds will display in your website&#39;s HTML source code.&lt;br /&gt;
Another method which some other sites are using is to add the seconds at the bottom of the page (footer) you can too follow that.&lt;br /&gt;
&lt;br /&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/144291792152824109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/10/counting-your-websites-loading-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/144291792152824109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/144291792152824109'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/10/counting-your-websites-loading-time.html' title='Counting your website&#39;s loading time using PHP'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-6458598572612697525</id><published>2013-09-21T03:16:00.000-07:00</published><updated>2014-02-26T16:59:52.696-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="Domain"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="SEO"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Getting Page URL using Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;
&lt;img height=&quot;133&quot; src=&quot;http://assistly-production.s3.amazonaws.com/mediacore/portal_attachments/97839/url1_original.jpg?AWSAccessKeyId=AKIAJNSFWOZ6ZS23BMKQ&amp;amp;Expires=1379834117&amp;amp;Signature=zDPOAQlf6J7E3kGmzZXXigEO8fs%3D&amp;amp;response-content-disposition=filename%3D%22url1.jpg%22&amp;amp;response-content-type=image%2Fjpeg&quot; style=&quot;-webkit-user-select: none;&quot; width=&quot;200&quot; /&gt;&lt;/div&gt;
&lt;br /&gt;
Getting Page URLs using Javascript is very useful in real life projects, it&#39;s been used by Facebook, Twitter for their share/tweet buttons, because when we click on the share button then we get the URL of the page we are browsing, and that&#39;s done using Javascript.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;var url= &quot;&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;if (typeof this.href === &quot;undefined&quot;) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; url = document.location.toString().toLowerCase();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;else {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; &amp;nbsp; url= this.href.toString().toLowerCase();&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;/form&gt;
&lt;/center&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/6458598572612697525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/09/getting-page-url-using-javascript.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/6458598572612697525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/6458598572612697525'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/09/getting-page-url-using-javascript.html' title='Getting Page URL using Javascript'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-4571627996899359941</id><published>2013-09-12T11:17:00.001-07:00</published><updated>2014-02-26T16:59:52.665-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Design"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Fade effect on hover using CSS3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: left;&quot;&gt;
&lt;a href=&quot;http://ceblog.s3.amazonaws.com/wp-content/uploads/2012/04/css3-transition-effects.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: right;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;172&quot; id=&quot;irc_mi&quot; src=&quot;http://ceblog.s3.amazonaws.com/wp-content/uploads/2012/04/css3-transition-effects.jpg&quot; style=&quot;margin-top: 14px;&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;These day&#39;s many websites, blogs have fade effects in their links which is trigger when user hover their mouse on the link and it&#39;s mostly implement using Javascript. In this article we&#39;ll do that using CSS3.&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;a {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; color:red;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; -o-transition:.5s;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; -ms-transition:.5s;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; -moz-transition:.5s;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; -webkit-transition:.5s;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; transition:.5s;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; text-decoration:none;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;a:hover {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;color:blue;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;text-decoration:underline;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;!--more--&gt;&lt;br /&gt;Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;/form&gt;&lt;/center&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/4571627996899359941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/09/fade-effect-on-hover-using-css3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4571627996899359941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4571627996899359941'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/09/fade-effect-on-hover-using-css3.html' title='Fade effect on hover using CSS3'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-8169048088696153321</id><published>2013-08-17T03:28:00.000-07:00</published><updated>2014-02-26T16:59:52.705-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Ajax"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Demos"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Loading website in a DIV using Ajax and PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://2.bp.blogspot.com/-m5oPjALgq3U/Ug86HW69YOI/AAAAAAAAABg/hRjBqJpluR8/s1600/ajax-first-tutorial----thecodepress.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: center;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;264&quot; src=&quot;http://2.bp.blogspot.com/-m5oPjALgq3U/Ug86HW69YOI/AAAAAAAAABg/hRjBqJpluR8/s320/ajax-first-tutorial----thecodepress.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;Loading a website or content inside a DIV in ajax using php is common, everyone learns it when they are new to ajax. I&#39;m also a beginner in Ajax. Let&#39;s start learning it from beginning, covering all the history of ajax as well as how to use ajax.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;History:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
If you want you can read the history of ajax at wikipedia:&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Ajax_(programming)&quot; target=&quot;_blank&quot;&gt;http://en.wikipedia.org/wiki/Ajax_(programming)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
To run ajax you&#39;ll need a server if you own a hosting then you can use that to run the application or you can download the XAMPP local server / host.&lt;br /&gt;
&lt;br /&gt;
First we&#39;ll create two files, one will be the index.html and another one will be url.php (&lt;i&gt;Refer below image to understand the directory structure.&lt;/i&gt;)&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://2.bp.blogspot.com/-lYypVJ2VxII/Ug875Qo7NSI/AAAAAAAAABs/IuMUJO7YBBg/s1600/directory.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-lYypVJ2VxII/Ug875Qo7NSI/AAAAAAAAABs/IuMUJO7YBBg/s1600/directory.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
In the inder.html file we&#39;ll add our javascript inside the head tags and we&#39;ll call that using click event.&lt;br /&gt;
&lt;b&gt;HTML &amp;amp; Javascript: &lt;/b&gt;index.html source code.&lt;br /&gt;
&lt;pre&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
function loader() {
var ajaxhttp;
try {
//For major browser like Chrome etc...not for IE
ajaxhttp = new XMLHttpRequest();
}catch(e1) {
try {
//For IE6 and above
ajaxhttp = new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;);
}catch(e2) {
try {
//For IE5
ajaxhttp = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
}catch(e3) {
//If all returns an error then we&#39;ll return false!
return false;
}
}
}
ajaxhttp.onreadystatechange = function() {
if(ajaxhttp.readyState==4) { //it should be 4 or 200
document.getElementById(&quot;frame&quot;).innerHTML = ajaxhttp.responseText;
}
}
ajaxhttp.open(&quot;GET&quot;, &quot;url.php&quot;, true);
ajaxhttp.send(null);
}
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body style=&quot;margin:0px;font-family:trebuchet Ms;&quot;&amp;gt;
&amp;lt;h2 onClick=&quot;loader()&quot; style=&quot;background:#2C2C2C;text-align:center;color:white;padding:15px;margin:0px;&quot;&amp;gt;Click to load the website in a DIV!&amp;lt;/h2&amp;gt;
&amp;lt;div id=&quot;frame&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
We are using try..catch construct, which is a powerful exception-handling technique that was initially implemented in OOP languages. Basically, when an error happens at run time in the JavaScript code, an exception is thrown. The exception is an object that contains the details of the error. Using the&amp;nbsp;try..catch&amp;nbsp;syntax, we can catch the exception and handle it locally, so that the error won&#39;t be propagated to the user&#39;s browser.&lt;br /&gt;
&lt;br /&gt;
Now we&#39;ll make url.php file to send the data from the server.&lt;br /&gt;
&lt;b&gt;PHP: &lt;/b&gt;url.php source code.&lt;br /&gt;
&lt;pre&gt;&amp;lt;?php
   $url = &quot;http://www.thecodepress.info&quot;;
   echo file_get_contents($url);
?&amp;gt;&lt;/pre&gt;
Basically the url.php file loads the content of the specified URL which is fetched from variable url.&lt;br /&gt;
and then we are printing the contents of the file. So when our index.html tries to get the responseText from the server, the server sends the contents of the file and that&#39;s the reason for the website to be displayed.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://doc-0s-2c-docs.googleusercontent.com/docs/securesc/vv3fu3tod5lrpe11q9mcvvqm8ibcbrl4/g5lpt4u8pla6tvolk1h9lqb9psfm9d03/1376733600000/05012308753976316058/05012308753976316058/0B6OENSrFSi3ZeHF3Tk5NRzJDNnc?e=download&amp;amp;h=16653014193614665626&amp;amp;nonce=d4bp7deb9uk2a&amp;amp;user=05012308753976316058&amp;amp;hash=aas97hr0uudtf0sp4vo8dm3e96ptuo32&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;Demo screenshots:&lt;/b&gt;&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-3a1x0_c4Z3Q/Ug9LYzfSifI/AAAAAAAAAB8/k8jnkCGMNN0/s1600/before-thecodepress.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-3a1x0_c4Z3Q/Ug9LYzfSifI/AAAAAAAAAB8/k8jnkCGMNN0/s1600/before-thecodepress.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Before the page will load this will look like this and when we&#39;ll click the black header the page will load the website without refreshing the page.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-aWkywj0G-10/Ug9MNKqg6dI/AAAAAAAAACI/CWGvRvazk3g/s1600/after-thecodepress.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/-aWkywj0G-10/Ug9MNKqg6dI/AAAAAAAAACI/CWGvRvazk3g/s1600/after-thecodepress.png&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;When the user will click the black header then the specified website will load.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;br /&gt;Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:&lt;br /&gt;
&lt;center&gt;
&lt;form action=&quot;http://feedburner.google.com/fb/a/mailverify&quot; id=&quot;subscribe&quot; method=&quot;post&quot; onsubmit=&quot;window.open(&#39;http://feedburner.google.com/fb/a/mailverify?uri=thecodepress&#39;, &#39;popupwindow&#39;, &#39;scrollbars=yes,width=550,height=520&#39;);return true&quot; target=&quot;popupwindow&quot;&gt;
&lt;input name=&quot;uri&quot; type=&quot;hidden&quot; value=&quot;thecodepress&quot; /&gt;
&lt;input name=&quot;loc&quot; type=&quot;hidden&quot; value=&quot;en_US&quot; /&gt;
&lt;input id=&quot;subbox&quot; name=&quot;email&quot; onblur=&quot;if (this.value == &amp;quot;&amp;quot;) {this.value = &amp;quot;Enter your email...&amp;quot;;}&quot; onfocus=&quot;if (this.value == &amp;quot;Enter your email...&amp;quot;) {this.value = &amp;quot;&amp;quot;}&quot; type=&quot;text&quot; value=&quot;Enter your email...&quot; /&gt;
&lt;input id=&quot;subbutton&quot; title=&quot;&quot; type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;
&lt;/form&gt;&lt;/center&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/8169048088696153321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/08/loading-website-in-div-using-ajax-and.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/8169048088696153321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/8169048088696153321'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/08/loading-website-in-div-using-ajax-and.html' title='Loading website in a DIV using Ajax and PHP'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-m5oPjALgq3U/Ug86HW69YOI/AAAAAAAAABg/hRjBqJpluR8/s72-c/ajax-first-tutorial----thecodepress.jpg" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-1364520752313325261</id><published>2013-08-14T04:30:00.000-07:00</published><updated>2014-02-26T16:59:52.630-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Demos"/><category scheme="http://www.blogger.com/atom/ns#" term="Design"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Simple and awesome CSS3 button design.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://2.bp.blogspot.com/-3sVUYgUkI68/UgtSsxWZb4I/AAAAAAAAABM/ac9ipL18Dzc/s1600/image_title.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em; text-align: left;&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-3sVUYgUkI68/UgtSsxWZb4I/AAAAAAAAABM/ac9ipL18Dzc/s1600/image_title.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; display: inline !important; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://2.bp.blogspot.com/-3sVUYgUkI68/UgtSsxWZb4I/AAAAAAAAABM/ac9ipL18Dzc/s1600/image_title.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
Their are many websites which shares the code for creating new and awesome CSS3 buttons not only buttons their are also many other websites which shows some awesome styles for HTML/HTML5 element as well as inputs. In this post i&#39;m sharing two button styles which is usually use for designing submit buttons.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
When i was new to CSS3 what i used to do is to go on many CSS3 generators website and generate a button and try to understand the code what they have used. You can also try that after reading this post.&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;CSS&lt;/b&gt;: Style properties for button.&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;input[type=submit] {
	box-shadow:inset 0px 1px 0px 0px #ffffff;
	background-color:#ededed;
	border-radius:6px;
	border:1px solid #dcdcdc;
	display:inline-block;
	color:#777777;
	font-family:arial;
	font-size:15px;
	font-weight:bold;
	padding:6px 24px;
	text-decoration:none;
	text-shadow:0px 1px 0px #ffffff;
}

input[type=submit]:hover {
	background-color:#dfdfdf;
}

input[type=submit]:active {
	position:relative;
	top:1px;
}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS&lt;/b&gt;: Style properties for button.&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;white-space: pre-wrap; word-wrap: break-word;&quot;&gt;input[type=submit] {
	  font-family: Arial;
	  color: #ffffff;
	  font-size: 17px;
	  padding:10px 15px;
	  text-decoration: none;
	  -webkit-border-radius: 5px;
	  -moz-border-radius: 5px;
	  border-radius: 5px;
	  -webkit-box-shadow: 0px 1px 5px #696969;
	  -moz-box-shadow: 0px 1px 5px #696969;
	  box-shadow: 0px 1px 5px #696969;
	  text-shadow: 1px 1px 3px #666666;
	  border: solid #3972b0 1px;
	  background: -webkit-gradient(linear, 0 0, 0 100%, from(#4bb007), to(#59d104));
	  background: -moz-linear-gradient(top, #4bb007, #59d104);
	  -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#4bb007, endColorStr=#59d104);
	  filter: progid:DXImageTransform.Microsoft.gradient(startColorStr=#4bb007, endColorStr=#59d104);
	  display:inline-block; /* IE is so silly */
}
input[type=submit]:hover {
	  background: #4bb007;
}&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
Have a look at the live demo also you can download the source file:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://googledrive.com/host/0B6OENSrFSi3ZelhENVNqaEtUbG8/css3buttons.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiveWA3NJJTVEW2yK_FZYjkIEbbIvs5GDZNL-bFPbJQWuXKv7YVgFWFdNX5I6u6rP8_uIDuZOHmpyGwqfNbwZ8BPa6fJWa0BELKixAMpIyxP_R8_VAkrSIt1FkxqTTyAdjkEQVs40BcTHUA/s1600/live.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://doc-0s-2c-docs.googleusercontent.com/docs/securesc/vv3fu3tod5lrpe11q9mcvvqm8ibcbrl4/p7neh7pumak6lpe3d6uvnlc723gt5i8n/1376474400000/05012308753976316058/05012308753976316058/0B6OENSrFSi3ZLV8yeElVYkhSb2c?h=16653014193614665626&amp;amp;e=download&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; /&gt;&lt;/a&gt;&lt;span id=&quot;goog_1852913262&quot;&gt;&lt;/span&gt;&lt;span id=&quot;goog_1852913263&quot;&gt;&lt;/span&gt;&lt;a href=&quot;http://www.blogger.com/&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/1364520752313325261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/08/simple-and-awesome-css3-button-design.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/1364520752313325261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/1364520752313325261'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/08/simple-and-awesome-css3-button-design.html' title='Simple and awesome CSS3 button design.'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-3sVUYgUkI68/UgtSsxWZb4I/AAAAAAAAABM/ac9ipL18Dzc/s72-c/image_title.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-3022258532780421551</id><published>2013-07-20T11:05:00.001-07:00</published><updated>2014-02-26T16:59:52.646-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Basic pagination with Mysql, PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Have you ever noticed why blogger or wordpress or any other blogging platform have added a &#39;Next Page&#39; button or you ever noticed that why facebook directly won&#39;t shows all the posts as well as twitter won&#39;t load the tweets ? The reason is: while loading tweets or loading status or articles from database developers loop over the database again and again and if their are many thousands or hundreds of status, tweets etc.. than the page get slow/crashes. That&#39;s the reason why they use pagination. By the way facebook and twitter loads their feed using Ajax.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1QuxMyzq5kUzw84mdN3-pSOkakq45opOw-PF1QAIfrZu1fGUOBU0S90sdWDwWICbuFoRDI5tk5bLAWr1gqHBMRhf3hXccNqTq4Pni8cMRm0KSS20JdPQpUzIuqdBzJyxI57k1GN31DoZD/s1600/pagination1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1QuxMyzq5kUzw84mdN3-pSOkakq45opOw-PF1QAIfrZu1fGUOBU0S90sdWDwWICbuFoRDI5tk5bLAWr1gqHBMRhf3hXccNqTq4Pni8cMRm0KSS20JdPQpUzIuqdBzJyxI57k1GN31DoZD/s1600/pagination1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Let&#39;s first connect to our database:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;PHP: &lt;/b&gt;Connecting to mysql database.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; $db_host = &#39;localhost&#39;; // your mysql host&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; $db_user = &#39;ashwin1999&#39;; // your mysql user name&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; $db_pass = &#39;&#39;; // password not set&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; $db_name = &#39;pagination&#39;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; mysql_connect($db_host, $db_user, $db_pass);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; mysql_select_db($db_name);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
After connecting let&#39;s move on adding tables and columns. First we&#39;ll create a table called &#39;page&#39; and then we&#39;ll create column which name will be &#39;data&#39; just for example i&#39;m adding this names. You can even use PHPmyadmin (PMA) to make tables columns. Also i have added numbers from 1-20. Refer below image to understand it properly.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiIysjAihp5ISPRTtWFg7uVpNJElzg4cCbixNsHuFrxPZJzrnaWZCoNDNHtd4clKXzSldIGZe7wfGoQlmBDTQXu5ZZCH3FI41m2eJeu799X_FYHOa4RQrSxcnFegAN8-WCrfmufEDpM9aG/s1600/admin-shot.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;363&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiIysjAihp5ISPRTtWFg7uVpNJElzg4cCbixNsHuFrxPZJzrnaWZCoNDNHtd4clKXzSldIGZe7wfGoQlmBDTQXu5ZZCH3FI41m2eJeu799X_FYHOa4RQrSxcnFegAN8-WCrfmufEDpM9aG/s640/admin-shot.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Let&#39;s begin with PHP code blocks!&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;PHP:&lt;/b&gt; Pagination code&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;background-position: initial initial; background-repeat: initial initial;&quot;&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;@$p = $_GET[&quot;page&quot;]; //Getting Page number&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;$pages_query = mysql_query(&quot;SELECT COUNT(data) FROM page&quot;); // Counting total rows&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;if($p==&quot;&quot; || $p==&quot;0&quot; || $p&amp;gt;$pages_query) { //checking is p is set and greater than 0&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;background-color: transparent; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;&amp;nbsp; &amp;nbsp;$p = 1; //if not set than setting it to 1&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;$per_page = 5; //Total data to display per page&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;$pages = ceil(mysql_result($pages_query, 0) / $per_page); //dividing total rows with total data to&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;display for example 20/10=2 so 2 pages&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;$start = ($p - 1) * $per_page; //&amp;nbsp;subtracting&amp;nbsp;$p value with 1 and multiplying it with $per_page for &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;example 2-1=1*10 = 10&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;$query = mysql_query(&quot;SELECT data FROM page ORDER BY data ASC LIMIT $start, $per_page&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;//Running our query&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;while($fetch_data = mysql_fetch_array($query)) { //fetching data using array method&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;background-color: transparent; white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: transparent;&quot;&gt;&amp;nbsp; &amp;nbsp;echo $fetch_data[&quot;0&quot;].&quot;&amp;lt;br /&amp;gt;&quot;; //printing the data&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;for($a=1;$a&amp;lt;=$pages;$a++) { //using for to display number&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; echo &quot;&amp;lt;a href=&#39;?page=$a&#39; class=&#39;page_link&#39;&amp;gt;$a&amp;lt;/a&amp;gt; &quot;; //printing numbers also using link tags&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;background-color: transparent;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
It just looks hard but it&#39;s not hard, just need to do the subtract and divide part properly and the it&#39;s done.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/3022258532780421551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/07/basic-pagination-with-mysql-php.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/3022258532780421551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/3022258532780421551'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/07/basic-pagination-with-mysql-php.html' title='Basic pagination with Mysql, PHP'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj1QuxMyzq5kUzw84mdN3-pSOkakq45opOw-PF1QAIfrZu1fGUOBU0S90sdWDwWICbuFoRDI5tk5bLAWr1gqHBMRhf3hXccNqTq4Pni8cMRm0KSS20JdPQpUzIuqdBzJyxI57k1GN31DoZD/s72-c/pagination1.jpg" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-3154570488266758514</id><published>2013-07-06T11:54:00.002-07:00</published><updated>2014-02-26T16:59:52.648-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Design"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Adding effects in Image using CSS3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Adding effects in image using CSS3 sounds cool, because many of you might be using photoshop or picasa or instagram or any other image editing application. So let&#39;s use CSS3 to add effects in image.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://4.bp.blogspot.com/-dPzQNHGEdVM/Udk00sV5uhI/AAAAAAAAAAw/-_kXunROUCg/s1600/tcp_post.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://4.bp.blogspot.com/-dPzQNHGEdVM/Udk00sV5uhI/AAAAAAAAAAw/-_kXunROUCg/s1600/tcp_post.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;b&gt;Before you start read this carefully:&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
The filter property in CSS3 from which we&#39;ll add effects is only supported to -webkit- it means only Google Chrome, Safari supports this CSS3 property.&lt;/div&gt;
&lt;div&gt;
Also i have tried to use -moz- to render that effects in Firefox but it didn&#39;t worked. So after some research about it i got to know that it only supports -webkit-.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Okay, first let&#39;s start.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS:&lt;/b&gt; Changing image opacity using CSS3 property: &amp;nbsp;-webkit-filter:opacity(100%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_opacity {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp;-webkit-filter: opacity(100%); /*Changing image opacity*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS:&lt;/b&gt; Adding Negative effect in image using CSS3 property:&amp;nbsp;-webkit-filter:invert(100%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_negative {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp;-webkit-filter: invert(100%); /*Adding negative effect*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS:&lt;/b&gt; Adding Black &amp;amp; White(Gray scale) effect using CSS3 property:&amp;nbsp;-webkit-filter: grayscale(100%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_b_w {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; -webkit-filter: grayscale(100%); /*Adding gray scale effect*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS: &lt;/b&gt;Making images blur using CSS3 property:&amp;nbsp;-webkit-filter: grayscale(100%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_blur {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;-webkit-filter: grayscale(100%); /*Making image blur*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS: &lt;/b&gt;Adding&amp;nbsp;saturate effect using CSS3 property:&amp;nbsp;-webkit-filter: saturate(200%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_saturate {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;-webkit-filter: saturate(200%); /*Adding saturate effect*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS:&lt;/b&gt; Playing with RGBA using CSS3 property: -webkit-filter: hue-rotate(100deg);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_hue {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; -webkit-filter: hue-rotate(100deg); /*Playing with RGBA*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS: &lt;/b&gt;Adding Sepia effects using CSS3 property:&amp;nbsp;-webkit-filter: sepia(100%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_sepia {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;-webkit-filter: sepia(100%); /*Adding sepia effect in image*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS:&lt;/b&gt; Adjusting Brightness in image using CSS3 property: -webkit-filter: brightness(140%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; image_bright {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #990000; text-align: center;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;-webkit-filter: brightness(140%); /*Adjusting brightness in image*/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;b&gt;CSS:&lt;/b&gt;&amp;nbsp;Adjusting Contrast of image using CSS3 property: -webkit-filter: brightness(140%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; image_contrast {&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #990000; text-align: center;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;-webkit-filter: contrast(110%); /*Adjusting Contrast of image*/&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
We have used almost many main effects and now one more awesome thing, we can combine it all together using CSS3 property:&amp;nbsp;-webkit-filter: sepia(50%) invert(100%) opacity(50%);&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;CSS:&lt;/b&gt; Combining it, all together CSS3 property:&amp;nbsp;-webkit-filter: sepia(50%) invert(100%) opacity(50%);&lt;/div&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp; .image_combine_effect {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; &amp;nbsp; -webkit-filter: sepia(50%) invert(100%) opacity(50%); /*Example combining of effects*/&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; color: #990000;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
For more information about the filter property read this documentation here:&amp;nbsp;&lt;a href=&quot;http://www.w3.org/TR/2013/WD-filter-effects-20130523/&quot;&gt;http://www.w3.org/TR/2013/WD-filter-effects-20130523/&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
And yes, the reason for using -webkit- before every property is to render the property in -webkit- browsers like Google Chrome, Safari.&lt;/div&gt;
&lt;div&gt;
And if you want to archive this effects using PHP then PHP&#39;s GD library is made for you. Articles coming soon for GD library.&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/3154570488266758514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/07/adding-effects-in-image-using-css3.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/3154570488266758514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/3154570488266758514'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/07/adding-effects-in-image-using-css3.html' title='Adding effects in Image using CSS3'/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/blank.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-dPzQNHGEdVM/Udk00sV5uhI/AAAAAAAAAAw/-_kXunROUCg/s72-c/tcp_post.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-9127908505003813125</id><published>2013-06-23T00:59:00.001-07:00</published><updated>2014-02-26T16:59:52.708-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="SEO"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Non-database page views counter using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Page views counter is very helpful to get numbers of visitors visiting your website, but most of time many people saves that in database and in text files. In this tutorials we are going to save it in text files.&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9oGWRy8H0c_vv_tmYMW3UAPXGK5_Ot7R9V6N_qG6HskMZYA2b2_XA-NVpkEuiaEV7cuekA6qodyOhgc288fc94D3DCKcHGpX-hAktb70pnx5wAkk4noul4kxVT3fPTkPDRWR_OjOGrrLz/s1600/no_db.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9oGWRy8H0c_vv_tmYMW3UAPXGK5_Ot7R9V6N_qG6HskMZYA2b2_XA-NVpkEuiaEV7cuekA6qodyOhgc288fc94D3DCKcHGpX-hAktb70pnx5wAkk4noul4kxVT3fPTkPDRWR_OjOGrrLz/s1600/no_db.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;PHP:&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;function hits(){&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$ips = Array(&quot;127.0.0.1&quot;); &amp;nbsp; &amp;nbsp; //Enter ip address which you don&#39;t want count&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$file = &quot;hits.txt&quot;; //file name&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;$ip = $_SERVER[&quot;REMOTE_ADDR&quot;]; &amp;nbsp; &amp;nbsp; //getting ip address&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;if($ips[0]!=$ip){ &amp;nbsp; &amp;nbsp; //checking that &#39;ips&#39; are not matched with var &#39;ip&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;if(file_exists($file)){ &amp;nbsp; &amp;nbsp; &amp;nbsp;//checking for hits.txt exists or not&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;$fr = fopen($file, &quot;r&quot;); &amp;nbsp; &amp;nbsp; //Opening file for reading&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;$fre = fread($fr, filesize($file))+1; &amp;nbsp; &amp;nbsp; &amp;nbsp;//reading and incrementing 1&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;$fh = fopen($file, &quot;w&quot;); &amp;nbsp; &amp;nbsp; &amp;nbsp;//Opening file for writing&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;$fw = fwrite($fh, $fre); &amp;nbsp; &amp;nbsp; //writing&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;}elseif(!file_exists($file)){ &amp;nbsp; &amp;nbsp; &amp;nbsp;//if not exists var &#39;hits.txt&#39; then to create one&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;$fh = fopen($file, &quot;w&quot;); &amp;nbsp; &amp;nbsp; //opening file for writing&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;$fw = fwrite($fh, &quot;0&quot;); &amp;nbsp; &amp;nbsp; //writing 0 to start from zero&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;				&lt;/span&gt;echo &quot;File Created.&quot;; &amp;nbsp; &amp;nbsp; //displaying a positive message&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;			&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;		&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;	hits&lt;/span&gt;(); &amp;nbsp; &amp;nbsp;// calling our function&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;
The ideal way to use this script is not to make the numbers of hits visible to your users, but if you want so make it visible then read the file and print it.&lt;br /&gt;
&lt;br /&gt;
Add this block of code after calling the function &#39;hits()&#39;.&lt;br /&gt;
&lt;b&gt;PHP:&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;$fr = fopen(&quot;hits.txt&quot;, &quot;r&quot;); &amp;nbsp; &amp;nbsp;//open file to read&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;$read = fread($fr, filesize(&quot;hits.txt&quot;)); &amp;nbsp; //read the file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;echo &quot;Total Views: &quot;.$read; // print the contents of file &#39;hits.txt&#39;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/9127908505003813125/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/06/non-database-page-views-counter-using.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/9127908505003813125'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/9127908505003813125'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/06/non-database-page-views-counter-using.html' title='Non-database page views counter using PHP'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9oGWRy8H0c_vv_tmYMW3UAPXGK5_Ot7R9V6N_qG6HskMZYA2b2_XA-NVpkEuiaEV7cuekA6qodyOhgc288fc94D3DCKcHGpX-hAktb70pnx5wAkk4noul4kxVT3fPTkPDRWR_OjOGrrLz/s72-c/no_db.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-5945511089524213360</id><published>2013-05-27T09:20:00.002-07:00</published><updated>2014-02-26T16:59:52.690-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Moving a div according to mouse coordinates using Javascript.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This post is similar to the post &quot;&lt;a href=&quot;http://www.thecodepress.info/2013/03/move-html-div-with-css-and-javascript.html&quot; target=&quot;_blank&quot;&gt;Move a HTML Div with CSS and Javascript, No JQuery!&lt;/a&gt;&quot; but in that post we are using user specified pixels by allowing user to add numbers of pixel in the text box. Here, in this post we are going to do the same thing but in a different way. We are going to use the coordinates of where our mouse clicks. Run the code in your browser you&#39;ll like it!&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTU4jgnYTZaWBLaW1poCw2_3t6t2tURYf5w9gJCONQG4rknlGx8qSyteJjshe7i00MdLIIPc6swYKRK1Q_uQRQ6PH1ymKFpi8n5Jua1qmNphUKnaxdcin5ZNMvUG29HWGEjYo8TdT5P0jr/s1600/cord1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTU4jgnYTZaWBLaW1poCw2_3t6t2tURYf5w9gJCONQG4rknlGx8qSyteJjshe7i00MdLIIPc6swYKRK1Q_uQRQ6PH1ymKFpi8n5Jua1qmNphUKnaxdcin5ZNMvUG29HWGEjYo8TdT5P0jr/s1600/cord1.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;Before i start, let me say you, this question was asked by one reader who want to move his div according to mouse click. Well he&#39;s my uncle and he was taking my test :D.&lt;br /&gt;
&lt;br /&gt;
Ok, let&#39;s get back to topic and implement javascript.&lt;br /&gt;
First of all before you start writing HTML don&#39;t forget to add doctype on the start or it will not support / it will not work. Because of doctype i&#39;m adding full code from start to end below.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Javascript:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;title&amp;gt;Hey, this is for you!&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;style type=&quot;text/css&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; #box {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;background-color:black;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;color:white;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;padding:90px;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;position:absolute;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;display:block;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;font-family:verdana;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;font-size:20px;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/style&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;script type=&quot;text/JavaScript&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;function moves(e){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;var cordx = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;var cordy = 0;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (!e) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;var e = window.event;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;if (e.pageX || e.pageY){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cordx = e.pageX;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cordy = e.pageY;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;else if (e.clientX || e.clientY){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cordx = e.clientX;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;    &lt;/span&gt;cordy = e.clientY;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;document.getElementById(&#39;box&#39;).style.left = cordx;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;document.getElementById(&#39;box&#39;).style.top = cordy;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;body onClick=&quot;moves(event)&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;div id=&quot;box&quot;&amp;gt;Hey! this is for you, enjoy :)&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
In the code we are using &#39;clientX&#39; and &#39;clientY&#39; to get the coordinates. We are also using &#39;pageX&#39; and &#39;pageY&#39; &amp;nbsp;to get he horizontal coordinate of the event relative to whole document.&lt;br /&gt;
To understand more or learn more about &#39;pageX&#39;, &#39;pageY&#39;, &#39;clientX&#39;, &#39;clientY&#39; you can refer to the mozilla documentation.&lt;br /&gt;
PageX:&amp;nbsp;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/event.pageX&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/API/event.pageX&lt;/a&gt;&lt;br /&gt;
PageY:&amp;nbsp;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/event.pageY&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/API/event.pageY&lt;/a&gt;&lt;br /&gt;
ClientX:&amp;nbsp;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/event.clientX&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/API/event.clientX&lt;/a&gt;&lt;br /&gt;
ClientY:&amp;nbsp;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/event.clientY&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/API/event.clientY&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I think so i have given the whole source code so it&#39;s no need to upload the file and share download link.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/5945511089524213360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/05/moving-div-according-to-mouse.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5945511089524213360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5945511089524213360'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/05/moving-div-according-to-mouse.html' title='Moving a div according to mouse coordinates using Javascript.'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTU4jgnYTZaWBLaW1poCw2_3t6t2tURYf5w9gJCONQG4rknlGx8qSyteJjshe7i00MdLIIPc6swYKRK1Q_uQRQ6PH1ymKFpi8n5Jua1qmNphUKnaxdcin5ZNMvUG29HWGEjYo8TdT5P0jr/s72-c/cord1.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-2996266082031896030</id><published>2013-05-24T10:47:00.001-07:00</published><updated>2014-02-26T16:59:52.642-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="SEO"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>A button hit counter for your PHP website.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
In this&amp;nbsp;tutorial, i&#39;m going to share how to make a button hit counter, it&#39;s a basic level PHP so many can understand it and modify it. For this tutorial i&#39;m going to save the counts in a text file, but if you want you can store it in a database.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB2wIm45X26aGvusxkIpVE9IvSq_pT0QBexGPx4962ZmQ_r01M5hfa4vKPAdPkU22TBAGRjkmLiNQh7YkttU9FE4GWnVDxUUQ1q4M7o2NGvR5KxXBd6Q5cLrDyHBIPzgsX45A4ERCldNku/s1600/demolog.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB2wIm45X26aGvusxkIpVE9IvSq_pT0QBexGPx4962ZmQ_r01M5hfa4vKPAdPkU22TBAGRjkmLiNQh7YkttU9FE4GWnVDxUUQ1q4M7o2NGvR5KxXBd6Q5cLrDyHBIPzgsX45A4ERCldNku/s1600/demolog.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.dropbox.com/s/3uqq5lgox08ykoh/counter.zip&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;b&gt;PHP: &amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;$file = &quot;data.txt&quot;; // Giving a name to our text file which will store numbers of counts&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(!file_exists($file)){// Checking wether file data.txt exists or not&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$fo = fopen($file, &quot;w&quot;); //If data.txt file dosen&#39;t exists then to create a new&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;fwrite($fo, &quot;0&quot;); // Start to count from zero&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;fclose($fo); // closing file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;@$click = $_POST[&quot;count&quot;]; //Getting button value with POST method&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;if(isset($click)){ // Checking is set of not, it&#39;s a technique to get click&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;di(); //calling our function di()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;function di(){&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;global $file; //making our file varail which contains file name global&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$clicks = file($file); //reading our data.txt file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$clicks[&quot;0&quot;]++; // incrementing 1, for example if value is 1 then to add 1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;$fo = fopen($file, &quot;w&quot;); //opening our file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;fwrite($fo, $clicks[&quot;0&quot;]);//writing our incremented value&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;fclose($fo); // closing file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;echo $clicks[&quot;0&quot;]; // printing total numbers of clicks&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;form method=&quot;POST&quot; action=&quot;counter.php&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&amp;lt;input type=&quot;submit&quot; value=&quot;Download Now&quot; name=&quot;count&quot; /&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
Make it look more beautiful by adding few CSS and add it on your site :).&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/2996266082031896030/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/05/a-button-hit-counter-for-your-php.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/2996266082031896030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/2996266082031896030'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/05/a-button-hit-counter-for-your-php.html' title='A button hit counter for your PHP website.'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjB2wIm45X26aGvusxkIpVE9IvSq_pT0QBexGPx4962ZmQ_r01M5hfa4vKPAdPkU22TBAGRjkmLiNQh7YkttU9FE4GWnVDxUUQ1q4M7o2NGvR5KxXBd6Q5cLrDyHBIPzgsX45A4ERCldNku/s72-c/demolog.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-4546302826525019092</id><published>2013-05-05T02:48:00.004-07:00</published><updated>2014-02-26T16:59:52.662-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Change Background Color on every refresh using PHP and CSS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;In the last post you have seen how to change background image of the website using PHP. But what if you want to change the background color of a website?. Let&#39;s see how to do it using PHP and CSS.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: inherit; margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiINzURtFvhu7_Edd51so7nGPN8B1uH449nxGmouKYcofzAOZn275Pw27d5JOhJGWJhIf1VdbuJCoxV0Zh7L8o7NXK-0fvcShhdqaL4fc96kW3fr4_w4FwcTSaCQAKfSVbMTiJ6aeYpnA8_/s1600/tab.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiINzURtFvhu7_Edd51so7nGPN8B1uH449nxGmouKYcofzAOZn275Pw27d5JOhJGWJhIf1VdbuJCoxV0Zh7L8o7NXK-0fvcShhdqaL4fc96kW3fr4_w4FwcTSaCQAKfSVbMTiJ6aeYpnA8_/s1600/tab.png&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://www.dropbox.com/s/1t68q4z55zh6rr0/color%20change%20in%20every%20refresh.zip&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;PHP CODE: &lt;/b&gt;PHP code to make background color change on every refresh.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;?php
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;2.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;$colors =&lt;/span&gt; &lt;span style=&quot;color: #b45f06;&quot;&gt;Array(&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#242424&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#7A7A7A&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#EBEBEB&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#292929&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;#940000&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;//Making colors&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #6aa84f; font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;array&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;3.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;$color_change =&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;&quot;0&quot;;&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;//Assigning a&amp;nbsp;variable with no value&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;4.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;$change = &lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;rand(&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #bf9000;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;//Getting random number&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;5.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;switch(&lt;/span&gt;&lt;span style=&quot;color: #0b5394;&quot;&gt;$change&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;){&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;6. &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;nbsp;case 1:&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;$color_change =&lt;/span&gt; &lt;span style=&quot;color: #b45f06;&quot;&gt;$colors[&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;7. &amp;nbsp;&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;8. &lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;case 2&lt;/span&gt;: &lt;span style=&quot;color: #990000;&quot;&gt;$color_change =&lt;/span&gt; &lt;span style=&quot;color: #b45f06;&quot;&gt;$colors[&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;9. &amp;nbsp;&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;10.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;case 3:&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;$color_change =&lt;/span&gt; &lt;span style=&quot;color: #b45f06;&quot;&gt;$colors[&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;11.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;12.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;case 4:&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;$color_change =&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt; $colors[&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;13.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;14.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;case 5:&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;$color_change = &lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;$colors[&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;15.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;break;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;16.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;default:&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;Something going wrong!&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;17.&lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;18.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
We are done with PHP and now we are going to embed PHP in HTML.&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;CSS CODE:&lt;/b&gt; Here, in CSS code we&#39;ll be&amp;nbsp;&lt;/span&gt;embed PHP code.&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;body {&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;2.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b45f06;&quot;&gt;&amp;nbsp;background-color:&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;lt;?php echo $color_change; ?&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;3.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
Now stick it all together in HTML document and debug it.&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/4546302826525019092/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/05/change-background-color-on-every.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4546302826525019092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/4546302826525019092'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/05/change-background-color-on-every.html' title='Change Background Color on every refresh using PHP and CSS'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiINzURtFvhu7_Edd51so7nGPN8B1uH449nxGmouKYcofzAOZn275Pw27d5JOhJGWJhIf1VdbuJCoxV0Zh7L8o7NXK-0fvcShhdqaL4fc96kW3fr4_w4FwcTSaCQAKfSVbMTiJ6aeYpnA8_/s72-c/tab.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-1466889127533784418</id><published>2013-04-19T11:22:00.001-07:00</published><updated>2014-02-26T16:59:52.639-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Change background on every refresh using PHP and CSS</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Have you seen the old TWITTER on which after every refresh the site changes it&#39;s background image not only twitter the old AOL was doing the same and many other major and minor sites are doing it. By using this method you can also change the background image of your website. In this post i have implemented few lines of code which will help to change your sites background image on every refresh. Don&#39;t forget to check the live demo.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuY02ml8cNtv-2hw_A71iNagfccYVXS0yzMh75314ZXNjlxRzFXuXnJNYRqWxClnstnplsp2L2OsMbwOSAnwG5iu9lr4E8jr9hQzT12Kc2CdaFEyto08SWI9us0qIwBLVpZWqZzoiuU5jk/s1600/change.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuY02ml8cNtv-2hw_A71iNagfccYVXS0yzMh75314ZXNjlxRzFXuXnJNYRqWxClnstnplsp2L2OsMbwOSAnwG5iu9lr4E8jr9hQzT12Kc2CdaFEyto08SWI9us0qIwBLVpZWqZzoiuU5jk/s1600/change.png&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://demos.thecodepress.info/demos/bgchange/Change%20background%20on%20every%20refresh%20using%20PHP%20and%20CSS.php&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiveWA3NJJTVEW2yK_FZYjkIEbbIvs5GDZNL-bFPbJQWuXKv7YVgFWFdNX5I6u6rP8_uIDuZOHmpyGwqfNbwZ8BPa6fJWa0BELKixAMpIyxP_R8_VAkrSIt1FkxqTTyAdjkEQVs40BcTHUA/s1600/live.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://demos.thecodepress.info/demos/bgchange/bgchange.zip&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Before you start typing codes you&#39;ll need to get suitable background images, and change it&#39;s name to 1, 2, 3 and so on and also the&amp;nbsp;extension of images should be same, and then need to gather it in a folder. For example:&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmJCz8p9Pml-CaDBwpM38LnALnffIcjSK2aSwe-A7AxZlO11wFP_LSAB2fYTro39Jhh9Zqv765WOPS5LZQZB7oXXiD-oKczPD4-Pvi5_wEck98mWqtsyHCjUNJq9lP2PoqMugKc6npVLxw/s1600/eg1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjmJCz8p9Pml-CaDBwpM38LnALnffIcjSK2aSwe-A7AxZlO11wFP_LSAB2fYTro39Jhh9Zqv765WOPS5LZQZB7oXXiD-oKczPD4-Pvi5_wEck98mWqtsyHCjUNJq9lP2PoqMugKc6npVLxw/s1600/eg1.png&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif; font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;I have made a folder which name is Backgrounds,&lt;/i&gt;&lt;i&gt;&amp;nbsp;and in that i added this images with same extension and numerically sorted.&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, we are ready to use PHP to make the function work.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;b&gt;PHP:&lt;/b&gt; Few lines of PHP code can do many things!.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;$bg&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #bf9000;&quot;&gt;rand(&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;3.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;$bgchange&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;$bg.&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;.jpg&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;4.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;We are using a &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;rand()&lt;/span&gt; to get random numbers and assigned it to a variable &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;$bg&lt;/span&gt;. Now we got random number and now we need to add extension to it. All my backgrounds images are in .JPG format (If any of your image is in other format you can download any image converter and convert it to a suitable format).&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;If you will print &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;$bgchange&lt;/span&gt; variable you will find any number between 1 to 5 with .JPG for example : 1.JPG or 2.JPG etc..&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;Now we will use CSS to change our background image :&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;CSS:&lt;/b&gt; Changing Background of HTML document with CSS.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;body {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;2.&amp;nbsp;&lt;/b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;background-image:&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;url(&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&quot;backgrounds/&amp;lt;?php echo $bgchange; ?&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;)&lt;/span&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;3.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;background-repeat:&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;no-repeat&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;4.&lt;/b&gt; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;hr /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;You can also do this using javascript. For doing it will javascript you can use &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;Math.ceil()&lt;/span&gt; or &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;math.floor()&lt;/span&gt; and you&#39;ll also need to use &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;Math.random()&lt;/span&gt; function inside Math.ceil or Math.floor function,and then need to multiply with total numbers of images. For example :&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;Javascript :&lt;/b&gt; For doing the same thing did with PHP and CSS.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;script type=&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;text/javascript&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b45f06;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;totalimgs =&lt;/span&gt; &lt;span style=&quot;color: #bf9000;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;3.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b45f06;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;bg_change()&lt;/span&gt; &lt;span style=&quot;color: #b45f06;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;4.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #b45f06;&quot;&gt;var&lt;/span&gt; &lt;span style=&quot;color: #990000;&quot;&gt;count =&lt;/span&gt; &lt;span style=&quot;color: #bf9000;&quot;&gt;Math.ceil(&lt;/span&gt;&lt;span style=&quot;color: #bf9000;&quot;&gt;Math.random()&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;totalimgs&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;5.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;document.body.background&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;=&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;backgrounds/&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;+count+&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&quot;.jpg&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;6.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;document.body.style.backgroundRepeat =&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;&quot;no-repeat&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;7.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #b45f06;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;8.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;The above Javascript should be added in head tags &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;&amp;lt;head&amp;gt;...&amp;lt;/head&amp;gt;&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;And the function &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;bg_change()&lt;/span&gt; should be called in body tags &lt;span style=&quot;background-color: #cfe2f3;&quot;&gt;&amp;lt;body&amp;gt;...&amp;lt;body&amp;gt;&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;HTML :&lt;/b&gt; Calling bg_change() function in body.&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;script type=&quot;&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;text/javascript&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&quot;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;3.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #b45f06;&quot;&gt;bg_change();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;4.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;script&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;5.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #990000;&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;For background Images you can download it from &lt;a href=&quot;http://www.flickr.com/&quot; target=&quot;_blank&quot;&gt;Flickr&lt;/a&gt; or &lt;a href=&quot;https://www.google.co.in/imghp&quot; target=&quot;_blank&quot;&gt;Google Images&lt;/a&gt; and other services. Also you can buy it from other online services.&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/1466889127533784418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/04/change-background-on-every-refresh.html#comment-form' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/1466889127533784418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/1466889127533784418'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/04/change-background-on-every-refresh.html' title='Change background on every refresh using PHP and CSS'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiuY02ml8cNtv-2hw_A71iNagfccYVXS0yzMh75314ZXNjlxRzFXuXnJNYRqWxClnstnplsp2L2OsMbwOSAnwG5iu9lr4E8jr9hQzT12Kc2CdaFEyto08SWI9us0qIwBLVpZWqZzoiuU5jk/s72-c/change.png" height="72" width="72"/><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-5600146744617200596</id><published>2013-04-14T05:06:00.001-07:00</published><updated>2014-02-26T16:59:52.680-08:00</updated><title type='text'>Filter inappropriate words using PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Many times what happens when you add a contact form to your website, many users use abusive language / words to give feedback or they spam with&amp;nbsp;abusive words. So we need a solution to not allow them do that. In this post i&#39;ll show you a method in which we are going to use a pre-defined PHP function, which will help us to convert abusive words in to any other word or to detect the abusive word and then not to accept the feedback.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg30AdgAXViyO7PLnPD-2gx6u0Vv6wcGtd3JWGVMF57HyZ1WnuOaMyrlnvHHYVIqYLRE59K1W5yFZjYIpUW9GquBo-rxdzSOLwb5HmvvHp5bCSsTbngTWY-mZJ7IYu4dxvwk3-aglZkC8px/s1600/bad.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg30AdgAXViyO7PLnPD-2gx6u0Vv6wcGtd3JWGVMF57HyZ1WnuOaMyrlnvHHYVIqYLRE59K1W5yFZjYIpUW9GquBo-rxdzSOLwb5HmvvHp5bCSsTbngTWY-mZJ7IYu4dxvwk3-aglZkC8px/s1600/bad.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/5600146744617200596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/04/filter-inappropriate-words-using-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5600146744617200596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5600146744617200596'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/04/filter-inappropriate-words-using-php.html' title='Filter inappropriate words using PHP'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg30AdgAXViyO7PLnPD-2gx6u0Vv6wcGtd3JWGVMF57HyZ1WnuOaMyrlnvHHYVIqYLRE59K1W5yFZjYIpUW9GquBo-rxdzSOLwb5HmvvHp5bCSsTbngTWY-mZJ7IYu4dxvwk3-aglZkC8px/s72-c/bad.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-2810122856229915198</id><published>2013-03-25T03:48:00.001-07:00</published><updated>2014-02-26T17:03:22.806-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Demos"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Find your Internet Protocol (IP) Address and Remote Port using your self made PHP Script</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Internet Protocol (IP) address is a unique key / number of your personal or your office computer. Most of the people who want to know their PC&#39;s / Laptop&#39;s IP Address, they directly go to &lt;a href=&quot;http://ipchicken.com/&quot;&gt;IPChicken.com&lt;/a&gt;&amp;nbsp;or any other IP Finding service. What if you create your own PHP Application which finds your PC&#39;s / Laptop&#39;s IP Address ?. In this post i&#39;ll show you few lines of PHP script which will help you to find your IP address and also it will find Remote Port.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2xiJyTZ1_RFTKVc5o91Disu4SiwK5LUQuS-dCcL7pWB_RI-QIxOLrLK98d00AjbqKucIRsiZpEdUxvsyBulCsYn3JplBAafOEwj3sfHuMD2MVb78YUuugSTsZO7JALkwLSZ_PQYDWHmkw/s1600/index.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2xiJyTZ1_RFTKVc5o91Disu4SiwK5LUQuS-dCcL7pWB_RI-QIxOLrLK98d00AjbqKucIRsiZpEdUxvsyBulCsYn3JplBAafOEwj3sfHuMD2MVb78YUuugSTsZO7JALkwLSZ_PQYDWHmkw/s1600/index.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;http://demos.thecodepress.info/demos/Find%20your%20IP%20Address%20using%20PHP.php&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiveWA3NJJTVEW2yK_FZYjkIEbbIvs5GDZNL-bFPbJQWuXKv7YVgFWFdNX5I6u6rP8_uIDuZOHmpyGwqfNbwZ8BPa6fJWa0BELKixAMpIyxP_R8_VAkrSIt1FkxqTTyAdjkEQVs40BcTHUA/s1600/live.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://demos.thecodepress.info/downloads/Find%20your%20IP%20Address%20using%20PHP.zip&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;PHP Code : &lt;/b&gt;To get the Internet Protocol Address.&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1. &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;color: #990000;&quot;&gt;$_SERVER[&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&quot;REMOTE_ADDR&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;That&#39;s the short code to find your IP address. Now, let&#39;s find our PCs or Laptops Remote Port. To find remote port we will again use the variable &lt;span style=&quot;background-color: #cccccc;&quot;&gt;$_SERVER[];&lt;/span&gt;&amp;nbsp;but we will assign different value to it.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;PHP Code :&lt;/b&gt; To get the Remote Port.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;$_SERVER[&lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&quot;REMOTE_PORT&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Great! you also got the remote port. Now, simply print it using &lt;span style=&quot;background-color: #cccccc;&quot;&gt;echo&lt;/span&gt; or using &lt;span style=&quot;background-color: #cccccc;&quot;&gt;print&lt;/span&gt;. The&amp;nbsp;preferred is to create a variable and then add the &lt;span style=&quot;background-color: #cccccc;&quot;&gt;$_SERVER[];&lt;/span&gt; variable.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Also, after making it share with your friends :P&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;What IP means :&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Every computer that communicates over the Internet is assigned an IP address that uniquely identifies the device and distinguishes it from other computers on the Internet. An IP address consists of four parts. For example :&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: #cccccc; font-family: verdana; text-align: center;&quot;&gt;59.182.17.16&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;What Remote Port Means :&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;In TCP / IP networking ports are the endpoint to a logical connection. When you type in a website address your computer is opening up a connection on a remote port and asking for the web pages to be sent to your computer. There are 65535 ports.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Subscribe to my blog :&amp;nbsp;&lt;input class=&quot;follow-by-email-address&quot; name=&quot;email&quot; placeholder=&quot;Enter Your E-Mail Here..&quot; style=&quot;border: 2px solid #000000; color: green;&quot; type=&quot;text&quot; /&gt;&lt;/span&gt; &lt;input class=&#39;follow-by-email-submit&#39; style=&#39;width:90px;border:2px solid black;&#39; type=&#39;submit&#39; value=&#39;Subscribe&#39;/&gt;&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/2810122856229915198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/03/find-your-internet-protocol-ip-address.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/2810122856229915198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/2810122856229915198'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/03/find-your-internet-protocol-ip-address.html' title='Find your Internet Protocol (IP) Address and Remote Port using your self made PHP Script'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2xiJyTZ1_RFTKVc5o91Disu4SiwK5LUQuS-dCcL7pWB_RI-QIxOLrLK98d00AjbqKucIRsiZpEdUxvsyBulCsYn3JplBAafOEwj3sfHuMD2MVb78YUuugSTsZO7JALkwLSZ_PQYDWHmkw/s72-c/index.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-523570871194868849</id><published>2013-03-22T11:01:00.000-07:00</published><updated>2014-02-26T17:03:22.811-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Blogging"/><category scheme="http://www.blogger.com/atom/ns#" term="Hosting"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>How to make a premium wordpress blog, without paying single buck!</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
Instead of writing a huge&amp;nbsp;explanation&amp;nbsp;on making a premium wordpress blog for free i thought to make a video of it. So it will be easier me to explain and also it will be easier for you to understand. So in this screen cast i&#39;ll be explaining you of creating a wordpress (WP) premium blog for free. Also i&#39;ll be introducing a free trusted web hosting service...&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;http://i.ytimg.com/vi/-tEw_Gc_reI/0.jpg&quot; height=&quot;366&quot; width=&quot;560&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/-tEw_Gc_reI?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata&quot; /&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed width=&quot;560&quot; height=&quot;366&quot;  src=&quot;http://www.youtube.com/v/-tEw_Gc_reI?version=3&amp;f=user_uploads&amp;c=google-webdrive-0&amp;app=youtube_gdata&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
The hosting service is very popular - it&#39;s&amp;nbsp;&lt;a href=&quot;http://www.000webhosting.com/&quot; target=&quot;_blank&quot;&gt;000webhosting.com&lt;/a&gt;&lt;br /&gt;
Hope so you will like the video. Also if you want any help or didn&#39;t understand how to setup then ask me anytime!&lt;br /&gt;
For a better quality view the video on youtube.&lt;br /&gt;
Thanks for watching and also if possible then subscribe my channel :P&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/523570871194868849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/03/how-to-make-premium-wordpress-blog.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/523570871194868849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/523570871194868849'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/03/how-to-make-premium-wordpress-blog.html' title='How to make a premium wordpress blog, without paying single buck!'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1141247975054932064.post-5242944660297258042</id><published>2013-03-15T11:45:00.002-07:00</published><updated>2014-02-26T17:03:22.813-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="CSS"/><category scheme="http://www.blogger.com/atom/ns#" term="Demos"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'>Move a HTML Div with CSS and Javascript, No JQuery!</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;On the web, when anyone searches about &quot;how to move div or any other element&quot; their are thousands of results, but only few of results are teaching it with Pure Javascript. In this tutorials i&#39;ll also teach you the same but i&#39;ll also add little bit of twist in it. Check the demo, i&#39;m sure you will like it.&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglmtNaxOba24hSymDlUq55rh0kTOAT6Vszv0-OxsmXNjho9q8sfO_ZizVc9IDyv84jgyk_tzDw-L0HU860H_JlFg4I2Fy7YQOToM5JmaJHyIXdjUZEq8v_Ew71DqvTjGi5fxu8qUy3TjvL/s1600/demo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglmtNaxOba24hSymDlUq55rh0kTOAT6Vszv0-OxsmXNjho9q8sfO_ZizVc9IDyv84jgyk_tzDw-L0HU860H_JlFg4I2Fy7YQOToM5JmaJHyIXdjUZEq8v_Ew71DqvTjGi5fxu8qUy3TjvL/s1600/demo.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;I know i&#39;m bad in selecting color schemes, now you guys also know that after seeing the above image..!&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiveWA3NJJTVEW2yK_FZYjkIEbbIvs5GDZNL-bFPbJQWuXKv7YVgFWFdNX5I6u6rP8_uIDuZOHmpyGwqfNbwZ8BPa6fJWa0BELKixAMpIyxP_R8_VAkrSIt1FkxqTTyAdjkEQVs40BcTHUA/s1600/live.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiveWA3NJJTVEW2yK_FZYjkIEbbIvs5GDZNL-bFPbJQWuXKv7YVgFWFdNX5I6u6rP8_uIDuZOHmpyGwqfNbwZ8BPa6fJWa0BELKixAMpIyxP_R8_VAkrSIt1FkxqTTyAdjkEQVs40BcTHUA/s1600/live.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_UZYhz3tbEqalRmR5YiUhu-2utlo0bzVPujLLFER2tBhgwD_-xArLiRHvln5iiIhbLZfN350VlQ8SOPRwyRF6TDQtErj_BWEq0jGEW3diH7n4yxOIMp87ZZ2kbPoe87WMDiE-MSw8rzUp/s1600/download.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now create a div in HTML, which is very simple...and id should be &lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&#39;tcp&#39;&lt;/span&gt;&amp;nbsp;or anything else what you want to add.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&amp;nbsp;&lt;/b&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;lt;div id=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;tcp&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;input type=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;text&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;maxlength=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Trebuchet MS, sans-serif;&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;id=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Trebuchet MS, sans-serif;&quot;&gt;&quot;mtop&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;placeholder=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Trebuchet MS, sans-serif;&quot;&gt;&quot;Add pixel to move top&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;3.&lt;/b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;lt;input type=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Trebuchet MS, sans-serif;&quot;&gt;&quot;text&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;maxlength=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Trebuchet MS, sans-serif;&quot;&gt;&quot;3&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;id=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Trebuchet MS, sans-serif;&quot;&gt;&quot;mleft&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;placeholder=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f; font-family: Trebuchet MS, sans-serif;&quot;&gt;&quot;Add pixel to move left&quot;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;4.&lt;/b&gt;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;After creating div we will style it...Create a external or internal or inline stylesheet, depends on you.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;In stylesheet the position should be absolute.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;#tcp {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;position:&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;absolute&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;3.&lt;/b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;background-color:&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;#ebebeb&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;b style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;4.&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #cc0000; font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;I&#39;m not adding too much style over here, but in the demo i have added many styles.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now, let&#39;s add the main&amp;nbsp;ingredient; which is javascript.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;

&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #cc0000;&quot;&gt;function&lt;/span&gt; &lt;span style=&quot;color: #e69138;&quot;&gt;moveit(&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;dmove&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;gtop&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;gleft&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;numvalid&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;{&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;2.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;dmove.style.top&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;gtop.value&lt;/span&gt; &lt;span style=&quot;color: #e69138;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt; &#39;px&#39;&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;3.&lt;/b&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;dmove.style.left&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;gleft.value&lt;/span&gt; &lt;span style=&quot;color: #e69138;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #6aa84f;&quot;&gt;&#39;px&#39;&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;4.&lt;/b&gt; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Now we will create a new input type which is button. We are making it to call our &lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&#39;function moveit()&#39;&lt;/span&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;


&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp; &lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;lt;input type=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;button&quot;&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;Move&quot;&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;done&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;Ok, Now we&#39;ll add &lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&#39;OnClick event&#39;&lt;/span&gt; and we will call our &lt;span style=&quot;background-color: #eeeeee;&quot;&gt;&#39;function moveit()&#39;&lt;/span&gt; also we will pass parameters.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: #dedede;&quot;&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;b&gt;1.&lt;/b&gt; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;lt;input type=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;button&quot;&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;value=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;Move&quot;&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;id=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;done&quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #cc0000;&quot;&gt;OnClick=&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;moveit(&lt;/span&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;document.getElementById(&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&#39;tcp&#39;&lt;/span&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #3d85c6;&quot;&gt;document.getElementById(&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&#39;mtop&#39;&lt;/span&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;document.getElementById(&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&#39;mleft&#39;&lt;/span&gt;&lt;span style=&quot;color: #3d85c6;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #e69138;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;&quot;&lt;/span&gt; &lt;span style=&quot;color: #cc0000;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;The OnClick function is too large, so it&#39;s not&amp;nbsp;fitting&amp;nbsp; to my blog&#39;s body..doesn&#39;t matter.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;If you will try it, it will work. But it&#39;s not moving smoothly, i&#39;ll try it..later, i&#39;ll add one more post on how to make it to work smoothly.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS, sans-serif;&quot;&gt;The first parameter of &#39;function moveit&#39; in which we are calling our &#39;div&#39; which id is &#39;tcp&#39; and the other parameters are in which we are calling our text boxes.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Check out TheCodePress on Facebook :&amp;nbsp;http://www.facebook.com/Thecodepress&lt;br /&gt;
Check out TheCodePress on Twitter :&amp;nbsp;https://twitter.com/TheCodePress&lt;br /&gt;
Don&#39;t forget to subscribe the blog :&amp;nbsp;&lt;input class=&quot;follow-by-email-address&quot; name=&quot;email&quot; placeholder=&quot;Enter Your E-Mail Here..&quot; style=&quot;border: 2px solid #000000; color: green;&quot; type=&quot;text&quot; /&gt;
 &lt;input class=&quot;follow-by-email-submit&quot; style=&quot;border: 2px solid black; width: 90px;&quot; type=&quot;submit&quot; value=&quot;Subscribe&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thecodepress.blogspot.com/feeds/5242944660297258042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thecodepress.blogspot.com/2013/03/move-html-div-with-css-and-javascript.html#comment-form' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5242944660297258042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1141247975054932064/posts/default/5242944660297258042'/><link rel='alternate' type='text/html' href='http://thecodepress.blogspot.com/2013/03/move-html-div-with-css-and-javascript.html' title='Move a HTML Div with CSS and Javascript, No JQuery!'/><author><name>Ashwin Pathak</name><uri>http://www.blogger.com/profile/16439273132197284002</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='33' height='26' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgr0i74m39GjUSwO2FaTRr01KKB5xhXp6A1jy1M0beSZCV_LOY5D0mSOp8Mi5lHItO-q2HdzpkoDOkyOKlaLNVf5_oV4FQBBvc1BCNJ-9yWQ4cGWSkTTjUa5UYhKurRjDY/s220/CP-LOGO.png'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglmtNaxOba24hSymDlUq55rh0kTOAT6Vszv0-OxsmXNjho9q8sfO_ZizVc9IDyv84jgyk_tzDw-L0HU860H_JlFg4I2Fy7YQOToM5JmaJHyIXdjUZEq8v_Ew71DqvTjGi5fxu8qUy3TjvL/s72-c/demo.png" height="72" width="72"/><thr:total>11</thr:total></entry></feed>