Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: comment table incl ip/host (code inside)  (Read 9847 times)

0 Members and 1 Guest are viewing this topic.

boii

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 65
comment table incl ip/host (code inside)
« on: October 04, 2003, 06:28:55 am »

i mean this is a severely easy addition, id do it myself if i wasnt at a cybercafe, just adding 2 columns to the comments table and in the add comment code having it insert the ip & host into each field.

it'd be snazzy if you were logged in as admin to to view it on the page also.

can show me where the comment insert code is so i can hack this together quickly? (and for anyone who knows oppermien code, will the addition of two tabel columns or what ive described break anything?)

cheers.
ken
Logged

boii

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 65
comment table incl ip/host (code inside)
« Reply #1 on: October 04, 2003, 06:44:35 am »

okay so does this look right before i implement it:

throw this in db_input.php:
Code: [Select]

//
// Comment
//
$user_ip = getenv ("REMOTE_ADDR");
$user_host = getenv ("REMOTE_HOST");


and then find this:
Code: [Select]

        if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
                $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id) VALUES ('$pid', '$msg_author', '$msg_body', NOW(), '{$USER['ID']}', '0')");


change to:
Code: [Select]

        if (!USER_ID) { // Anonymous users, we need to use META refresh to save the cookie
                $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, user_ip, user_host) VALUES ('$pid', '$msg_author', '$msg_body', NOW(), '{$USER['ID']}', '0', '$user_ip','$user_host')");


and find:
Code: [Select]

        } else { // Registered users, we can use Location to redirect
                $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id) VALUES ('$pid', '".addslashes(USER_NAME)."', '$msg_body', NOW(), '', '".USER_ID."')");


change to:
Code: [Select]

        } else { // Registered users, we can use Location to redirect
                $insert = db_query("INSERT INTO {$CONFIG['TABLE_COMMENTS']} (pid, msg_author, msg_body, msg_date, author_md5_id, author_id, user_ip, user_host) VALUES ('$pid', '".addslashes(USER_NAME)."', '$msg_body', NOW(), '', '".USER_ID."','$user_ip', '$user_host')");


(also make sure you added the two columns in your comments table called 'user_ip' and 'user_host')

i havent implemented it yet, waiting for someone to look at it and tell me if itll break. i dont have a test versionof coppermine up.

cheers.
ken

edit: obviously this wont display it within coppermine, youll have to look at it in the actual db. when i have more time to sit down (see next year, im traveling!) and put it together is when ill add it to the display pages (unless someone does it first).
Logged

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
comment table incl ip/host (code inside)
« Reply #2 on: October 04, 2003, 06:53:34 am »

Sorry to be rain on your parade - this has already been done
Logged
SANIsoft PHP applications for E Biz

boii

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 65
comment table incl ip/host (code inside)
« Reply #3 on: October 04, 2003, 07:41:48 am »

hey, all the better. im happy it was done. now where can i get my hands on the code? :D

done or not, its not currently in my coppermine version (and im glad i then assume itll be in 1.2) but how can i go about mod'ing the current one to have ip/hosts included (does my hack look right?..id rather use the other if its proven).

cheers.
ken
Logged

boii

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 65
comment table incl ip/host (code inside)
« Reply #4 on: October 04, 2003, 08:37:14 am »

anyhow.
for anyone who also has no idea where this code tarique refers to is..

i just tried mine, it works.

feel free to use it.

cheers.
ken
Logged

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
comment table incl ip/host (code inside)
« Reply #5 on: October 04, 2003, 09:10:41 am »

Quote from: "boii"
for anyone who also has no idea where this code tarique refers to is..


Let me tell you that it will be in the next version :)
Logged
SANIsoft PHP applications for E Biz

boii

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 65
comment table incl ip/host (code inside)
« Reply #6 on: October 04, 2003, 09:59:29 am »

Quote from: "tarique"
Quote from: "boii"
for anyone who also has no idea where this code tarique refers to is..


Let me tell you that it will be in the next version :)


rock on.
here's a quick question that maybe you can answer..

when one will upgrade from 1.1.0 to 1.2.x, those of who have made mods (ie: the one i posted above, and god knows what else here and there), will we lose or screw somethign up by havign a diff database structure or code in certain files?

i assume the only answer can be yes ;)

cheers.
ken
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
comment table incl ip/host (code inside)
« Reply #7 on: October 04, 2003, 10:43:41 am »

yup,

as you'll have to replace nearly all files, all mods will be lost. I haven't heard of a software that is capable of preserving the mods when there's an update (except they're all done in separate files).

GauGau
Logged

boii

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 65
comment table incl ip/host (code inside)
« Reply #8 on: October 14, 2003, 06:09:00 am »

i know. i know.
this is already in the next version.

but for anyone who so happened to use the code above:

i edited two lines in: reviewcom.php to display the hostname next to msg author/date

Code: [Select]

$result = db_query("SELECT msg_id, msg_author, msg_body, user_host, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, {$CONFIG['TABLE_COMMENTS']}.pid as pid, aid, filepath, filename, url_prefix, pwidth, pheight FROM {$CONFIG['TABLE_COMMENTS']}, {$CONFIG['TABLE_PICTURES']} WHERE {$CONFIG['TABLE_COMMENTS']}.pid = {$CONFIG['TABLE_PICTURES']}.pid ORDER BY msg_id DESC LIMIT $start, $count");

^ just added ' user_host,' in the db_query.

changed:
Code: [Select]

<td><b>{$row['msg_author']}</b> - {$msg_date}</td>

to:
Code: [Select]

<!-- <td><b>{$row['msg_author']}</b> - {$msg_date}</td> -->
<td><b>{$row['msg_author']}</b> - {$msg_date} : {$row['user_host']}</td>


simple enough. and now you can see the hostname in the review of comments without logging into the db.

cheers.
ken
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.