Announcement

Collapse
No announcement yet.

IP conditional - Please help - Urgent

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Kusadasi-Guy
    replied
    Floris, Thank you for your help
    i found the solution to my problem.

    to better help for others, can you please change the title of the thread? So that people can easily find this.

    Problem: I wanted to show/hide somethings in my forum template to some visitors that using some specific ip addresses (include ip-a, ip-b, ip-c ..etc). For anytime, you may need this, e.g. for your ads or any message to specific ip addresses...


    Response to problem: You should include .php codes to your templates.

    Solution:
    Please read this useful thread: How to Include a PHP or HTML File

    and this is from phpclasses.org: http://www.phpclasses.org/browse/file/11663.html

    Download: IPAddressSubnetSniffer.php from PhpClasses.org and
    add this snippet to the end of the code;
    PHP Code:
     $okay = array( "73""74.11""75.12.58""76.25.58.69" );
    //type your own ip addresses, see i am doing somethings for 73.X.X.X., 74.11.X.X, 75.12.58.X and 76.25.58.69
           
    $ipsniff = new IPAddressSubnetSniffer$okay );
           if ( ! 
    $ipsniff->ip_is_allowed$_SERVER['REMOTE_ADDR'] ) ){
            
    //adsense code 
           
    echo "Your msg or html output goes here - Condition A" ;
              
           }
           
           else
           {
           echo 
    "Your msg or html output goes here - Condition B";

           } 
    save the file and upload into your forum home directory.

    As Feldon23 told in http://www.vbulletin.com/forum/showthread.php?t=173937 ;

    Create a Plug-in for global_start with these contents:

    ob_start();
    include('path/to/this/file/myfile.php');
    $includedphp = ob_get_contents();
    ob_end_clean();

    and place $includedphp in one of your templates.

    Remember, this process will include a .php file into your templates. So Please use caution.

    Leave a comment:


  • Floris
    replied
    I tried $bbuserinfo[ip] & userid & host and $userinfo[ip] userid & host
    and they all returned empty.
    Perhaps this requires you to set a global_start php code plugin that gets the value and stores it into your own one and then use $myipvalue in the template with a condition.

    Leave a comment:


  • Kusadasi-Guy
    started a topic IP conditional - Please help - Urgent

    IP conditional - Please help - Urgent

    Please help me as this is urgent for me.

    Can i apply ip based conditional?

    for example;

    <- if ip = 99.99.99
    do this html

    else

    do this html ->
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X