FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Need help





DanielXP
ok i have this link submiter and im tryin to add this ip loger to it the code i have is

Code:
<?php

include "style.php";
$filename = 'link.txt'; // edit this

function addlink($link_name,$link_url,$by,$email) {
global $filename;
$html = "<a href='$link_url' target='blank'>$link_name</a>, posted by <a href='mailto:$email'>$by\n";
$fp = fopen($filename, 'a+');


function logIP()
{
     $ipLog="log.txt"; // Your logfiles name here (.txt or .html extensions ok)


     $register_globals = (bool) ini_get('register_gobals');
     if ($register_globals) $ip = getenv(REMOTE_ADDR);
     else $ip = $_SERVER['REMOTE_ADDR'];

     $date=date ("l dS of F Y h:i:s A");
     $log=fopen("$ipLog", "a+");

     if (preg_match("/\bhtm\b/i", $ipLog) || preg_match("/\bhtml\b/i", $ipLog))
     {
          fputs($log, "IP: $ip - Link added: $link_name <br>");
     }
     else fputs($log, "IP: $ip - Link added: $link_name \n");

     fclose($log);
}
// Place the below function call wherever you want the script to fire.
logIp();


fputs($fp, $html) or die("Could not open file!");
echo 'The link was added successfully.<br><br>';

}

function showlinks() {
global $filename;
$html = implode('<br/>',array_reverse(file($filename)));
echo $html;
}

If (!$link_url){
   print "You must enter a Link Address";
} elseif (!$link_name){
   print "You must enter a Link Name";
} elseif (!$by){
   print "You must enter your Name";
} elseif (!$email){
   print "You must enter a Email Address";
} else {
   addlink($link_name,$link_url,$by,$email);
   print "<b>Existing Links</b>:<br>";    // adds new link
   showlinks();                      // display's list of links
}


?>



It records there ip into the log.txt file but not the link name. can anyone help please?
Stubru Freak
Change logIP() to logIP($link_name) both in
Code:
function logIP()

and
Code:
logIp();
DanielXP
Just put $link_name in the () of both?
DanielXP
It comes up this error

Code:
Warning: Missing argument 1 for logip() in /home/www/scripting4habbo.com/V3/links/add.php on line 12
Stubru Freak
DanielXP wrote:
Just put $link_name in the () of both?


Yes, $link_name is never passed to the function, so the function doesn't know what $link_name contains.

DanielXP wrote:
It records both but no it comes up this error

Code:
Warning: Missing argument 1 for logip() in /home/www/scripting4habbo.com/V3/links/add.php on line 12


Did you use it in both?
DanielXP
i can't find the other bit
Related topics
can i help?
help,Bonding
HELP!!
Help me with MySQL Account Maintenance and phpBB 2.0.15 :((
help, change pass my acc in cpanel
help me upgrade php to 5.
Need help adding a domain
help add admin in phpbb forum
How to solve this problem? Thanks
Help!
Help me change port for phptriad
problam Plz help
Help!!
Google Ads help fund Spyware ?
simple php problem, please help...
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.