Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Top PHP Online Resources

Top PHP Online Resources

5 Top excellent PHP online resource

 http://www.php.net/
This is perhaps the most useful of the sites listed
 in this appendix, simply because this is the site
that contains up-to-date versions of not only the
 official documentation, but also the latest releases
 of PHP, including the PHP source and PHP binaries.
 If that is not enough, this site also contains an up-to-date
 listing of the major sites that use PHP, and a listing of al
l the books written on PHP. Not only does this site contain
 a plethora of resources, it also contains links to the other
 PHP sites, the latest news about all things PHP



http://www.zend.com
The Zend engine is the engine that powers PHP.
The Zend Web site is the site of the company that
 puts out the Zend engine, as well as many other
tools. For example, at this site you can also
download the Zend Optimizer, which gives your
PHP scripts a 40-100% increase in speed on average.

http://www.phpbuilder.com
The documentation on PHP is an awesome reference,
but some of the more abstract concepts of PHP can't
 be covered by a simple function reference; they need
to be explained by experts who have been there and
done that. PHPBuilder offers an impressive set of tutorials

http://www.phpwizard.net
This site contains an excellent repository of daily tips
 and tricks. In addition to the daily tips, this Web site
contains high-quality programs such as an online quiz
system and an online chat program.
ranging in level from beginner to advanced. 


http://www.devshed.com
DevShed is an excellent resource for all things open
source including Perl, Python, Jserv, Zope, and, of
course, PHP. It contains a nice repository of introductory
 PHP tutorials and an active message board. It also
has the latest PHP news posted on its site. Although
DevShed's PHP section is not as comprehensive as
 Zend's or PHPBuilder's, beginning and intermediate
 PHP programmers are sure to find something they like.













PHPINFO-Displaying information about the PHP environment

PHPINFO-Displaying information

PHPINFO-about the PHP environment


Functions that are built into PHP can be called from
any PHP script. When you call functions, you are
executing the code inside them, except the code
 is reusable and more maintainable.
Phpinfo- It returns configuration and technical information
 about your PHP installation. The function helps you
 diagnose common problems and issues.
You may find that this is one of the most helpful
places to look when checking to see whether
 you meet the requirements of a PHP script.



To call a function, write the name of the function
 followed by an opening parenthesis , the parameters, and then
a closing parenthesis , followed by a semicolon ;
. It would look like this: function_name(parameters);.
 Function names aren't case sensitive, so calling phpinfo
 is the same as calling PhpInfo.


How to Sending Data to a Database php

How to Sending Data to a Database php

Save Data to a Database by php


The process of adding information to a table is similar
 to creating the table itself in terms of which functions
 you use, but the SQL query will be different.

$Query = "INSERT into $TableName values
 ('value1', 'value2', 'value3', etc.)";
mysql_db_query ("DatabaseName", $Query,
 $Link);


The query begins with INSERT into $TableName values. Then, within the parentheses, the value for each column should be put within single quotation marks with each value separated by a comma. There must be exactly as many values listed as there are columns in the table or else the query will not work! Then the query is submitted to the MySQL using mysql_db_query().



To demonstrate this, you'll use an HTML form that takes the user's first name, last name, E-mail address, and comments. The PHP script that handles this form will put the submitted information into the database.

To enter data into a database from an HTML form:

Create a new HTML document in your text editor that will create the HTML form.

Code the standard HTML header

<HTML><HEAD><TITLE>HTMLForm
 </TITLE><BODY>

Create a form.

<FORM ACTION="HandleForm.php"
 METHOD=POST>

Code for four text inputs.

First Name <INPUT TYPE=TEXT
 NAME="Array[FirstName]"
 SIZE=20><BR>
 Last Name <INPUT TYPE=TEXT
 NAME="Array[LastName]" SIZE=40><BR>
 E-mail Address <INPUT TYPE=TEXT
 NAME="Array[Email]" SIZE=60><BR>
 Comments <TEXTAREA
 NAME="Array[Comments]" ROWS=5
 COLS=40></TEXTAREA><BR>

You can make your form more attractive than this one but be sure to make note of your input variable names, which you'll need in the HandleForm.php page.

Add the submit button, close the form, and close the HTML page.

<INPUT TYPE=SUBMIT NAME="SUBMIT"
 VALUE="Submit!"
</FORM>
</BODY>
</HTML>

Save the page as form.html and upload it to the server.

Now you will write the HandleForm.php page, which takes the data generated by the form and puts it into the database.

Create a new PHP document in your text editor.







PHP method of securely Tips

PHP method of securely website

PHP Web security tips

Passwords used within your PHP application
 should always be encrypted. If the server you
are using does not support mcrypt(), use crypt() to
encrypt the password entered during the login,
then check this against the stored encrypted password.

Cryptography is just a part of a secure solution as it can
 only be used once data has been received by the server.


 You may also need to take advantage of SSL connections
 in your Web sites. SSL, which stands for Secure Sockets Layer,
 is a method of securely transmitting information between a
 client the Web browser and the server. Utilization of SSL
connections indicated by the https://prefix in a URL is a
must for e-commerce applications. You can also specify
that cookies are sent over a SSL connection by setting the
 proper parameters when using the setcookie() function.
Check with your ISP or server administrator to see if SSL
 connections are supported on the machine you are using.

Security Resources.




There are literally dozens upon dozens of Web sites you can
 visit to keep yourself informed of pertinent security issues. The most prominent four, in my opinion, are:

Computer Response Emergency Team (http://www.cert.org)

Security Focus (http://www.security-focus.com)

Packet Storm (http://packetstorm.securify.com)

World Wide Web Consortium (http://http://www.w3.org/Security/Faq/www-security-faq.html)

There are also any number of books available ranging from those that generically discuss security to those that will assist in establish secure Windows NT or Linux Web servers.

With respect to PHP, do not forget to read the PHP manual's
section on security. Also review the security section of the
documentation for the database you are using on the server.
 Some, such as MySQL's manual, includes tips specifically
 with respect to using PHP and MySQL.









PHP File Upload Script


PHP File Uploading Code

Take a moment to commit the following list to memory—
it contains the variables that are automatically placed in the
 $_FILES superglobal after a successful file upload.
 The base of img1 comes from the name of the input
 field in the original form.

$_FILES[$img1] [tmp_name]. The value refers to the temporary file on the Web server.

$_FILES[img1] [name]. The value is the actual name of the file that was uploaded. For example, if the name of the file was me.jpg, the value of $_FILES[img1] [name] is me.jpg.

$_FILES [img1] [size]. The size of the uploaded file in bytes

$_FILES [img1] [type]. The mime type of the uploaded file, such as image/jpg

uploaded file by PHP code




The goal of this script is to take the uploaded file and copy it to the document root of the Web server and return a confirmation to the user containing values for all the variables in the preceding list.

Open a new file in your text editor and start a PHP block:

<?

Create an if…else statement that checks for a value in $_FILES[img1].

if ($_FILES[img1] != "") {

If $_FILES [img1] is not empty, execute the copy function. Use @ before the function name to suppress warnings, and use the die() function to cause the script to end and a message to display if the copy() function fails.

@copy($_FILES[img1][tmp_name], "/usr/local/bin/apache_1.3.26/
htdocs/".$_FILES[img1][name]) or die("Couldn't copy the file.");




 Note  If the document root of your Web server is not /usr/local/bin/apache_1.3.26/htdocs/ as shown in step 3, change the path to match your own system. For example, a Windows user might use /Apache/htdocs/.


Continue the else statement to handle the lack of a file for upload:

} else {
   die("No input file specified");

Close the if…else statement, then close your PHP block:

}
?>

Add this HTML:

<HTML>
<HEAD>
<TITLE>Successful File Upload</TITLE>
</HEAD>
<BODY>
<H1>Success!</H1>


Mingle HTML and PHP, printing a line that displays values for the various elements of the uploaded file (name, size, type):

<P>You sent: <? echo $_FILES[img1][name]; ?>, a <? echo
$_FILES[img1][size]; ?> byte file with a mime type of <? echo
$_FILES[img1][type]; ?>.</P>

Add some more HTML so that the document is valid:

</BODY>
</HTML>

Save the file with the name do_upload.php.

Creating a Php Script to Mail Your Form

Php Mail Script

According to the form action in simple_form.html, you
 need a script called send_simpleform.php. The goal
 of this script is to accept the text in
 $_POST[sender_name], $_POST[sender_email],
and $_POST[message] format, send an e-mail, and
 display a confirmation to the Web browser.
Open a new file in your text editor.
Begin a PHP block, then start building a message string:

PHP script to process the form, send the mail






<?
$msg = "E-MAIL SENT FROM WWW SITE\n";

Continue building the message string by adding an entry for the sender's name:

$msg .= "Sender's Name:\t$_POST[sender_name]\n";


 Note  The next few steps will continue building the message string by concatenating smaller strings to form one long message string. Concatenating is a fancy word for "smashing together." The concatenation operator (. =) is used.


Continue building the message string by adding an entry for the sender's e-mail address:

$msg .= "Sender's E-Mail:\t$_POST[sender_email]\n";

Continue building the message string by adding an entry for the message:

$msg .= "Message:\t$_POST[message]\n\n";

The final line contains two new line characters to add additional white space at the end of the string.

Create a variable to hold the recipient's e-mail address (substitute your own):

$to = "you@youremail.com";

Create a variable to hold the subject of the e-mail:

$subject = "Web Site Feedback";

Create a variable to hold additional mailheaders:

$mailheaders = "From: My Web Site <> \n";

Add to the $mailheaders variable:

$mailheaders .= "Reply-To: $_POST[sender_email]\n\n";

Add the mail() function:

mail($to, $subject, $msg, $mailheaders);

Close your PHP block:

?>

php Sessions code


Php Sessions


Sessions are used to help maintain the values of variables
across multiple web pages. This is done by creating a unique
 session ID that is sent to the client browser. The browser
 then sends the unique ID back on each page request and
 PHP uses the ID to fetch the values of all the variables
associated with this session.


The session ID is sent back and forth in a cookie or in the URL.
By default, PHP tries to use cookies, but if the browser has
disabled cookies.








PHP falls back to putting the ID in the URL. The php.ini directives that affect this are:

session.use_cookies
When on, PHP will try to use cookies

session.use_trans_sid
When on, PHP will add the ID to URLs if cookies are not used

The trans_sid code in PHP is rather interesting. It actually parses the entire HTML file and modifies/mangles every link and form to add the session ID. The url_rewriter.tags php.ini directive can change how the various elements are mangled.

Writing an application that uses sessions is not hard. You start a session using session_start( ), then register the variables you wish to associate with that session. For example:

<?php
  session_start( );
  session_register('foo');
  session_register('bar');

  $foo = "Hello";
  $bar = "World";
?>

If you put the previous example in a file named page1.php and load it in your browser, it sends you a cookie and stores the values of $foo and $bar on the server. If you then load this page2.php page:

<?php
  session_start( );
  echo "foo = $_SESSION[foo]<br />";
  echo "bar = $_SESSION[bar]<br />";
?>
You should see the values of $foo and $bar set in page1.php. Note the use of the $_SESSION superglobal. If you have register_globals on, you would be able to access these as $foo and $bar directly.

You can add complex variables such as arrays and objects to sessions as well. The one caveat with putting an object in a session is that you must load the class definition for that object before you call session_start( ).

A common error people make when using sessions is that they tend to use it as a replacement for authentication -- or sometimes as an add-on to authentication. Authenticating a user once as he first enters your site and then using a session ID to identify that user throughout the rest of the site without further authentication can lead to a lot of problems if another person is somehow able to get the session ID. There are a number of ways to get the session ID:

If you are not using SSL, session IDs may be sniffed

If you don't have proper entropy in your session IDs, they may be guessed

If you are using URL-based session IDs, they may end up in proxy logs

If you are using URL-based session IDs, they may end up bookmarked on publicly-accessible computers

All Operators Of PHP

 

All PHP Operators

 An expression is the basic building block of the language.
Anything with a value can be thought of as an expression. Examples include:

5
5+5
$a
$a==5
sqrt(9)
By combining many of these basic expressions, you can build larger, more complex expressions.

Note that the echo statement we've used in numerous examples cannot be part of a complex expression because it does not have a return value. The print statement, on the other hand, can be used as part of complex expression -- it does have a return value. In all other respects, echo and print are identical: they output data.




Expressions are combined and manipulated using operators. The following table lists the operators from highest to lowest precedence; the second column (A) shows the operators' associativity. These operators should be familiar to you if you have any C, Java, or Perl experience.

Operators
A
!, ~, ++, --, @, (the casting operators)
Right
*, /, %
Left
+, -, .
Left
<<, >>
Left
<, <=, >=, >
Nonassociative
==, !=, ===, !==
Nonassociative
&
Left
^
Left
|
Left
&&
Left
||
Left
? : (conditional operator)
Left
=, +=, -=, *=, /=, %=, ^=, .=, &=, |=, <<=, >>=
Left
AND
Left
XOR
Left
OR
Left

Variables in PHP


Variables in PHP

Variables are used for storing a values, like text strings, numbers or arrays.
When a variable is set it can be used over and over again in your script
All variables in PHP start with a $ sign symbol.
The correct way of setting a variable in PHP:



<?php
$txp = "test";
$no = 18;
?>

PHP here are  three different variable scopes:

    local
    global
    static

Variable Naming Rules

  • A variable name must start with a letter or an underscore "_"
  • A variable name can only contain alpha-numeric characters and underscores (a-Z, 0-9, and _ )
  • A variable name should not contain spaces. If a variable name is more than one word, it should be separated with underscore ($my_string), or with capitalization ($myString)






PHP Array Introduction


Function Description PHP


 Testing Array and sizeof( )
<?php
$fixture = Array( );
// $fixture is expected to be empty.

$fixture[] = "element";
// $fixture is expected to contain one element.
?>


A really simple way to check whether we are getting the results we expect is to print the result of sizeof( ) before and after adding the element

array() Creates an array 
array_change_key_case() Returns an array with all keys in lowercase or uppercase
array_chunk() Splits an array into chunks of arrays 
array_combine() Creates an array by using one array for keys and another for its values 
array_count_values() Returns an array with the number of occurrences for each value
array_diff() Compares array values, and returns the differences
array_diff_assoc() Compares array keys and values, and returns the differences 
array_diff_key() Compares array keys, and returns the differences 
array_diff_uassoc() Compares array keys and values, with an additional user-made function check, and returns the differences 
array_diff_ukey() Compares array keys, with an additional user-made function check, and returns the differences 
array_fill() Fills an array with values 
array_filter() Filters elements of an array using a user-made function 
array_flip() Exchanges all keys with their associated values in an array 
array_intersect() Compares array values, and returns the matches 
array_intersect_assoc() Compares array keys and values, and returns the matches 
array_intersect_key() Compares array keys, and returns the matches 
array_intersect_uassoc() Compares array keys and values, with an additional user-made function check, and returns the matches 
array_intersect_ukey() Compares array keys, with an additional user-made function check, and returns the matches 
array_key_exists() Checks if the specified key exists in the array 
array_keys() Returns all the keys of an array 
array_map() Sends each value of an array to a user-made function, which returns new values 4
array_merge() Merges one or more arrays into one array 
array_merge_recursive() Merges one or more arrays into one array 
array_multisort() Sorts multiple or multi-dimensional arrays 
array_pad() Inserts a specified number of items, with a specified value, to an array 
array_pop() Deletes the last element of an array 
array_product() Calculates the product of the values in an array 
array_push() Inserts one or more elements to the end of an array 
array_rand() Returns one or more random keys from an array 
array_reduce() Returns an array as a string, using a user-defined function 
array_reverse() Returns an array in the reverse order 
array_search() Searches an array for a given value and returns the key 
array_shift() Removes the first element from an array, and returns the value of the removed element 
array_slice() Returns selected parts of an array 
array_splice() Removes and replaces specified elements of an array 
array_sum() Returns the sum of the values in an array 
array_udiff() Compares array values in a user-made function and returns an array 
array_udiff_assoc() Compares array keys, and compares array values in a user-made function, and returns an array 
array_udiff_uassoc() Compares array keys and array values in user-made functions, and returns an array 
array_uintersect() Compares array values in a user-made function and returns an array 
array_uintersect_assoc() Compares array keys, and compares array values in a user-made function, and returns an array 
array_uintersect_uassoc() Compares array keys and array values in user-made functions, and returns an array 
array_unique() Removes duplicate values from an array 
array_unshift() Adds one or more elements to the beginning of an array 
array_values() Returns all the values of an array 
array_walk() Applies a user function to every member of an array 
array_walk_recursive() Applies a user function recursively to every member of an array 
arsort() Sorts an array in reverse order and maintain index association 
asort() Sorts an array and maintain index association 
compact() Create array containing variables and their values
count() Counts elements in an array, or properties in an object 
current() Returns the current element in an array 
each() Returns the current key and value pair from an array 
end() Sets the internal pointer of an array to its last element 
extract() Imports variables into the current symbol table from an array 
in_array() Checks if a specified value exists in an array
key() Fetches a key from an array
krsort() Sorts an array by key in reverse order
ksort() Sorts an array by key 
list() Assigns variables as if they were an array 
natcasesort() Sorts an array using a case insensitive "natural order" algorithm 

natsort() Sorts an array using a "natural order" algorithm 
next() Advance the internal array pointer of an array 
pos() Alias of current() 
prev() Rewinds the internal array pointer 
range() Creates an array containing a range of elements 
reset() Sets the internal pointer of an array to its first element
rsort() Sorts an array in reverse order
shuffle() Shuffles an array 
sizeof() Alias of count()
sort() Sorts an array 
uasort() Sorts an array with a user-defined function and maintain index association
uksort() Sorts an array by keys using a user-defined function
usort() Sorts an array by values using a user-defined function 

XML in PHP-SimpleXML-DOM-XMLReader


There are many ways we can work with XML in PHP, and they’re all useful in different
situations. There are three main approaches to choose from and they all have their
advantages and disadvantages:
1. SimpleXMLis the most approachable, and my personal favorite. It is easy to use
and understand, is well documented, and provides a simple interface (as the name
suggests) for getting the job done. SimpleXML does have some limitations, but it
is recommended for most applications.
2. DOM is handy when a project encounters some of the limitations in SimpleXML.
It’s more powerful and therefore more complicated to use, but there are a small
number of operations that can’t be done with SimpleXML. There are built-in func‐
tions to allow conversion between these two formats, so it’s very common to use a
combination of both in applications.
XMLReader, XMLWriter, and their sister XMLParserare lower-level ways of dealing
with XML. In general, these tools are complicated and unintuitive but they have a
major advantage: they don’t load the entire XML document into memory at once.





PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP

Working with Cookies in PHP


Cookies are key/value pairs, that are sent to the browser along with
some other information, such as which paths the cookie is valid for and when it expires.
Since PHP is designed to solve “the Web problem,” it has some great features for working
with cookies. To set a cookie, use a function helpfully called setcookie():
<?php
setcookie("visited", true);
We can use this approach to show a welcome message to a visitor when he first comes
to the site—because without any previous cookies, he won’t have the “visited” cookie
set. Once he has received one response from this server, his “visited” cookie will be seen
on future requests. In PHP, cookies that arrived with a request can be found in the
$_COOKIEsuperglobal variable. It is an array containing the keys and values of the cook‐
ies that were sent with the request.





When working with APIs, the same facilities are available to us. When PHP is a server,
the techniques of using setcookie and checking for values in $_COOKIEare all that are
needed, exactly like when we are working with a standard web application. When con‐
suming external services in PHP, it is possible to send cookie headers with our requests
in the usual way.

Php get_meta_tags-Extracts all meta tag content attributes
Reading DOC file in php
php interview questions
convert time in php
PHP Classes
in_array() function in php
keep your session secure php
What is SQL Injection?
You want to extract part of a string, starting at a particular place in the string
How we know browser properties?
Extracting Substrings
Checking Variable Values and Types
Scope Resolution Operator?
how create a new instance of an object?
how eliminate an object?
what is ob_start?
XML file using the DOM API
What is MVC?
What is CAPTCHA?
Finding the Position of a Value in an Array
difference between include and require?|
calculate the sum of values in an array ?
total number of rows?
Show unique records mysql?
MySQL Triggers
MySQL data directory?
MySQL Subqueries?|
Restore database (or database table) from backup?
Conditional Functions mysql|
function overloading?
friend function?
difference between mysql_connect and mysql_pconnect?
PHP Redirect - Redirect Script?
PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP

Free php classified script


PHP Classified Script | The best classifieds software.
Plug and Play. Our theme is plug and play and you dont need any extra plugins or other scripts to run your classified ads website. Also the installation process is .
http://phpclassifiedscript.com

Classified Script | Best PHP Classified Script
PHP Classified Script. Easy-to-use SEO friendly classifieds script which allow you to create own classified ads web site in a few clicks. Make money from a listing .
http://www.classifiedscript.org

PHP Classified Ads, best php script classifieds, software
PHP Classified Ads is a complete web system / php web software, that can be easily installed on a web hosting of your choice or provided by us to create an online ...
http://www.phpclassifiedads.com






PHP Classifieds - Classifieds ads script
PHP Classifieds is the world's most advanced classifieds script. With many unique features, including unlimited number of categories, SEO friendly pages, unlimited ...
http://php-classifieds.com


Free Classifieds Script - Open Classifieds
Open Classifieds, the best classifieds script to create a website for classifieds within few minutes. download the classifieds software and get started.
http://open-classifieds.com



Classified Script | Classified Software | PHP Script
1Classified Script Now only for 99$ The Best PHP Classified Ads Software! You are only few clicks away from starting a fully Automated Classified Script for your website.
http://www.1classifiedscript.com

PHP Classified Ad Scripts - Free, commercial and open
Huge collection of commercial and free PHP classified ads scripts to add to your site. Includes commercial, free and open source scripts with reviews.
http://www.hotscripts.com/category/scripts/php/scripts-programs/classified-ads/general

PHP Classifieds | DeltaScripts
PHP Classifieds, the original is one of the most customizable Classified ads program that exist for PHP and MySQL. It has been around since 1998 and was the first PHP .
http://www.deltascripts.com/phpclassifieds

Top PHP Tutorial website


PHP - Wikipedia, the free encyclopedia
PHP is a server-side scripting language designed for
 web development but also used as a general-purpose
programming language. As of January 2013, PHP was installed on ...
http://en.wikipedia.org/wiki/PHP



PHP 5 Tutorial - W3Schools Online Web Tutorials
PHP is a server scripting language, and a powerful
tool for making dynamic and interactive Web pages.
 PHP is a widely-used, free, and efficient alternative
http://www.w3schools.com/php/default.asp



PHP File Extension - Open .PHP Files -Info
Common PHP Filenames: index.php - Often the default
 file to be loaded when a client Web browser
requests a directory from a PHP-enabled Web server.
http://fileinfo.com/extension/php




PHP Developers Sharing Knowledge Since 1999 | PHPBuilder.com
The source for php developers with a variety of source
 codes and tutorials.
http://www.phpbuilder.com




PHP | Facebook
PHP 5.5.0 was released today! Read the changelog
 for additional details. Also, note that 5.3.x will
only receive security fixes after 5.3.27 is released.
http://www.facebook.com/PHP 


PHP For Windows:
PHP For Windows. This site is dedicated to supporting
PHP on Microsoft Windows. It also supports ports of
 PHP extensions or features.
http://windows.php.net



PHP Tutorial - Table of contentsentutorial
PHP Tutorial - Table of contents - Free tutorials
 on HTML, CSS and PHP - Build your own website
http://html.net/tutorials/php


PHP scripts - download free PHP scripts
Free PHP scripts for your website: PHP scripts that
 made this website famous! Downloaded over 1 million times!
http://www.phpjunkyard.com  
Top Google AdSense Tips-who publish AdSense ads
Top Seo Practice-key to Google success
Best ways to promote your video
Forum Marketing-seo-tips
Rewriting Keyword-Rich URLs
AdSense for Video
Micromax Canvas-wao
Management Grade Job India
Airport Authority of India -Job Opening
OnePlus One-India subcontinent
Scientist / Senior Scientist Job-NEERI
Faculty jobs-Sardarkrushinagar Dantiwada Agricultural University
Android 5.0 Lollipop-Motorola Moto G
Meizu has announced a new smartphone
Google AdSense-Enabling earn revenue
How ta Starting a Blog-Make Your Blog Work For You
How to-Proper Keyword Placement
Robots-signals the Googlebot
Earning with AdSense for Mobile
Adsense-Placing mobile ads to increase earnings

PHP Sessions - setcookie

mplement a session timeout of your own.
 Both options mentioned by others session.gc_maxlifetime
 and session.cookie_lifetime are not reliable.

session.gc_maxlifetime
session.gc_maxlifetime specifies the number
of seconds after which data will be seen as
 'garbage' and cleaned up. Garbage collection
 occurs during session start.

But the garbage collector is only started with
a probability of session.gc_probability divided
 by session.gc_divisor. And using the default
values for those options 1 and 100 respectively,
the chance is only at 1%.

Well, you could simply adjust these values
 so that the garbage collector is started
more often. But when the garbage collector
is started, it will check the validity for
every registered session. And that is cost-intensive.

Furthermore, when using PHP's default
session.save_handler files, the session data
 is stored in files in a path specified in
session.save_path. With that session handler,
 the age of the session data is calculated on
 the file's last modification date and not the
last access date

if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 1800)) {
    // last request was more than 30 minutes ago
    session_unset();     // unset $_SESSION variable for the run-time 
    session_destroy();   // destroy session data in storage
}
$_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
 
Updating the session data with every request also 
changes the session file's modification date so that the session
 is not removed by the garbage collector prematurely. 

Top PHP Interview Questions with Answers For Job


  What is PHP?

    PHP is a server side scripting language  used for web development applications.
    Php is the powerful tool for making dynamic website.
    Many open source, free and commercial scripts    and   Stuff made by php

 What is a data type?

A Data type is the classification of data into a category according to its attributes;
• Alphanumericcharacters are classified as strings
• Whole numbersare classified integers
• Numberswith decimal pointsare classified as floating points.
• True or falsevalues are classified as Boolean.
PHP is a loosely typed language;it does not have explicit defined data types.






What is a variable?

A variable is a name given to a memory location that stores data at runtime.
 The scope of a variable determines its visibility.
A global variable is accessible to all the scripts in an
application. A local variable is only accessible to the script
that it was defined in.

How to retrieve a secure URL?
To retrieve secure URLs, the cURL extension needs access to an SSL library, such as OpenSSL.
<?php
$c = curl_init('https://secure.example.com/accountbalance.php');
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
 $page = curl_exec($c); curl_close($c);
?>



Why you should use variables?

Variables help separate data from the program algorithms. The same algorithm can be used
for different input data values. For example, suppose that you are developing a calculator
program that adds up two numbers, you can create two variables that accept the numbers
then you use the variables names in the expression that does the addition.


  How to show all PHP runtime errors?
 
   Add error_reporting function set  1 .

  What is htaccess?

   .htaccess files are configuration files of Apache Server which provide
   a way to make configuration changes on a per-directory basis.

How to redirect a user to a page?

header('Location: http://www.example.com/');
The redirect URL must include the protocol and hostname.




   What is  echo in php?

    It is a keyword.
    It is used to print  data on the webpage, like that <?php echo 'test'; ?> ,
  
    How to include a file to a php page?

    Add include a file using include() or require() function with the path.


    What's the difference between include and require?

    PHP provides two constructs to load code and HTML from another module: require and include.
    They both load a file as the PHP script runs, work in conditionals and loops, and complain if
    the file being loaded can't be found. The main difference is that attempting to require a
   nonexistent file is a fatal error, while attempting to include such a file produces a warning
    but does not stop script execution.

    If the file is not found by require(), it will gives a fatal error and stop the execution of the script.
    If the file is not found by include(), it  will gives a warning , but execution will continue.

    will not get the "function re-declared" error.
   
    Differences between GET and POST methods ?
    A GET request encodes the form parameters in the URL, in what is called a query string:

    /path/to/chunkify.php?word=despicable&length=3
    A POST request passes the form parameters in the body of the HTTP request, leaving the URL untouched.
    POST requests are not idempotent. This means that they cannot be cached,
    and the server is recontacted every time the page is displayed.

    How to declare an array php?

    Example : var $arr = array('ie', 'firefox', 'safari');

    What is the use of 'print' in php?

    This is not actually a real function, It is a language construct.
    So you can use with out parentheses with its argument list.
   


    What is  in_array() function?

    The in_array( ) function returns true or false, depending on whether the first
     argument is an element in the array given as the second argument.
    in_array used to checks if a value exists in an array that Searching for Values of array.
   
    What is count() function in php ?

    The count( ) and sizeof( ) functions are identical in use and effect.
    They return the number of elements in the array.


    What’s the difference between include and require?

    It’s how they handle failures. If the file is not found by require(),
   it will cause a fatal error and halt the execution of the script. If the file is not
   found by include(), a warning will be issued, but execution will continue.


    What is the difference between Session and Cookie?

    sessions are stored on the server, and cookies are stored on the client’s computers in the text file format.
    A cookie is a bit of information that the server can give to a client.
    Every session has a data store associated with it. You can register variables to be loaded
    from the data store when each page starts and saved back to the data store when the page ends.
   

   How to set cookies in PHP?

    Setcookie("test", "sem", time()+3600);
   

    How to Retrieve a Cookie Value?
     echo $_COOKIE["test"];
   

    How to create a session? 

    Create session by  session_start();

   How to set a value in session ?

    Set value into session by  $_SESSION['test_ID']=1987654;

   How to Remove data from a session?

   Remove data from  session -> session_unset($_SESSION['test_ID'];



    How to create a mysql connection?
    call mysql_connect(servername,username,password);


    How to select a database?

    call mysql_select_db($db_name);

    How to execute an sql query? How to fetch its result ?
    $my_qry = mysql_query("SELECT * FROM `test` WHERE `test_id`='16'; ");
    $result = mysql_fetch_array($my_qry);
    echo $result['First_test_name'];


    How to get the resultset of MySQL using PHP?
        1. mysql_fetch_row
        2. mysql_fetch_array
        3. mysql_fetch_object
        4. mysql_fetch_assoc
   
       
   
    How to strip whitespace or other characters from the beginning and end of a string ?

    The trim() function removes whitespaces or other predefined characters from both sides of a string.
   
    What is the use of header() function in php ?

    The header() function sends a raw HTTP header to a client browser.
    Remember that this function must be called before sending the actual out put.
    For example, You do not print any HTML element before using this function.
   
    How to redirect a page in php?

    The following code can be add for it, header("Location:test.php");
   
    How stop the execution of a php scrip ?

    exit() function  stop the execution of a page.
   
   
    How to get the length of a string?

    strlen() function  gives  the length of a string


    How to generate random numbers in php?

    Add rand function  to generate random numbers.

    How  to varify a variable in php?

    This is_set  function is used to determine if a variable is set and is not .   

      
    What is mean by an associative array?

    Associative arrays are arrays that indexed by string keys is called associative arrays.


   
   
    How do you define a constant?

    Using define() directive, like  that define ("MYCONSTANT",765754);
   
   
    How send email using php?

    To send email using PHP, you use the mail() function.This mail() function accepts 5 parameters

    How to find current date and time?

    The date() function gives  the current date and time .
  
       
    What is the use of ksort in php?

    Its  sort an array by key in reverse order.
  
  Who is the father of PHP ?

  Rasmus Lerdorf is known as the father of PHP.     
       
    How to delete a file from the system?

    Unlink() deletes the  file from the file system.
   
    How to get the value of current session id?

    session_id() function gives the session id for the current session.


What is the difference between $name and $$name?

$name is variable where as $$name is reference variable
like $name=sonia and $$name=singh so $sonia value is singh.

  mysql_fetch_object vs  mysql_fetch_array?

mysql_fetch_object() is similar tomysql_fetch_array(), with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets numbers are illegal property names

In PHP for pdf which library used?. 

The PDF functions in PHP can create PDF files using the PDFlib library With version 6, PDFlib offers an object-oriented API for PHP 5 in addition to the function-oriented API for PHP 4. There is also the » Panda module. FPDF is a PHP class which allows to generate PDF files with pure PHP, that is to say without using the PDFlib library. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. FPDF requires no extension (except zlib to activate compression and GD for GIF support) and works with PHP4 and PHP5.
 
How  to Connecting two Strings? 
a useful concept—concatenation. It refers to the process of linking
items together. Specifically in programming, you concatenate strings.
The period . is the operator for performing this action, and it's used like so:

$tString = $String1 . $bString2;

echo $tString;





Why we use strstr?
strstr returns all of string after the first occurrence of substring .
If substring doesn't exist in string , the function returns FALSE.

How to  capitalize only the first character of a string?
you use ucfirst:
$txt = "welcome to the this site";
echo $ucfirst($txt);
 
What three components need to create a dynamic web page? 
A web server, a server-side programming language, and a database.

What does Apache use to load extensions?

Modules.

What does the PHP Interpreter do?
 It processes the HTML and PHP files.

What's a more secure function than md5() for encoding passwords? 
The sh1() function creates a 160-bit key instead of md5()'s 128-bit string. 
It also uses a superior algorithm for making it difficult to determine the 
values that generate a particular encoding.

What are the advantages of using PEAR?
 The PEAR functions are more compact, and they automate some of the manual
 work of connecting to and selecting from the database. Because PEAR code
 is used by many developers, it is less likely to have an error than to have code
 that's written from scratch.

Learn Php Code
 
PHP Functions
Php tutorial - imagemagick
php.ini Basics
PHP Sessions
Cookies Versus Sessions
PHP Web-Related Variables
PHP ERRORS
maximum size of a file uploaded
Php Image upload
php file_get_contents
MySQL Data on the Web
What are GET and POST
php and pdf
$_ENV and $_SERVER
PEAR with php
SELECTING DATA PHP
prevent hijacking with PHP
LAMP
PHP MySQL Functions
PHP Zip File Functions
Substrings PHP
PHP Variable names
PHP magic methods
How to get current session id
Add variables into a session
$_GET , $_POST,$_COOKIE
different tables present in mysql
PHP CURL
php Sessions page
PHP-sorting an array
PHP-count the elements of array
Operators for If/Else Statements
PHP file uploading code
PHP global variables
Testing working using phpinfo
PHP Code for a Valid Number
PHP-Associative Arrays
PHP mvc tutorial
PHP get_meta_tags-Extracts
difference between print and echo
PHP best tutorial-PHP variables
Reading DOC file in PHP
PHP interview questions
convert time PHP
PHP implode array elements
header function-PHP
PHP-Renaming Files Directories
PHP Classes
in_array function in PHP
keep your session secure PHP
Web Application with PHP
What is SQL Injection
PHP-extract part of a string
PHP urlencode
PHP- know browser properties
PHP- Extracting Substrings
Checking Variable Values /Types
PHP-best 20 Open Source cms
IP AddressPHP
PHP-Scope Resolution Operator
how create new instance of object
how eliminate an object
PHP- ob_start
XML file using the DOM API
PHP- MVC
PHP- CAPTCHA
PHP- Position of a Value in an Array
PHP-Mail Functions
PHP-difference include vs require
calculate the sum of values in an array
PHP-total number of rows
Show unique records mysql
MySQL Triggers
MySQL data directory
MySQL Subqueries
PHP- Networking Functions
PHP- Operators
Restore database
Conditional Functions mysql
PHP-function overloading
Friend function
mysql_connect /mysql_pconnect
PHP-Error Control Operators
what is IMAP
Apache-Specific Functions
Send Email from a PHP Script
SQL inherently
WAMP, MAMP, LAMP
Php tutorial-SYMBOLS
Table Types-MySQL
PHP-Encryption data management
PHP Array
Running MySQL on Windows
Maximum Performance MySQL
XML-RPC
PHP-static variables
Advanced Database Techniques
FTP
Codeigniter
Apache Pool Size
Why NoSQL
MySQL Server Performance
Database software
SQL Interview Answers
PHP Redirect
PHP Interview Questions with Answers
Advanced PHP