Viser koder av ZtigO
Det ble i alt funnet 14 koder i databasen
Valgmuligheter
ZtigO sendte inn denne php-koden 01.12.2011 kl. 11:14.
<?php /** * @author Stig M. Halvorsen (ZtigO) * @version 1.0.0 (01.12.2011) * * @description: A class for reading and writing to file, Java style! * Throws exceptions on errors. */ // Define custom exceptions class FileNotFoundException extends Exception { } class FileNotReadableException extends Exception { } class FileNotWriteableException extends Exception { } class fileHandler { /** Class variables */ protected $fileName; // to hold the file name // P U B L I C F U N C T I O N S /** * public Constructor, sets path to file (optional) * * @param string $filename = NULL */ public function __construct($filename = NULL) { // Try to store the file name $this->setFile($filename); } /** * public setFile, sets path to file. No exceptions thrown here. * If you're opening a URI with special characters, such as spaces, * you need to encode the URI/filename with urlencode(). * * @param string &$filename (& == pass by reference) * @return boolean */ public function setFile(&$filename) { // Make sure it's a valid file name (string w/length) { // Set the filename $this->fileName = $filename; return true; // success } // Invalid file name return false; } /** * public getFileName, returns the file name. * * @return string $filename */ public function getFileName() { return $this->fileName; } /** * public getFileContents, returns the contents of the file. * Throws exceptions if file isn't set, doesn't exist or can't be read. * The function returns the read data or FALSE on failure. * * @return string || boolean */ public function getFileContents() { // Make sure we can read from the file. Throw eventual exceptions. $this->verifyFile(); // Return file contents, "@" to supress potential warnings. } /** * public write, writes data to the file. * Throws exceptions if file isn't set, doesn't exist, can't be read * or if it can't write to file. If filename does not exist, the file * is created. Otherwise, the existing file is overwritten, unless the * FILE_APPEND flag is set. The function returns the number of bytes * that were written to the file, or FALSE on failure. * * The optional value flags can be any combination of the following flags, * joined with the binary OR (|) operator: FILE_USE_INCLUDE_PATH, FILE_APPEND, * LOCK_EX. For details, see flag section on http://php.net/file_put_contents. * * $param string $data * $param int $flags = 0 * @return int || boolean */ public function write($data, $flags = 0) { // Make sure we can write to the file. Throw eventual exceptions. $this->verifyFile(true); // Return the save result, FALSE on failure. Use the === operator // to verify the return data of this function. return file_put_contents($this->fileName, $data, $flags); } // P R O T E C T E D F U N C T I O N S /** * protected verifyFile, helper function that checks that * the file can be used for our purpose. Throws exceptions * if something's wrong with the file. * * Optional parameter, $write, is if it should check for * write permissions or not. Default is false. * * @param boolean $write = false */ protected function verifyFile($write = false) { // Make sure the file path variable is set { // Check if the file exists { // It does not, throw exception. } // Check if file is readable { // It is not, throw exception throw new FileNotReadableException('File "'.htmlentities($this->fileName).'" can\'t be read, check file permissions.'); } // Optional ($write == true): Check if file is writeable { // It is not, throw exception throw new FileNotWriteableException('Can\'t write to file "'.htmlentities($this->fileName).'", check file permissions.'); } } else { // File path isn't set, throw exception throw new FileNotFoundException('Undefined file name.'); } } } ?>
Emneord (tags): Fil, fillesing, exceptions
Valgmuligheter
ZtigO sendte inn denne php-koden 23.07.2009 kl. 11:02.
<?php /** * nerdMail class * @author Stig Magnus Halvorsen (ZtigO) * @version 1.0.2 * * http://nerdvar.com/ * * A class using PHPs mail() function to send * emails as text and/or HTML with or without * attachments. Highly customizeable headers * and with a emailadress validator and anti * email injection function. */ class nerdMail { /** * define the required variables */ public $text; public $html; public $subject; public $sender; public $returnPath; /** * The list of accepted encoding of attachments * default is BASE64 * Must be uppercase! */ /** * The list of not overrideable headers * To prevent different unwanted results * The standards shouldn't be removed * Must be uppercase! */ /** * function $this->parseMail() or nerdMail::parseMail() * Based upon Hellkeepa's Val_email() function * Validates the email with a regular expression, then * checks if the mail server exists using checkdnsrr() * * @param string $email * @return boolean */ $RegExp = "/^[a-z][\\w\\pL\\.-]*[a-z0-9]@[a-z0-9][\\w\\pL\\.-]*[a-z0-9]\\.[a-z][a-z\\.]*[a-z]\\z/ui"; return true; } } return false; } /** function $this->antiInjection or nerdMail::antiInjection * looks for email injection attempts in $field by checking * for line breaks and horizontal tabs * * @param string|int $field * @return boolean */ return true; } else { return false; } } /** function $this->addMail * type: to, cc or bcc * email: address to add * parse: true -> validate $email * * Use it to populate the list of recipients * to for regular recievers, cc for carbon copy * and bcc for blind carbon copy * * @param "to"|"cc"|"bcc" $type["to"] * @param string $email * @param boolean $parse[false] * @return boolean */ public function addMail($type, $email, $parse = false) { return false; } if ($parse) { if (!$this->parseMail($email)) { return false; } } else { if ($this->antiInjection($email)) { return $email; } } switch ($type) { case "to": $this->receivers[] = $email; break; case "cc": $this->Cc[] = $email; break; case "bcc": $this->receivers[] = $email; break; default: $this->receivers[] = $email; } return true; } /** function $this->addHeader * Use it to add extra headers or to * override the nerdMail default ones * * Examples: * $this->addHeader("List-Unsubscribe", "<http://nerdvar.com/unsubscripe.php>"); * $this->addHeader("Message-Id: 123xxx@nerdvar.com"); * * @param string $key * @param boolean $val[false] * @return boolean */ public function addHeader ($key, $val = false) { return false; } /** Check for injectionattempt */ if ($this->antiInjection($key) or $this->antiInjection($val)) { return false; } if ($val == false) { $key = $val[0]; $val = $val[1]; } else { } } $this->headers["keys"][] = $key; $this->headers["values"][] = $val; return true; } /** function $this->attach * filePath: http://example.com/myfile.jpg, myfile.txt, etc * contenttype: image/jpeg, plain/text, etc.. * encoding: BASE64, BIT7, etc.. Must be in $enctypes array * * Adds and validates file to attach in the attachment list * * @param string $filePath * @param string $contenttype["OCTET"] * @param string $encoding["BASE64"] * @return boolean */ public function attach ($filePath, $contenttype = "OCTET", $encoding = "BASE64") { return false; } $contenttype = "OCTET"; } $encoding = "BASE64"; } if ($data) { $thisEnc = "base64"; } $this->attachments["encoding"][] = $thisEnc; $this->attachments["cType"][] = "text/plain; charset=UTF-8"; } elseif ($contenttype == OCTET) { $this->attachments["cType"][] = "application/octet-stream"; } else { $this->attachments["cType"][] = $contenttype; } return true; } else { return false; } } /** function $this->send * This completes the mailing by putting it all togheter and * sending it out. Returns false on failure and fails if it's * missing some required vars * * @return mixed */ public function send() { $i = 0; /** Define the multipart email hdr info */ /** Check wether it's any attachments or not and sets multitype */ $multiType = "mixed"; $attach = true; } else { $multiType = "alternative"; $attach = false; } /** Verify that the required variables are set */ return false; } /** Validate Subject */ $this->subject = "(No subject)"; } /** Add the receivers */ $sendData["receivers"] .= $this->receivers[$i]; $i++; $sendData["receivers"] .= ", "; } } $i = 0; /** Add the Carbon Copy receivers (CC) */ $sendData["Cc"] .= $this->Cc[$i]; $i++; $sendData["Cc"] .= ", "; } } $i = 0; /** Add the Blind Carbon Copy receivers */ $sendData["Bcc"] .= $this->Bcc[$i]; $i++; $sendData["Bcc"] .= ", "; } } $i = 0; /** Add the Headers **/ $headers .= "MIME-Version: 1.0\r\n"; } $headers .= "Content-Type: multipart/$multiType; boundary=\"$boundary1\"\r\n"; $headers .= "From: ".$this->sender."\r\n"; $headers .= "Reply-To: ".$this->sender."\r\n"; } /** Make sure the header isn't in the blocked list */ $headers .= $this->headers["keys"][$i].": ".$this->headers["values"][$i]."\r\n"; } $i++; } $i = 0; } if ($sendData["Cc"]) { $headers .= "Cc: ".$sendData["Cc"]."\r\n"; } if ($sendData["Bc"]) { $headers .= "Bcc: ".$sendData["Cc"]."\r\n"; } $headers .= "\n"; /** Add the mail body */ if (!$attach) { $body = "MIME-Version: 1.0\r\nContent-Type: multipart/alternative; boundary=\"$boundary1\"\r\n\r\n"; $body .= "--$boundary1\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n".$this->text."\n\n"; } $body .= "--$boundary1\nContent-Type: text/html; charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n".$this->html."\n\n"; } } else { $body = "--$boundary1\nContent-Type: multipart/alternative; boundary=\"$boundary2\"\r\n\r\n"; $body .= "--$boundary2\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n".$this->text."\n\n"; } $body .= "--$boundary2\nContent-Type: text/html; charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n".$this->html."\n\n"; } $body .= "--$boundary2--\n\n"; /** Add attachments */ $body .= "--$boundary1\nContent-Type: ".$this->attachments["cType"][$i]."; name=\"".$this->attachments["name"][$i]."\"\nContent-Transfer-Encoding: ".$this->attachments["encoding"][$i]."\nContent-Disposition: attachment; filename=\"".$this->attachments["name"][$i]."\"\n\n"; $body .= $this->attachments["data"][$i]; $i++; } $i = 0; } $body .= "--$boundary1--"; /** Send the final mail */ } else { } } } /** checkdnsrr() FUNCTION FOR WINDOWS SERVER WITH PHP VERSIONS LOWER THAN 5.3 * Checks for existence and creates the function if it doesn't, parameter * data is validated to avoid shell injection * * It's being used by the $nerdMail->pasreMail() function * * @param string $hostName * @param string $recType[""] * @return boolean */ /** List of accepted recTypes */ $accepted = array('A', 'MX', 'NS', 'SOA', 'PTR', 'CNAME', 'AAAA', 'A6', 'SRV', 'NAPTR', 'TXT', 'ANY'); global $accepted; /** validate the recType */ /** Validate domain/host name */ foreach ($result as $line) { return true; } } } return false; } return false; } } ?>
Emneord (tags): php, class, mail, epost, vedlegg
Valgmuligheter
ZtigO sendte inn denne php-koden 16.05.2009 kl. 17:20.
<script> // Percent Bar - Version 1.0 // Author: Brian Gosselin of http://scriptasylum.com // Script featured on http://www.dynamicdrive.com // Note: Modified by Dynamicdrive so incr/decrCount() accepts any percentage var spanID='output' ; // ZtigO Fix var loadedcolor='navy' ; // PROGRESS BAR COLOR var unloadedcolor='lightgrey'; // BGCOLOR OF UNLOADED AREA var barheight=15; // HEIGHT OF PROGRESS BAR IN PIXELS var barwidth=350; // WIDTH OF THE BAR IN PIXELS var bordercolor='black'; // COLOR OF THE BORDER // THE FUNCTION BELOW CONTAINS THE ACTION(S) TAKEN ONCE BAR REACHES 100%. // IF NO ACTION IS DESIRED, TAKE EVERYTHING OUT FROM BETWEEN THE CURLY BRACES ({}) // BUT LEAVE THE FUNCTION NAME AND CURLY BRACES IN PLACE. // PRESENTLY, IT IS SET TO DO NOTHING, BUT CAN BE CHANGED EASILY. // TO CAUSE A REDIRECT, INSERT THE FOLLOWING LINE IN BETWEEN THE CURLY BRACES: // window.location="http://redirect_page.html"; // JUST CHANGE THE ACTUAL URL IT "POINTS" TO. //*****************************************************// //********** DO NOT EDIT BEYOND THIS POINT **********// //*****************************************************// var w3c = (document.getElementById) ? true : false; var ns4 = (document.layers) ? true : false; var ie4 = (document.all && !w3c) ? true : false; var ie5 = (document.all && w3c) ? true : false; var ns6 = (w3c && navigator.appName.indexOf("Netscape")>=0) ? true : false; var blocksize = (barwidth-2) / 100; var loaded = 0; var perouter = 0; var perdone = 0; var txt=''; txt+='<div id="perouter" onmouseup="hidebar()" style="position:relative; visibility:hidden; background-color:'+bordercolor+'; width:'+barwidth+'px; height:'+barheight+'px;">'; txt+='<div style="position:absolute; top:1px; left:1px; width:'+(barwidth-2)+'px; height:'+(barheight-2)+'px; background-color:'+unloadedcolor+'; z-index:100; font-size:1px;"></div>'; txt+='<div id="perdone" style="position:absolute; top:1px; left:1px; width:0px; height:'+(barheight-2)+'px; background-color:'+loadedcolor+'; z-index:100; font-size:1px;"></div>'; txt+='</div>'; document.getElementById(spanID).innerHTML = txt; function incrCount(prcnt) { loaded+=prcnt; setCount(loaded); } function decrCount(prcnt) { loaded-=prcnt; setCount(loaded); } function setCount(prcnt) { loaded = prcnt; if (loaded<0) { loaded = 0; } if (loaded>=100) { loaded=100; setTimeout('hidebar()', 400); } clipid(perdone, 0, blocksize*loaded, barheight-2, 0); } //THIS FUNCTION BY MIKE HALL OF BRAINJAR.COM function findlayer(name,doc) { var i,layer; for(i=0;i<doc.layers.length;i++) { layer=doc.layers[i]; if(layer.name==name)return layer; if(layer.document.layers.length>0) if((layer=findlayer(name,layer.document))!=null) return layer; } return null; } function progressBarInit() { perouter = (ns4) ? findlayer('perouter',document) : (ie4) ? document.all['perouter'] : document.getElementById('perouter'); perdone = (ns4) ? perouter.document.layers['perdone'] : (ie4) ? document.all['perdone'] : document.getElementById('perdone'); clipid(perdone,0,0,barheight-2,0); if (ns4) { perouter.visibility="show"; } else { perouter.style.visibility="visible"; } } function hidebar() { action(); //(ns4)? perouter.visibility="hide" : perouter.style.visibility="hidden"; } function clipid(id,t,r,b,l) { if(ns4) { id.clip.left=l; id.clip.top=t; id.clip.right=r; id.clip.bottom=b; } else { id.style.width=r; } } progressBarInit(); </script> <script type="text/javascript"> incrCount(75) //set bar to 75% </script>
Emneord (tags): JavaScript
Valgmuligheter
ZtigO sendte inn denne php-koden 02.12.2007 kl. 17:59.
<?php /* Use this function to check if another server is online, requier that your server or host use PHP5 or newer. Function by Stig M. Halvorsen */ # Example # if (isOnline("www.domain.com", 80, 1)) { // www.domain.com is Online } # Example # if (isOnline("83.67.80.234", 80, 3)) { // The server with the IP mentioned above is online } # Function # function isOnline($server, $port, $timeout) { $timeout = 1; } $check = @stream_socket_client("tcp://$server:$port", $errno, $errstr, $timeout); if ($check) { return TRUE; } return FALSE; } ?>
Valgmuligheter
ZtigO sendte inn denne php-koden 07.12.2011 kl. 12:16.
<?php function mimeType($file) { // Function made by Stig M. Halvorsen, list is based on DavidS' function: http://norskwebforum.no/pastebin/8208 "3dmf" => "x-world/x-3dmf", "7z" => "application/x-7z-compressed", "a" => "application/octet-stream", "aab" => "application/x-authorware-bin", "aam" => "application/x-authorware-map", "aas" => "application/x-authorware-seg", "abc" => "text/vnd.abc", "acgi" => "text/html", "afl" => "video/animaflex", "ai" =>"application/postscript", "aif" =>"audio/x-aiff", "aifc" =>"audio/x-aiff", "aiff" =>"audio/x-aiff", "as" => "text/actionscript", "asc" =>"text/plain", "atom" =>"application/atom+xml", "avi" =>"video/x-msvideo", "bcpio" =>"application/x-bcpio", "bmp" =>"image/bmp", "cdf" =>"application/x-netcdf", "cgm" =>"image/cgm", "cpio" =>"application/x-cpio", "cpt" =>"application/mac-compactpro", "crl" =>"application/x-pkcs7-crl", "crt" =>"application/x-x509-ca-cert", "csh" =>"application/x-csh", "css" =>"text/css", "dcr" =>"application/x-director", "dir" =>"application/x-director", "djv" =>"image/vnd.djvu", "djvu" =>"image/vnd.djvu", "doc" =>"application/msword", "dtd" =>"application/xml-dtd", "dvi" =>"application/x-dvi", "dxr" =>"application/x-director", "eps" =>"application/postscript", "etx" =>"text/x-setext", "ez" =>"application/andrew-inset", "fla" => "application/octet-stream", "gif" =>"image/gif", "gram" =>"application/srgs", "grxml" =>"application/srgs+xml", "gtar" =>"application/x-gtar", "hdf" =>"application/x-hdf", "hqx" =>"application/mac-binhex40", "html" =>"text/html", "html" =>"text/html", "ice" =>"x-conference/x-cooltalk", "ico" =>"image/x-icon", "ics" =>"text/calendar", "ief" =>"image/ief", "ifb" =>"text/calendar", "iges" =>"model/iges", "igs" =>"model/iges", "indd" => "application/octet-stream", "jpe" =>"image/jpeg", "jpeg" =>"image/jpeg", "jpg" =>"image/jpeg", "js" =>"application/x-javascript", "kar" =>"audio/midi", "latex" =>"application/x-latex", "m3u" =>"audio/x-mpegurl", "m4a" => "audio/x-m4a", "man" =>"application/x-troff-man", "mathml" =>"application/mathml+xml", "me" =>"application/x-troff-me", "mesh" =>"model/mesh", "mid" =>"audio/midi", "midi" =>"audio/midi", "mif" =>"application/vnd.mif", "mov" =>"video/quicktime", "movie" =>"video/x-sgi-movie", "mp2" =>"audio/mpeg", "mp3" =>"audio/mpeg", "mpe" =>"video/mpeg", "mpeg" =>"video/mpeg", "mpg" =>"video/mpeg", "mpga" =>"audio/mpeg", "ms" =>"application/x-troff-ms", "msh" =>"model/mesh", "mxu m4u" =>"video/vnd.mpegurl", "nc" =>"application/x-netcdf", "oda" =>"application/oda", "ogg" =>"application/ogg", "pbm" =>"image/x-portable-bitmap", "pdb" =>"chemical/x-pdb", "pdf" =>"application/pdf", "pgm" =>"image/x-portable-graymap", "pgn" =>"application/x-chess-pgn", "php" =>"application/x-httpd-php", "php4" =>"application/x-httpd-php", "php3" =>"application/x-httpd-php", "phtml" =>"application/x-httpd-php", "phps" =>"application/x-httpd-php-source", "png" =>"image/png", "pnm" =>"image/x-portable-anymap", "ppm" =>"image/x-portable-pixmap", "ppt" =>"application/vnd.ms-powerpoint", "ps" =>"application/postscript", "qt" =>"video/quicktime", "ra" =>"audio/x-pn-realaudio", "ram" =>"audio/x-pn-realaudio", "ras" =>"image/x-cmu-raster", "rdf" =>"application/rdf+xml", "rgb" =>"image/x-rgb", "rm" =>"application/vnd.rn-realmedia", "roff" =>"application/x-troff", "rtf" =>"text/rtf", "rtx" =>"text/richtext", "sgm" =>"text/sgml", "sgml" =>"text/sgml", "sh" =>"application/x-sh", "shar" =>"application/x-shar", "shtml" =>"text/html", "silo" =>"model/mesh", "sit" =>"application/x-stuffit", "skd" =>"application/x-koan", "skm" =>"application/x-koan", "skp" =>"application/x-koan", "skt" =>"application/x-koan", "smi" =>"application/smil", "smil" =>"application/smil", "snd" =>"audio/basic", "spl" =>"application/x-futuresplash", "src" =>"application/x-wais-source", "sv4cpio" =>"application/x-sv4cpio", "sv4crc" =>"application/x-sv4crc", "svg" =>"image/svg+xml", "swf" =>"application/x-shockwave-flash", "t" =>"application/x-troff", "tar" =>"application/x-tar", "tcl" =>"application/x-tcl", "tex" =>"application/x-tex", "texi" =>"application/x-texinfo", "texinfo" =>"application/x-texinfo", "tgz" =>"application/x-tar", "tif" =>"image/tiff", "tiff" =>"image/tiff", "tr" =>"application/x-troff", "tsv" =>"text/tab-separated-values", "txt" =>"text/plain", "ustar" =>"application/x-ustar", "vcd" =>"application/x-cdlink", "vrml" =>"model/vrml", "vxml" =>"application/voicexml+xml", "wav" =>"audio/x-wav", "wbmp" =>"image/vnd.wap.wbmp", "wbxml" =>"application/vnd.wap.wbxml", "wml" =>"text/vnd.wap.wml", "wmlc" =>"application/vnd.wap.wmlc", "wmlc" =>"application/vnd.wap.wmlc", "wmls" =>"text/vnd.wap.wmlscript", "wmlsc" =>"application/vnd.wap.wmlscriptc", "wmlsc" =>"application/vnd.wap.wmlscriptc", "wrl" =>"model/vrml", "xbm" =>"image/x-xbitmap", "xht" =>"application/xhtml+xml", "xhtml" =>"application/xhtml+xml", "xls" =>"application/vnd.ms-excel", "xml xsl" =>"application/xml", "xpm" =>"image/x-xpixmap", "xslt" =>"application/xslt+xml", "xul" =>"application/vnd.mozilla.xul+xml", "xwd" =>"image/x-xwindowdump", "xyz" =>"chemical/x-xyz", "zip" =>"application/zip" ); $fileExt = $fileExt[extension]; if ($mTypes[$fileExt]) { return $mTypes[$fileExt]; } return FALSE; } ?>
Emneord (tags): mimetype, mime, type, types
Valgmuligheter
ZtigO sendte inn denne php-koden 02.12.2007 kl. 17:59.
<?php foreach ($element as $value) { if (search($value, "æ") or search($value, "ø") or search($value, "Ã¥")) { echo "Samtilige ord i søkestrengen må være mer enn tre tegn for at det skal være gyldig <strong>«".$value."»</strong><br />\n"; } } else { echo "Samtilige ord i søkestrengen må være mer enn tre tegn for at det skal være gyldig <strong>«".$value."»</strong><br />\n"; } } } function search($haystack, $needle) { return false; } else { return true; } } ?>
Valgmuligheter
ZtigO sendte inn denne php-koden 02.12.2007 kl. 17:59.
<?php ?> <?php $ip = $_SERVER['REMOTE_ADDR']; include ("config.php"); $do = $_GET['do']; // Funksjonen som bestemmer hva som skal gjøres ?> <h1>Gjestebok</h1> Hva synes du om siden min? Vil du kanskje legge igjen et lite innlegg her?<br /> <?php if($do == "post") { echo "<b>NB!:</b> Din IP adresse blir logget for og forhindre spam! IP adressen som blir registrert er: <b>$ip</b><br /><br />"; } else { echo "<a href='?do=post'>Klikk her for og skrive et innlegg!</a><br /><br>"; } ?> <?php if($do == "post") { ?> <form method="post" action="?do=send"> <table cellspacing="0" cellpadding="0"> <tr> <td><label><b>Ditt navn</b></label> : </td> <td><input name="navn" type="text" id="navn" style="width: 300px;"></td> </tr> <tr> <td><label><b>Din e-post</b></label> : </td> <td><input name="epost" type="text" id="epost" style="width: 300px;"></td> </tr> <tr> <td valign="top"><label><b>Din melding</b></label> : </td> <td><textarea name="melding" id="melding" style="width: 300px; height: 75px;"></textarea></td> </tr> <tr> <td><label> <input type="submit" name="Submit" value="Send inn!"> </label></td> <td><input type="reset" name="Reset" value="Visk ut!"></td> </tr> </table> </form> <? } // Slutt $navn = $_POST['navn']; $epost = $_POST['epost']; $melding = $_POST['melding']; if ($do == "send") { if ($navn == "" or $epost == "" or $melding == "") { $error .= "<b>Det skjedde en eller flere feil under sendingen!</b><br>"; } if ($navn == "") { $error .= "<li>Du fyllte ikke ut et navn!</li><br>"; } if ($melding == "") { $error .= "<li>Du fyllte ikke ut en melding!</li><br>"; } if ($epost == "") { $error .= "<li>Du fyllte ikke ut en epost!</li><br>"; } if (!$error) { echo "<b><font color='#FF0000'>Ditt innlegg ble lagt til! Du kan lese ditt innlegg nedenfor her!</font></b><br><br>"; } else { echo $error; } } echo "<br><b>$vis siste innlegg:</b><br><br>"; /* Nedenfor her vises innleggene! */ $linje = 0; if ($totalt >= $vis) $linje = $totalt - $vis; while ($fil[$linje]) { $guest[] = "<div id='guest'> <b>$a[3] skrev <a href='mailto:$a[2]'>$a[0]</a>:</b><br /> $a[1]<br /> </div><br /> \n"; $linje++; } ?>
Valgmuligheter
ZtigO sendte inn denne html4strict-koden 21.01.2007 kl. 00:57.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Scrolling</title> <style type="text/css"> #scroll { height: 300px; width: 300px; overflow: scroll; } </style> </head> <div id="scroll"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam nunc augue, tincidunt sed, lacinia vitae, congue eu, ante. Nunc sit amet ante. Aliquam at felis. Nulla in libero. Pellentesque tincidunt libero id leo. Morbi at lorem. Maecenas rhoncus est vitae nibh consequat facilisis. Fusce mauris arcu, fermentum in, posuere vitae, blandit ac, quam. Aenean elementum euismod mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Fusce risus felis, tristique a, eleifend in, sodales sit amet, nunc. Proin quis tortor non leo laoreet aliquet. Aliquam erat volutpat. Donec quis leo. Pellentesque porttitor leo non ante ultrices pellentesque. Aenean cursus sapien quis enim. Proin adipiscing, purus et faucibus vulputate, mauris nulla sagittis metus, in mattis nisi nisl ut leo. Duis dapibus tincidunt lectus. </div> </body> </html>
Valgmuligheter
ZtigO sendte inn denne php-koden 02.12.2007 kl. 17:59.
<?php // config $file = "data/shout.dat"; $show = 8; $spamWords = array("nice site", "free", "casino", "sex", "look at this", "check", "virgin", "poker", "porn", "gratis", "asdfhg", "cheap", "delicious", "fuck", "play", "cards", "win", "gift", "surprise"); // start $name = $_POST['name']; $msg = $_POST['msg']; // Henter IP adressen $ip = $_SERVER['REMOTE_ADDR']; // Kaller opp variablen $ip som skal skrives til filen senere // Funksjon som sjekker spammen function checkSpam($string) { global $spamWords; foreach ($spamWords as $badWord) { $foundWord = TRUE; return TRUE; } } if (!$foundWord) { return FALSE; } } // save // $msg = wordwrap($msg, 16, " ", 1); $pattern="%((http://|https://|ftp://|file://|www.)[^\s]+?)(.*)%isU"; $pattern='<a href="www.'; } // show $line = 0; if ($total >= $show) $line = $total - $show; while ($file[$line]) { $shoutOut[] = "<b>$a[0]:</b> $a[1]<br>\n"; $line++; } ?> <br> <a name="shout"><br> <form action="index.php?page=shout#shout" method="post"> <input type="text" name="name" size="25" value="Navn" onBlur="if (this.value == '') this.value = 'Navn';" onFocus="if (this.value == 'Navn') this.value = '';"><br> <input type="text" name="msg" size="25" value="Melding" onBlur="if (this.value == '') this.value = 'Melding';" onFocus="if (this.value == 'Melding') this.value = '';"><br> <input type="submit" value="Go"></p> </form></a>
Valgmuligheter
ZtigO sendte inn denne php-koden 11.01.2007 kl. 20:45.
<?php // Slik sjekker du det if (sjekkBanning($melding)) { echo "Advarsel! Innlegget ditt inneholdt banneord..."; } // Funksjoner function stripos ($string, $ord, $start = 0) { } function sjekkBanning($string) { $a = 0; foreach ($banneord as $verdi) { if (stripos($string, $verdi) !== false) { $a++; } } if ($a > 0) { return TRUE; // Det er ett eller flere banneord } else { return FALSE; // Det er ikke banneord } } ?>
Det vises 10 koder per side.



