Recommend this page to a friend! |
GET by IP | > | All threads | > | setting up | > | (Un) Subscribe thread alerts |
|
![]() Hi,
I just thought i'd give this class a try but it seems that there is s database queried in it and also several include files are missing. Is it possible to get a copy of the structure of the required database and links to inc files? My apologies if I am missing something very obvious. Regards, Euan
![]() CREATE TABLE "SVOD_ADM"."WW_COUNTER" (
"MAINKEY" NUMBER(10) NOT NULL, "DTMAKE" DATE NOT NULL, "IPADDR" VARCHAR2(15 byte) NOT NULL, "NCLICKS" NUMBER(10) NOT NULL, CONSTRAINT "PK_WW_COUNTER" PRIMARY KEY("MAINKEY") USING INDEX TABLESPACE "SVOD2_DATA" STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1) PCTFREE 10 INITRANS 2 MAXTRANS 255) TABLESPACE "SVOD2_DATA" PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1) LOGGING This is ORACLE structure. But class does not need database: example of counter need it. You may see results of class in such way: <? $ipdata=new get_by_ip('194.44.39.135');//here is any IP address echo str_repeat("-=", 10)."<br><br>"; echo $ipdata->msg; echo str_repeat("-=", 10)."<br><br>"; echo $ipdata->ip."<br>"; echo $ipdata->host."<br>"; echo $ipdata->netname."<br>"; echo $ipdata->country."<br>"; echo $ipdata->person."<br>"; echo $ipdata->address."<br>"; echo $ipdata->phone."<br>"; echo $ipdata->email."<br>"; ?>
![]() When I use that code, I get the following error message:
Error SQL-query: CREATE TABLE "SVOD_ADM"."WW_COUNTER" ( "MAINKEY" NUMBER(10) NOT NULL, "DTMAKE" DATE NOT NULL, "IPADDR" VARCHAR2(15 byte) NOT NULL, "NCLICKS" NUMBER(10) NOT NULL, CONSTRAINT "PK_WW_COUNTER" PRIMARY KEY("MAINKEY") USING INDEX TABLESPACE "SVOD2_DATA" STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1) PCTFREE 10 INITRANS 2 MAXTRANS 255) TABLESPACE "SVOD2_DATA" PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE ( INITIAL 64K NEXT 0K MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1) LOGGING MySQL said: You have an error in your SQL syntax near '"SVOD_ADM"."WW_COUNTER" ( "MAINKEY" NUMBER(10) NOT NULL, "DTMAKE" DATE NOT NUL' at line 1
![]() Hay, guys, are you really programmers?
Do you know what's MySQL and Oracle? RTFM! 1)"SVOD_ADM". -- it's users session for Oracle. Newer use it if you have'nt such user. 2)SQL query optimized for Oracle. If you want to use class for MySQL you have to modify fields types of table structure and queries of example. I think, MySQL version is like that: ################ structure: CREATE TABLE counter ( id int(12) NOT NULL auto_increment, ip varchar(15) default NULL, county varchar(2) default NULL, domain varchar(60) default NULL, clicks int(12) default NULL, day int(2) default NULL, month int(2) default NULL, year int(4) default NULL, PRIMARY KEY (id), INDEX(ip, day,month,year) ) ############### /* and example for using: */ # warning: connect database here, change your database settings $db = mysql_connect($DB_HOST,$DB_USER,$DB_PASS)OR DIE("Unable to connect server, change <b>inc.php</b> file"); mysql_select_db($DB_NAME,$db)OR DIE("Unable to select DataBase."); #add counter's data $today = getdate(); $counter_where="WHERE ip='".$REMOTE_ADDR."' and day='$today[mday]' and month='$today[mon]' and year='$today[year]'"; $click_today=@mysql_result(mysql_query("SELECT sum(clicks) FROM counter $counter_where"),0); if ($click_today>0) { $q_res=mysql_query("UPDATE counter SET clicks=clicks+1 $counter_where"); } else { include_once ($pristavka."get_by_ip.class.php"); $ipdata=new get_by_ip($_SERVER['REMOTE_ADDR']); /*echo $ipdata->host."<br>"; echo $ipdata->netname."<br>"; echo $ipdata->country."<br>"; echo $ipdata->person."<br>"; echo $ipdata->address."<br>"; echo $ipdata->phone."<br>"; echo $ipdata->email."<br>";*/ mysql_query("INSERT INTO counter (ip,clicks,day,month,year, domain, county) VALUES ('".$ipdata->ip."', '1', '$today[mday]','$today[mon]','$today[year]','".$ipdata->host."', '".$ipdata->country."') "); } ################################################################### # if you'll get eroor fSocksOpen configure your socket connection # # of Apache&PHP server -- class uses socket. # ################################################################### |
info at phpclasses dot org
.