Nov 8, 2009

Another Simple Php Tutorial For Beginners - another easy-to-apply-and-use tutorial

free web hosting
Open Discussion > MODERATED AREA > Tutorials

Another Simple Php Tutorial For Beginners - another easy-to-apply-and-use tutorial

karlo
Another easy to use and to apply PHP tutorial.

CODE
<?php print $_SERVER['USER_AGENT']; ?>

Means to OUTPUT the visitor's browser.

CODE
<?php print $_SERVER['REMOTE_ADDR']; ?>

Means to OUTPUT the visitor's IP address.

CODE
<?php print $_SERVER['SERVER_NAME']; ?>

Means to OUTPUT the current server.

CODE
<?php print $_SERVER['DOCUMENT_ROOT']; ?>

Menas to OUTPUT the current location where the PHP script is located.

How to apply:

Create a PHP script with any file name.

CODE
<html>
<head>
<title>Sample PHP Script</title>
</head>
<body>
<div align="center" style="font-size: 11px; font-family: verdana; color: black;">
Hello! Welcome to website.com!

Your current browser is: <strong><?php print $_SERVER['USER_AGENT']; ?></strong><br>
Your IP address is: <strong><?php print $_SERVER['REMOTE_ADDR']; ?></strong><br><br>
This script is located at <strong><?php print $_SERVER['DOCUMENT_ROOT']; ?></strong> on <strong><?php print $_SERVER['SERVER_NAME']; ?></strong><br><br>
<strong>If you try to hack my site, I'll know who you are!</strong>
</div>
</body>
</html>

There. It's finish. What do you think?

 

 

 


Comment/Reply (w/o sign-up)

OpaQue
Pretty nice. Also you can simply run this code <? phpinfo(); ?> and get the output regarding the total no. of available envoirnment variables which are available for you to use.

Use those values inside $_SERVER['VARIABLE-NAME-HERE'] and impress your clients wink.gif

Comment/Reply (w/o sign-up)

beeseven
I like $_SERVER['HTTP_REFERER'] (that's not a typo--there's supposed to be only one R after the second E). Sometimes it's interesting to see, and you could also make a database of the referrers and see what site gives you the most hits.

Comment/Reply (w/o sign-up)

Roly
Dont use print, use echo. Its' faster. Only use print when you are using the "or" operator. Liek dis

<?php
fopen($file, 'w+') or print('Could not open file');
?>

Comment/Reply (w/o sign-up)

rejected
Thanks, I may use this for my 404 error, just customize it. happy.gif I don't know much about php, but I can understand that little bit. lol

Comment/Reply (w/o sign-up)

karlo
QUOTE(Roly @ Mar 1 2005, 10:27 AM)
Dont use print, use echo. Its' faster. Only use print when you are using the "or" operator. Liek dis

<?php
fopen($file, 'w+') or print('Could not open file');
?>
*


i think echo and print are the same.

Comment/Reply (w/o sign-up)



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : simple, php, beginners, easy, apply

  1. Beginners Guide To Becoming A Computer Hardware Tech
    (2)
  2. How To Create Self-unzipping Files
    for beginners (18)
    This tutorial is based on winzip 10.0 (but it should work on other versions). Create or open the
    file you would like unzipped. Now, on the Actions menu, click make .exe file. A popup box should
    popup. Click ok. Now in the popup box that appears, type in the default folder that the program
    will unzip to. Press ok. Now another popup will tell you if you want to test the file, click yes.
    Now click ok again in the box that appears. Now press unzip. If it says - files unzipped
    succsessfully! Click ok and pat your self on the back! You have created the self-zipping ....
  3. Beginner's Guide To Skiing
    Based on my own experience. (4)
    I really like skiing. It is so much fun that you won't know how you could have survived until
    your first time. So here are some things you should know before you head over to your lcoal ski
    area: Dressing: You should get a few basic things: -Base layer: long underwear, especially
    thermals, keep you warm, wick moisture from the skin, keep your legs from getting irritated by your
    ski pants -Middle layer: A fleece jacket; or anything aside from wool, which is very itchy. This
    will keep you warm in cold weather. If your outer jacket or parka (see below) is insulate....
  4. Making Interactive Cds With Flash
    My second flash tutorial for Beginners (2)
    Im back again with what i think it would be an interesting tutorial for all of you guys who wants to
    take flash out of the web and make really cool interactive CDS. First of all if all of you are
    thinking right now: "this dude is wrong for making interactive cds you have to use macromedia
    Director", well you are right macromedia director it's used to build interactive cds and dvds
    among other things, but you can also make interactive cds with Flash, the thing is: if you want to
    make a simple interactive CD you can totally do it with flash, of course Director brings ....
  5. Handy Javascript Code Snips
    Ready to Apply in your webpage (5)
    /tongue.gif' border='0' style='vertical-align:middle' alt='tongue.gif' /> Some common things to
    implement in our webpage very frequently are as follows. How to implement all these I am going to
    tell you in this tutorial. Add To Favorite Set As Homepage Go To Top Of Page No Right Click
    Print Page Adding Current Date Adding Current Time Pop-Up Page Creation Closing Window
    Copyright Notice Updation 01. Add To Favorite Someone may be interested in the content of your
    page. Offer him/her to add the page in his/her favorite menu. To do this you have ....
  6. Saint Michael Css2 Tips And Tricks Issue #1
    css tips and tricks for you beginners and experts (1)
    since my htmls tips and tricks issues are hot on the forum i decided to do some css stuff so lets
    get to work all you beginners and experts. Also note to those who read this is coming from other
    websites so i am not claming any rights to this info even though some people think if they make it,
    its theirs which is bs cuz if that were true then there would not be to many websites on the
    internet now would their?. Ok the scripting im using for right now is the the actually scripting
    on the website without external linking first css trick that is sometimes good to use is....
  7. Php For Beginners
    By Skazi (17)
    In creating a php file, you can combine HTML and PHP in one file, but you MUST save it as a .php
    file if it contains any PHP information. Remember, these tutorials are just for your learning and
    you should not just copy and paste these into notepad and call it good. You also may realize PHP is
    alot like the C++ programming language /tongue.gif' border='0' style='vertical-align:middle'
    alt='tongue.gif' /> CODE   PHP Test Hello World '; ?> What the
    Hello World '; ?> command does is it exports The information between the 's as raw....

    1. Looking for simple, php, beginners, easy, apply

Searching Video's for simple, php, beginners, easy, apply
See Also,
advertisement


Another Simple Php Tutorial For Beginners - another easy-to-apply-and-use tutorial

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com