referer

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
Montana
Registered User
Posts: 93
Joined: Sun Jun 20, 2004 7:43 pm
Contact:

referer

Post by Montana »

i have made a mod to my site
its lists all the urls where the users are comming from
example if you press a link to my site from here
the page you visit
your isp info
your (if you have on) nickname or else ANONYMOUS
and the url you are from

i have put in all the php files

after
init_userprefs($userdata);

include($phpbb_root_path . 'referer.'.$phpEx);
to get the nickname

now this is the file thats show the list:

Code: Select all

<?php
/***************************************************************************
*     begin                : Thu Oct 30, 2003
*     copyright            : (C) 2003 Pokemaster
*     email                : aaronboffin@hotmail.com
*
****************************************************************************/
define('IN_PHPBB', 1);
//
// First we do the setmodules stuff for the admin cp.
//
if( !empty($setmodules) )
{
	$filename = basename(__FILE__);
	$module['Infos']['Referer'] = $filename;
	return;
}
//
// Load default header
//
$no_page_header = TRUE;
$phpbb_root_path = './../';
require($phpbb_root_path . 'extension.inc');
require('./pagestart.' . $phpEx);
//
// Output the authorisation details
//
$sql = "SELECT datum, url, pagina, ip, host, nick
	FROM " . phpbb_referer . "
	ORDER BY referer_id";
if( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not query referer', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
	$i = 0;
	do
	{
	$template->assign_block_vars('refererrow', array(
        'pagina' => $row['pagina'], 
        'url' => $row['url'],
        'url2' => substr($row['url'],0,35) .'...',
        'datum' => create_date("m/d/Y - h:i:s", $row['datum'], $board_config['board_timezone']),
        'ip' => $row['ip'],
        'nick' => $row['nick'],
        'host' => $row['host'])
	);
      $i++;
      }
	while ( $row = $db->sql_fetchrow($result) );
	$db->sql_freeresult($result);
      }
        $sql = "SELECT * FROM phpbb_referer ORDER BY url DESC";
        $result = $db->sql_query( $sql );
        if ( !$result )
        {
            message_die(GENERAL_ERROR, "Could not query referer logs.", "",__LINE__, __FILE__, $sql);
        }
     $aantalcu = 0;
     $aantalphpbbnl = 0;
     $aantalsl = 0;
     $urls = 0;
     while( $row = $db->sql_fetchrow($result) )
     {
         $referer_rowset[] = $row;
         $urls++;
     }
     $db->sql_freeresult($result);
	$aantal = 0; 
	for($i = 0; $i < $urls; $i++) 
	 { 
	 if (eregi("chat-united", $referer_rowset[$i]['url'])) 
	  { 
	   $aantalcu++;
	  } 
	 if (eregi("phpbb.nl", $referer_rowset[$i]['url'])) 
	  { 
	   $aantalphpbbnl++;
	  } 
	 if (eregi("slangenforum.com", $referer_rowset[$i]['url'])) 
	  { 
	   $aantalsl++;
	  }
	 if (eregi("msn", $referer_rowset[$i]['url'])) 
	  { 
	   $aantalmsn++;
	  }
	 if (eregi("google", $referer_rowset[$i]['url'])) 
	  { 
	   $aantalgoogle++;
	  } 
	 if (eregi("hagedissenforum", $referer_rowset[$i]['url'])) 
	  { 
	   $aantalhdf++;
	  } 
	 }
	$template->assign_vars(array(
       'L_datum' => $lang['L_datum'],
       'L_url' => $lang['L_url'],
       'L_referer' => $lang['website'],
       'L_aantal' => $lang['aantal'],
       'aantalcu' => $aantalcu,
       'aantalphpbbnl' => $aantalphpbbnl,
       'aantalsl' => $aantalsl,
       'aantalmsn' => $aantalmsn,
       'aantalgoogle' => $aantalgoogle,
       'aantalhdf' => $aantalhdf,
       'L_iphost' => $lang['L_iphost'],
       'L_pagina' => $lang['L_pagina'],
       'L_REF_TITLE' => $lang['ref_title'],
       'L_REF_EXPLAIN' => $lang['ref_explain'])
);
$template->set_filenames(array(
	'body' => 'admin/admin_ref.tpl'
	)
);
include('./page_header_admin.'.$phpEx);
$template->pparse('body');
include('./page_footer_admin.'.$phpEx);
?>
but becous i am a beginner with php i have 1 problem

how can i make this so when i press a button it clears all the entry`s in mysql ? :roll:

tnx :)
Sorry for my bad english :?
montanas-corner
Montana
Registered User
Posts: 93
Joined: Sun Jun 20, 2004 7:43 pm
Contact:

Post by Montana »

is there noone with an idea for this ? :roll:

all i want to know is some thing like this:

when button is presed {
delete stuff(i can do this my self i hope :P )
}

i am really stuck whit this :?
it could by go to another file
but i would like it to have it in the same file :roll:
Sorry for my bad english :?
montanas-corner
agent00shoe
Registered User
Posts: 373
Joined: Sat Feb 12, 2005 9:39 pm

Post by agent00shoe »

Do you mean a query like "DELETE * FROM phpbb_referer"? That would clear the whole table.
Montana
Registered User
Posts: 93
Joined: Sun Jun 20, 2004 7:43 pm
Contact:

Post by Montana »

no thats not the problem
i would like to know how the file knows when to use the code to delete the entry`s
Sorry for my bad english :?
montanas-corner
TNW
Registered User
Posts: 53
Joined: Sat Aug 27, 2005 11:37 pm
Location: IN
Contact:

Post by TNW »

I believe u create an if function and an sql variable in your config table so if u visit the file it goes through the if and if your variable in sql ispast the date of what your other variable is it will clean sweap it
Hmmm I understand how to do it jsut hard to explain

Code: Select all

if ( date ("m/d/Y") < $duedate )
  {
     Select * 
       clear *
   }
   else
   {
    //do nothing
    }
Please dont directly copy this Im not that experienced at sql and php together it porbally dont work if u know correct format this will give great idea to solving it.
Im writing my signature here for what reason i do not understand. No i wont put my name here.
Post Reply

Return to “[2.0.x] MOD Writers Discussion”