/* creates a compressed zip file */ function create_zip($files = array(),$destination = '',$overwrite = false) { //if the zip file already exists and overwrite is false, return false if(file_exists($destination) && !$overwrite) { return false; } //vars $valid_files = array(); //if files were passed in... if(is_array($files)) { //cycle through each file foreach($files as $file) { //make sure the file exists if(file_exists($file)) { $valid_files[] = $file; } } } //if we have good …
Questa funzione serve a far entrare nel database le stringhe che contengono caratteri speciali come ad esmpio apici e molto altro. Applicare questa funzione prima di far entrare la stringa nel database.
function mask($string) { // Masks a string for an sql query. $string =(get_magic_quotes_gpc()) ? stripslashes($string) : $string; return mysql_real_escape_string($string); } …
Nella pagina index.php cercate il codice:
< ?php while (have_posts()) : the_post(); ?>
e sostituitelo con:
< ?php /* Key = Position of the Ad Value = The AdSense Banner Code */ $advertisements = array('3' => '<!-- adsense ad code 1 here -->', '6' => '<!-- adsense ad code 2 here -->', '9' => '<!-- adsense ad code 3 here -->'); $i = 1; while (have_posts()) : the_post(); ?>
Adesso cercate:
< ?php endwhile; ?>
e cambiatelo con:
< ?php
if…
CODICE HTML
<div id="live-preview-form" class="lp-block"> <strong>Your Name:</strong> <input type="text" name="name" id="name" value="" class="input" /> <strong>Your Email:</strong> <input type="text" name="email" id="email" value="" class="input" /> <strong>Your Website:</strong> <input type="text" name="website" id="website" value="" class="input" /> <strong>Your Comment:</strong> <textarea name="comment" id="comment" class="input" rows="10"></textarea> </div> <div id="live-preview-display" class="lp-block"> <div id="lp-avatar"></div> <div id="lp-name"></div> <div id="lp-comment"></div> </div>
CODICE CSS
.lp-block { width:400px; float:left; } .lp-block input, .lp-block textarea { width:90%; } #live-preview-display { background:#eee; padding:10px; margin-left:50px; margin-top:20px; } #lp-name { font-weight:bold; } #lp-avatar { float…

Guida editor vi per linux a questo indirizzo:
http://www.science.unitn.it/~fiorella/guidavi/guidavi.html#guidavi001…
< ?php class GetImage { var $source; var $save_to; var $set_extension; var $quality; function download($method = 'curl') // default method: cURL { $info = @GetImageSize($this->source); $mime = $info['mime']; // What sort of image? $type = substr(strrchr($mime, '/'), 1); switch ($type) { case 'jpeg': $image_create_func = 'ImageCreateFromJPEG'; $image_save_func = 'ImageJPEG'; $new_image_ext = 'jpg'; // Best Quality: 100 $quality = isSet($this->quality) ? $this->quality : 100; …
function replace_content_inside_delimiters($start, $end, $new, $source) { return preg_replace('@('.$start.')(.*)('.$end.')@esi', "stripslashes(('\\1').'$new'.('\\3'))", $source); } $data = '<body> <div class="wrap"> <div class="inside">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div> </div> </body>'; $start = ' <div class="inside">'; $end = '</div> '; $replace_with = 'PHP: Hypertext Preprocessor'; $str = replace_content_inside_delimiters($start, $end, 'PHP: Hypertext Preprocessor', $data); echo $str; // Result: <body> <div class="wrap"> <div class="inside">PHP: Hypertext Preprocessor</div> …
CODICE HTML
<ul> <li class="col1">Eggs</li> <li class="col1">Ham</li> <li> </li> <li class="col2 top">Bread</li> <li> </li> <li class="col2">Butter</li> <li> </li> <li class="col3 top">Flour</li> <li> </li> <li class="col3">Cream</li> </ul>
CODICE CSS
ul {list-style:none;} li {line-height:1.3em;} .col2 {margin-left:100px;} .col3 {margin-left:200px;} .top {margin-top:-2.6em;} /* the clincher */ …
CODICE PHP
function formatTime($secs) { $times = array(3600, 60, 1); $time = ''; $tmp = ''; for($i = 0; $i < 3; $i++) { $tmp = floor($secs / $times[$i]); if($tmp < 1) { $tmp = '00'; } elseif($tmp < 10) { $tmp = '0' . $tmp; } $time .= $tmp; if($i < 2) { $time .= ':'; } $secs = $secs % $times[$i]; } return $time; }…