Skip navigation

Tag Archives: html

First of all i would like to thanks to this blog ( ) for giving this very nice php snippets info to keep. (w/c took me to other php site codes to ponder)  I am not a hardcoder of php so i would like to keep this one for my future references. Now, time to go through my notes…

function generatePassword($length=9, $strength=0) {
$vowels = ‘aeuy’;
$consonants = ‘bdghjmnpqrstvz’;
if ($strength >= 1) {
$consonants .= ‘BDGHJLMNPQRSTVWXZ’;
if ($strength >= 2) {
$vowels .= “AEUY”;
if ($strength >= 4) {
$consonants .= ‘23456789’;
if ($strength >= 8 ) {
$vowels .= ‘@#$%’;

$password = ”;
$alt = time() % 2;
for ($i = 0; $i < $length; $i++) {
if ($alt == 1) {
$password .= $consonants[(rand() % strlen($consonants))];
$alt = 0;
} else {
$password .= $vowels[(rand() % strlen($vowels))];
$alt = 1;
return $password;

function age($date){
$year_diff = ”;
$time = strtotime($date);
if(FALSE === $time){
return ”;

$date = date(‘Y-m-d’, $time);
list($year,$month,$day) = explode(“-“,$date);
$year_diff = date(“Y”) – $year;
$month_diff = date(“m”) – $month;
$day_diff = date(“d”) – $day;
if ($day_diff < 0 || $month_diff < 0) $year_diff–;

return $year_diff;

header(‘Content-type: text/css’);
function compress($buffer) {
/* remove comments */
$buffer = preg_replace(‘!/\*[^*]*\*+([^/][^*]*\*+)*/!’, ”, $buffer);
/* remove tabs, spaces, newlines, etc. */
$buffer = str_replace(array(“\r\n”, “\r”, “\n”, “\t”, ‘  ‘, ‘    ‘, ‘    ‘), ”, $buffer);
return $buffer;

/* your css files */


function maintenance($mode = FALSE){
if(basename($_SERVER[‘SCRIPT_FILENAME’]) != ‘maintenance.php’){
if(basename($_SERVER[‘SCRIPT_FILENAME’]) == ‘maintenance.php’){

  • HIGHLIGHT SPECIFIC WORDS IN A PHRASE – Sometimes it can be really usefull for a visitor to have the terms he serached for highlighted. The following snippet is using a simple regular expression to find words in a phrase and highlight them.

function highlight($sString, $aWords) {
if (!is_array ($aWords) || empty ($aWords) || !is_string ($sString)) {
return false;

$sWords = implode (‘|’, $aWords);
return preg_replace (‘@\b(‘.$sWords.’)\b@si’, ‘<strong style=”background-color:yellow”>$1</strong>’, $sString);

Well so far these are the snippets that i needed most and I wanna keep on my blog. And If you guys need more of the codes then you can just click on the links above for more of it. 🙂


In this section explains if you are making a website and you need a code for html to work with a pop-up html window with specific length and width.


*this will be placed inside the html you are working on*
<script type=”text/javascript”>
//Insert this code inside the javascript
function popup(url) {,’name’,’height=600,width=800′);
if (window.focus) {newwindow.focus()}
return false;


*Then this is the code for the link*
<a href=”samplepopup.html” onclick=”return popup(‘samplepopup.html’)”>This is the Pop-up</a>

In this section explains if you are making a website and you need a code for a flash button to work with a pop-up html window with specific length and width.


*this will be the code inside the flash button*
on (release) {
getURL (“javascript:openNewWindow(‘samplepopup.html’,’thewin’,’height=600,width=800,toolbar=no,scrollbars=no’);”);

*html code* *where the flash object is embeded*
<script language=”JavaScript”>
//Insert this code inside the javascript
function openNewWindow(URLtoOpen, windowName, windowFeatures) {, windowName, windowFeatures); }

*inside html-body tag*

<EMBED src=”samplepopup.swf” quality=high bgcolor=#FFFFFF WIDTH=800 HEIGHT=500 swLiveConnect=true name=samplepopup.swf TYPE=”application/x-shockwave-flash” PLUGINSPAGE=””></EMBED&gt;

take note: the width and height of the object is up to you to decide on what will you be using.

I’ve been browsing some online-game-forums and caught my attention on this little, but tricky site game. I called this a game because this site was intended to measure your IT/programming skills like  JavaScript, PHP, HTML and such. No harm will be done if you ended up wrong answers in guessing. We’ll you better try it and let’s see how deep can you explore~! 😀

Btw, im currently stuck in Level 8 now and still guessing how to bypass these tricks.. hehehe. I believe these site has 100 levels! who knows? 😀 Go figure it yourself!

Note: I’m not endorsing this site or what-so-ever and this is not mine, i just wanna share to others how cool this site works. lol 😛 I believe this site is safe since i never encounter any viruses or spam of it. Just enter at your own risk. 🙂 And it works on any internet browsers. (Opera, IE, Mozilla) Happy Hacking! 😉


WORLDWIDE HACKING IN PROGRESS… is your own online hacker simulation. With over 100 levels that require different skills to get to another step of the game, this new real-life simulation will help you advance your security knowledge and also improve your JavaScript, PHP, HTML and graphic thinking in a fun way. Have a spare minute? Log on! Each level will provide you with a new, harder clue to find a way to get to another level. Only few people have gotten to the end of the maze. How good are your Hacker Skills?
visit this site and test your hacking skills now!