Let us do something more useful now. We are going to check what sort of browser the visitor is using. For that, we check the user agent string the browser sends as part of the HTTP request. This information is stored in a variable. Variables always start with a dollar-sign in PHP. The variable we are interested in right now is $_SERVER['HTTP_USER_AGENT'].
Note: $_SERVER is a special reserved PHP variable that contains all web server information. It is known as a superglobal. See the related manual page on superglobals for more information. These special variables were introduced in PHP » 4.1.0. Before this time, we used the older $HTTP_*_VARS arrays instead, such as $HTTP_SERVER_VARS. Although deprecated, these older variables still exist. (See also the note on old code.)
<?phpecho $_SERVER['HTTP_USER_AGENT'];?>
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) <?phpif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {
echo 'You are using Internet Explorer.<br />';
}?> You are using Internet Explorer.<br />
<?phpif (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) {?><h3>strpos() must have returned non-false</h3>
<p>You are using Internet Explorer</p>
<?php} else {?><h3>strpos() must have returned false</h3>
<p>You are not using Internet Explorer</p>
<?php}?> <h3>strpos() must have returned non-false</h3>
<p>You are using Internet Explorer</p>
php may be you don't know yet
php syntax
PHP is stand for PHP Hypertext Preprocessor. It is a recursive acronym; the first "P" stands for "PHP," and the first "P" of that stands for "PHP" as well, thus the cycle continues. PHP is a widely used. PHP is general-purpose scripting language. It was originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document.
PHP code is processed by an interpreter application in command-line mode performing desired operating system operations and producing program output on its standard output channel, cause it is a general-purpose programming language. It may also function as a graphical application. PHP is available as a processor for most modern web servers and as standalone interpreter on most operating systems and computing platforms.
PHP can be edited by standart text editor. But you need another server in order to connect it. You can try appserv. It's easy one, and portable. You can edit your php everywhere, whenever you need it, as long as you bring your appserv with you.
PHP document start with <?php and ended with ?> . Every PHP command ended with ;. we use <?php as start because it's available in all browser. some time may be you'll find <?, but it's not recomended. When PHP parses a file, it looks for opening and closing tags, which tell PHP to start and stop interpreting the code between them. Parsing in this manner allows PHP to be embedded in all sorts of different documents, as everything outside of a pair of opening and closing tags is ignored by the PHP parser. Most of the time you will see PHP embedded in HTML documents.
A simple example.
<?php
echo 'hallo';
?>
You will see hallo in your browser if succed
php introduction
PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more.
There are three main areas where PHP scripts are used.
* Server-side scripting. This is the most traditional and main target field for PHP. You need three things to make this work. The PHP parser (CGI or server module), a web server and a web browser. You need to run the web server, with a connected PHP installation. You can access the PHP program output with a web browser, viewing the PHP page through the server. All these can run on your home machine if you are just experimenting with PHP programming. See the installation instructions section for more information.
* Command line scripting. You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks. See the section about Command line usage of PHP for more information.
* Writing desktop applications. PHP is probably not the very best language to create a desktop application with a graphical user interface, but if you know PHP very well, and would like to use some advanced PHP features in your client-side applications you can also use PHP-GTK to write such programs. You also have the ability to write cross-platform applications this way. PHP-GTK is an extension to PHP, not available in the main distribution. If you are interested in PHP-GTK, visit » its own website.
PHP can be used on all major operating systems, including Linux, many Unix variants (including HP-UX, Solaris and OpenBSD), Microsoft Windows, Mac OS X, RISC OS, and probably others. PHP has also support for most of the web servers today. This includes Apache, Microsoft Internet Information Server, Personal Web Server, Netscape and iPlanet servers, Oreilly Website Pro server, Caudium, Xitami, OmniHTTPd, and many others. For the majority of the servers, PHP has a module, for the others supporting the CGI standard, PHP can work as a CGI processor.
PHP allows you to have the freedom of choosing an operating system and a web server. Furthermore, you also have the choice of using procedural programming or object oriented programming, or a mixture of them. Although not every standard OOP feature is implemented in PHP 4, many code libraries and large applications (including the PEAR library) are written only using OOP code. PHP 5 fixes the OOP related weaknesses of PHP 4, and introduces a complete object model.
PHP's abilities includes outputting images, PDF files and even Flash movies (using libswf and Ming) generated on the fly. You can also output easily any text, such as XHTML and any other XML file. PHP can autogenerate these files, and save them in the file system, instead of printing it out, forming a server-side cache for your dynamic content. With PHP you are not limited to output HTML.
PHP has One of the strongest and most significant features. PHP supports for a wide range of databases. Writing a database-enabled web page is incredibly simple. The following databases are currently supported:
* Adabas D
* dBase
* Empress
* FilePro (read-only)
* Hyperwave
* IBM DB2
* Informix
* Ingres
* InterBase
* FrontBase
* mSQL
* Direct MS-SQL
* MySQL
* ODBC
* Oracle (OCI7 and OCI8)
* Ovrimos
* PostgreSQL
* SQLite
* Solid
* Sybase
* Velocis
* Unix dbm
PHP supports ODBC, the Open Database Connection standard, so you can connect to any other database supporting this world standard. We also have a database abstraction extension (named PDO) allowing you to transparently use any database supported by that extension. Additionally
PHP also has support for talking to other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) and countless others. You can also open raw network sockets and interact using any other protocol. PHP has support for the WDDX complex data exchange between virtually all Web programming languages. Talking about interconnection, PHP has support for instantiation of Java objects and using them transparently as PHP objects. You can also use our CORBA extension to access remote objects.
PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents. For parsing and accessing XML documents, PHP 4 supports the SAX and DOM standards, and you can also use the XSLT extension to transform XML documents. PHP 5 standardizes all the XML extensions on the solid base of libxml2 and extends the feature set adding SimpleXML and XMLReader support.
PHP has many other interesting extensions, the mnoGoSearch search engine functions, the IRC Gateway functions, many compression utilities (gzip, bz2, zip), calendar conversion, translation...
emoticon on yahoo
Emoticon on Yahoo massanger
Surprise your friends with these hidden characters.
You will not find these characters emoticons in the menu, but you can still send them by typing the shortcut character code directly into your message.
: O3 puppy
: -? I do not know
% - ( do not listen
: @) pig
3:-O cow
: (|) monkey
~:> chicken
@); - rose
%% - leaf
**== flag
(~ ~) squash
~ O) coffee
*-:) bright idea
8-X skull
=:) insect
> -) alien
:-L frustrating
[-O < pray
$ -) mercenary
: - " whistle
b-( black-and-blue
:)> - peace
[-X can not
\: D / dance
>: / who fear
;)) hi .. hi .. hi
: - @ fussy
^:) ^ salute
:-J oh aja
(*) star
o-> hiro
o => billy
o-+ April
(%) yin
: Bz bee
[..] Transformer *
emoticon for email
HAPPY, SMILING, LAUGHING
:-) smiling; agreeing
:-D laughing
|-) hee hee
|-D ho ho
:-> hey hey
;-) so happy, I'm crying
:'-) crying with joy
\~/ full glass; my glass is full
TEASING, MISCHIEVOUS
;-) winking; just kidding
'-) winking; just kidding
;-> devilish wink
:*) clowning
:-T keeping a straight face
AFFIRMING, SUPPORTING
:^D "Great! I like it!"
8-] "Wow, maaan"
:-o "Wow!"
^5 high five
^ thumbs up
:] Gleep, a friendly midget who wants
to befriend you
(::()::) bandaid; offering help or support
UNHAPPY, SAD
:-( frowning; boo hoo
:( sad
:-< really sad
:-c really unhappy
:-C really bummed
&-| tearful
:' crying
:'-( crying and really sad
:-| grim
:[ really down
:-[ pouting
\_/ "my glass is empty"
ANGRY, SARCASTIC
>:-< angry
:-|| angry
:-@ screaming
:-V shouting
:-r sticking tongue out
>:-< absolutely livid!!
:-, smirk
:-P nyahhhh!
:-> bitingly sarcastic
TRYING TO COMMUNICATE
:-& tonguetied
:-S incoherent
:-\ undecided
:- I "hmmm..."
:-, "hmmm "
:-# "My lips are sealed"
:-X "My lips are sealed"
:-Y a quiet aside
:-" pursing lips
:-W speaking with forked tongue
:( ) can't stop talking
FEELING STUPID OR TIRED
:~/ mixed up
%-) braindead
(:I egghead
<:-I dunce
=:-) hosehead
:-] smiling blockhead
:-[ un-smiling blockhead
|-O yawning
|-I asleep
:-6 exhausted; wipeout
SURPRISED, INCREDULOUS, SKEPTICAL
:> What?
:@ What?
:Q What?
:-o "uhh oh!" OR surprise
;-) sardonic incredulity
:O shocked
8-| eyes wide with surprise
:-/ skeptical
8-O "Omigod!!"
:-C just totally unbelieving
|-{ "Good Grief!" (Charlie Brown)HUGS AND KISSES
: * kisses
:-X a big wet kiss!
:-x kiss kiss
:-{} blowing a kiss
[] hugs
(( )):** hugs and kisses
((((name)))) hug
MISCELLANEOUS
:-* Oops!
:-I indifferent
\-o bored
:-P tongue hanging out in anticipation
O :-) angelic; being an angel (at heart, at least)
NEW EMOTICONS (by Tracy Marks):
][ feeling separate
] [ separating
) ( really separating
{ } face-to-face
[ ] wanting to hug
}xx kisses
() feeling in harmony; connecting
] ? moving away and wondering about you?
[ ? moving toward you and wondering about you?
link
A link is the "address" to a document (or a resource) on the web.
Hyperlinks, Anchors, and Links
In web terms, a hyperlink is a reference (an address) to a resource on the web. Hyperlinks can point to any resource on the web: an HTML page, an image, a sound file, a movie, etc. An anchor is a term used to define a hyperlink destination inside a document.The HTML anchor element <a>, is used to define both hyperlinks and anchors.
We will use the term HTML link when the <a> element points to a resource, and the term HTML anchor when the <a> elements defines an address inside a document.
An HTML Link
Link syntax:<a href="url">Link text</a>
The start tag contains attributes about the link. The element content (Link text) defines the part to be displayed.
Note: The element content doesn't have to be text. You can link from an image or any other HTML element.
The href Attribute
The href attribute defines the link "address".This example defines a link to http://mhabibie.blodspot.com:
<a href="http://mhabibie.blogspot.com/">Visit Habibie's blog!</a> The code above will display like this in a browser:
Visit Habibie's blog!
The target Attribute
The target attribute defines where the linked document will be opened. The code below will open the document in a new browser window:example:
<a href="http://mhabibie.blogspot.com/" target="_blank">Visit Habibie's blog!</a>
The name Attribute
When the name attribute is used, the <a> element defines a named anchor inside a HTML document.Named anchor are not displayed in any special way. They are invisible to the reader.
Named anchor syntax:
<a name="label">Any content</a> The link syntax to a named anchor:
<a href="#label">Any content</a> The # in the href attribute defines a link to a named anchor.
Basic Notes - Useful Tips
Always add a trailing slash to subfolder references. If you link like this: href="http://mhabibie.blogspot.com/html", you will generate two HTTP requests to the server, because the server will add a slash to the address and create a new request like this: href="http://mhabibie.blogspot.com/html/"Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.
If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs. Read More..
HTML format and style
Big strong small del insert
These are part of formating tag that use in html.
You use <i> for italic. <b> for bold. <big> big. <small> for small. <sub> for subscript like H2O. <sup> for superscript like x2 + y2.
You can use <style> to modify you document. example
<p style="font-family:verdana;color:red">
This text is in Verdana and red</p>
html tutorial basic
What is HTML?
HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language. HTML is not a programming language, it is a markup language. A markup language is a set of markup tags. HTML uses markup tags to describe web pages.
HTML markup tags are usually called HTML tags
HTML tags are keywords surrounded by angle brackets like <html>
HTML tags normally come in pairs like <b> and </b>
The first tag in a pair is the start tag, the second tag is the end tag
Start and end tags are also called opening tags and closing tags.
example:
<html>
<head>
<title>Title of your document</title>
</head>
<body>
Your content is here
</body>
<html>
The text between <html> and </html> describes the web page.
The text between <head> and </head> is your web description head.
The text between and is the visible page content
<>
HTML uses tags like <b>, <u> and <i> for formatting output, like bold, italic text or underline text.
These HTML tags are called formatting tags.
For formatting your web, you should be better using CSS to format your web. we'll study about CSS in next time.