working on it ...

Filters

snippets
58k
followers
300
Published by markcl

PHP

Sort by

Found 58k snippets

    public by AbhishekGhosh modified Oct 11, 2017  46  1  1  0

    ob flush example

    ob flush example: ob_flush.php
    <?php
    
    /*
    	== ob_end_flush() ==
    	Flush (send) the output buffer and turn off output buffering
    
    	== ob_end_clean() ==
    	Clean (erase) the output buffer and turn off output buffering
    
    	== ob_get_contents() ==
    	Return the contents of the output buffer
    */
    
    
    # The following two functions result in the same output.
    
    function output_some_html_with_var() {
    	ob_start();
    	?>
    	<p>This is a paragraph echoed from a variable.</p>
    	<?php
    	$para = ob_get_contents();
    	ob_end_clean();
    	echo $para;
    }
    
    function output_some_html_with_end_flush() {
    	ob_start();
    	?>
    	<p>This is a paragraph sent with ob_end_flush.</p>
    	<?php
    	ob_end_flush();
    }
    
    output_some_html_with_var();
    
    output_some_html_with_end_flush();
    
    /*
    	If you want to return the contents of ob_start()
    	you should store ob_get_contents() into a variable,
    	then call ob_end_clean(), and then return the variable.
    */
    
    function return_some_html_with_var() {
    	ob_start();
    	?>
    	<p>This is a paragraph being stored into a variable and returned.</p>
    	<?php
    	$para = ob_get_contents();
    	ob_end_clean();
    	return $para;
    }
    
    echo return_some_html_with_var();
    
    echo '<a style="text-decoration:none;" href="http://php.net/manual/en/function.ob-start.php">See the ob_start documentiation for more info</a>';
    
    

    public by AbhishekGhosh modified Jun 8, 2017  27  0  1  0

    GEO IP TEST PHP Script

    GEO IP TEST PHP Script: geoip.php
    <html>
    <body>
    <?php
    
    $geoip_country_code = getenv(GEOIP_COUNTRY_CODE);
    $geoip_country_name = getenv(GEOIP_COUNTRY_NAME);
    $geoip_region = getenv(GEOIP_REGION);
    $geoip_city = getenv(GEOIP_CITY);
    $geoip_postal_code = getenv(GEOIP_POSTAL_CODE);
    $geoip_latitude = getenv(GEOIP_LATITUDE);
    $geoip_longitude = getenv(GEOIP_LONGITUDE);
    
    
    echo 'Country code: '.$geoip_country_code.'<br>';
    echo 'Country name: '.$geoip_country_name.'<br>';
    echo 'Region: '.$geoip_region.'<br>';
    echo 'City: '.$geoip_city.'<br>';
    echo 'Postal code: '.$geoip_postal_code.'<br>';
    echo 'Latitude: '.$geoip_latitude.'<br>';
    echo 'Longitude: '.$geoip_longitude.'<br>';
    
    ?>
    </body>
    </html>
    
    

    public by vnhgroup4m modified May 22, 2017  224  0  4  0

    update wp

    update wp
    php
    $wpdb->update('usertb', array('xu'=>$xuThang,'RemainMoney'=>$tienThang ,'RemainTime'=>$newTime) ,array('FirstName'=>$username)); // cộng tiền gỡ 
    

    public by paulsimmons modified May 10, 2017  581  0  5  0

    Magento Shop by Manufacturer Plugin by FMEAddons

    Magento shop by manufacturer plugin by FMEAddons helps you to create unlimited brands and display them in the brand slider. This module adds the separate page on your e-store for brands and customers can find the brand they love on this page. They can see the products of brands and buy the products right away. Brand page enables brands by category,
    // Enter here the actual content of the snippet.                        

    public by paulsimmons modified Apr 12, 2017  692  7  4  0

    WooCommerce Bookings and Appointment Plugin

    WooCommerce Bookings and Appointment plugin by FMEAddons gives the ability to business owners to sell products and services that require bookings and timed appointments. These products and services involve tickets selling, bookings for concerts, appointments, rentals services, secure a seat online, space in training, book products and much more lik
    // Enter here the actual content of the snippet.            

    public by paulsimmons modified Apr 11, 2017  578  0  4  0

    Rich Snippets Magento Extension by FMEAddons

    Magento rich snippets extension for online stores helps the store owners to highlight their products in search results and drag more traffic on the website. This is a must have plugin if you want the success of your business through organic traffic from search engines. This rich snippet module adds schema tags in all product and services pages to
    // Enter here the actual content of the snippet.            

    public by paulsimmons modified Apr 4, 2017  847  0  4  0

    WooCommerce Variable Pricing Plugin by FMEAddons

    If you want to convert potential customers to successful business leads, then WooCommerce variable pricing extension is a powerful tool for achieving this goal. This addon provides you an easy interface to offer bulk discounts on various sections on your website. You can give a special offer to your customers such as buy three products and get one
    // Enter here the actual content of the snippet.            

    public by paulsimmons modified Mar 30, 2017  837  0  4  0

    Magento Follow Up Emails Extension

    Magento Follow Up Email is a complete extension developed by FMEAddons that allows store owners to integrate and advance email marketing system in their online store based on Magento. With the help of this powerful extension, they can send emails after occurring of different events such as new order completion, Cart abandonment, Birthday, Christmas
    // Enter here the actual content of the snippet.                        

    public by JavierSalazar modified Mar 30, 2017  1155  7  5  0

    Clonar registros en mysql

    Si necesitas una función para clonar registros, aquí tienes unas. La idea es sencilla: usar SQL para clonar un registro. En esencia es algo así: INSERT INTO tabla (SELECT * FROM tabla WHERE id=..) El problema es que la SQL anterior no funciona si tienes un campo clave (99% de las tablas, o un campo único). Así que toca refinar mas la funció
    php
    <?php
    function mysql_clonar_registro ( $tabla, $clave ) {
    
       // limpieza parámetros
       $tabla= mysql_real_escape_string($tabla);
       $clave= mysql_real_escape_string($clave);
    
       // obtener lista de campos, no únicos
       $rsCampos = mysql_query("SHOW COLUMNS FROM $tabla");
       $campos= array();
       $campoClave ="";
       while ( $campo = mysql_fetch_array($rsCampos) ){
    
           if ( $campo["Key"] == "PRI" ){
               $campoClave = $campo[0];
           }
           $campos[] =  $campo["Key"] == "PRI" || $campo["Key"] == "UNI" ? "NULL":    $campo[0];
       }
       mysql_free_result ( $rsCampos );
    
       // clonar el registro mediante una SQL
       if ( $campoClave && count($campos)>0 ) {
           $SQL = sprintf( "INSERT INTO $tabla ( SELECT %s FROM $tabla WHERE %s='%s' )",
               implode(",",$campos),
               $campoClave,
               $clave );
           mysql_query ($SQL);
           return mysql_affected_rows();
       }
       return false;
    }   
    ?>            

    public by paulsimmons modified Mar 29, 2017  586  0  4  0

    WooCommerce Currency Converter Plugin

    If you want to target multiple regions with your web store you must use WooCommerce multi-currency plugin to provide the best user experience to your international clients. WooCommerce currency switcher plugin allows you to add multiple currencies which will allow your customers to view product pricing and checkout in their local currency or to whi
    // Enter here the actual content of the snippet.            
    • Public Snippets
    • Channels Snippets