web dictionary for beginners
These functions allow to get any tag from a website, read the contents and return an array with a) the contents b) the count of occurrences. Furthermore added: retrieve mails, get doctype, keywords, metas, link rel's, p tags, h tags, comments, inline used classes and id's, title tags, images, alt desc of images, separate internal links from external links and much more.
source: http://www.weberdev.com/get_example-4625.html
Read the rest of this entry »
<?
$page = 0;
$URL = "http://www.beginnersphp.co.uk/";
$page = @fopen($URL, "r");
print("Links at $URL<BR>\n");
print("<UL>\n");
while(!feof($page)) {
$line = fgets($page, 255);
while(eregi("HREF=\"[^\"]*\"", $line, $match)) {
print("<LI>");
print($match[0]);
print("<BR>\n");
$replace = ereg_replace("\?", "\?", $match[0]);
$line = ereg_replace($replace, "", $line);
}
}
print("</UL>\n");
fclose($page);
?>
source:http://www.weberdev.com/get_example-4254.html
1) $_SERVER['REQUEST_URI'] - It return the URL in to access the page which is executing the script. If you need to type http://www.example.com/product.php?id=5 to access the page then $_SERVER['REQUEST_URI'] returns “/product.php?id=5″.
2) $_SERVER['DOCUMENT_ROOT'] - Returns the root directory of the server which is specified in the configuration file of server. This variable usually returns the path like “/usr/yoursite/www” in Linux and “D:/xamps/xampp/htdocs” in windows.
3) $_SERVER['HTTP_HOST'] - Returns the host’s name as found in the http header. This variable usually returns the path like “example.com” when the you find “http://example.com” in browser’s address-bar and return “www.example.com” when you see http://www.example.com in the address-bar. This is quite useful when you’ve to preserve session while making online payment using PHP since session stored for “http://example.com” is not same as for the “http://www.example.com”.
4) $_SERVER['HTTP_USER_AGENT'] - Returns the user agent’s (browser) detail accessing the web page. We can use strpos($_SERVER["HTTP_USER_AGENT"],”MSIE”) to detect Microsoft Internet explorer or you can use strpos($_SERVER["HTTP_USER_AGENT"],”Firefox”) to detect firefox browser in PHP.
5) $_SERVER['PHP_SELF'] - Returns the file-name of the currently executing script. Let’s suppose that you’re accessing the URL http://www.example.com/product.php?id=5 then $_SERVER['PHP_SELF'] returns “/product.php” in your script.
6) $_SERVER['QUERY_STRING'] - Returns the query string if query string is used to access the script currently executing. Query strings are those string which is available after “?” sign.if you use $_SERVER['QUERY_STRING'] in the script executing the following URL “http://www.example.com/index.php?id=5&page=product” then it returns “id=5&page=product” in your script.
7) $_SERVER['REMOTE_ADDR'] - Returns the IP address of remote machine accessing the current page. But you can’t relie on $_SERVER['REMOTE_ADDR'] to get the real IP address of client’s machine. See this article to know how to get real IP addrees in PHP.
8 ) $_SERVER['SCRIPT_FILENAME'] - Returns the absolute path of the file which is currently executing. It returns path like “var/example.com/www/product.php” in Linux and path like “D:/xampp/xampp/htdocs/test/example.php” in windows.
source: http://roshanbh.com.np/2008/05/useful-server-variables-php.html
source: http://www.atlantavirtual.com/support/sup-doc/ssh.shtmlMoving, Copying and Deleting Files
| mv [old filename] [new filename] | Move/rename a file |
| cp [filename] [new filename] | Copies a file |
| rm [filename] | Deletes a file |
| rm * | Deletes all files in current directory |
| rm *.html | Deletes all files ending in .html |
Creating, Moving, Copying and Deleting Directories
| mkdir [directory name] | Creates a new directory |
| ls -d */ | Lists all directories within current directory |
| cp -r [directory] [new directory] | Copies a directory and all files/directories in it |
| rmdir [directory name] | Removes a directory if it is empty |
| rm -r [directory name] | Removes a directory and all files in it |
Searching Files and Directories
| find . -name [filename] -print | Searches for a file starting with current directory |
| grep [text] [filename] | Searches for text within a file |
File and Directory Permissions
There are three levels of file permissions; read, write, and execute. In addition, there are three groups to which you can assign permissions; file owner, user group, and everyone.
The command chmod followed by three numbers is used to change permissions. The first number is the permission for the owner, the second for the group and the third for everyone. Here are how the levels of permission translate:
| 0 = --- | No permission |
| 1 = --x | Execute only |
| 2 = -w- | Write only |
| 3 = -wx | Write and execute |
| 4 = r-- | Read only |
| 5 = r-x | Read and execute |
| 6 = rw- | Read and write |
| 7 = rwx | Read, write and execute |
It is preferred that the group always have permission of 0. This prevents other users on the server from browsing files via FTP. Here are the most common file permissions used:
| chmod 604 [filename] | Minimum permissions for HTML file |
| chmod 705 [directory name] | Minimum permissions for directories |
| chmod 755 [filename] | Minimum permissions for scripts & programs |
| chmod 606 [filename] | Permissions for data files used by scripts |
| chmod 703 [directory name] | Write-only permissions for public FTP uploading |
Web Siteblob is a collection of useful web development dictionary for web developers (beginner). Visitors can find information related to php, mysql, javascript, and some server configuration here.
We wish you can join as our member and start sharing your tricks with everyone.
As some of the information here is from other sites, credits will be given to these site by stating the source and adding the sites in our friend's link.
Thank you!