vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Displaying ip address of user (https://vborg.vbsupport.ru/showthread.php?t=318946)

Duckface 06-04-2015 02:12 PM

Displaying ip address of user
 
Code:

{vb: raw bbuserinfo.ip}
The above displays an empty string, what is the variable name exactly or isn't there one?

Additionally, this doesn't work either:

Code:

{vb:rawphrase ip}

MarkFL 06-04-2015 02:20 PM

In a plugin (with appropriate hook location), you could use the statement:

PHP Code:

$useripaddress $_SERVER['REMOTE_ADDR']; 

and then register that variable for the template in which you wish to use it.

To which template are you trying to add it, and I can help further. :D

Duckface 06-04-2015 02:22 PM

Which hook location would you recommend? As it's for a custom page that I made http://spawnscape614.co.uk/forums/donate/donate.php

MarkFL 06-04-2015 02:25 PM

Quote:

Originally Posted by Duckface (Post 2547134)
Which hook location would you recommend?

I edited my post above...to which template are you trying to add the user's IP?

Duckface 06-04-2015 02:30 PM

The template is a custom template called Donate.

MarkFL 06-04-2015 02:38 PM

Okay, for your plugin, try the hook location "global_start" (since I don't know if there are any custom hook locations associated with this template) and let's try this instead for the PHP code:

PHP Code:

if (THIS_SCRIPT === 'donate')
{
    
$show['userip'] = $_SERVER['REMOTE_ADDR'];


Then, in your template, use {vb:raw show.userip}. Let me know if this works. :D

Duckface 06-04-2015 02:49 PM

Strangely not as logical as it sounds... I even tried (in the template):

PHP Code:

<?php

echo($_SERVER['REMOTE_ADDR']);

?>

And still nothing.

MarkFL 06-04-2015 02:55 PM

What PHP version are you using?

Duckface 06-04-2015 02:55 PM

5.5.42-cll

MarkFL 06-04-2015 03:01 PM

What I suggested should work...don't know why it's not. Maybe someone else can suggest another solution. :D


All times are GMT. The time now is 03:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01120 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete