vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   if condition depending on url or address (https://vborg.vbsupport.ru/showthread.php?t=202215)

Super Jinni 01-18-2009 08:44 AM

if condition depending on url or address
 
Hi everyone,
I'm wondering if there is anyway to set an if condition depending on page url or address and on the last part of url, like:

when user go to usercp and go to edit his signature I want him to get notification on the header or change the header or something like that

the links are usually like this
Code:

http://www.xxxxx.com/forum/profile.php?do=buddylist
http://www.xxxxx.com/album.php?u=1
http://www.xxxxx.com/private.php?do=newpm
http://www.xxxxx.com/forumdisplay.php?f=10

so what I want is:
1- set a condition depending on the last part - which is in red- of the link.

2- set a condition depending on the whole link.

is there anyway to do that?
appreciate your help

best wishes :)

Dismounted 01-18-2009 09:56 AM

I don't understand what you're trying to do there.

Super Jinni 01-18-2009 10:17 AM

OK, let me say it in this way,

I have some customized header, so I want to change depending on the page that user going to visit, so some pictures will change in the main header, and some colors will change too.

so, I want to do that according to the url of the page that user visit. or according to the last part of the the url like what in red in the first post in this thread.

so, I want to do it in this way,

<if condition (the url is:www.whatever)> show this header</if>

or

<if condition (the last part of the url is: (/?do=buddylist or whatever)>show this or do this</if>

so I want to set a condition for whatever according to and depending on url or part of it.

I hope I could explain it clear enough. and sorry for my poor English.

so, is there any way to do something like that?

thanks again :)

Lynne 01-18-2009 03:24 PM

If do=buddylist is in the url of the page you want to post your message on, have you tried just doing:
HTML Code:

<if condition="$_REQUEST['do'] == 'buddylist'>
whatever
</if>


Super Jinni 01-18-2009 03:47 PM

ok, I'll give that a try,
and what about the whole url?

I mean like in this thread's url

Code:

<if condition = the whole url is "https://vborg.vbsupport.ru/showthread.php?t=202215">
whatever
</if>

is that possible?

Lynne 01-18-2009 03:56 PM

Not exactly. You can do a condition on (THIS_SCRIPT == 'showthread') or a condition on ($thread[threadid] == 202215) though.

Super Jinni 01-18-2009 06:24 PM

Well, thanks Lynne. I used (THIS_SCRIPT) before and I think the ($_REQUEST ['do'] == whatever) will work for now.

really appreciate your help :)

thanks a lot

Dismounted 01-19-2009 05:00 AM

You can actually find the request string (everything after the domain) using $_SERVER['REQUEST_URI'].

Super Jinni 01-19-2009 11:27 AM

Thanks for your reply,
but I have a dumb question though :D:
how could I use that exactly? can you give an example please? :)

Dismounted 01-19-2009 11:42 AM

Code:

<if condition="$_SERVER['REQUEST_URI'] == '/forum/member.php?u=1'">
This shouldn't really be used, ideally, you should use the THIS_SCRIPT constant along with other conditionals.

Super Jinni 01-19-2009 11:03 PM

OK, thanks man,
really appreciate your your help, and Lynne of course. :)

may I ask you another question?

why shouldn't $_SERVER['REQUEST_URI'] be used? any security issues with it?

Dismounted 01-20-2009 05:00 AM

Quote:

Originally Posted by Super Jinni (Post 1718364)
why shouldn't $_SERVER['REQUEST_URI'] be used? any security issues with it?

Because it is not exact. It will not match every case of the URL that you expect. For example, you can access a forum (forumdisplay) with both f=X and forumid=X.

Super Jinni 01-20-2009 04:04 PM

aaha,
OK, thank you so much for your help :)


All times are GMT. The time now is 04:07 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.01919 seconds
  • Memory Usage 1,738KB
  • 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
  • (3)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (13)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete