Your Open Source
Free YourOpenSource Softwares Online Resources and Softwares Downloads with Demo
PHP
XML Parser in PHP
The XML parser that can be used to read and manipulate XML and SaveTagValue() and GetTagValue() used to save and get the data into the xml file.
3868
Jun 17 08 02:16:06
Sekar
Who is IPs / Domain lookup tools
This scripts used to get the domain information. its very easy to handle for programmers.
6076
Jun 17 08 03:08:48
Sekar
Array in PHP
To print a array value print_r($arrayname);syntax:print_r( name );
248
Jun 18 08 01:30:57
Damu
How to create a random string in php
Random String Generation :- Function random_gen() is used to generate random string with ten characters
265
Jul 03 08 03:01:23
Psbharathy
How to create a file in PHP
How to create a file in PHP ?: You can use the Linux commands to create a new file in PHP. exec() is execute the external function from PHP code. The Linux CAT command used to create a new file.The Syntax is ---------------------------exec( commands );commands > is a string -----------------------------
388
Jun 20 08 02:14:15
Sekar
How to stroed / get a array data into SESSIONs
PHP array data values you can stored into a SESSION and you also get the array values from SESSION. It will most helpful for programmers because If you need to create a page bar without fetch data from the database, you can use this method to get the array values from the SESSION variable.
331
Jun 23 08 04:03:32
Sekar
Create a Captcha or Verification code image in PHP
How to Create a Captcha or Verification code image in PHPYou can develop the Cpatcha or Image verification code. CAPTCHA acronym for Completely Automated Public Turing test to tell Computers and Humans Apart, its an image of letters is dynamically generated. If you use the CAPTCHA, difficult for a spambot or other computer program ..
6837
Jul 03 08 06:00:31
Sekar
How to store array values in php
ARRAY :array() is a language construct used to represent literal arrays, and not a regular function. Function array_to_database($arr) is used to store the array values( In array format ) in table " array " Function get_array_from_db() is used to retrieve values( In array formate ) from table " array " Notes : var_export() function ret..
396
Jun 23 08 04:07:46
Sam
Regular experssions
Regular expressions is a string that represents pattern. Regular expressions functions compares string pattern with another string.PHP support 2 types of Regular expressions POSIX and pearl compatible Syntax preg_match ( string pattern, string subject [, array matches [, int flags]] ) preg_match('{class}','This is ..
244
Jun 24 08 10:16:39
Psbharathy
How to Parse the Xml Using Simple xml element
to parse the xml using SimpleXMLElement()
235
Jul 07 08 02:05:31
Damu
Send E-Mail via GMAIL or YAHOO
You can send the mail through in your gmail and yahoo. Look as following code
313
Nov 25 08 02:44:52
Sekar
How to setup Date in server:
How can I set the system date and time from the command prompt (bash shell)? I don't have GUI installed and I am login over ssh session.A. Use date command to display the current date and time or set the system date and time over ssh session.This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from..
237
Jun 30 08 10:51:52
Gary
How to convert date to timestamp
mktime() function used to convert the date to timestamp in PHP. The syntax is :------------------ mktime(int hour, int min, int sec, int mon, int day, int year) ;
316
Jul 01 08 11:27:44
Sekar
What is PUT method in PHP
PUT Method :- This is a standard input stream to read the contents from the HTTP PUT method. its similar then file uploads and look likes as follows PUT /path/filename.html HTTP/1.1
300
Jul 01 08 02:57:19
Sekar
Remove the HTML tags from the strings
Remove the HTML tags from the contents :- You can remove the HTML tags in PHP using strip_tags() function.The Syntax is---------------------strip_tags ( string str [, string allowable_tags )
317
Jul 03 08 08:11:40
Sekar
How to send mails with attachment in php
How to send mails with attachment in php :- You can send the email with attachment using PHP mail() function.
14400
Jul 08 08 04:23:20
Sekar
FFMPEG - Convert video files to FLV using FFMPEG command and Downloads ffmpeg.exe file
What is FFMPEG ?FFMPEG is a used to convert audion, video and images from one formats to another one and also supports grabbing and encoding in real time from a TV card. FFMPEG is a gross platform and FFMPEG is developed under Linux. Note: Here you can download the ffmpeg.exe for windows Convert FLV vidoe to jpg image The following comma..
3592
Nov 13 08 12:21:31
Sekar
Creloaded Arabic Language pack downloads
Cre loaded Arabic Lang pack downloads :- You can download the CRE Loaded Arabi Language pack here. You just extract the zip files and copy to /inlcudes/languages folder. If you need more information about it, please read readme.html file.
300
Nov 27 08 07:36:24
Sekar
How to Give Add To faviroute list in ur site
this code is used to add the site in to your browser add to favorties list.
7526
Jul 08 08 10:18:32
Damu
Call the another controller function in cakephp
In cakePHP,Use the requestAction() function if you need to call a one method from the another controller, The example code given below, class NotesController extends AppController { function test() { $damu= $this->requestAction('/Stores/read'); $this->set('data', $damu); } } ================== class StoresController extends Ap..
1572
Feb 25 09 09:14:41
Damu
Simplexml_load_file function
simplexml_load_file :- Its is interprets an XML file into an object. You can easily get the xml values by using the simplexml_load_file() function.The Syntax is : simplexml_load_file ( string $url ).The Example as follows,
315
Jul 09 08 04:53:00
Sekar
How to view cached google pages of your site using PHP
How to view cached google pages of your site using PHP :- You can get the google cached pages on your site by using the following PHP script. Here also available demo and download for the script. Please check it out here.
1017
Jul 10 08 01:11:40
Sekar
How to get the current execute file in php
How to get the current execute file in php You can get the current file name with extension by use the following codes
191
Jul 16 08 11:00:40
Damu
Contact us page With Verification Image
Contact us page With Verification Image :-You can get the simple Contact us page with verification image ( CAPTCHA CODE). Its very easy to handle it. Here also available for demo and downloads. Please check it now..
221
Jul 14 08 03:39:00
Sekar
How to get the last week starting and end date
How to get the last week starting and end date:- You can get the last week day and you can get starting / end day of the month by using MYSQL query. The PHP code given below,
215
Oct 30 08 07:11:37
Damu
How to export the mysql data in to Excel file
hi need to export the data's in to excel file . i create a class to export the data. call the function here two ways to take you give the field name means the particular fields only export or take the full table.
217
Jul 19 08 07:51:57
Damu
Replace the content in the particular directory
Replace the particular content in the directory :-You can the replace the particular content in the directory file.
188
Jul 21 08 03:00:23
Sekar
YouTube grabber the embed code source download
YouTube grabber the embed code : - You can easily grab the embed and images from the youtube site. The following links to you can get the code. Click the Download link as follows.
1876
Jul 24 08 10:38:18
Sekar
How to Turning OFF or ON PHPSESSID
Turning off PHPSESSID Check your php.ini file, and if it is not there, add the following line session.use_trans_sid = Off Alternativly, add this to your scripts: ini_set('session.use_trans_sid', 0);
167
Jul 24 08 03:26:18
Psbharathy
Paypal Payment Gateway Script Downloads
Paypal Payment Gateway Script Downloads The Paypal class use to easy to integrate the your site. The code as follows, <?php class paypal extends payments { var $gatewayName='Pay Pal'; var $gatewayId ='paypal'; function paypal($cartID=''){ $sql =&sql(); $this->cart_id = $cartID; $this->data['currecy_code'] = 'USD'; $this->data['..
411
Jul 25 08 01:56:33
Sekar
Clear or Remove all sessions in the domain
How to Clear or Remove all sessions in the domain :- session_destroy() function is used to clear the all session in the domain. The Syntax as follows: session_destroy() Example :- <?php // Initialize the session. session_start(); //create a new session for this domain $_SESSION['user'] = 'youropensource.com'; //destroy the ses..
153
Jul 28 08 03:35:00
Sekar
IIF function
IIF function :-IIF stands for Immediate IF, this is a well-known function in most languages but unfortunately PHP does not contain such a function. PHPkit provide the functon as follows,Syntax :-IIF(condition , true statment , false statment ) ;
4528
Jul 17 08 03:43:58
Sekar
String Comparison In PHP
String Comparison in php strcmp() is used to compare the given strings Syntax: strcmp(string1,string2); and it Returns < 0 if string1is less than string2; > 0 if string1 is greater than string2, and 0 if they are equal. Note : strcmp comparison is case sensitive //String Comparison $string1="This is an Example "; $string2="This is"; $str..
170
Jul 29 08 06:52:11
Psbharathy
Str_replace :: String Replace Function in PHP
How to Replace the text with a variable in PHP ? str_replace() function used to replace the string. The syntax is, str_replace($find ,$replace , $content ) Example :- <?php $content = 'some world in the content.'; $find = 'some world' ; $replace = 'Some World'; echo str_replace($find ,$replace , $content ); ?> Output is : Some World in t..
175
Jul 29 08 03:58:08
Sekar
How to compare the 2 strings with the specifed no of characters ?.
strncmp() Description Binary safe string comparison of the first n characters This function is similar to strcmp(), with the difference that you can specify the (upper limit of the) number of characters from each string to be used in the comparison. Note that this comparison is case sensitive Syntax strncmp ( string $str1 , string $str2 ..
205
Jul 31 08 11:43:27
Eric
How to get the chnaged content iside the text area
Test Name
143
Jul 31 08 02:39:17
Damu
Get the unmatched word in two string
How get the unmatched word in two string PHP :- You can get highlights unmatched word to compare the two string.. Example: $str = 'You are great!'; $str2 = 'You are really great!'; $arr1 = explode(" ",$str); $arr2 = explode(" ",$str2); $decr =0; for($i=0; $i
152
Aug 01 08 03:25:00
Sekar
301 Moved Permanently in PHP Script
The following code the redirect the URL " http://www.yourdomain.com/page " to " http://yourdomain.com/page ". Example : $url = "http://$_SERVER[HTTP_HOST]/$_SERVER[REQUEST_URI]"; youropensource.com= parse_url($url); youropensource.com= $host[host]; if(substr($host,0,4) == 'www.'){ $url = str_replace("www.",'',$url); Header( "HTTP/1.1 301 Moved Permanently" );..
188
Aug 04 08 02:21:38
Sekar
How to display the PHP errors in .htaccess
.htaccess to you can show the PHP errors, you write the following code in .htaccess file. php_flag display_startup_errors on php_flag display_errors on php_flag html_errors on Or In PHP file to show the errors in your site, the code as follows, <?php error_reporting(E_ALL); ini_set('error_reporting', E_ALL); ?>
201
Aug 06 08 11:18:51
Sekar
New PHP Template Parser
YourOpenSource PHP Template The YourOSTemplate class used to you can use the php variables in the HTML code. The PHP script as follows : <?php include_once('template.php'); $tpl = new YourOSTemplate(); $tpl->setValue('SAM','Great Your OpenSource PHP Template Code..'); $tpl->setBlockValue('LIST', array("NAME" => "Ryan","ROW" =>1,..
371
Aug 06 08 03:36:57
Sekar
Call culate the Year and month Between the tow dates
To calculate the total years and months between the two different dates // fiind the year and month between the two dates in php $fromdate = "2007-12-06"; $curdate = date('Y-m-d'); $datediffrence = diffYearMonth($fromdate,$curdate); echo $datediffrence; function diffYearMonth($fromdate,$todate) { $from_dt = explode('-',$fromdate); $to_dt =..
204
Aug 07 08 05:16:17
Damu
Show file name and size when uploding the files or images
Hi Folks, See below link, for display file size and name, when upload files or images using Jquery. http://www.pixeline.be/experiments/jqUploader/test.php
267
Aug 08 08 12:13:03
Ajoydhas
PHP and Java Configuration in Windows
PHP & Java ConfigurationYou must to install the Java VM on your machine and use this extension. Windows User:- You must enable the php_java.dll in php.ini file. The first action you need to add the following line to the extensions section in php.ini file extension=php_java.dll Then, You need to create a new JAVA section in php.ini file, ..
188
Aug 09 08 02:55:07
Sekar
Word Count in PHP
Word Count in PHP , WordCount function used to get the words of the sentence. Word_Count() function used to search the particular word in the string and return the no of words found in the string. The code as follows, <?php function wordcount($str) { return count(explode(" ",$str)); } function word_count($str,$word){ $str = str_repl..
447
Aug 21 08 02:44:01
Sekar
Regular Expression Tricks
remove the space between the content $noPunc = preg_replace('/[^a-zA-Z-`]/', '', $content); ------------------------------------------------------------------------------- clean the start of the content $start= preg_replace('/ [-`]*/', '', $content); -------------------------------------------------------------------------------
164
Aug 21 08 02:46:54
Damu
To order the recrods depends ont the word count
<?php // SAME FOR USING DB TO GET GET THE VALUES AND DISPLAY DEPEND ON THE WORD COUNT // DAMU function wordcount($str) { return count(explode(" ",$str)); } function word_count($str,$word){ $str = str_replace(". "," ",$str); $words = explode(" ",$str); $count=0; foreach($words as $key=>$value){ if($value == $word){ $count+..
192
Aug 22 08 04:56:50
Damu
Autmatically Login into the PHPBB3 forum from the your primary site
If the member login to your site, automatically logged in the your phpBB forum in backend, so If the member goto the forums, they wont logged in again. Usage:- Create a new file and store in the PHPBB home directory and use the PHPBB class in your primary site. good luck! Requirements, PHPBB3 <?php global $phpbb_root_path,$phpE..
13602
Aug 25 08 05:07:19
Sekar
Parsing Query strings
$str=$_SERVER['QUERY_STRING']; parse_str($str,$array); print_r($array) //returns the name value pair
147
Aug 26 08 05:26:28
Nimalan
PHP vs ASP.NET
Difference between PHP and ASP.Net No ASP.NET PHP 1 ASP.NET has a lot of options for new development, Here you can use languages such as c# ,J# & VB.NET etc., Minimum language support eg, Java etc., 2 Development Environment :- ASP.NET has only one choice, Visual Studio whic..
217
Sep 12 08 12:22:57
Sekar
SYMFONY FRAME WORK INSTALLATION
here is the step by step guide to install the SYMFONY frame work
168
Oct 02 08 02:49:18
Damu
Email Indication when opened or read the mail
How to get the Email Indication when opened or read the mailSend the html message and put a 1px image, that image hosted on your server and your server will recored when the image is loaded. For example :- If anyone opened the mail, you get the indication to the mail_image.php with mail_id. that's all
160
Oct 03 08 09:56:55
Sekar
PHP ONE FUNCTION TO GET THE DATAS FROM TABLE
function getuserval() { $con = mysql_connect('localhost', 'myuser', 'mypassword'); // Performing MYSQL QUERY SQL query $result = query_execute('SELECT name, password FROM usertable', 'blog_db', $con); // Filling up the array $resul = array(); while ($row = fetch_results($result)) { $result[] = $row; } // Closing ..
148
Oct 01 08 11:14:19
Damu
What is Direct Checkout
DirectCheckout :- Direct Checkout is an innovative ordering system that provides the fastest possible way to checkout for a single page. list out the following information for the single page 1. Cart information, here customer can change the quantity of the products 2. Shipping information 3. Confirm Order ( display tax,shipping charges and ..
150
Oct 02 08 09:49:11
Sekar
How to identify the spam email
Get the Spam email :- The is_spam_email() function to identify the mail is spam or not. The PHP function as follows, <?php function is_spam_email($email){ if(!filter_var($email, FILTER_VALIDATE_EMAIL)){ return true; }else return false; } ?> Example :- <?php $email = "spam.....@youropensource.com"; if(!is_spam_ema..
228
Sep 15 08 03:29:51
Sekar
URL REDIRECT CODE FOR ALL
IN PHP ===== <?php header("location:http://www.test.com/index.html"); exit; ?> IN JS ==== document.location.href='www.test.com/index.php'
142
Sep 23 08 10:01:18
Damu
Advanced PHP Security
What is Security ?Security is a measurement, not a characteristic. It’s is also an growing problem that requires an continually evolving solution. A good measure of secure application is it’s ability to predict and prevent future security problems, before someone devises an exploit. As far as application design goes, security must be cons..
210
Oct 05 08 01:10:06
Sekar
PHP and Security
PHP keeps on growing as a language, making headway into enterprise and corporate markets.Consequently PHP applications often end up working with sensitive data. Unauthorized access to this data is unacceptable. To prevent problems a secure design is needed >
219
Oct 05 08 01:04:10
Sekar
Get the Directory Size
How to get the Directory Size ? The getDirectorySize() function used to get the exact size of the folder. The syntax is getDirectory(string directory_name); <?php echo getDirectorySize("dating"); function getDirectorySize($dir){ $size = dirsize($dir); return ConvertBytes($size); } function dirsize($dir,$buf=2) { static $buffer; ..
186
Oct 04 08 06:25:50
Sekar
Security:: Input Validation
One of the key concepts you must accept is that user input is unreliable and not to be trusted.Partially lost in transmission between server & client.Corrupted by some in-between process.Modified by the user in an unexpected manner.Intentional attempt to gain unauthorized access or to crash the application.Which is why it is absolutely essenti..
237
Oct 05 08 01:11:08
Sekar
Security:: Accessing Input data
As of PHP 4.1, there are a series of super-globals that offer very simple access to the input data.$_GET – data from get requests. $_POST – post request data. $_COOKIE – cookie information. $_FILES – uploaded file data. $_SERVER – server data $_ENV – environment variables $_REQUEST – combination of GET/POST/COOKIE >
224
Oct 06 08 11:00:11
Sekar
Security:: Register Globals
Arguably the most common source of vulnerabilities in PHP applications. Any input parameters are translated to variables. ?foo=bar >> $foo = “bar”; No way to determine the input source.Prioritized sources like cookies can overwrite GET values.Un-initialized variables can be “injected” via user inputs. if (authenticated_user()) { $auth..
205
Oct 06 08 11:08:45
Sekar
Solutions To Register Globals
Disable register_globals in PHP.ini. Already done by default as of PHP 4.2.0 Code with error_reporting set to E_ALL. Allows you to see warnings about the use of un-initialized variables. Type sensitive validation conditions. Because input is always a string, type sensitive compare to a Boolean or an integer will always fail.if ($authorized ==..
158
Oct 06 08 11:25:50
Sekar
Security:: $_REQUEST and $_SERVER
$_REQUEST The $_REQUEST super-global merges data from different input methods, like register_globals it is vulnerable to value collisions. PHP.ini: variables_order = GPCSecho $_GET['id']; // 1 echo $_COOKIE['id']; // 2 echo $_REQUEST['id']; // 2 $_SERVER Even though the $_SERVER super-global is populated based on data supplied by the webserver..
234
Oct 06 08 11:26:52
Sekar
Security :: Validation in String and Path
Numeric Value Validation All data passed to PHP (GET/POST/COOKIE) ends up being a string. Using strings where integers are needed is not only inefficient but also dangerous.// integer validation if (!empty($_GET['id'])) { $id = (int) $_GET['id']; } else $id = 0; // floating point number validation if (!empty($_GET['price'])) { $price = (float)..
377
Oct 06 08 11:44:43
Sekar
Magic_quotes_gpc and Magic Quotes Normalization
magic_quotes_gpc PHP tries to protect you from attacks, by automatically escaping all special characters inside user input. ( ‘, “, \, \0 (NULL) ) Slows down input processingWe can do better using casting for integers.Requires 2x memory for each input element.May not always be availableCould be disabled in PHP configuration. Generic soluti..
196
Oct 06 08 11:44:05
Sekar
Test Credit Card (CC) Numbers
List of Testing CC Numbers :-Card TypeNumberMaster Card 5105 1051 0510 5100 5555 5555 5555 4444Visa 13 Digits - 4222222222222 16 Digits 4111 1111 1111 1111 4012 8888 8888 1881 American Express3782 8224 6310 005 3714 4963 5398 431 Discover 6011 1111 1111 1117 6011 0009 9013 9424 JCB3530 1113 3330 0000 3566 0020 2036 0505
2553
Oct 13 08 10:22:24
Sekar
Session Test Code
The following code to you can test the session is working or not in your domain. <?php session_start(); if($_GET[test] ==1){ if(isset($_SESSION[test]) && $_SESSION[test] == 1) echo "Session is working fine on your server.."; else echo "Session is not working . please contact your server adminstrator.."; }else{ $_SESSION[test] = 1; ..
144
Oct 15 08 06:03:50
Sekar
Cake php for Beginner Part II (Starting Simple code)
cake php for Beginner Part II (Starting Simple code) following steps to start the code with cake php database and other configuration refer the link ----------------------------------------------------------- http://youropensource.com/projects/173-Cacke-PHP-Guide-For-beginner-Part-1-Configuration --------------------------------------------..
219
Oct 18 08 04:20:37
Damu
Abstract Class
Abstract Class: Abstract class sample : abstract class aaa { //In abstract class a method must be declared as abstract. //For abstract methods there will be no body i.e. There is no implementation. //The Abstract methods can declare with Access modifiers(public,internal,protected etc )But //when implementing in subclass same access mo..
158
Oct 30 08 07:34:57
Damu
OOPS Concepts in PHP
OOPS CONCEPTS IN PHP Access control modifiers: `````````````````````` Public: used from anywhere in the script Private: only be used by the object it is part of; it cannot be accessed elsewhere Protected: used by the object it is part of, or descendants of that class Final: This variable or function cann..
513
Oct 30 08 09:22:45
Damu
SESSION WITH MYSQL TABLE
SESSION WITH MYSQL TABLE: handle the session with mysql table: <?php class Session { /** * a database connection resource * @var resource */ private $_sess_db; /** * Open the session * @return bool */ public function open() { if ($this->_sess_db = mysql_connect(SESSION_DB_HOST, ..
163
Oct 30 08 09:43:10
Damu
Joomla Tempalte Helps
used to ech the my name in the page: <?php echo JText::_('Damu'); ?> IMAGE PATH :
181
Nov 21 08 07:54:52
Damu
JavaScript Popup Windows
Popup windows are additional browser window opened from a web page. The popups are opened programmatically using JavaScript. Changing the features of the Popup You can control the features of the popup using the last argument to the window.open method. The following code opens a window with a status bar and no extra features. window.open ("h..
238
Nov 17 08 10:40:48
Psbharathy
To Get the month name from given number in php
hi You have the number you need to find the corresponding month means <?php $number = 1; echo date("M",mktime(0,0,0,$number,15,2000)); ?>
671
Jul 10 09 12:09:16
Damu
How to use check box , Option Button , Imagefiled like form fields in CakePHP?
CAKE FORM FIELDS : INPUT FIELD in cake php <?php echo $html->input('controllername/tablefieldname', array('size' => '25')); ?> HIDDEN FIELDS IN cake php > <?php echo $html->hidden('Professional/userid', array('size' => '25','value'=>"$loginusrid")); ?> TEXT AREA <?php echo $html->textarea('Professional/industry', ..
342
Nov 21 08 07:46:04
Damu
What is different between in PHP4 and PHP5
PHP 4xPHP 5x 1PHP 4 objects weren't references<?php class YOS{ var $name ="YourOpenSource"; function getName() { return $this->name; } function setName($name) { $this->name = $name; } function change(&$obj,$name){ $this->setName($name); return $obj->getName(); } } $yos = new YOS(); $yos->change($yo..
262
Nov 21 08 01:02:14
Sekar
How to get all the methods inside the calss
<?php class damu { function sekar() { return $name ="hi am sekar"; } function angapparaj() { return $name ="hi am angappa"; } } $d = new damu(); $first = $d->sekar(); $methods = get_class_methods($d); print_r($methods); ?>
175
Nov 25 08 02:26:44
Damu
Gets the properties of the given object in the CLass in php
<?php class damu { private $a; public $b = 2; public $name = "damu"; function __constructor() { echo "hai"; } function sekar() { return $name ="hi am sekar"; } function angapparaj() { return $name ="hi am angappa"; } } $d = new damu(); $first = $d->sekar(); $methods = get_object_vars($d); print_r($methods); // out..
149
Nov 25 08 02:39:07
Damu
Php function to remove the duplicate values in array
$array = attay("damu","sekar","damu") array_unique($array);
334
Nov 26 08 10:53:04
Damu
Time delay in the Javascript
function closeme(id) { document.getElementById(id).innerHTML = "now ok "; } function wait() { setTimeout ( "closeme('add_form')", 1000 ); } content etnetnetn entententetn
187
Nov 27 08 07:24:34
Damu
Convert the special char to unicode in PHP
The utf8_encode() or decode function to convert the unicode <?php echo $code = utf8_encode("Götte"); echo ""; echo $code = utf8_decode($code); ?> The output given below, Götte Götte
175
Jan 28 09 03:26:27
Sekar
I want to Zero Fill and Decimal fields is also
The zeroFill() function used to you can fill the zero what you given the target. <?php echo zeroFill(16,5); function zeroFill($in, $target){ // by sekar if(strlen($in) The output as follow, 00016
168
Jan 29 09 01:52:08
Sekar
How to check the valid ip using the regular expression
hi if you need to check the enter ip address is valid ip or not -- Using the Regular Expression. $my_ip = $_REQUEST['my_ip']; if (!preg_match("/^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/i", $my_ip)) { echo "invalid ip"; return false; }
110
Mar 06 09 12:57:31
Damu
How to get the ip for the particular host
get the ip address for the given host name : sample Code: $host_ name = 'www.youropensource.com'; $ip = gethostbyname($host_ name); echo $ip ; Definition : gethostbyname() — Get the IP address corresponding to a given Internet host name string gethostbyname ( string $hostname ) Returns the IP address of the Internet host specified..
107
Mar 06 09 01:03:47
Damu
How to get the Host Name for the website
Hi How to get the host name for the particular Web site address <?php youropensource.com= "www.youropensource.com"; // get the ipp adress for the url $ip = gethostbyname('www.youropensource.com'); // get the hostname for the url $hostname = gethostbyaddr($ip); echo $hostname; ?>
96
Mar 06 09 01:18:32
Damu
How to get the Server Operating System Name Using th php
hi , How to get the Operating system name using the php Code echo $os = strtoupper(PHP_OS);
169
Mar 06 09 01:52:06
Damu
Zip into a particular file
ZipArchive is a predefined class in PHP, so use this class to can create a zip files in PHP. This example opens a ZIP file archive test.zip and add the file /path/to/index.txt. as newname.txt. <?php $zip = new ZipArchive; if ($zip->open('test.zip') === TRUE) { $zip->addFile('/path/to/index.txt', 'newname.txt'); $zip->close(); ..
124
Mar 13 09 03:32:39
Sekar
File Downloads script in PHP
In header() function used to download the file by using "Content-Disposition" attributes, and need to specify the type of file and charset is an optional. $filename="sekar.xml"; header('Content-type: application/xml; charset="ISO-8859-1"',true); header('Content-Disposition: attachment; filename="'.$filename.'"'); readfile($filename);
631
Mar 20 09 12:53:24
Sekar
What is different between mysql_connect and mysql_pconnection
MYSQL Connect() 1. Open a new connection 2. We can close the connection 3. Opened new connection when page loaded. MYSQL pconnect() 1. persistent connection to a MySQL server. 2. We cant close this connection. 3. No need to open new connection until host,username and password is not different.
108
Jun 18 09 08:27:52
Sekar
Get Current location/URL
The getURL() function used to get the CURRENT page location with query strings etc., the function as follows, function getURL(){ $url = 'http://'.$_SERVER['HTTP_HOST']; if($_SERVER['QUERY_STRING'] !='') $url .= $_SERVER['SCRIPT_NAME'] .'?'.$_SERVER['QUERY_STRING']; else $url .= $_SERVER['REQUEST_URI']; return $url; }
126
Jul 04 09 04:59:09
Sekar
Pause() function in PHP
we can pause the php execution while running the php process by using sleep() function. The pause() function given below, function pause($seconds){ sleep($seconds); } delays or pause the program execution for the given number of seconds. In HTML, need to use meta tags,
2676
Jul 08 09 09:51:50
Sekar
Convert date to timestamp php
<?php $indate= '2009-07-24'; cinverttimestamp($indate); function cinverttimestamp($indate){ list($year, $month, $day) = explode('-', $indate); $timestamp = mktime(0, 0, 0, $month, $day, $year); return $timestamp; } ?>
426
Jul 08 09 01:56:16
Damu
How to get monday date if the given date is friday in php
how to calculate the next day date other then the day is Saturday or Sunday $str = '2009-07-12'; echo calculate_saturdaysunday ($str); Function for getting the next date if the given date is Saturday or Sunday function calculate_saturdaysunday($curent_dates){ // SATURDAY SUNDAY CALCULATION $time_stamp = convert_timestamp($curent_..
123
Jul 08 09 02:42:48
Damu
PHP redirect
The redirect() function used to redirect the page without having errors. function redirect($url){ if (!headers_sent()){ //If headers not sent yet... then do php redirect header('Location: '.$url); exit; }else{ //If headers are sent... do java redirect...if java disabled, do html redirect. echo ''; ..
73
Jul 28 09 10:58:34
Sekar
Arrays
What are Arrays? Arrays are special variables that can hold more than one value.These are special datatypes which allows to store a group of related datas in a structured table like format. How to create an array? Arrays can be created using array function. Syntax: <?php $array_name=array() print_r($array_name); ?> code: ..
91
Jul 30 09 07:22:49
Karthika
Google Chart API
how can i show the Chart display in my web site using the Google Chart API http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Direct|SEO http://chart.apis.google.com/chart? - this is the URL to the Chart API & - separates the parameters cht=p3 - specifies the chart type chs=250x100 - specifies the dimensions of th..
89
Jul 31 09 01:51:34
Damu
PHP Cheat Sheet
I found this PHP cheat sheet at http://www.addedbytes.com/download/php-cheat-sheet-v2/pdf/ and I find it very helpful specially when you're in a hurry doing PHP programs and you want everything at your side for easy access.
54
Aug 02 09 05:56:13
Lazywriter
How can i translate my web site content to another language
In my site i need to translate the site content into some other languishes how can i do ?? <?php /******************************************************************************* ** Class: googleTranslateTool ** Purpose: Translate text using Google language tools ** Filename: googleTranslateTool.class .php ** Author: Gabriel Solomon ** ..
96
Aug 02 09 02:21:39
Damu
Stock Quoute using PHP
Hi How can we use the yahoo to show case the Particular stock value in our web sites , here i give one class to get the stock quote values from the finance.Yahoo.com <?php Class yahoostack { function get_yahoo_stock_quote($symbol){ $url = sprintf("http://finance.yahoo.com/d/quotes.csv?s=%s&f=sl1d1t1c1ohgv" ,$symbol); $fp = f..
53
Aug 03 09 01:37:01
Damu
GetState in Google API
Getting Statename by using GOOGLE api The following method to get the state name or state code by given location. $location = "Ambasamudrum ,Tirunelveli"; $address = "http://maps.google.com/maps/geo?q=" . urlencode($location) . "&output=js"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $address); curl_setopt($ch, CUR..
88
Aug 04 09 07:17:16
Sekar
Get MetaTags from the site
GetMetaTags The GetMetaTags function used to get the all the metatags from the given site or domain. function getMetaTags($domain=''){ $content =file_get_contents($domain ); $find ='/
57
Aug 04 09 07:32:06
Sekar
PDF Comparison
i have a sample pdf file in a format of a application.user will upload a pdf in sample format.system should compare sample pdf file and the user upload file.and should tell if there is any mismatch.is there any pdf parser classes available for it.should be easier to use
83
Sep 01 09 05:23:56
Pavi.pmv
Different between mysql_connect or mysql_pconnect
what is different between in mysql_connect and mysql_pconnect ?Mysql_connect opens a new connection each time a PHP page is called up, and closes the connection down again at the end of the request.Mysql_pconnect will also open a new connection when a PHP page is called up (at any rate, it will the first time after a server reboot), but it wil..
46
Sep 09 09 02:53:43
Sekar
Getclass vs instance
Difference between getclass vs instancegetclass()----------Just give the name of the class of the given object . instance()----------Get the instance of the object, so if you want to access the all functions or variable with in the class, you need to calll instace() to create a instance of the object.
57
Sep 09 09 03:04:51
Sekar
JUser and JUserTable class in Joomla
JUser and JTableUser class in JoomlaIf you want to add one or more fields in the registration, you need to add the variable in the following classesmJUserJTableUserFor JUser class, path is located at/libraries/joomla/user/user.phpFor JUserTable class, path is located at /libraries/joomla/database/table/user.php
94
Sep 15 09 07:39:37
Tech
PHP Warning: Module \'mysql\' already loaded in Unknown on line 0
PHP Warning: Module 'mysql' already loaded in Unknown on line 0 It seems like you are trying to load the mysql module twice in your extensions.ini. Take a look at /usr/local/lib/php.ini or /home/user/public_htmlphp.ini. Which is your php.ini point for your domain. You may have duplicate module entries. You are on Windows, please take a lo..
161
Sep 18 09 01:00:04
Gopal
How to create mail account from PHP script?
Email Accounts from PHP script :-The following code to you can create a email account on your server.function createEmailAC($cpuser,$cppass,$email,$epass,$equtoa='250'){ $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$euser&domain=$edomain&password=$epass"a=$equota..
233
Oct 01 09 04:13:33
Sekar
Auto_load
Many developers writing object-oriented applications create one PHP source file per-class definition. One of the biggest annoyances is having to write a long list of needed includes at the beginning of each script (one for each class). In PHP 5, this is no longer necessary. You may define an __autoload function which i..
132
Oct 08 09 07:42:51
Vickeey2003
Url validation in php
A function to validate URL (website name)I wrote the following function to validate the given url<?//url validation$url = validate_url('http://www.youropensource.com'); //is a valid URL and returns TRUE$url = validate_url('https://www.youropensource.com'); //is a valid URL and returns TRUE$url = validate_url('htt://w..
338
Nov 06 09 07:16:35
Psbharathy
Cron Jobs in PHP
Hi all i need help for cron jobs in php. The technical Issue is if we send 100 emails in php. how can we send it . we have to create cron job to send emails page if anyone know that pls send ur codes Thanks in Advance
88
Nov 23 09 12:41:34
Phpkarthic
Cron Jobs
Hi , This is karthic working as web developer . can anyone post codes for cron using php. As perviously sekar sir told the good idea .its very useful and then how to make cron job in php .i know little bit using exec command through we can do that.but i didn't idea about that.so pls post the codes related like that.Thanks in Advance .
65
Nov 24 09 11:13:21
Phpkarthic
.htaccess issue
Hi . How to use htaccess in localhost .I am using wamp server. Thanks in Advance
110
Nov 24 09 11:19:24
Phpkarthic
Htaccess seo friendly urls
Hi,How to make seo friendly urls using htaccess files .my Url : http://www.demo.com/success.php?id=2 http://www.demo.com/success/2 can anyone pls post codes..Thanks in Advance.
146
Nov 25 09 06:30:37
Phpkarthic
SMTP commands authentication
Sending mail SMTP AuthSMTP-AUTH can be used to allow users to relay mail while denying relay service to unauthorized users, such as spammers. The following commands to able sending the mail from Telnet.C:>Telnet youropensource.com 25Telnet> HELO mail.youropensource.comTelnet> Ehlo YOSTelnet> AUTH PLAIN aEbeFegHRDseYOs1245aYu=Telnet..
99
Dec 10 09 03:43:47
Sekar
Serialize() and unserialize() in php
serialize() and unserialize() :-Serialize :- This is useful for storing or passing PHP values around without losing their type and structure. For example stored the data like session data. The stored the data format like a:1:{s:5:"title";s:71:"This is simple example of the serialize and unserialize function in php";} Unserialize :- single s..
117
Dec 11 09 05:53:32
Sekar
How to let PHP to create subdomain automatically for each user
Hi, How do I create subdomain like http://user.mywebsite.com ? Do i have to access htaccess somehow? Is it actually simply possible to create it via pure php code or I need to use some external script-server side language
43
Mar 04 10 05:30:04
Phpkarthic
Mysql
How to lock the particular table in database.. Give me the executed query.
26
Mar 10 10 06:22:18
Anand78758
How to convert web application to windows applications
Hi.. I can develop project in php and mysql. I want to convert these as window application.
29
Mar 10 10 08:51:17
Anand78758
How to convert web application to windows applications
Hi.. I can develop project in php and mysql. I want to convert these as window application.
18
Mar 10 10 08:51:25
Anand78758




