Search Results

Sort by: Date / Title /

  1. 4 weeks ago by inbox
    Code pour vos pages en Php
    1. function bbcode($text) {
    2.     $text = preg_replace("#\[img\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img\]#sie", "'<img src=\\1' . str_replace(' ', '%20', '\\3') . '>'",
    3. $text);
    4.     $text = preg_replace("#\[url\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/url\]#sie", "'<a href=\"\\1' . str_replace(' ', '%20', '\\3') . '\" target=blank>\\1\\3</a>'", $text);
    5.     $text = preg_replace("/\[url=(.+?)\](.+?)\[\/url\]/", "<a href=$1 target=_blank>$2</a>", $text);
    6.     $text = preg_replace("/\[b\](.+?)\[\/b\]/", "<b>$1</b>", $text);
    7.     $text = preg_replace("/\[i\](.+?)\[\/i\]/", "<i>$1</i>", $text);
    8.     $text = preg_replace("/\[u\](.+?)\[\/u\]/", "<u>$1</u>", $text);
    9.     $text = preg_replace("/\[code\](.+?)\[\/code\]/", "<table width=100%><tr><th align=left>Code :</th></tr><tr><td align=left><code>$1</code></td></tr></table>", $text);
    10.     $text = preg_replace("/\[quote=(.+?)\]/", "<center><table width=80%><tr><th align=left>Message de $1 :</th></tr><tr><td align=left class=milieu_messages>", $text);
    11.     $text = preg_replace("/\[\/quote\]/", "</td></tr></table></center>", $text);
    12.     $text = preg_replace("/\[color=(.+?)\](.+?)\[\/color\]/", "<font color=$1>$2</font>", $text);
    13.     return $text;
    14.     }
    15.  
    16. EXEMPLE:
    17.     <tr>
    18.         <td width=394 height=3>
    19.             <p><font color=#FFFFFF>".bbcode(nl2br($mess))."</font></p>
    20.         </td>
    21.     </tr>
  2. 1 month ago by sm0k1nggnu
    1. <?php
    2.         $useragent = $_SERVER['HTTP_USER_AGENT'];
    3.  
    4.    
    5. if( eregi("(msie) ([6]{1})",$useragent) )
    6. {print "IE 8.0 -> do something";}
    7.  
    8. else
    9. { } 
    10. ?>
  3. 4 months ago by kaosklub
    Original web not working, here's the code
    1. <?php
    2. /*
    3. Plugin Name: Limit Posts
    4. Plugin URI: http://labitacora.net/comunBlog/limit-post.phps
    5. Description: Limits the displayed text length on the index page entries and generates a link to a page to read the full content if its bigger than the selected maximum length.
    6. Usage: the_content_limit($max_charaters, $more_link)
    7. Version: 1.1
    8. Author: Alfonso Sánchez-Paus Díaz y Julián Simón de Castro
    9. Author URI: http://labitacora.net/
    10. License: GPL
    11. Download URL: http://labitacora.net/comunBlog/limit-post.phps
    12. Make:
    13.     In file index.php
    14.     replace the_content()
    15.     with the_content_limit(1000, "more")
    16. */
    17.  
    18. function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
    19.     $content = get_the_content($more_link_text, $stripteaser, $more_file);
    20.     $content = apply_filters('the_content', $content);
    21.     $content = str_replace(']]>', ']]&gt;', $content);
    22.     $content = strip_tags($content);
    23.  
    24.    if (strlen($_GET['p']) > 0) {
    25.       echo "";
    26.       echo $content;
    27.       echo "";
    28.    }
    29.    else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
    30.         $content = substr($content, 0, $espacio);
    31.         $content = $content;
    32.         echo "";
    33.         echo $content;
    34.         echo "...";
    35.         echo "";
    36.    }
    37.    else {
    38.       echo "";
    39.       echo $content;
    40.       echo "";
    41.    }
    42. }
    43.  
    44. ?>
  4. sponsorised links
  5. 4 months ago by spirit
    Ça parait simple comme ça mais ça m'a pris du temps de trouver, donc pas la peine de le perdre :)
    1. rand(0,1)*2-1
  6. 4 months ago by spirit
    1. function distance($lat1, $lon1, $lat2, $lon2, $unit) {
    2.  
    3.   $theta = $lon1 - $lon2;
    4.   $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2))cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
    5.   $dist = acos($dist);
    6.   $dist = rad2deg($dist);
    7.   $miles = $dist * 60 * 1.1515;
    8.   $unit = strtoupper($unit);
    9.  
    10.   if ($unit == "K") {
    11.     return ($miles * 1.609344);
    12.   } else if ($unit == "N") {
    13.       return ($miles * 0.8684);
    14.     } else {
    15.         return $miles;
    16.       }
    17. }
    18.  
    19. echo distance(32.9697, -96.80322, 29.46786, -98.53506, "m") . " miles<br>";
    20. echo distance(32.9697, -96.80322, 29.46786, -98.53506, "k") . " kilometers<br>";
    21. echo distance(32.9697, -96.80322, 29.46786, -98.53506, "n") . " nautical miles<br>";
  7. 4 months ago by zeros0
    this is my firt code in my life... that is good!!!...
    1. <?php
    2.  
    3. echo "Hello World";
    4.  
    5. ?>
  8. 6 months ago by spirit
    1. /etc/apache2/apache2.conf
    2. > ServerTokens Prod
    3. > ServerSignature Off
    4.  
    5. /etc/php5/apache2/php.ini
    6. > expose_php = Off
  9. 6 months ago by cyo
    1. wget --timeout=0 -q -t 1 -O -  http://127.0.0.1/path/file.php >result.txt 2>result.txt
    2. SORTIE=`cat result.txt | tr '\015\012' ' '`
    3. echo $SORTIE
  10. 7 months ago by jacinmontava
    1. <?php
    2.  
    3. $dbhost = "servidor"; $dbuser = "usuario"; $dbpassword = "clave"; $dbname = "base_de_datos";
    4. mysql_connect($dbhost,$dbuser,$dbpassword);
    5. $tablas = mysql_list_tables($dbname);
    6.  
    7. while (list($tabla) = mysql_fetch_row($tablas)) {
    8. echo $tabla."<br />";
    9. } ?>
  11. 7 months ago by cyo
    1. wget http://exemple.com/index.php >result.txt 2>result.txt
    2. FICHIER=`sed '/^$/d' result.txt | head -1 | cut -d" " -f2-20`
    3. RETOUR=`sed '/^$/d' result.txt | tail -1`
    4. DATEHEURE=`date "+%Y-%m-%d %H:%m:%S"`
    5. touch flux.log
    6. echo "$DATEHEURE -$FICHIER : $RETOUR" >>flux.log

First / Previous / Next / Last / Page 1 of 11 (106 posteets)