Computer Science Canada Unique hits |
| Author: | Amailer [ Fri Mar 12, 2004 8:21 pm ] | ||
| Post subject: | Unique hits | ||
Okay, i got a problem, all the work im checking in the for() loop get's messed up because each and every variables value get's repeated.... can anyone help me? |
|||
| Author: | wtd [ Fri Mar 12, 2004 9:21 pm ] | ||
| Post subject: | |||
First I'd replace that for loop with something like:
|
|||
| Author: | Amailer [ Fri Mar 12, 2004 10:20 pm ] | ||
| Post subject: | |||
see the problem now is
the $user_ip is getting repeated for every record in the database :S so.. it's basicallt the same thing |
|||
| Author: | wtd [ Fri Mar 12, 2004 10:36 pm ] |
| Post subject: | |
That's because you don't change $user_ip in the loop. |
|
| Author: | Amailer [ Fri Mar 12, 2004 10:45 pm ] |
| Post subject: | |
errr, yes-- and the way to fix this is? |
|
| Author: | wtd [ Fri Mar 12, 2004 11:07 pm ] | ||
| Post subject: | |||
Somewhere inside your loop put:
The something depends on what kind of information you want to store in $user_ip. |
|||
| Author: | Amailer [ Sat Mar 13, 2004 10:15 am ] |
| Post subject: | |
no no no no, user_ip is already set -.- *duh*, it's the encoded ip address of the user viisting the page-- but the script wrong woth because if you see... it' keeps duplicating the user_ip (ie c0394101c0394101c0394101c0394101c0394101c0394101c0394101 ) that means the if statement does not work--- because there is never going to be such a long ip in the database (cuz it get's repeated for every record in the db...) that's the first problem it's self :S btw, there is an if statement saying if ($set_2 == 1) { do bla but because of this problem, the $set_2 is always 1 !!!! |
|
| Author: | Amailer [ Sun Mar 14, 2004 8:52 am ] | ||
| Post subject: | |||
OKAY. Well i did solve the problem this way
but i don't like that way :S so anyone know another way TELL me |
|||
| Author: | wtd [ Sun Mar 14, 2004 10:09 am ] |
| Post subject: | |
PHP makes me want to turn into the Hulk and smash things. Since everything is dependent on global variables, it's very hard to help you without seeing all of the code. |
|
| Author: | Amailer [ Sun Mar 14, 2004 11:02 am ] | ||||
| Post subject: | |||||
Now, no need to see the OO code, cuz it's big -- so i think you should get the rest...(come on it's simple!) $unique_hits = $db->select_table(UNIQUE_HITS_TABLE); selects the table...
that.. k? |
|||||
| Author: | Homer_simpson [ Wed Mar 17, 2004 4:53 am ] |
| Post subject: | |
yo i remember i used to have some code like that in my old website for downloads or something.... here's how it was: i had a row for every download file... everytime an ip would try downloading them it would check the existing ips and if they were'nt there it would just add it to the ip string in my database... here's how the ip string worked: ipÞipÞipÞipÞip ie 24.24.65.78Þ54.698.32.12Þ01.54.38.65Þ i just used Þ for separator... and it worked perfectly fine... so u might wanna give that a try... |
|
| Author: | Amailer [ Wed Mar 17, 2004 9:15 am ] |
| Post subject: | |
I fixed the unique hits problem but you gave me an idea for my download module... insted of using cookies thanks ;D |
|
| Author: | Homer_simpson [ Thu Mar 18, 2004 3:14 am ] |
| Post subject: | |
netime... if u need i could send u source code for my whole website... it had some code parts that might come to use... |
|
| Author: | Amailer [ Thu Mar 18, 2004 8:51 am ] |
| Post subject: | |
sure, why not |
|
| Author: | Homer_simpson [ Thu Mar 18, 2004 2:14 pm ] |
| Post subject: | |
pm me yer msn... btw site address is: http://evilgamerz.sytes.net |
|
| Author: | wtd [ Thu Mar 18, 2004 3:30 pm ] |
| Post subject: | |
Yes, cookies are evil. The only reason you should use cookies is to hold an identifying number for a session. Sessions are essentially cookies stored on the server, where they can't get corrupted or lost by users. |
|