This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $this->db->last_query(); | |
| Returns the last query that was run (the query string, not the result). Example: | |
| $str = $this->db->last_query(); | |
| // Produces: SELECT * FROM sometable.... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| phishing attack | |
| What to be done if your website is under phishing attack | |
| 1) http://www.semanticoverload.com/2009/03/17/if-your-site-has-been-compromised-with-phishing-attack- code/index.html | |
| 2) http://google-gruyere.appspot.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Include Jfactory class in external php file | |
| define( '_JEXEC', 1 ); | |
| define( 'DS', DIRECTORY_SEPARATOR ); | |
| define( 'JPATH_BASE', $_SERVER[ 'DOCUMENT_ROOT' ] ); | |
| ... then you need to include three files, like: | |
| require_once( JPATH_BASE . DS . 'includes' . DS . 'defines.php' ); | |
| require_once( JPATH_BASE . DS . 'includes' . DS . 'framework.php' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /*$connect = mysql_connect('localhost','root','12345'); | |
| if (!$connect) { | |
| die('Could not connect to MySQL: ' . mysql_error()); | |
| }*/ | |
| // $cid =mysql_select_db('test',$connect); | |
| // supply your database name | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $country_array = array( | |
| "AA" => "Please select country", | |
| "AFG" => "Afghanistan" , | |
| "ALB" => "Albania" , | |
| "DZA" => "Algeria" , | |
| "ASM" => "American Samoa" , | |
| "AND" => "Andorra" , | |
| "AGO" => "Angola" , | |
| "AIA" => "Anguilla" , | |
| "ATA" => "Antarctica" , |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // to calculate age | |
| $interval = date_diff(date_create(), date_create('2008-01-01 10:30:00')); | |
| echo $interval->format("You are %Y Year, %M Months, %d Days, %H Hours, %i Minutes, %s Seconds Old"); | |
| About Date | |
| /* $startYear=strtotime(date("Y-04-1")); | |
| $startYear = date('Y-m-d', $startYear); | |
| // echo "startyear : ". $startYear; | |
| // $startYear = DateTime::createFromFormat('Y-m-d', $startYear); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if($_FILES["zip_file"]["name"]) { | |
| $filename = $_FILES["zip_file"]["name"]; | |
| $source = $_FILES["zip_file"]["tmp_name"]; | |
| $type = $_FILES["zip_file"]["type"]; | |
| $name = explode(".", $filename); | |
| $accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed'); | |
| foreach($accepted_types as $mime_type) { | |
| if($mime_type == $type) { | |
| $okay = true; | |
| break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $db =& JFactory::getDBO(); | |
| $db->setQuery( $query ); | |
| $db->query(); | |
| To get the last insert id: | |
| $db->insertid(); | |
| To get Number of rows fetched | |
| $db->getNumRows(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo JHTML::_('calendar','value', 'start', 'id', $format = '%d-%m-%Y', array('class'=>'inputbox', 'size'=>'25', 'maxlength'=>'19')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('#' + id).is(":checked") | |
| that gets if the checkbox is checked. | |
| for an array of checkboxes with the same name you can get the list of checked ones by | |
| var boxes = $('input[name=thename]:checked'); | |
| then to loop through them and see what's checked you can do |