Hi all, We can count files in a folder using PHP by using the following function. It return the no of files in the directory provided as input argument function count_files ($dir){ $count = count(glob($_SERVER[‘DOCUMENT_ROOT’].$dir . “*”)) ; return $count; } Thanks Jawed Read More »
crop image after upload php
I tried to explain crop image after upload using php. /* crop image after upload php */ function add_picture_story($story_id,$filename,$tmpname) { global $config; $filename_parts = explode(“.”,strrev($filename),2); $filename_base = strrev($filename_parts[1]); $filename_ext = strrev($filename_parts[0]);$unique_filename_base = strtolower(sanitize_filename($filename_base)); $final_filename = $unique_filename_base . “.” . $filename_ext;// final fully qualified file name $final_fqfn = $config[“basedir”].’images/images_story/’.$final_filename;if (is_uploaded_file($tmpname)) { if (!move_uploaded_file($tmpname,$final_fqfn)) { $result[‘errors’] .= sprintf(plog_tr(‘Could not move uploaded file! ... Read More »
image slideshow in jquery
Guys, you can find a list of image slideshow in jquery from undermentioned urls. http://www.dhtmlgoodies.com/scripts/image_slideshow/image_slideshow.html http://www.dhtmlgoodies.com/index.html?whichScript=image_slideshow http://www.developphp.com/ sliding window code ( http://www.panic.com/coda/ ) Read More »
google currency converter using php
Here is the code for currency conversion google currency converter using php. function exchangeRate( $amount, $currency, $exchangeIn ) { $googleQuery = $amount . ‘ ‘ . $currency . ‘ in ‘ . $exchangeIn; $googleQuery = urlEncode( $googleQuery ); $askGoogle = file_get_contents( ‘http://www.google.com/search?q=’ . $googleQuery ); $askGoogle = strip_tags( $askGoogle ); $matches = array(); preg_match( ‘/= (([0-9]|.|,| )*)/’, $askGoogle, $matches ); ... Read More »
calculate time difference using php
Here is the code to calculate time difference using php. function get_time_difference( $start, $end ) { $uts[‘start’] = strtotime( $start ); $uts[‘end’] = strtotime( $end ); if( $uts[‘start’]!==-1 && $uts[‘end’]!==-1 ) { if( $uts[‘end’] >= $uts[‘start’] ) { $diff = $uts[‘end’] – $uts[‘start’]; if( $days=intval((floor($diff/86400))) ) $diff = $diff % 86400; if( $hours=intval((floor($diff/3600))) ) $diff = $diff % 3600; if( $minutes=intval((floor($diff/60))) ... Read More »
realex payment gateway integration
Here is the realex payment gateway integration code using PHP. $timestamp = strftime(“%Y%m%d%H%M%S”); $topay = ‘5’; $merchantid = “mytalentplace”;//here grant crow`s realex merchent id should come $secret = “wXcHmZ9yec”; $orderid= $timestamp.’-‘.$_SESSION[‘ord_id’]; $amount =$_POST[‘amt’]*100; if($_REQUEST[‘currency’]==”doller”){ $curr= “USD”; } elseif($_REQUEST[‘currency’]==”euro”){ $curr= “EUR”; }else { $curr= “GBP”; } $tmp = “$timestamp.$merchantid.$orderid.$amount.$curr”; //$tmp = “$timestamp.$merchantid.$orderid”; $md5hash = sha1($tmp); $tmp = “$md5hash.$secret”; $md5hash = sha1($tmp); $up=”UPDATE ... Read More »
Website Payments Standard Integration Guide (Paypal)
https://www.paypalobjects.com/WEBSCR-580-20090702-1/en_US/pdf/PP_WebsitePaymentsStandard_IntegrationGuide.pdf Thanks Jawed Read More »
Generate PDT token PayPal
To generate PDT token paypal, please follow the undermentioned steps. 1. Click the My Account tab. 2. Click Profile at the top of the page. 3. On the right under Selling Preferences click on Website Payment Preferences. 4. Under Auto Return for Website Payments click "on" 5. After Return URL put http://www.mytalentplace.co.uk 6. Under Payment Data Transfer (Optional) click "on" ... Read More »
php paypal identity token
Here is the php paypal identity token script. if (!$fp) { // HTTP ERROR } else { fputs ($fp, $header . $req); // read the body data $res = ''; $headerdone = false; while (!feof($fp)) { $line = fgets ($fp, 1024); if (strcmp($line, "rn") == 0) { // read the header $headerdone = true; } else if ($headerdone) { // header ... Read More »
Custom URL rewritting
RewriteEngine on RewriteRule ^career-options/(.*)-([0-9]+).html$ careerdetails.php?carr_id=$2RewriteRule ^career-advice$ careeradvice.phpRewriteRule ^parent-career-help$ parent_profile.phpRewriteRule ^Forum/(.*)-([0-9]+).html$ forum_index.php?career_category_id=$2RewriteRule ^career-advice/career-counselling$ careercounselling.phpRewriteRule ^career-advice/interview-training$ interviewsuccess.phpRewriteRule ^career-advice/interview-questions-answers$ interview_questions.phpRewriteRule ^career-options$ career.phpRewriteRule ^community$ community.phpRewriteRule ^career–options/(.*)-([0-9]+).html$ careerdetails.php?carr_id=$2&addFirstChoice=1 Thanks Jawed Read More »