PDA

View Full Version : || PHP - Very Basic ||



Dan Williamson
19-11-2005, 11:00 PM
Ok firstly i'm not a PHP expert, i'm just writing down a few codes i know that may help you in somepoints of your websites.




<?php
echo "Hello Habbox!";
?>



The echo bit is what will show in your browser.




<?php
if( $lang == 1 )
{
echo "Hello Habbox!";
}
?>



Well know were using a Variable we can tell this by the $ so it's more a less the same.

IP Addresses.




<?
$log_file = "ipsthathavebeenlogged.txt"; // This is the files the IPs are logged in.
$ip = getenv(\'REMOTE_ADDR\');
$fp = fopen("$log_file", "a");
fputs($fp, "$iprn");
flock($fp, 3);
fclose($fp);
PRINT("your IP has been logged.....$ip");
// "your IP has been logged....." .
?>




Firstly we create a .txt file named whatever name you want

Then add this code in notepad and add it to your page then you need to change




$log_file = "ipsthathavebeenlogged.txt"; //



bit to what your IP's files going to be.

Don't forget to CHMOD your text file to 666

With me so far? Hope so.

PHP Includes



<?
include ('phppage.php');
?>


As i say just basic PHP codes that i've used some times, i'll put more PHP tutorials on here as i get more knowledge.

- Dan

Splinter
20-11-2005, 01:56 PM
cool although
<?php
if( $lang == 1 )
{
echo "Hello Habbox!";
}
?> would only show in your browser if you set the variable $lang to 1 or in the url put index.php?lang=1 etc..

Dan Williamson
20-11-2005, 05:59 PM
Yeah, i forgot to mention that "/

- Dan

Want to hide these adverts? Register an account for free!