$directory = substr(DIR_BASE,0,-1); $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)); $i=1; while($it->valid()) { if (!$it->isDot()) { echo "$i\n"; echo 'SubPathName: ' . $it->getSubPathName() . "\n"; echo 'SubPath: ' . $it->getSubPath() . "\n"; echo 'Key: ' . $it->key() . "\n\n"; $i++; } $it->next(); }
Html, JAVA,DOTNET,Javascript, PHP, and JQuery Scripts and its issues with solutions
Thursday, 31 July 2014
How to list files in Main directory & its Sub directory in dynamically in php?
How to create Zip file using php?
$zip = new ZipArchive(); $zip_name = time().".zip"; // Zip name $zip->open($zip_name, ZipArchive::CREATE); $zip->addFile('test.php'); $zip->close(); header('Content-type: application/zip'); header('Content-Disposition: attachment; filename="'.$zip_name.'"'); readfile($zip_name); unlink($zip_name);
How to export My Sql Database Backup in php?
$backuptime = "DB_Backup_".DB_NAME."-".time().".sql"; //$backuptime = DB_NAME.".sql"; $data["db_file_name"] = $backuptime; $insert = $CommonObj->insert_query("db_backup",$data); $str = ""; $show_tables = "show tables from ".DB_NAME; $tables = $db->query($show_tables); if($tables){ while($row = mysql_fetch_assoc($tables)){ $table = $row["Tables_in_".DB_NAME]; $show_each_tables = "show create table ".$table; $each_tables = $db->query($show_each_tables); $each_tables = mysql_fetch_assoc($each_tables); $str .= $each_tables["Create Table"]; $str .= ";\n\n"; $show_column = "SHOW COLUMNS FROM $table"; $column = $db->query($show_column); $get_val_query = "select * from $table"; $get_val = $db->query($get_val_query); if($column && mysql_num_rows($get_val)>0){ $str .= "INSERT INTO `$table` ("; while($cols = mysql_fetch_assoc($column)){ $str .= '`'.$cols["Field"].'`, '; } $str = substr($str,0,-2); $str .= ") VALUES \n"; } if($get_val && mysql_num_rows($get_val)>0){ while($vals = mysql_fetch_assoc($get_val)){ $str .= "( "; foreach($vals as $k=>$v){ $v= mysql_real_escape_string($v); $str .= '"'.$v.'", '; } $str = substr($str,0,-2); $str .= "),\n"; } $str = substr($str,0,-2); } $str .= ";\n\n"; } } $handle = fopen(DIR_DB.$backuptime,'w+'); fwrite($handle,$str); fclose($handle);
Wednesday, 30 July 2014
Google Shorten URL :: To make Bitly Url
<?php $postData = array('longUrl' => "http://softwarepottikadai.com"); $jsonData = json_encode($postData); $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url'); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); //As the API is on https, set the value for CURLOPT_SSL_VERIFYPEER to false. // This will stop cURL from verifying the SSL certificate. curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData); $response = curl_exec($curlObj); $json = json_decode($response); curl_close($curlObj); echo $json->id; ?>
Friday, 18 July 2014
Google finance calculator - Currency conversion in php
<? function currency($from, $to, $amount){ $content = file_get_contents('https://www.google.com/finance/converter?a='.$amount.'&from='.$from.'&to='.$to); $doc = new DOMDocument; @$doc->loadHTML($content); $xpath = new DOMXpath($doc); $result = $xpath->query('//*[@id="currency_converter_result"]/span')->item(0)->nodeValue; $converted = str_replace(' '.$to, '', $result); return round($converted, 3); } echo $currentval = currency('USD', 'INR', 1); // returns 0.7216 ?> AED => United Arab Emirates Dirham (AED) AFN => Afghan Afghani (AFN) ALL => Albanian Lek (ALL) AMD => Armenian Dram (AMD) ANG => Netherlands Antillean Guilder (ANG) AOA => Angolan Kwanza (AOA) ARS => Argentine Peso (ARS) AUD => Australian Dollar (A$) AWG => Aruban Florin (AWG) AZN => Azerbaijani Manat (AZN) BAM => Bosnia-Herzegovina Convertible Mark (BAM) BBD => Barbadian Dollar (BBD) BDT => Bangladeshi Taka (BDT) BGN => Bulgarian Lev (BGN) BHD => Bahraini Dinar (BHD) BIF => Burundian Franc (BIF) BMD => Bermudan Dollar (BMD) BND => Brunei Dollar (BND) BOB => Bolivian Boliviano (BOB) BRL => Brazilian Real (R$) BSD => Bahamian Dollar (BSD) BTN => Bhutanese Ngultrum (BTN) BWP => Botswanan Pula (BWP) BYR => Belarusian Ruble (BYR) BZD => Belize Dollar (BZD) CAD => Canadian Dollar (CA$) CDF => Congolese Franc (CDF) CHF => Swiss Franc (CHF) CLF => Chilean Unit of Account (UF) (CLF) CLP => Chilean Peso (CLP) CNH => CNH (CNH) CNY => Chinese Yuan (CN¥) COP => Colombian Peso (COP) CRC => Costa Rican Colón (CRC) CUP => Cuban Peso (CUP) CVE => Cape Verdean Escudo (CVE) CZK => Czech Republic Koruna (CZK) DEM => German Mark (DEM) DJF => Djiboutian Franc (DJF) DKK => Danish Krone (DKK) DOP => Dominican Peso (DOP) DZD => Algerian Dinar (DZD) EGP => Egyptian Pound (EGP) ERN => Eritrean Nakfa (ERN) ETB => Ethiopian Birr (ETB) EUR => Euro (€) FIM => Finnish Markka (FIM) FJD => Fijian Dollar (FJD) FKP => Falkland Islands Pound (FKP) FRF => French Franc (FRF) GBP => British Pound Sterling (£) GEL => Georgian Lari (GEL) GHS => Ghanaian Cedi (GHS) GIP => Gibraltar Pound (GIP) GMD => Gambian Dalasi (GMD) GNF => Guinean Franc (GNF) GTQ => Guatemalan Quetzal (GTQ) GYD => Guyanaese Dollar (GYD) HKD => Hong Kong Dollar (HK$) HNL => Honduran Lempira (HNL) HRK => Croatian Kuna (HRK) HTG => Haitian Gourde (HTG) HUF => Hungarian Forint (HUF) IDR => Indonesian Rupiah (IDR) IEP => Irish Pound (IEP) ILS => Israeli New Sheqel (₪) INR => Indian Rupee (Rs.) IQD => Iraqi Dinar (IQD) IRR => Iranian Rial (IRR) ISK => Icelandic Króna (ISK) ITL => Italian Lira (ITL) JMD => Jamaican Dollar (JMD) JOD => Jordanian Dinar (JOD) JPY => Japanese Yen (¥) KES => Kenyan Shilling (KES) KGS => Kyrgystani Som (KGS) KHR => Cambodian Riel (KHR) KMF => Comorian Franc (KMF) KPW => North Korean Won (KPW) KRW => South Korean Won (₩) KWD => Kuwaiti Dinar (KWD) KYD => Cayman Islands Dollar (KYD) KZT => Kazakhstani Tenge (KZT) LAK => Laotian Kip (LAK) LBP => Lebanese Pound (LBP) LKR => Sri Lankan Rupee (LKR) LRD => Liberian Dollar (LRD) LSL => Lesotho Loti (LSL) LTL => Lithuanian Litas (LTL) LVL => Latvian Lats (LVL) LYD => Libyan Dinar (LYD) MAD => Moroccan Dirham (MAD) MDL => Moldovan Leu (MDL) MGA => Malagasy Ariary (MGA) MKD => Macedonian Denar (MKD) MMK => Myanma Kyat (MMK) MNT => Mongolian Tugrik (MNT) MOP => Macanese Pataca (MOP) MRO => Mauritanian Ouguiya (MRO) MUR => Mauritian Rupee (MUR) MVR => Maldivian Rufiyaa (MVR) MWK => Malawian Kwacha (MWK) MXN => Mexican Peso (MX$) MYR => Malaysian Ringgit (MYR) MZN => Mozambican Metical (MZN) NAD => Namibian Dollar (NAD) NGN => Nigerian Naira (NGN) NIO => Nicaraguan Córdoba (NIO) NOK => Norwegian Krone (NOK) NPR => Nepalese Rupee (NPR) NZD => New Zealand Dollar (NZ$) OMR => Omani Rial (OMR) PAB => Panamanian Balboa (PAB) PEN => Peruvian Nuevo Sol (PEN) PGK => Papua New Guinean Kina (PGK) PHP => Philippine Peso (Php) PKG => PKG (PKG) PKR => Pakistani Rupee (PKR) PLN => Polish Zloty (PLN) PYG => Paraguayan Guarani (PYG) QAR => Qatari Rial (QAR) RON => Romanian Leu (RON) RSD => Serbian Dinar (RSD) RUB => Russian Ruble (RUB) RWF => Rwandan Franc (RWF) SAR => Saudi Riyal (SAR) SBD => Solomon Islands Dollar (SBD) SCR => Seychellois Rupee (SCR) SDG => Sudanese Pound (SDG) SEK => Swedish Krona (SEK) SGD => Singapore Dollar (SGD) SHP => Saint Helena Pound (SHP) SLL => Sierra Leonean Leone (SLL) SOS => Somali Shilling (SOS) SRD => Surinamese Dollar (SRD) STD => São Tomé and Príncipe Dobra (STD) SVC => Salvadoran Colón (SVC) SYP => Syrian Pound (SYP) SZL => Swazi Lilangeni (SZL) THB => Thai Baht (฿) TJS => Tajikistani Somoni (TJS) TMT => Turkmenistani Manat (TMT) TND => Tunisian Dinar (TND) TOP => Tongan Paʻanga (TOP) TRY => Turkish Lira (TRY) TTD => Trinidad and Tobago Dollar (TTD) TWD => New Taiwan Dollar (NT$) TZS => Tanzanian Shilling (TZS) UAH => Ukrainian Hryvnia (UAH) UGX => Ugandan Shilling (UGX) USD => US Dollar ($) UYU => Uruguayan Peso (UYU) UZS => Uzbekistan Som (UZS) VEF => Venezuelan Bolívar (VEF) VND => Vietnamese Dong (₫) VUV => Vanuatu Vatu (VUV) WST => Samoan Tala (WST) XAF => CFA Franc BEAC (FCFA) XCD => East Caribbean Dollar (EC$) XDR => Special Drawing Rights (XDR) XOF => CFA Franc BCEAO (CFA) XPF => CFP Franc (CFPF) YER => Yemeni Rial (YER) ZAR => South African Rand (ZAR) ZMK => Zambian Kwacha (1968-2012) (ZMK) ZMW => Zambian Kwacha (ZMW) ZWL => Zimbabwean Dollar (2009) (ZWL
How to get IP based country,state,currency and countrycode and Internet connection Provider and lattitude & longitude in PHP?
<?php echo getipaddress(); function getipaddress(){ $xml = simplexml_load_file("http://www.geoplugin.net/xml.gp?ip=".getRealIpAddr()); print_r($xml); $ccode=$xml->geoplugin_countryCode; return $ccode; } function getRealIpAddr(){ if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip=$_SERVER['HTTP_CLIENT_IP']; }elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; }else{ $ip=$_SERVER['REMOTE_ADDR']; } //$ip="YOUR IP"; return $ip; } echo "<hr>"; $details = ip_details(getRealIpAddr()); print_r($details); function ip_details($ip) { $json = file_get_contents("http://ipinfo.io/{$ip}"); $details = json_decode($json); return $details; } ?>
Wednesday, 16 July 2014
How to download your profile from facebook?
1. Login to your FB account in http://facebook.com
2. Goto your Account -> Settings
3. Click Download as Copy & you have get mail from fb registered account
4. Check you mail the subject is " Your Facebook download is ready" and click the link
Ex: https://www.facebook.com/dyi?x=**************
5. You have get you full profile & uploaded photos, videos & wall everything will be get
Tuesday, 15 July 2014
CSS Message bog show automatically & hide
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <style type="text/css"> .message{ width: 90%; margin-left:auto; margin-right:auto; position: relative; top: 5px; } </style> <?php if(isset($_SESSION["e_msg"]) && $_SESSION["e_msg"]!=""){ ?> <div class="alert alert-danger alert-error message" style='display:none;'> <a href="#" class="close" data-dismiss="alert">×</a> <strong>Error!</strong> <?php echo $_SESSION["e_msg"]; ?> </div> <script type='text/javascript'> $( document ).ready(function() { $(".alert-danger").fadeIn( "slow" ); }); setTimeout(function(){ $(".alert-danger").slideToggle( "slow" ); },3000);</script> <?php unset($_SESSION['e_msg']); } if(isset($_SESSION["i_msg"]) && $_SESSION["i_msg"]!=""){ ?> <div class="alert alert-info message" style='display:none;'> <a href="#" class="close" data-dismiss="alert">×</a> <strong>Note!</strong> <?php echo $_SESSION["i_msg"]; ?> </div> <script type='text/javascript'> $( document ).ready(function() { $(".alert-info").fadeIn( "slow" ); }); setTimeout(function(){ $(".alert-info").slideToggle( "slow" ); },3000);</script> <?php unset($_SESSION['i_msg']); } if(isset($_SESSION["w_msg"]) && $_SESSION["w_msg"]!=""){ ?> <div class="alert alert-warning warning message " style='display:none;'> <a href="#" class="close" data-dismiss="alert">×</a> <strong>Warning!</strong> <?php echo $_SESSION["w_msg"]; ?> </div> <script type='text/javascript'> $( document ).ready(function() { $(".alert-warning").fadeIn( "slow" ); }); setTimeout(function(){ $(".alert-warning").slideToggle( "slow" ); },3000);</script> <?php unset($_SESSION['w_msg']); } if(isset($_SESSION["s_msg"]) && $_SESSION["s_msg"]!=""){ ?> <div class="alert alert-success message" style='display:none;'> <a href="#" class="close" data-dismiss="alert">×</a> <strong>Success!</strong> <?php echo $_SESSION["s_msg"]; ?> </div> <script type='text/javascript'> $( document ).ready(function() { $(".alert-success").fadeIn( "slow" ); }); setTimeout(function(){ $(".alert-success").slideToggle( "slow" ); },3000);</script> <?php unset($_SESSION['s_msg']); } ?>
Friday, 11 July 2014
How to calculate no of working days in php?
function getWorkingDays($startDate, $endDate){ $begin=strtotime($startDate); $end=strtotime($endDate); if($begin>$end){ echo "tartdate is in the future!
"; return 0; }else{ $no_days=0; $weekends=0; while($begin<=$end){ $no_days++; // no of days in the given interval $what_day=date("N",$begin); if($what_day>6) { // 6 and 7 are weekend days $weekends++; }; $begin+=86400; // +1 day }; $working_days=$no_days-$weekends; return $working_days; } }
How to find last day of month in jquery datetime picker?
function getLastDayOfYearAndMonth(year, month){ return(new Date((new Date(year, month + 1, 1)) - 1)).getDate(); }
Thursday, 10 July 2014
How to find your mobile number?
உங்கள் மொபைல் எண் மறந்துவிட்டதா? *********************************** "உங்கள் மொபைல் எண் திரையில் தோன்ற அழுத்துங்கள்" Idea சேவையைப் பயன்படுத்துபவர்கள் *1# Bsnl சேவையைப் பயன்படுத்துபவர்கள் *888# Aircel சேவையைப் பயன்படுத்துபவர்கள் *131# Videocon சேவையைப் பயன்படுத்துபவர்கள் *1# Airtel சேவையைப் பயன்படுத்துபவர்கள் *121*9# Reliance சேவையைப் பயன்படுத்துபவர்கள் *1# Virgin Mobile சேவையைப் பயன்படுத்துபவர்கள் *1# Vodafone சேவையைப் பயன்படுத்துபவர்கள் *131*0# Tata DoComo சேவையைப் பயன்படுத்துபவர்கள் *580#
Thursday, 3 July 2014
How to make Bitly Url using Google API
$GoogleApiKey = $appkey; $postData = array('longUrl' => $currenturl, 'key' =>$GoogleApiKey); $jsonData = json_encode($postData); $curlObj = curl_init(); curl_setopt($curlObj, CURLOPT_URL, 'https://www.googleapis.com/urlshortener/v1/url'); curl_setopt($curlObj, CURLOPT_RETURNTRANSFER, 1); //As the API is on https, set the value for CURLOPT_SSL_VERIFYPEER to false. This will stop cURL from verifying the SSL certificate. curl_setopt($curlObj, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curlObj, CURLOPT_HEADER, 0); curl_setopt($curlObj, CURLOPT_HTTPHEADER, array('Content-type:application/json')); curl_setopt($curlObj, CURLOPT_POST, 1); curl_setopt($curlObj, CURLOPT_POSTFIELDS, $jsonData); $response = curl_exec($curlObj); $json = json_decode($response); curl_close($curlObj); return $json->id;
Wednesday, 2 July 2014
How to find prime numbers between two numbers with sliding effect?
<?php $min = 0; $max = 10; if(isset($_POST) && isset($_POST["prime"])){ $min = (isset($_POST["min"])) ?$_POST["min"]:$min; $max = (isset($_POST["max"])) ?$_POST["max"]:$max; } ?> <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> <style type='text/css'> aside{ font-size: 14px; font-family:Arial; } .main{ margin: 0 auto;width:90%; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; border:1px solid #000000;background-color:#0D020D; padding: 20px; } #prime_no{ height: 200px; overflow-y: scroll; } .main1{ margin: 0 auto;width:90%; height:150px; -webkit-border-radius: 20px; -moz-border-radius: 20px; border-radius: 20px; border:1px solid #000000;background-color:#0D020D; padding: 20px; } .oran{ border:0; color:#f6931f; font-weight:bold; } .white{ border:0; color:#FFFFFF; font-weight:bold; } .mgroup{ /*border:1px solid red;*/ margin:0 auto; width:50%; padding:10px; } .mgroup label{ border:0; color:#FFFFFF; font-weight:bold; } .css_button { margin : 0px 0px 0px 150px; font-family:Arial; font-weight:normal; -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; border: 1px solid #3866A3; padding: 9px 18px; text-shadow:1px 1px 0px #5E5E5E; -moz-box-shadow:inset 1px 1px 0px 0px #BEE2F9; -webkit-box-shadow:inset 1px 1px 0px 0px #BEE2F9; box-shadow:inset 1px 1px 0px 0px #BEE2F9; font-weight:normal; text-decoration:none; cursor: pointer; background:-webkit-linear-gradient(90deg, #468ccf 5%, #63b8ee 100%); background:-moz-linear-gradient(90deg, #468ccf 5%, #63b8ee 100%); background:-ms-linear-gradient(90deg, #468ccf 5%, #63b8ee 100%); background:linear-gradient(180deg, #63b8ee 5%, #468ccf 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#63b8ee', endColorstr='#468ccf'); /*background-color:#468ccf;*/ color:#FFFFFF; display:inline-block; } .css_button:hover { background:-webkit-linear-gradient(90deg, #63b8ee 5%, #468ccf 100%); background:-moz-linear-gradient(90deg, #63b8ee 5%, #468ccf 100%); background:-ms-linear-gradient(90deg, #63b8ee 5%, #468ccf 100%); background:linear-gradient(180deg, #468ccf 5%, #63b8ee 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#468ccf', endColorstr='#63b8ee'); /*background-color:#63b8ee;*/ } .css_button:active { position:relative; top:1px; } .textbox { background: white; font-weight:bold; border: 1px solid #ffa853; border-radius: 3px; box-shadow: 0 0 3px 1px #ffa853; color: #666; outline: none; height:23px; width: 100px; } </style> <aside> <center><h3>Prime Number</h3></center> <div class='main'> <div id="range" class="oran"></div><br> <div id="slider-range"></div><br> <div id="prime_no" class="white"></div><br> </div> <br> <div class='main1'> <form action="" method="post" onsubmit="return ck_min();"> <div class="mgroup"> <label for="name">Minimum Value</label> <input type='text' placeholder="Min Value" maxlength='5' class="textbox" name='min' id='min' onkeyup = "if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')"> </div> <div class="mgroup"> <label for="name">Minimum Value</label> <input type='text' placeholder="Max Value" maxlength='5' class="textbox" name='max' id='max' onkeyup = "if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')"> </div> <div class="mgroup"> <input type='submit' class="css_button" value='Enter' name='prime'> </div> </form> </div> <script type='text/javascript'> var minval = <?php echo $min; ?>; var maxval = <?php echo $max; ?>; $(function() { isPrime(minval,maxval); $( "#slider-range" ).slider({ range: true, min: minval, max: maxval, values: [ minval, maxval ], slide: function( event, ui ) { $( "#range" ).html( "Min No : " + ui.values[ 0 ] + " - Max No : " + ui.values[ 1 ] ); isPrime(ui.values[ 0 ],ui.values[ 1 ]); } }); $( "#range" ).html( "Max No : " + $( "#slider-range" ).slider( "values", 0 ) + " - Min No : " + $( "#slider-range" ).slider( "values", 1 ) ); }); function ck_min(){ var mi = $("#min").val(); var mx = $("#max").val(); mi = parseInt(mi); mx = parseInt(mx); if (mi && mx) { if (mi > mx) { alert("Min val should be less than Max val and Max Val should be greater than Min Val"); return false; }else{ return true; } }else{ return false; } } function isPrime(a,b) { var temp = new Array(); var x=0 for(i=a; i<=b; i++){ if(isPrimeno(i)){ temp[x]=i; x++; } } var str = "Prime No : "; for(y=0;y<temp.length;y++){ str += temp[y]; if (temp.length-1>y) { str += " , "; } } $("#prime_no").html(str); } function isPrimeno(numb){ for(var i=2; i<= Math.sqrt(numb); i++){ if(numb%i ==0){ return false; } } return true; } </script> </aside>
Subscribe to:
Posts (Atom)