...

View Full Version : Where is the error ?!?!?!



Peuplarchie
07-01-2007, 05:44 AM
Good day to you all,
It's been couple hours that I'm working on this can somebody help me to find my how to solve my error in the following code :



$logInTracker="successLog.txt";
function success($logSuccess,$logInTracker,$loginName,$goHere)
{
$date=date ("l dS of F Y h:i:s A");
$register_globals = (bool) ini_get('register_gobals');
if ($register_globals) $ip = getenv(REMOTE_ADDR);
else $ip = $_SERVER['REMOTE_ADDR'];

// If webmaster wants to log successful logins
if($logSuccess=="1"){
$log=fopen("files/$logInTracker", "a+");


$lines=file($logInTracker);//load the lines to an array
$insert_line = 0;//the line to insert at...could be a post variable
$insert_text = "$loginName" . logged in on: $date - Logged IP address: ."$ip" ."\n";
//this could be a post variable, but at any case make sure to append the var with the new line, otherwise it will run together
$temp="";//start a temp variable to work with
$count=1;//initialize a counter


foreach($lines as $line){
($count != $insert_line) ? $temp .= $line : $temp .= $insert_text . $line;
$count++;
}



The problem come from the line 17. I' have tried many thing, maybe it's right in front of me.......

Thanks

Fumigator
07-01-2007, 05:57 AM
Perhaps you could tell us what error you are getting?

Iszak
07-01-2007, 06:09 AM
Ok from what I saw it's this line
"$insert_text = "$loginName" . logged in on: $date - Logged IP address: ."$ip" ."\n";"
I've corrected it, I also noticed that you forgot the trailing / ending bracket(s), whether it's because we're only seeing a small portion of the code, or what. So for your sanity I didn't correct that.



$logInTracker="successLog.txt";
function success($logSuccess,$logInTracker,$loginName,$goHere)
{
$date=date ("l dS of F Y h:i:s A");
$register_globals = (bool) ini_get('register_gobals');
if ($register_globals) $ip = getenv(REMOTE_ADDR);
else $ip = $_SERVER['REMOTE_ADDR'];

// If webmaster wants to log successful logins
if($logSuccess=="1"){
$log=fopen("files/$logInTracker", "a+");


$lines=file($logInTracker);//load the lines to an array
$insert_line = 0;//the line to insert at...could be a post variable
$insert_text = $loginName." logged in on: ".$date." - Logged IP address: ".$ip."\n";
//this could be a post variable, but at any case make sure to append the var with the new line, otherwise it will run together
$temp="";//start a temp variable to work with
$count=1;//initialize a counter


foreach($lines as $line){
($count != $insert_line) ? $temp .= $line : $temp .= $insert_text . $line;
$count++;
}

Peuplarchie
07-01-2007, 06:00 PM
Resolved



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum