Tags: php

Sort by: Date / Title /

  1. 4 years ago by xarkam
    1. echo '<?php phpinfo(); ?>' | php 2>&1 |grep -i ssl
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2166"></script>
  2. 4 years ago by macks
    1. $data = array('result' => true,'data' => array());
    2. return $this->getResponse()->setContent(ZendJsonJson::encode($data));
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2157"></script>
  3. 7 years ago by cyo
    1. $videofile = "fichier.flv";
    2.  
    3. passthru("ffmpeg -i "{$videofile}" 2>&1");
    4. $duration = ob_get_contents();
    5.  
    6. $search='/Duration: (.*?),/';
    7. $duration=preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 3);
    8.  
    9. echo $matches[1][0];
    10.  
    11.  
    12. Pour récupérer la durée, en seconde, on peut utiliser cette fonction :
    13.  
    14. echo hms2sec($matches[1][0]);
    15.  
    16.  
    17. function hms2sec ($hms) {
    18.         list($h, $m, $s) = explode (":", $hms);
    19.         $seconds = 0;
    20.         $seconds += (intval($h) * 3600);
    21.         $seconds += (intval($m) * 60);
    22.         $seconds += (intval($s));
    23.         return $seconds;
    24. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2052"></script>
  4. sponsorised links
  5. 7 years ago by spirit
    Prevents jobs to collide if they take longer to run than the frequency itself
    1. $fp = fopen('/tmp/lock.txt', 'r+')
    2.  
    3. if(!flock($fp, LOCK_EX | LOCK_NB)) { 
    4.    echo 'Unable to obtain lock'
    5.    exit(-1)
    6. } 
    7.    
    8. /* ... */ 
    9.  
    10. fclose($fp);
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2040"></script>
  6. 7 years ago by spirit
    it's also possibl with a .htaccess file and "deny from all " in that file
    1. if (isset($_SERVER['REMOTE_ADDR'])) die('Permission denied.');
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2039"></script>
  7. 7 years ago by sx
    1. echo substr($filename, strripos($filename, '.'),strlen($filename));
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/2038"></script>
  8. 7 years ago by macks
    1. //MenuCardTable.class
    2. public function getMenuCardForCombo(){
    3.         $q = Doctrine_Query::create()
    4.           ->select('m.*')
    5.           ->from('MenuCard m');
    6.         $results = $q->execute();
    7.  
    8.         foreach($results as $menu){
    9.             $choice[$menu->getId()] = $menu->getName();
    10.         }
    11.  
    12.         return $choice;
    13.     }
    14.  
    15. ====================no funciona para validar "required"=========================================
    16. //DishesForm.class
    17.         $choices = array('Seleccione un item') + Doctrine::getTable('MenuCard')->getMenuCardForCombo();
    18.         $this->widgetSchema['menu_card_id'] = new sfWidgetFormSelect(array('choices' => $choices));
    19.         $this->validatorSchema['menu_card_id'] = new sfValidatorChoice(array('choices' => array_keys($choices)));
    20.  
    21. ====================otro metodo: validar "required"=========================================
    22. //el item x defecto sera en blanco (poner 'add_empty true')
    23. //BasesDishesForm.class
    24. 'menu_card_id' => new sfWidgetFormDoctrineChoice(array('model' => 'MenuCard', 'add_empty' => true)),
    25. //DishesForm.class
    26. $this->validatorSchema['menu_card_id']->setOption('required', true);
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1897"></script>
  9. 7 years ago by macks
    1. Doctrine
    2. $eventName = Doctrine::getTable('Events')->find($id)->getName();
    3.  
    4. Propel
    5. $event = EventsPeer::RetriveByPk($id);
    6. $eventName = $event->getName();
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1896"></script>
  10. 7 years ago by macks
    1. /* lib/model/Industria.php
    2. - en el formulario de clientes hay un combo industrias (relacion bd)
    3. - descripcion se mostrara en el combo
    4. */
    5.  
    6. class Industria extends BaseIndustria {
    7.     public function __toString(){
    8.         return $this->getDescripcion();
    9.     }
    10. }
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1842"></script>
  11. 7 years ago by macks
    escapando y decodificando
    1. $specialCharacter = 'Fondo General de Contravalor Perú Japón - " FGCPJ "';
    2. $scape_decohtmlspecialchars(utf8_decode($specialCharacter));
    Paste this in your website: <script type="text/javascript" src="http://www.posteet.com/embed/1840"></script>

First / Previous / Next / Last / Page 1 of 12 (111 posteets)