HTML Language code List

HTML Language code List

aa_DJ.UTF-8 UTF-8
aa_DJ ISO-8859-1
aa_ER UTF-8
aa_ER@saaho UTF-8

....


31/01/2018

List of PHP Language Locale Code

List of PHP language local code for countries

mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay

....


31/01/2018

Codeigniter 3 upper(ucwords) first letter of filename for libraries,controllers,models

Codeigniter 3 upper(ucwords) first letter of filename  for libraries,controllers,models

In this page updating PHP filename for "codeigniter version 3" explained

Starting with CodeIgniter 3.0, all class filenames (libraries, drivers, controllers and models) must be named in a Ucfirst-like manner or in other words - they must start with a capital letter

 

 


31/10/2017

PHP Excel date time format for php code to insert mysql database row timestamp format int

PHP Excel date time format for php code to insert mysql database row  timestamp format int

$rowData[0][2]= (($rowData[0][2] - 25569) * 86400);


10/02/2017

PHP preg_replace formatting telephone number script code

PHP preg_replace formating telephone number   (999) 123 4567


17/01/2017

PHP Uploading Large Files

PHP Uploading Large Files

in Default PHP settings there is some constrait when posting  a form


22/12/2016

Countries and Continents sql

 
Countries and Continents sql  includes create table and row insertion with iso3 codes

countries.sql
continents.sql


29/12/2015

How To Run Composer ?

cd /your _project path ...


04/02/2015

php5 curl installation in linux

login console as root apt-get install php5-curl that is all and check  you phpinfo

14/01/2015

Cron Job Commands List

PHP Command to run a PHP5 cron job: php /home/username/public_html/cron.php Optional flags are sometimes required for a PHP cron job: php -q /home/username/public_html/cron.php Command to run a PHP4 cron job: /usr/local/php4/bin/php /home/strong>username/public_html/cron.php Command to use a specific php.ini file: php -c /home/username/public_html/php.ini /home/username/public_html/myscript.php Command to GET a remote file:  /usr/bin/GET http://www.example.com/file.php

PHP

Command to run for a PHP5 cron job:
/usr/local/php5/bin/php5 /home/username/public_html/cron.php
Command to run for a PHP4 cron job:
/usr/bin/php /home/username/public_html/cron.php
File
delete all file in cache folder
rm home/username/public_html/cache/*
delete all file and folder in cache
rm -vrf  home/username/public_html/cache/
process cron.php file in admin fo
wget -O /dev/null/ http://www.muslum21.com/admin/cron.php > /dev/null
> /dev/null   ->  cancel sending email
SSH Command to run a code script cron job: /bin/sh /home/username/public_html/file.sh Mysql Command to import a database: mysql -u mysql_user -ppassword database_name < backup.sql Command to export a database: mysqldump -u mysql_user -ppassword database_name >backup.sql

14/01/2015

Creating SimpleXMLElement Example

[php] $xml = new SimpleXMLElement(''); $xml->addAttribute('version',"1.0"); $xml->addAttribute("encoding","iso-8859-9"); for ($i = 1; $i <= 8; ++$i) { $track = $xml->addChild('track'); $track->addChild('path', "song$i.mp3"); $track->addChild('title', "Track $i - Track Title"); } Header('Content-type: text/xml'); print($xml->asXML()); [/php] output  :
<xml version="1.0" encoding="iso-8859-9">
<track>
<path>song1.mp3</path>
<title>Track 1 - Track Title</title>
</track>
<track>
<path>song2.mp3</path>
<title>Track 2 - Track Title</title>
</track>
<track>
<path>song3.mp3</path>
<title>Track 3 - Track Title</title>
</track>
<track>
<path>song4.mp3</path>
<title>Track 4 - Track Title</title>
</track>
<track>
<path>song5.mp3</path>
<title>Track 5 - Track Title</title>
</track>
<track>
<path>song6.mp3</path>
<title>Track 6 - Track Title</title>
</track>
<track>
<path>song7.mp3</path>
<title>Track 7 - Track Title</title>
</track>
<track>
<path>song8.mp3</path>
<title>Track 8 - Track Title</title>
</track>
</xml>

14/01/2015

.htaccess file example

  RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule .? http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] description:  redirect to   from   http://muslum21.com    to  http://www.muslum21.com

14/01/2015

PHP ini Example

http://www.reallylinux.com/docs/php.ini  
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
max_input_time = 60	; Maximum amount of time each script may spend parsing request data
memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)
 

14/01/2015

Php Curl Post Example

[PHP] //extract data from the post extract($_POST); //set POST variables $url = 'http://domain.com/get-post.php'; $fields = array( 'lname' => urlencode($last_name), 'fname' => urlencode($first_name), 'title' => urlencode($title), 'company' => urlencode($institution), 'age' => urlencode($age), 'email' => urlencode($email), 'phone' => urlencode($phone) ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POST, count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); [/PHP] ref: http://davidwalsh.name/curl-post

14/01/2015

php file system read all file in directory class

[php] class readd_all_file{ function __construct() { $this->index(); } function index(){ $this->all_pic=array(); $dir_name="images"; $this->open_dir($dir_name); $this->dbg2($this->all_pic); } function open_dir($dir_name){ $IMAGES_fold=scandir($dir_name); foreach($IMAGES_fold as $fold){ if(in_array($fold,array(".",".."))){continue;} if(!is_dir($dir_name."/".$fold)){ $this->all_pic[]=$dir_name."/".$fold; }else{ $this->open_dir($dir_name."/".$fold); } } } } [/php] [14] => images/Buttons/1320202803_button.png [15] => images/Buttons/1320203926_button.png [16] => images/Buttons/1320203948_button.png [17] => images/Buttons/1320203966_button.png [18] => images/Buttons/1337051437_button.png [19] => images/Buttons/1337051451_button.png [20] => images/Buttons/mcith/mcith_1320202803_button.png [21] => images/Buttons/mcith/mcith_1320203926_button.png [22] => images/Buttons/mcith/mcith_1320203948_button.png [23] => images/Buttons/mcith/mcith_1320203966_button.png [24] => images/Buttons/mcith/mcith_1337051437_button.png [25] => images/Buttons/mcith/mcith_1337051451_button.png [26] => images/Buttons/mcith/mcith_tukendi_buton.png [27] => images/Buttons/mcith/mcith_tukendi_buton_en.png [28] => images/Buttons/mcith/mcith_yeni_buton.png [29] => images/Buttons/mcith/mcith_yeni_buton_en.png [30] => images/Buttons/refrsh.jpeg [31] => images/Buttons/tukendi_buton.png [32] => images/Buttons/tukendi_buton_en.png [33] => images/Buttons/yeni_buton.png [34] => images/Buttons/yeni_buton_en.png [35] => images/MiniSlide/1335804630_1.png [36] => images/MiniSlide/1335810909_1.png [37] => images/MiniSlide/1335812296_1.png [38] => images/MiniSlide/1335812377_.jpeg [39] => images/MiniSlide/1335812456_1.png [40] => images/MiniSlide/1335812484_1.png [41] => images/MiniSlide/1335812493_1.png [42] => images/MiniSlide/1335813419_1.png [43] => images/MiniSlide/1335813426_1.png [44] => images/MiniSlide/1335917378_1.png [45] => images/MiniSlide/1335917394_1.png [46] => images/MiniSlide/1336410058_1.gif [47] => images/MiniSlide/1336410066_1.gif [48] => images/MiniSlide/1336410103_1.gif [49] => images/MiniSlide/1336550136_1.jpeg [50] => images/MiniSlide/1336555136_1.jpeg

14/01/2015

objPHPExcel adjust to printing

 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
[php]

// Set Orientation, size and scaling
 $objPHPExcel->setActiveSheetIndex(0);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);

[/php]





----

14/01/2015

Php Redirect with POST data.

/**
 * Redirect with POST data.
 *
 * @param string $url URL.
 * @param array $post_data POST data. Example: array('foo' => 'var', 'id' => 123)
 * @param array $headers Optional. Extra headers to send.
 */
public function redirect_post($url, array $data, array $headers = null) {
    $params = array(
        'http' => array(
            'method' => 'POST',
            'content' => http_build_query($data)
        )
    );
    if (!is_null($headers)) {
        $params['http']['header'] = '';
        foreach ($headers as $k => $v) {
            $params['http']['header'] .= "$k: $v\n";
        }
    }
    $ctx = stream_context_create($params);
    $fp = @fopen($url, 'rb', false, $ctx);
    if ($fp) {
        echo @stream_get_contents($fp);
        die();
    } else {
        // Error
        throw new Exception("Error loading '$url', $php_errormsg");
    }
}

http://stackoverflow.com/questions/5576619/php-redirect-with-post-data

14/01/2015

mysql having count(*) (Miracle )

$$having =" GROUP BY p.ID  having count(*) >=".(count($_REQUEST["DD"])-1)." ";

14/01/2015

Enter key on html form submission

[php] <pre><script> function testfunction(){ document.Add.submit(); } </script></pre> <form action="" method="post" name="Add" id="Add"  enctype="multipart/form-data" onkeypress="if(Enter(event)==true){ return testfunction () }"> [/php] --------

14/01/2015

php implode multi dimentioanal array key

[php] $array = array( array( Title => "rose", Price => 1.25, Number => 15 ), array( Title => "daisy", Price => 0.75, Number => 25, ), array( Title => "orchid", Price => 1.15, Number => 7 ) ); $str=implode(',', array_map( function($subarr){return $subarr["Number"];},$array)); [/php] ootput : 15,25,7     -----

14/01/2015

php - html

  • nl2br — Inserts HTML line breaks before all newlines in a string
  • htmlspecialchars() - Convert special characters to HTML entities
  • htmlentities() - Convert all applicable characters to HTML entities
  • wordwrap() - Wraps a string to a given number of characters
http://www.php.net/manual/en/function.nl2br.php

14/01/2015