Monthly Archives: February 2011

Different kinds of http status

In http protocols have so many status.

* 100 continue
* 101 Switching Protocols
* 200 OK
* 201 Created
* 202 Accepted
* 203 Non-Authoritative Information
* 204 No Content
* 205 Reset Content
* 206 Partial Content
* 300 Multiple Choices
* 301 Moved Permanently
* 302 Found
* 303 See Other
* 304 Not Modified
* 305 Use Proxy
* 306 Unused
* 307 Temporary Redirect
* 400 Bad Request
* 401 Unauthorized
* 402 Payment Required
* 403 Forbidden
* 404 Not Found
* 405 Method Not Allowed
* 406 Not Acceptable
* 407 Proxy Authentication Required
* 408 Request Timeout
* 409 Conflict
* 410 Gone
* 411 Length Required
* 412 Precondition Failed
* 413 Request Entity Too Large
* 414 Request-URI Too Long
* 415 Unsupported Media Type
* 416 Requested Range Not Satisfiable
* 417 Expectation Failed
* 500 Internal Server Error
* 501 Not Implemented
* 502 Bad Gateway
* 503 Service Unavailable
* 504 Gateway Timeout
* 505 HTTP Version Not Supported
* 502 Bad Gateway

PHP-Magic Quotes

Escaping troublesome characters
When you are inserting data into a MySQL database, certain characters have a special meaning and
must therefore be escaped if you wish to insert these characters literally.
By default, PHP will escape these characters for you in any data coming from the user in GET, Post
or Cookie data. This magic escaping is known as Magic Quotes and can be configured in your php.ini
file by setting the magic_quotes_gpc directive.
The characters affected are \ ‘ ” and NUL (char 0). If these characters appear in user-supplied data
they will be escaped with a \ (backslash).
Some people prefer to turn this feature off and handle escaping data manually using the addslashes()
function. There is a converse function, stripslashes(), which removes the backslash characters in an
escaped string.

PHP-file functions

rename()	Renames a given file	rename("oldname.txt","newname.txt");
unlink()	Deletes a file	unlink("file.txt");
filesize()	Returns the file size of a file	print file("file.txt");
copy()	Copys a file from location to another	copy("olddir/oldname.txt","newdir/newname.txt");

Similar Links:

Link 1

Link 2

PHP – File Read: getc Function

The fgetc() file system function in PHP will return a single character read from a file that is opened using fopen() or fsockopen().

code

<?php
$file = fopen("myfile.txt", "r");
$character = fgetc($file);
fclose($file);
echo $character;
?>
OUTPUT
H

My file contents are “Hello World”. As you can see it returned one single character from that file.

Link One

PHP – File Read: gets Function

The fgets() filesystem function in PHP will return a line from your target file handler. This function can take up to two parameters. The first parameter is your file handler. The second parameter is the character length you wish to read into the line. If no second parameter is supplied it will read until the end of the line.

Code

OUTPUT

Returns 9 character from the file