Author |
Message |
dad7732
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Mar 18, 2007
Posts: 1242
|
Posted:
Tue Feb 01, 2011 11:30 pm |
|
Is there a way, in the Terms of Service document to add:
Your UserAgent: xxxxxxx
Your IP Address: xxx.xxx.xxx
I tried to add some code but it only displayed the code. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
RavenNuke(tm) Development Team
![](modules/Forums/images/avatars/48fb116845dfecf66294c.gif)
Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA
|
Posted:
Wed Feb 02, 2011 2:36 am |
|
I would probably add your code for IP and user agent to classes/class.legal_document.php, then look for the "Make any necessary tag replacements" section and add some replacements for ip and agent. Then you can call them in the templates the same as you can the site, country, and date. Noticed that section is still using ereg, this is an untested preg_replace sample:
Code: $docText = preg_replace('/\[sitename\]', $sitename, $docText);
$docText = preg_replace('/\[country\]', $this->docCountry, $docText);
$docText = preg_replace('/\[date\]', $dateS, $docText);
$docText = preg_replace('/\[ip\]', $UserIP, $docText);
$docText = preg_replace('/\[agent\]', $UserAgent, $docText);
|
Where $UserIP and $UserAgent are your pre-formatted/validated IP and agent. Then call [ip] and [agent] from your docs. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Feb 02, 2011 8:06 am |
|
Didn't work. Changed preg to eregi and still didn't work because if "preg" was entered I got an error something about no ending delimiter ('/').
I embedded [ip] and [agent] and it remained as such in the document. It seems that $UserIP and $UserAgent aren't defined like $sitename is for instance. I even added $UserIP and $UserAgent to the global string and still no luck.
To verify that it still works, I embedded [sitename] and it was replaced by the site name.
Thanks |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Feb 02, 2011 10:37 am |
|
You would have to add code for the $UserIP and $UserAgent, prior to the text replacement. The IP is fairly simple
Code:$UserIP = $_SERVER['REMOTE_ADDR'];
|
the user agent is a little trickier, I might look at using something like this
http://www.php.net/manual/en/function.get-browser.php#92310
(not the get_browser function (overkill) but the user submitted alternative)
You could also look at the includes/counter.php and see how it is done there, although that is also still using ereg and is somewhat dated.
As for the preg_match it was a shot in the dark so lets try and get an ereg version working first. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Feb 02, 2011 10:42 am |
|
Still doestn't work, here is what the addition looks like:
Code:
$UserIP = $_SERVER['REMOTE_ADDR'];
$docText = $this->doc['text'];
$docText = eregi_replace('\[sitename\]', $sitename, $docText);
$docText = eregi_replace('\[country\]', $this->docCountry, $docText);
$docText = eregi_replace('\[date\]', $dateS, $docText);
$docText = eregi_replace('/\[ip\]', $UserIP, $docText);
$docText = eregi_replace('/\[agent\]', $UserAgent, $docText);
if (empty($docText)) $docText = $lgl_lang['LGL_ERRDB_TRANSNOTFOUND'];
$s = '';
$s .= '<div><table ' . LGL_STYLE_DOC . '><tr><td>' . $docText . '</td></tr></table></div>';
return $s;
|
|
Last edited by dad7732 on Wed Feb 02, 2011 11:08 am; edited 1 time in total |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
spasticdonkey
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Feb 02, 2011 10:54 am |
|
since we are using eregi try it like so
Code:$docText = eregi_replace('\[ip\]', $UserIP, $docText);
$docText = eregi_replace('\[agent\]', $UserAgent, $docText);
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Wed Feb 02, 2011 11:18 am |
|
Whoaaa .. that works!! was just a matter of a \ in the right spot looks like. The IP works, now to see if the useragent works.
It doesn't .. ![Sad](modules/Forums/images/smiles/icon_sad.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
dad7732
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sat Feb 05, 2011 11:30 am |
|
Aha, got it!
Code:
$UserIP = $_SERVER['REMOTE_ADDR'];
$UserAgent = $_SERVER['HTTP_USER_AGENT'];
|
Thanks for all the insight, etc.
Cheers |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|