This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| // source: www.apphp.com/index.php?snippet=javascript-blocking-right-click | |
| function f1() { | |
| if(document.all) { return false; } | |
| } | |
| function f2(e) { | |
| if(document.layers || (document.getElementById && document.all)) { | |
| if(e.which==2 || e.which==3) { return false; } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // This code allows to perform a query to WhoIs service in PHP. | |
| // Source: www.apphp.com/index.php?snippet=php-whois-query | |
| // Special thanks to: Corne O Kelly | |
| function whois_query($domain) { | |
| // fix the domain name: $domain = strtolower(trim($domain)); | |
| $domain = preg_replace('/^http:\/\//i', '', $domain); | |
| $domain = preg_replace('/^www\./i', '', $domain); | |
| $domain = explode('/', $domain); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // This code allows to calculate the full size of a directory using PHP. | |
| // source http://www.apphp.com/index.php?snippet=php-whois-query | |
| // Special thanks to: Corne O Kelly | |
| /** | |
| * Calculate the full size of a directory | |
| * @param string $DirectoryPath Directory path | |
| */ | |
| function CalcDirectorySize($DirectoryPath) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT order_id,product_name,qty FROM orders | |
| INTO OUTFILE '/tmp/customers.csv' | |
| FIELDS TERMINATED BY ',' | |
| ENCLOSED BY '"' | |
| LINES TERMINATED BY '\n' | |
| -- source: http://www.apphp.com/index.php?snippet=mysql-create-csv-from-select |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This would be useful when a text input is one-off or unique. Like a username or email input, one-time use codes, or for when you have built your own auto-suggest/auto-complete feature and need to turn off the browser default. | |
| <input name="email" type="text" autocomplete="off" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style type="text/css"> | |
| /* source: www.apphp.com/index.php?snippet=css-cross-browser-gradient */ | |
| background-color: #000; | |
| filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bbb', endColorstr='#000'); | |
| background-image: -webkit-gradient(linear, left top, left bottom, from(#bbb), to(#000)); | |
| background-image: -webkit-linear-gradient(top, #bbb, #000); | |
| background-image: -moz-linear-gradient(top, #bbb, #000); | |
| background-image: -ms-linear-gradient(top, #bbb, #000); | |
| background-image: -o-linear-gradient(top, #bbb, #000); | |
| background-image: linear-gradient(top, #bbb, #000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style type="text/css"> | |
| /* source: www.apphp.com/index.php?snippet=css-my-own-font */ | |
| @font-face{ | |
| font-family: 'MyFont'; | |
| src: url('myfont.eot'); | |
| src: url('myfont.eot?#iefix') format('embedded-opentype'), | |
| url('myfont.woff') format('woff'), | |
| url('myfont.ttf') format('truetype'), | |
| url('myfont.svg#webfont') format('svg'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| // Source: Anti iFrame Buster in JavaScript | |
| var prevent_bust = 0; | |
| window.onbeforeunload = function() { prevent_bust++; } | |
| setInterval(function() { | |
| if (prevent_bust > 0) { | |
| prevent_bust -= 2; | |
| window.top.location = 'http://domain.com'; | |
| } | |
| }, 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| // Source: http://www.apphp.com/index.php?snippet=javascript-getting-ip-address | |
| var ip = '<!--#echo var="REMOTE_ADDR"-->'; | |
| document.write('Your IP address is: ' + ip); | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // source: http://www.apphp.com/index.php?snippet=php-calculate-age-using-birth-date | |
| function age($date){ | |
| $time = strtotime($date); | |
| if($time === false){ | |
| return ''; | |
| } | |
| $year_diff = ''; |