Wednesday, August 15, 2007

Intrebari frecvente

http://www.romaniantravelzone.com/index.php?sid=faq

Tuesday, August 14, 2007

Mi s-a urat

Ceilalti copii

- Tata, imi cumperi un mobil hightech 3G cu USB, bluetooth cu camera video, GPRS si cu aplicatii java si mp3?
- Fiule, nu te-ai putea droga si tu ca ceilalti copii?!

Cocosul...

Un preot locuia langa o manastire si avea 10 gaini si un cocos.
Cocosul din cand in cand disparea, dar aparea pana seara. Ultima data cand a zburat nu s-a mai intors si preotul, primul lucru duminica in biserica, a intrebat lumea:
- As vrea sa stiu daca cineva are un cocos?... si toti barbatii s-au sculat in picioare...
- Nu, nu, nu, am vrut sa intreb daca cineva a vazut un cocos?...si toate femeile s-au sculat in picioare...
- Nu, nu, nu, nici asta n-am vrut sa stiu, vreau sa stiu daca cineva de aici a vazut un cocos care nu-i apartine?... si jumatate din femei s-au sculat in picioare...
- Nu, nu, nu, nici asta n-am vrut sa stiu, vreau sa stiu daca cineva a vazut cocosul meu?... si toate maicutele s-au sculat in picioare.

Monday, August 13, 2007

Se poate rezolva

Un cetatean se duce la doctor sa-i faca o radiografie la plamini.
Doctorul: - Domnule, iata radiografia. Am 2 vesti... una buna si una proasta.
Pacientul: - Care e vestea proasta?
Doctorul: - Dupa cum puteti vedea, aveti o tumoare foarte mare la plamini
Pacientul: - Si aia buna?
Doctorul: - Se poate rezolva in Photoshop

Sunday, August 12, 2007

5 mari evrei ai lumii

Moise: - Totul este lege.
Isus: - Totul este dragoste.
Marx: - Totul este bani.
Freund: - Totul este sex.
Einstein: - Totul este relativ.

Un arab la aeroport

Un arab la aeroport:
- Name?
- Abdul al-Rhazib.
- Sex?
- Three to five times a week.
- No, no. I mean male or female?
- Male, female,sometimes camel.
- Holy cow!
- Yes, cow, sheep, animals in general.
- But isn't that hostile?
- Horse style, doggy style, any style!
- Oh dear!
- No,no! Deer run too fast!

Thursday, August 9, 2007

PHP/MySQL Logging

CREATE TABLE `user_log` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`log_date` DATE,
`log_time` TIME,
`method` TEXT,
`page` TEXT,
`referer` TEXT,
`adress` TEXT,
`browser` TEXT,
PRIMARY KEY (`id`),
INDEX (`date`, `time`));

<?

$date = date("Y-m-d"); // Current date
$time = date("H:i:s"); // Current time

if (isset($_SERVER['REQUEST_METHOD'])) { // HTTP-method
$method = $_SERVER['REQUEST_METHOD'];
} else {
$method = "";
}
if (isset($_SERVER['REMOTE_ADDR'])) { // IP-adress
$ip_adress = $_SERVER['REMOTE_ADDR'];
} else {
$ip_adress = "";
}
if (isset($_SERVER['HTTP_USER_AGENT'])) { // Browser
$browser = $_SERVER['HTTP_USER_AGENT'];
} else {
$browser = "";
}
if (isset($_SERVER['PHP_SELF'])) { // Current page
$page = $_SERVER['PHP_SELF'];
} else {
$page = "";
}
if (isset($_SERVER['HTTP_REFERRER'])) { // Previous page
$referer = $_SERVER['HTTP_REFERRER'];
} else {
$referer = "";
}
?>

$sql="INSERT INTO user_log (log_date, log_time, method, page,
referer, adress, browser)VALUES('$date', '$time', '$method', '$ip_adress', '$browser', '$page' ,'$referer')";

Animated favicon

<link rel="shortcut icon" href="favicon.ico" >
<link rel="icon" href="animated_favicon1.gif" type="image/gif" >

Sending mail with mail()

<?

$email = "webmaster@yourwebsite.net"; // Recieve this by your email adress
$subject = "My Test Subject"; // Replace this by a subject
$message = "This is a test message"; // Replace this by your message
$header = "From: Webmaster@" . $_SERVER['SERVER_NAME'] . "\r\n";

if (mail($email, $subject, $message, $headers)) {
$report = "Your email has been send";
} else {
$report = "Your email could not be send";

echo "<b>$report</b>";

?>

Blocking proxies

if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) || ($_SERVER['HTTP_USER_AGENT']=='') || ($_SERVER['HTTP_VIA']!='')){
die("Don't use proxies, please.");
}

$fp = fopen(".htaccess", "a"); /*append the file*/
$write = fputs($fp, "deny from " .$_SERVER['REMOTE_ADDR'] . "\n");
fclose($fp);

Header redirect

<?php
header("location:/yourfile.php");
// replace yourfile.php with your filename
?>

Headers Already Sent is a problem many people have. To solve this:

<?php
// Run ob_start
ob_start();

//Your script here

//Run ob_end_flush
ob_end_flush();
?>

Constants

<?php

// Constant
define("MYNAME", "Noru");

// Lets output what we defined
echo MYNAME; // outputs Noru
echo Myname; // outputs Myname, so make sure you use caps.

?>

Meta refresh

<meta http-equiv='refresh' content='5;url='shoutbox.html'>

Mysql connect

$mysql_host="localhost";
$mysql_username="myusername";
$mysql_password="dbpassword";
$mysql_database="datbasename";

$db = mysql_connect("$mysql_host", "$mysql_username", "$mysql_password");
if (!$db) {
die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db("$mysql_database", $db);
if (!$db_selected) {
die ('Could not connect : ' . mysql_error());
}

Filter language

function filter($string) {

$string = str_replace ("shit", "***", $string);
$string = str_replace ("stupid", "***", $string);
$string = str_replace ("foul", "***", $string);

return $string;

}

MD5 generator

<?php

if(isset($_POST['submit']))
{

$encoded=md5(trim($_POST['input']));

if($_POST['input'] && strlen($_POST['input']) > 0){

echo '<div class="message"><b>MD5 HASH:</b> '.$encoded.'</div>';

}else{

echo '<div class="message"><b>Error:</b> Empty Input</div>';

}

}

?>

Check if website is online or offline


<?php
if(isset($_POST['url'])){
$fp = fsockopen($_POST['url'], 80, $errno, $errstr, 30);
if (!$fp) {
echo "".$_POST['url']." Status:";
echo "$errstr ($errno)";
} else {
echo "".$_POST['url']." Status:";
echo "Online
";

fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
}
?>


<form action="" method="post">
URL(no http):<input type="text" name="url" value=""<
<input type="submit" name="submit" value="Check Status">
</form>