PHP Ads Click Statistics Code, last night there are several IDC network to work with this site to put some ads, but I want to see the effect of advertising after the write a simple advertising statistics code, here is only the statistics can not IP restrictions or nausea click and so on.
First, create the database.
CREATE TABLE IF not EXISTS ' Ad_count ' ( ' ad_id ' int (8) not NULL auto_increment, ' Ad_hit ' int (8) Not NULL default ' 0 ', ' ad_name ' varchar character set gb2312 default NULL, ' Ad_datetime ' datetime default NULL, ' AD_QQ ' varchar character set gb2312 default NULL, ' Ad_url ' varchar (900) Character Set gb2312 not NULL, ' Ad_price ' int (8) Not NULL, PRIMARY KEY (' ad_id ') ) Engine=innodb DEFAULT charset=latin1 auto_increment=4;
Data creation Well, we started writing programs. Data connections I'm not going to write anymore.
<?php require_once ("... Province "); $ad _id =get_value (' ad_id ', '): Here's a talk if (Is_numeric ($ad _id)) {
$ad _select= "Select Ad_id,ad_url from Ad_count where ad_id= ' $ad _id ' limit 1";
$ad _update= "Update Ad_count set ad_hit=ad_hit+1 where ad_id= ' $ad _ Id ' limit 1 ';
$ad _result=mysql_query ($ad _select) or Die (' ID error '); &NBSP;&NBSP if (mysql_num_rows ($ad _result)) { &NBSP mysql_query ($ad _update); &NBSP;&NBSP $ad _rs=mysql_fetch_array ($ad _result); &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP header ("Location:". $ad _rs[' Ad_url ']);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.