Jump to content

Is This Valid?


phpSensei

Recommended Posts

Before Anything, I think I should Explain how my Forum works.

 

Everytime a user adds a topic, the Id of the Forum which the topic is being added to, is inserted in a table row called id_forum, in the messages table. (Same table for Adding Topics).

 

Once it has the Forum's id, you can display these topics like this

 

<?php

//We Get the ID of the Topic passed from the URL//
$id=$_GET['id'];

//Here We Select Everything from Messages, then INNER JOIN with the Forums table//
$sql="SELECT * FROM messages INNER JOIN forums  ON id_message=id_forum  WHERE id_forum='$id'  ";


$result=mysql_query($sql);
$row=mysql_fetch_array($result);

?>

 

 

 

I am trying to Collect a user's ip when he views a thread in my forum.

 

Now to skip some of the code, I will do a IF statement for:

 

<?php

//Here we Collect the IP Adress of this user//
$ip=$_SERVER['REMOTE_ADDR']; 
//Here we check if in OUr SELECT STATEMENT, We can Find a unique ip//
If( $ip == $row['unique_ip']){

//If The ip already Exists, We do Not ADD 1 to the Unique Views//
die();
}
//Else If the ip is unique, We add it to our list of Ip's, so Later this ip will not count as unique//
elseif ($ip != $row['uniqure_ip']{


$id=$_GET['id_message'];

mysql_query ("INSERT INTO message_msg (uip) WHERE id_msg='$id' VALUES ('$ip')")

mysql_query("UPDATE messages SET uniqueviews = uniqueviews + 1 WHERE message_id='$id2'");
}

?>

 

The ip doesnt go to the proper message id.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.