lolwut
29-09-2007, 09:41 AM
I've commented the code. So read the orange bits if you don't get it.
Step 1) Create a ip.txt file, leave it blank for now. It's the file that remember's the IP you are alerting.
Step 2) Create a alert.txt file, leave it blank for now. It's the file that will remember the alert.
Step 3) Create a alert.php file, use the following code.
<?php
$ip = file_get_contents("ip.txt"); // This code gets the ip.txt file and variable-ises it.
$alert = file_get_contents("alert.txt"); // This code gets the alert.txt file and variable-ises it.
if($_SERVER['REMOTE_ADDR'] == $ip){ // If the users IP IS the one specified in ip.txt, do this:
echo("
<script language=\"JavaScript\">
<!--
alert('$alert');
//-->
</script>
");// The above lines print a JavaScript alert using the text in alert.txt to the user speicified in ip.txt
}else{ // If the users IP IS NOT the one speicified in ip.txt, do this:
echo("<br />");
} // End the script.
?>
Step 4) Edit the ip.txt and alert.txt files, ip.txt to whatever you want the IP of the user you're going to alert to be. And set alert.txt to whatever you want the message the user will send.
Please note: Some hosts, mostly non-cPanel ones, do NOT support the use of the file_get_contents(); PHP function. This is for reasons I don't quite understand, but that's the way it is.
Step 1) Create a ip.txt file, leave it blank for now. It's the file that remember's the IP you are alerting.
Step 2) Create a alert.txt file, leave it blank for now. It's the file that will remember the alert.
Step 3) Create a alert.php file, use the following code.
<?php
$ip = file_get_contents("ip.txt"); // This code gets the ip.txt file and variable-ises it.
$alert = file_get_contents("alert.txt"); // This code gets the alert.txt file and variable-ises it.
if($_SERVER['REMOTE_ADDR'] == $ip){ // If the users IP IS the one specified in ip.txt, do this:
echo("
<script language=\"JavaScript\">
<!--
alert('$alert');
//-->
</script>
");// The above lines print a JavaScript alert using the text in alert.txt to the user speicified in ip.txt
}else{ // If the users IP IS NOT the one speicified in ip.txt, do this:
echo("<br />");
} // End the script.
?>
Step 4) Edit the ip.txt and alert.txt files, ip.txt to whatever you want the IP of the user you're going to alert to be. And set alert.txt to whatever you want the message the user will send.
Please note: Some hosts, mostly non-cPanel ones, do NOT support the use of the file_get_contents(); PHP function. This is for reasons I don't quite understand, but that's the way it is.