what title says... want to sell ad space on my sites, but have no idea what script (to count impressions or/and clicks) should I use.. thanks
I used self made script coz it effective Bear in mind that this code is an example of how to create a script that counts all impressions done by humans. Since robots don’t execute JavaScript code, only human impressions count. Firstly create the table in your MySQL database by executing this query: CREATE TABLE IF NOT EXISTS `days_impressions` ( `day` date NOT NULL, `impressions` int(11) NOT NULL, PRIMARY KEY (`day`), KEY `impressions` (`impressions`) ) Then open your text editor and place this code: <?php $server = “localhostâ€; $user = “userâ€; $dbase = “databaseâ€; $passwd = “passwordâ€; $days_impr = “days_impressionsâ€; //function that reports fatal errors in MySQL instead of showing them as output if (!function_exists(’fatal_error_report’)) { function fatal_error_report($line,$file) { //fatal_error_report(__line__,__FILE__); $to = “bugs@yourserver.comâ€; $subject = “Fatal errorâ€; $ip = $_SERVER[’REMOTE_ADDR’]; $messaget= ‘<html><body><h1>Fatal error has occured</h1><br />Details:<br />’.$file.†on line “.$line.†with this error “.mysql_error().’<br />Page accessed: <b>’.$_SERVER[’REQUEST_URI’].’</b>. IP: <b>’.$ip.’</b></body></html>’; $postmast= “postmaster@yourserver.comâ€; $headers = “From: “.$postmast. “\n†. “X-Mailer: PHP/†. phpversion() . “\n†. “MIME-Version: 1.0\n†. “Content-Type: text/html; charset=utf-8\n†. “Content-Transfer-Encoding: 8bit\nâ€; mail($to, $subject, $messaget, $headers); die (); } //end of error reporting function } $link = mysql_connect($server, $user, $passwd) or fatal_error_report(__line__,__FILE__); mysql_select_db($dbase) or fatal_error_report(__line__,__FILE__); $date = date(â€Y-m-dâ€); $found = 0; $result = mysql_query(â€select * from $days_impr where day = ‘$date’ limit 1;â€, $link) or fatal_error_report(__line__,__FILE__); if (mysql_num_rows($result)) while ($qry = mysql_fetch_array($result)) $found = 1; if($found==1) { $result = mysql_query(â€update $days_impr set impressions = impressions + 1 where day = ‘$date’ limit 1;â€, $link) or fatal_error_report(__line__,__FILE__); } else { $result = mysql_query(â€insert into $days_impr values ( ‘$date’ , ‘1′)â€, $link) or fatal_error_report(__line__,__FILE__); } mysql_close(); ?> Don’t forget to modify these variables’ values: $server, $user, $dbase, $passwd, $postmast, $to Once you have done this, save the file as, for example, “stats.phpâ€. Then place this code in all pages that are available to visitors: <script src="http://www.yourserver.com/statistics/stats.php" type="text/javascript"> </script>
Nice helping post Mentos , thanks i hope i can use it for my site. Actually this topic is new to me , but my hope is high