Archive for the Category Server und System
PHP Code: ICQ Online Check
Hiermit kannst du überprüfen ob eine ICQ Nummer online ist. Die Ausgabe erfolgt in Text.
<?php
function GetICQ($uin) {
if (!is_numaeric($uin)) return FALSE;
$fp = fsockopen('web.icq.com',80,&$errno,&$errstr,8);
if (!$fp) return FALSE;
$request = "HEAD /whitepages/online?icq=$uin&img=5 HTTP/1.0\r\n"."Host: web.icq.com\r\n"."Connection: close\r\n\r\n";
fputs($fp, $request);
do {
$response = fgets($fp, 1024);
} while (!feof($fp) && !stristr($response,'Location'));
fclose($fp);
if (strstr($response, '4367'))
return 'online';
if (strstr($response, '4349'))
return 'offline';
if (strstr($response, '4386'))
return 'disabled';
return FALSE;
}
?>
PHP Code: Backlink-Check
Dieses Schnipsel prüft, ob ein bestimmter Link sich auf einer anderen Seite befindet.
<?php
function check_back_link($remote_url,$link) {
$match_pattern = preg_quote(rtrim($link,"/"),"/");
$found = false;
if ($handle = @fopen($remote_url, "r")) {
while (!feof($handle)) {
$part = fread($handle, 1024);
if (preg_match("/<a(.*)href=[\"']".$match_pattern."(\/?)[\"'](.*)>(.*)<\/a>/", $part)) {
$found = true;
break;
}
}
fclose($handle);
}
return $found;
}
?>
PHP Code: Loescht Verzeichnis oder Datei
Dieses Schnipsel erkennt, ob es sich um eine Datei oder ein Verzeichnis handelt und löscht diese entsprechend.
<?php
function delete($file) {
if (file_exists($file)) {
if (is_dir($file)) {
$handle = opendir($file);
while($filename = readdir($handle)) {
if ($filename != "." && $filename != "..") {
delete($file."/".$filename);
}
}
closedir($handle);
rmdir($file);
} else {
unlink($file);
}
}
}
?>
