//PHP scripts // // Code in the head of my link-monkey page // \n"; $url = $_POST['url']; // Name $name = "st33d"; if($_POST['password'] != "****"){ if($_POST['name'] != ""){ $temp = $_POST['name']; $temp = trim($temp); if($temp != "st33d"){ $name = $_POST['name']; } else { $name = "someone pretending to be me"; } } else { $name = "anonymous"; } } // Site description $site = "who knows where this link goes..."; if($_POST['site'] != ""){ $site = $_POST['site']; } // Category $category = "interesting"; if($_POST['use'] == "useful"){ $category = "useful"; } // Build the string $link = "\n".$site." submitted by ".$name." under ".$category."
"; } // Append to file $filename = "links.txt"; $fp = fopen($filename,"a") or die("failed to open links.txt for appending"); fwrite($fp, $link); fclose($fp); ?> // //Page counter for old index page bottom (almost identical code in bacterium.php) // "; fclose($fd) ; $fd = fopen ($filename , "w") or die ("Can't open $filename") ; $fcounted = $fstring + 1 ; $fout= fwrite ($fd , $fcounted ) ; fclose($fd) ; ?> // //random text and acronym text (shpiel.php) // "; echo $txt1[rand(0,sizeof($txt1)-1)]; echo $txt2[rand(0,sizeof($txt2)-1)]; echo ""; ?> // //random splash pages (splash.php) // // //list of splash pages (splashList.php) // sizeof($import)-1){ $number = 0; } include ($import[$number]); echo "
\n"; echo "

\n"; echo "Next\n"; echo "

\n"; echo "
"; ?> // //segment of collapsable links (left frame of index.html) // Images
'; } else { echo 'Images
'; } ?> requires Acrobat Reader

// //collapsable links on favourites page // '.$tabs[$i].'

'; } else { echo '0" target="_self">'.$tabs[$i].'

'; include $inc[$i]; } } ?> // //split a string by newlines and print (I've a bad memory) // $listed = split("\n",$fstring); for ($i = 0; $i < count($listed); $i++){ echo $listed[$i]."
"; } // //saving text files to a local directory securely and scanning the directory (code on coding.php) // 0 && count($displayCode) > 0){ if(!checkForExt($fileToSave,"txt")){ $fileToSave .= ".txt"; } if(strtolower($fileToSave) == "manifest.txt"){ echo "

You may not save your file as manifest.txt

"; }else{ //format code for saving: remove html and strip whitespace around colons $displayCode = strip_tags($displayCode); $fixCode = explode("\n",$displayCode); foreach($fixCode as $i => $colonFix){ if(strpos($colonFix,":") != false){ $elements = explode(":",$colonFix); for($ii = 0; $ii < count($elements); $ii++){ $elements[$ii] = trim($elements[$ii]); } $colonFix = implode(":",$elements); } $fixCode[$i] = $colonFix; } $displayCode = implode("\n",$fixCode); stripFolderChange($fileToSave); saveToFile($fileToSave,$displayCode); } } //loading if(count($fileToLoad) > 0){ if(!checkForExt($fileToLoad,"txt")){ $fileToLoad .= ".txt"; } stripFolderChange($fileToLoad); $displayCode = loadToString($fileToLoad); $displayCode = strip_tags($displayCode); } ?>
files available on site:
"; } } closedir($handle); } ?> // //string operations file included in automat project //includes checking file extensions, stripping folder changes (../) and loading and saving files // "; return ""; }else{ $file = fopen ($filename , "r") or die ("Can't open $filename") ; $fstring = fread ($file , filesize ($filename)) ; fclose($file) ; return $fstring; } } function saveToFile ($filename, $fstring){ //saves a string to file $file = fopen ($filename , "w") or die ("Can't open $filename") ; fwrite ($file , $fstring) ; fclose($file) ; } ?> // //saving a list of files to include securely (code in manifest.php) // 0){ $manifestString = strip_tags($manifestString); $manifestToSave = split("\n",$manifestString); for ($i = 0; $i < count($manifestToSave); $i++){ $manifestToSave[$i] = trim($manifestToSave[$i]); stripFolderChange($manifestToSave); if(!checkForExt($manifestToSave[$i],"txt") && strlen($manifestToSave[$i]) > 0){ $manifestToSave[$i] = $manifestToSave[$i].".txt"; } } saveToFile("manifest.txt",join($manifestToSave,"\n")); } $displayManifest = loadToString("manifest.txt"); ?> // //file upload script - adapted from tizag.com // //first page: - contains checkForExt() from above
Choose a file to upload:

Files uploaded

$file"."
"; } } closedir($handle); } ?> //second page: // //verifying an email address's format an checking if the address exists (verifyEmail.php) // \n"; return false; } }else{ //if no mail exchanger, maybe the host itself will accept mail $mxhost[] = $domain; $mxweight[] = 1; } //create sorted array of hosts for($i = 0; $i < count($mxhost); $i++){ $weighted_host[($mxweight[$i])] = $mxhost[$i]; } ksort($weighted_host); //loop over each host foreach($weighted_host as $host){ //connect to host on SMTP port if(!($fp = fsockopen($host, 25))){ //couldn't connect to this host but the next might work continue; } //skip over 220 messages, giver up if no response for 10 seconds set_socket_blocking($fp, false); $stopTime = time() + 10; $gotResponse = false; while(true){ //try to get a line from mail server $line = fgets($fp, 1024); if(substr($line,0,3) == "220"){ //reset timer $stopTime = time() + 10; $gotResponse = true; }elseif(($line == "") and ($gotResponse)){ break; }elseif(time() > $stopTime){ break; } } if(!$gotResponse){ //this host was unresponsive, but maybe the next will be better continue; } set_socket_blocking($fp, true); //sign in fputs($fp, "HELO $SERVER_NAME\r\n"); fgets($fp, 1024); //set from fputs($fp, "MAIL FROM: \r\n"); $line = fgets($fp, 1024); //close connection fputs($fp, "QUIT\r\n"); fclose($fp); if(substr($line,0,3) != "250"){ //mail server doesn't recognize this address, so it must be bad $error = $line; return false; }else{ //address recogniszed return true; } } $error = "Unable to reach a mail exchanger!"; return false; } ?>