Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

php challenge

Original Message
Name: Jamie_McCoy
Date: October 15, 2004 at 09:44:20 Pacific
Subject: php challenge
OS: XP Pro 5.1
CPU/Ram: Pentium 4 2.4Ghz
Comment:
ok, i have a script i wrote to log visitors, however i want the script to only be processed if the following is true

$input = $_GET['send'];

if ($input == NULL || $input == "NoReffer") {i want the script in here}

if tried loads of times, but the 2nd part of the script requires the first part to be processed, otherwise errors appear. basically i need the two scrips joined together

<?php

$day = date("d M Y");


$countfile = ("todays---s/" .$day. ".txt");
if (!file_exists("$countfile")) {
$fp = fopen("$countfile", "a");
fputs($fp, "0");
fclose($fp);
}

$count = join('', file($countfile));
trim($count);
$count++;

$ip = ($_SERVER['REMOTE_ADDR']);

if ($ip == "192.168.1.2" || $ip == "192.168.1.3") {}

else {

$fp = fopen($countfile, "w");
fputs($fp, $count);
fclose($fp);

}

?>

<?php
error_reporting(0);
$countfile = "log/counter.txt";
$logfile = "log/data.htm";
if (!file_exists("$countfile")) {
$fp = fopen("$countfile", "a");
fputs($fp, "0");
fclose($fp);
}

$count = join('', file($countfile));
trim($count);
$count++;


if (!isset($_SERVER['HTTP_REFERER'])) { // Checks to see if some other website redirrected them here...
$refferer = "No Referer";
}
else { // If it Is set...
$refferer = $_SERVER['HTTP_REFERER'];
}

$hisip = ($_SERVER['REMOTE_ADDR']);
$useragent = ($_SERVER['HTTP_USER_AGENT']);

if ($hisip == "195.188.50.199") {
$hisip = "Litherland High";
}

else if ($hisip == "212.219.14.3") {
$hisip = "Southport College";
}

if ($hisip == "192.168.1.2" || $hisip == "192.168.1.3" || $hisip == "192.168.1.4")
{}


else {


$fp = fopen($countfile, "w");
fputs($fp, $count);
fclose($fp);
$fp = fopen($logfile, "a");
$date = date("d M Y");
$time = date("g:i a");
fputs($fp, "<tr><td>".$hisip."<td>".$date."<td>".$time."<td>".$count."<td>".$refferer);
fputs($fp, "\n");
fclose($fp);

}
?>

Jaymc.co.nr


Report Offensive Message For Removal


Response Number 1
Name: Jamie_McCoy
Date: October 16, 2004 at 11:04:08 Pacific
Subject: php challenge
Reply: (edit)
problem now solved, its just that i was so busy with other work i cudnt spent more than 2 mins checking for syntax errors

ive had a chance to look at it and everthings fine now :)

Jaymc.co.nr


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: php challenge

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12

help mandriva install last straw!

Icon Scaling in Explorer Bar


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC