Jump to content

PHP Scripts


Blackwar

Recommended Posts


Hey,

i wrote a php script so that you will be able to see your ip, host and browser information in one place if ever needed.. I know it soudns kind of silly, but no kidding, there are times you need to check what your browser is identifying as etc etc...

ANY VISIT TO B.I.R.S is NOT logged in any way, no ips, browsers or hosts, basically nothing

**You can visit BIRS here : http://www.timdorr.com/~blackwar/birs.php **

And here is the PHP source code if anyone is interested :

<?php
$date  = date("Y-F-l - H:i:s");
$host = gethostbyaddr("$REMOTE_ADDR");
$dns = gethostbyname ($host);
$browser = $_SERVER["HTTP_USER_AGENT"];
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Blackwar's Info Revealing Services ( - BIRS - )</title>
</head>

<body background="/~blackwar/aimg/lines.gif">
<font size="7" face="Impact" color="#FFFFFF"> - BIRS - </font>
<br><br><br>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
 <tr>
   <td width="50%" bgcolor="#808080"><b> YOUR HOST :</b></td>
   <td width="50%" bgcolor="#C0C0C0" align="center"><? echo $host ?></td>
 </tr>
 <tr>
   <td width="50%" bgcolor="#808080"><b> YOUR IP ADDRESS : </b></td>
   <td width="50%" bgcolor="#C0C0C0" align="center"><? echo $dns ?></td>
 </tr>
 <tr>
   <td width="50%" bgcolor="#808080"><b>YOUR BROWSER : </b></td>
   <td width="50%" bgcolor="#C0C0C0" align="center"><? echo $browser ?></td>
 </tr>
 <tr>
   <td width="50%" bgcolor="#808080"><b> DATE : </b></td>
   <td width="50%" bgcolor="#C0C0C0" align="center"><? echo $date ?></td>
 </tr>

</table>

</body>

</html>

</body>

Blackwar :)

Link to comment
Share on other sites

Hey,

i just wrote a small script that allows you to log access to your site ( as long as main page is php-based)

here is a screenshot of how it logs the ips : http://blackwar2.netfirms.com/iplogger.jpg

If you just want the php script:

the code is ,

<?php
$date  = date("F d , l , Y - H:i:s");
$fp = fopen("D:/localhost/log/ip.txt", "a+");
$host = gethostbyaddr("$REMOTE_ADDR");
$dns = gethostbyname ($host);
$log = "At $date , \n \n * Host: $host , \n \n * IP: $dns ,\n \n * Browser: $HTTP_USER_AGENT";
@fwrite($fp, "$log \n\n ----------------------------------------------------------------------------------- \n\n");
@fclose($fp);
?>

change the $fp = fopen("D:/localhost/log/ip.txt", "a+"); value to the exact path of your text file.

If you just want to restrict access to everyone, like i do on my local server, and tell them that their ip is logged, and to log their ip, use this code :

<?php
$date  = date("F d , l , Y - H:i:s");
$fp = fopen("D:/localhost/log/ip.txt", "a+");
$host = gethostbyaddr("$REMOTE_ADDR");
$dns = gethostbyname ($host);
$log = "At $date , \n \n * Host: $host , \n \n * IP: $dns ,\n \n * Browser: $HTTP_USER_AGENT";
@fwrite($fp, "$log \n\n ----------------------------------------------------------------------------------- \n\n");
@fclose($fp);
?>
<html>
<head>
<title>Blackwar's private server</title>
</head>
<body>
<font face="Verdana"><i>Your IP has been logged,
<br>
<br>
If you get out now, no action will be taken against you. This is a private server and you are not allowed in here.
<br>
<br>
<p align="right"> --Blackwar</p>
</i>
</font>
</body>
</html>

change the $fp = fopen("D:/localhost/log/ip.txt", "a+"); value to the exact path of your text file. Also edit the other html values as you want which are currently set as my example to show you where to put what :)

Enjoy,

Blackwar

Link to comment
Share on other sites

this is a small php script that reads the output file created by ClearInfo and creates a page with that info... This script assumes that the following code is in a php file that is in the same folder as the output file created by clearinfo and the output file name is "stats.php" (i know, a little confusing, but if you have any questions, please ask :rolleyes:

<?php
$root = './';
include ($root . 'stats.php');
?>
<html>
<head>
<title>System Stats</title>
</head>
<body>
<center>
<font size="7"><span style="text-decoration: overline"><u>System Stats</font></span></u><br><br>
[ <b>Processor</b> ] : <? echo $processor ?><br><br>
[ <b>CPU Class</b> ] : <? echo $cpuclass ?><br><br>
[ <b>CPU Usage</b> ] : <? echo $currentusage ?>%<br><br>
[ <b>Windows Version</b> ] : <? echo $winver ?><br><br>
[ <b>Memory Used</b> ] : <? echo $memused ?><br><br>
[ <b>Virtual Memory Used</b> ] : <? echo $virmemused ?><br><br>
[ <b>Screen Resolution</b> ] : <? echo $screen ?><br><br>
[ <b>Current Song Playing</b> ] : <? echo $curplaying ?><br><br>
[ <b>Temperature 1</b> ] : <? echo $temp1 ?><br><br>
[ <b>Temperature 2</b> ] : <? echo $temp2 ?><br><br>
[ <b>Temperature 3</b> ] : <? echo $temp3 ?><br><br>
[ <b>Clear Info Version</b> ] : Clearinfo <? echo $clearinfo ?>
</center>
</body>
</html>

Blackwar :)

Link to comment
Share on other sites

I'm thinking of learning PHP over my 4 month summer break, how long does it take to get a basic/intermediate understanding of it? And where's the best place to start learning? http://www.php.net/manual/ ?

yup, you hit it spot on :rolleyes:

i just read the functions i needed to create the files i need, then over time, i learned almost all of them and i dont need to look so often..

I don't know so much yet, just at the basic level tho.. But i'll tell ya, that is the best source you can find.. I've learned everything i did so far from there...

Good luck :)

Blackwar

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...