PHP Tutorial

Messages
341
Reaction score
0
Points
0
Here Is My PHP Totoural


Code:
<Limit GET>
order deny,allow
deny from 0.0.0.0
</Limit>

This needs to be in a .htaccess file.





Here is PHP sendmail code

PHP:
<?php
$from='you@yourdomain.com';
$to='you@yourdomain.com';
$headers="From: $from\n";
$headers.="Reply-to: $from\n";
mail($to,'Subject','Body',$headers);

?>

I created a script that sends a email to the emails I secify when I go to that page. Very handy for notifycation of member signups.







Here is some PHP code that works well together. This code will modify a TXT file and show it on a PHP page

This Modifys a TXT file. Change filename.txt in 3 places
PHP:
  <? 
if($_POST['Submit']){ 
$open = fopen("filename.txt","w+"); 
$text = $_POST['update']; 
fwrite($open, $text); 
fclose($open); 
echo "Update Sucessful. Use The Back Button To Go Back.     Updated Text: ";  
echo ""; 
$file = file("filename.txt"); 
foreach($file as $text) { 
echo $text."<br />"; 
} 
}else{ 
$file = file("filename.txt"); 
echo "<form action=\"".$PHP_SELF."\" method=\"post\">"; 
echo "<textarea Name=\"update\" cols=\"50\" rows=\"10\">"; 
foreach($file as $text) { 
echo $text; 
}  
echo "</textarea>"; 
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n 
</form>"; 
} 
?>


This reads a file

PHP:
  <?
readfile("filename.txt");
?>





This PHP code will get a users IP and turn it into a varible called $REMOTE_ADDR

PHP:
<? 
$domain = GetHostByName($REMOTE_ADDR); 
?>



If This Toutorial Helped You Please Donate A Few Credits, Click The
reputation.gif
Or Rate It
 
Last edited:

cyberxzt

Zine Tech
Messages
798
Reaction score
0
Points
0
Re: PHP And .Htaccess Tutorial

NOTE: Remove the Error Document information, or this thread will be deleted.
 

cyberxzt

Zine Tech
Messages
798
Reaction score
0
Points
0
Yah, i found out yesterday that "Free" members arent allowed to have custom error messages.
 

cyberxzt

Zine Tech
Messages
798
Reaction score
0
Points
0
I.D.K. lol, its also not in the T.O.S. (or at least wasnt the last time i read it) but idk.
 

cyberxzt

Zine Tech
Messages
798
Reaction score
0
Points
0
o_O normally I have snappy remarks for alot of questions, i just dont have a snappy remark for this question though, so ill just tell you, lol

"IDK" = "I dont know"
 

Sohail

Active Member
Messages
3,055
Reaction score
0
Points
36
Can't you do it using .htaccess?
Just add the following line to the document :-

ErrorDocument 404 /errorpages/errorpage404.html

Where to slash refers to the directory and error document on the server.

Someone try this out because it should work...
 
Top