Php file uploading code
PMA07:58
Php file uploading code
To uploading a file, two changes must be
made to the standard HTML form. First, the initial FORM line must
include the code ENCTYPE = "multipart/form-data", which lets the
HTML know to expect a file as well other data.
Second, <input name="NAME" type="FILE" /> the element is used to create the necessary field.
Another trap is the size of uploaded files.
Although you can tell the browser the maximum size of file to upload, this is only a recommendation and it cannot ensure that your script won't be handed a file of a larger size. The danger is that an attacker will try a denial of service attack by sending you several large files in one request and filling up the filesystem in which PHP stores the decoded files. The php file uploading code: <form action="" method="post"> Select Filename: <input type="file" name="adFile"> <input type="submit" value="Upload"> </form> <?php move_uploaded_file ($_FILES['adFile'] ['tmp_name'], "../uploads/{$_FILES['adFile'] ['name']}") ?>
Set the post_max_size configuration option in php.ini to the
maximum size in bytes that you want:
post_max_size = 1024768 ; one megabyte The default 10 MB is probably larger than most sites require. |
Php Code for a Valid Number
PMA07:12
Php Code for a Valid Number
Besides working on numbers, is_numeric( ) can also be applied to numeric strings.
Use is_numeric( ):
if (is_numeric('five')) { /* false */ } if (is_numeric(5)) { /* true */ } if (is_numeric('5')) { /* true */ } if (is_numeric(-5)) { /* true */ } if (is_numeric('-5')) { /* true */ }
It is often useful to determine where in the code output originates.
Helpfully, is_numeric( ) properly parses decimal numbers, however, numbers with thousands separators, such as 5,100, cause is_numeric( ) to return false.
To strip the thousands separators from your number before calling
is_numeric( ) use str_replace( ):
is_numeric(str_replace($number, ',', ''));
To check if your number is a specific type, there are a
variety of self-explanatorily named related functions:
is_bool( ) , is_float( ) (or is_double( ) or is_real( );
they're all the same), and is_int( ) (or is_integer( )
or is_long( )).
|
Magic Methods-Php
PMA11:11
Magic Methods and Constants
Magicmethods are specially named methods that
can be defi nedin any class and are executed via builtin PHP functionality. Magic methods always begin with a double underscore. In fact, the magic methods __destruct() and __construct() have already been used several times.
It is often useful to determine where in the code output originates.
This is the purpose of all of the magic constants and is particularlyuseful when writing custom logging functions. The seven magic constants are as follows:
__CLASS__ equates to the class in which the constant is referenced.
As noted earlier, this variable is always equal to the class in which it is defi ned, which is not always the class that was instantiated. For example, __CLASS__ as defi ned inside Node always returns Node even if the method is part of an object that was instantiated as a descendant class. In addition to debugging, the class constant is also useful for static callback functions.
__FILE__ is always equal to the file name where the constant is referenced.
__LINE__ is used in conjunction with __FILE__ in order to output a location in code.
|
Php HTTP Basics
PMA11:15
Php Web Application Php Email Codes Php Array Php Ifelse Php variables Php Substrings Php Mysql Functions php-sessions |
Php HTTP BasicsWhen a web browser requests a web page, it sends an HTTP requestmessage to a web server. The request message always includes some header information, and it sometimes also includes a body. The web server responds with a reply message, which always includes header information and usually contains a body. The first line of an HTTP request looks like this: GET /index.html HTTP/1.1 This line specifies an HTTP command, called a method , followed by the address of a document and the version of the HTTP protocol being used. In this case, the request is using the GET method to ask for the index.html document using HTTP 1.1. After this initial line, the request can contain optional header information that gives the server additional data about the request. For example: User-Agent: Mozilla/5.0 Windows 2000; U Opera 6.0 [en] Accept: image/gif, image/jpeg, text/*, */* The User-Agent header provides information about the web browser, while the Accept headerspecifies the MIME types that the browser accepts. After any headers, the request contains a blank line, to indicate the end of the header section. The request can also contain additional data, if that is appropriate for the method being used . If the request doesn't contain any data, it ends with a blank line. The web server receives the request, processes it, and sends a response. The first line of an HTTP response looks like this: HTTP/1.1 200 OK This line specifies the protocol version, a status code, and a description of that code. In this case, the status code is "200", meaning that the request was successful hence the description OK. After the status line, the response contains headers that give the client additional information about the response. For example: Date: Sat, 26 Jan 2002 20:25:12 GMT Server: Apache 1.3.22 Unix mod_perl/1.26 PHP/4.1.0 Content-Type: text/html Content-Length: 141 The Server header provides information about the web server software, while the Content-Type header specifies the MIME type of the data included in the response. After the headers, the response contains a blank line, followed by the requested data, if the request was successful. |
socket tcp server with php
PMA10:48
Php Web Application Php Email Codes Php Array Php Ifelse Php variables Php Substrings Php Mysql Functions php-sessions |
HTTP is the standard that allows documents to be communicated and shared over the Web. From a network perspective, HTTP is an application-layer protocol that is built on top of TCP/IP. Using our courier analogy from the previous section, HTTP is a kind of cover letter—like a fax cover sheet—that is stored in the envelope and tells the receiver what language the document is in, instructions on how to read the letter, and how to reply. Since the original version, HTTP/0.9, there have only been two revisions of the HTTP standard. HTTP/1.0 was released as RFC-1945[A] in May 1996 and HTTP/1.1 as RFC-2616 in June 1999. HTTP is simple: a client—most conspicuously a web browser—sends a request for some resource to a HTTP server, and the server sends back a response. The HTTP response carries the resource—the HTML document or image or whatever—as its payload back to the client. A simulated HTTP request using telnet % telnet www.w3.org 80 Trying 18.29.1.35... Connected to www.w3.org. Escape character is '^]'. HEAD / HTTP/1.1 HTTP/1.1 200 OK Date: Wed, 26 Sep 2001 03:42:32 GMT Server: Apache/1.3.6 (Unix) PHP/3.0.11 P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml" Cache-Control: max-age=600 Expires: Wed, 26 Sep 2001 03:52:32 GMT Last-Modified: Tue, 25 Sep 2001 21:08:00 GMT ETag: "5b42a7-4b06-3bb0f230" Accept-Ranges: bytes Content-Length: 19206 Connection: close Content-Type: text/html; charset=us-ascii Connection closed by foreign host. % |
Php session Info and cookies
PMA06:27
Php Web Application
Php Email Codes
Php Array
Php Ifelse
Php variables
Php Substrings
Php Mysql Functions
php-sessions
Php Email Codes
Php Array
Php Ifelse
Php variables
Php Substrings
Php Mysql Functions
php-sessions
Php session Info and cookies
1Cookiesare small files saved on the user’s computer2 Cookies can only be readfrom the issuing domain
3 Cookies can have an expiry time, if it is not set, then the cookie expireswhen the browseris closed
4 Sessions are like global variablesstored on the server
5 Each session is given a unique identification idthat is used to track the variables for a user.
6 Both cookies and sessionsmust be started before any HTML tagshave been sentto the browser.
Cookies are great little tools, but they get a bad rap in the press when nasty people misuse them.
These little bits of text will make your development life much easier if you use them properly.
#Set a cookie
#Extract data from a cookie
Sessions are like cookies on steroids.
Using sessions, you can maintain user-specific information without setting multiple cookies or even using a database.
Start a session
Add a variable to the $_SESSION superglobal
Enable a per-user access count
Maintain user preferences throughout multiple pages
Creating a Simple Php Functions
PMA06:00
Php Web Application
Php Email Codes
Php Array
Php Ifelse
Php variables
Php Substrings
Php Mysql Functions
php-sessions
Php Email Codes
Php Array
Php Ifelse
Php variables
Php Substrings
Php Mysql Functions
php-sessions
Creating a Simple Php Functions
As you program, you'll discover that there are certain sections of code you frequently use, either within a single script or in several. Placing these routines into a self-defined function can save you time and make your programming easier, especially as your Web sites become larger. Once you create a function, the actions of that function take place each time the function is called, just as print() will send text to the browser with each use. The syntax to create a user-defined function is: function FunctionName () { statement(s); }You can use roughly the same naming conventions for the function name as you do for variables, just without the initial dollar sign. The most important rule is to remain consistent. Second to that is the suggestion of creating meaningful function names, just as you ought to write representative variable names CreateHeader would be a better function name than Function1.
Remember not to use spaces, though, as that would constitute two separate words for the function name, which will result in error messages the underscore is a logical replacement for the space, for example Create_Header is a valid function name.
Any valid PHP code can go within the statements area of the function, including calls to other functions. There is also no limit to the number of statements a function has, but make sure each statement ends with a semi-colon.
Internet/E-commerce jobs
PMA10:20
It jobs and computing careers on totaljobs.com find permanent and part time internet
jobs and upload your cv to apply now. Guide to finding jobs online: online job search
tutorial - job the guide to finding jobs online: where and how to find jobs, from
employer websites to social media for job search and job aggregators like indeed.com.
Online jobs search results. Online jobs, part time work from home & data entry jobs
online jobs for students.com is the best place for students to find online jobs and
make money online opportunities tailored to students interviews with students.
Job-hunt.org - jobs, employers, and job search resources and jobhuntorg, free
award-winning jobs portal, one of the web s oldest and most trusted sources of
job search resources and advice.
Best jobs online is your online employment community browse latest job vacancies and
join the recruitment. What are the different types of online jobs internet business
jobs and careers: search jobs in internet business all internet business jobs updated daily.
Simply the best online jobs - ezinearticles submission compare the best job listing solutions
if you post job openings on multiple job boards then these solutions are a must for you
post job openings to multiple job. Online jobs in the philippines there are many types
of online jobs, including working as a graphic artist, a website designer,
a forum moderator, an online.
Part time jobs online, work from home, ad posting jobs, data are you convinced about
the usefulness of the internet for employers recruiting for and filling jobs you should
be you can post jobs online and get the attention of. Part time jobs online, work from
home, ad posting jobs, data learn how to make money online at home discover how teens
make money online with free resources blogging, seo, ad sense and more. Online jobs work
at home part time jobs this blog is made for your benefit and convenience to find online
jobs without any investments and how to work at home without paying fee. Online jobs ph
jobs & careers in online marketing, internet marketing, digital marketing and online
advertising.
Online marketing jobs & careers - internet marketing jobs want to know about an online
job application they are becoming the norm for employers who wants to store hundreds of
paper resumes when you can ask applicants to. Homeworkers - work from home jobs, home
based business search results. Dice.com - official site data entry jobs, offline data
entry jobs, online data entry jobs without registration fees earn $1000 per month work
from home no registration fees data entry jobs. Free online jobs disclaimer all jobs
online posted here are free and not paid advertisements philippine jobs online is not
connected in any way whatsoever to these online job posts. Internet job your work at
home telecommuting resource center find legitimate work at home jobs, information on
how to start a home based business, home based medical courses
jobs and upload your cv to apply now. Guide to finding jobs online: online job search
tutorial - job the guide to finding jobs online: where and how to find jobs, from
employer websites to social media for job search and job aggregators like indeed.com.
Online jobs search results. Online jobs, part time work from home & data entry jobs
online jobs for students.com is the best place for students to find online jobs and
make money online opportunities tailored to students interviews with students.
Job-hunt.org - jobs, employers, and job search resources and jobhuntorg, free
award-winning jobs portal, one of the web s oldest and most trusted sources of
job search resources and advice.
Best jobs online is your online employment community browse latest job vacancies and
join the recruitment. What are the different types of online jobs internet business
jobs and careers: search jobs in internet business all internet business jobs updated daily.
Simply the best online jobs - ezinearticles submission compare the best job listing solutions
if you post job openings on multiple job boards then these solutions are a must for you
post job openings to multiple job. Online jobs in the philippines there are many types
of online jobs, including working as a graphic artist, a website designer,
a forum moderator, an online.
Part time jobs online, work from home, ad posting jobs, data are you convinced about
the usefulness of the internet for employers recruiting for and filling jobs you should
be you can post jobs online and get the attention of. Part time jobs online, work from
home, ad posting jobs, data learn how to make money online at home discover how teens
make money online with free resources blogging, seo, ad sense and more. Online jobs work
at home part time jobs this blog is made for your benefit and convenience to find online
jobs without any investments and how to work at home without paying fee. Online jobs ph
jobs & careers in online marketing, internet marketing, digital marketing and online
advertising.
Online marketing jobs & careers - internet marketing jobs want to know about an online
job application they are becoming the norm for employers who wants to store hundreds of
paper resumes when you can ask applicants to. Homeworkers - work from home jobs, home
based business search results. Dice.com - official site data entry jobs, offline data
entry jobs, online data entry jobs without registration fees earn $1000 per month work
from home no registration fees data entry jobs. Free online jobs disclaimer all jobs
online posted here are free and not paid advertisements philippine jobs online is not
connected in any way whatsoever to these online job posts. Internet job your work at
home telecommuting resource center find legitimate work at home jobs, information on
how to start a home based business, home based medical courses