Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2009, 12:27 AM
DJ29Joesph DJ29Joesph is offline
 
Join Date: Jan 2009
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Possible Miscode in poll.php

I was coming across some code and was in poll.php and I think I found an error in the php file.

Heres the code

Its on line 626.
PHP Code:
        while ($name $db->fetch_array($public))
        {
            
fetch_musername($name);
            
$allnames["$name[voteoption]"][] = '<a href="member.php?' $vbulletin->session->vars['sessionurl'] . "u=$name[userid]\">$name[musername]</a>";
        } 
I believe where the </a> ends it should be a single quote, not a double quote. Can someone please look at this for me.

I may be wrong I am just a beginner, but I thought I would give it a shot of reporting it.

I have vbulletin Version 3.8.3. Thanks
Reply With Quote
  #2  
Old 07-21-2009, 12:29 AM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I do believe you are correct

--------------- Added [DATE]1248140019[/DATE] at [TIME]1248140019[/TIME] ---------------

Actually, now that I look at it again, I think it may be missing a quote
Reply With Quote
  #3  
Old 07-21-2009, 01:12 AM
JamesC70 JamesC70 is offline
 
Join Date: Jun 2007
Posts: 219
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DJ29Joesph View Post
I was coming across some code and was in poll.php and I think I found an error in the php file.
It looks correct to me. I'll use quote instead of code, so I can highlight the pairs:

Quote:
$allnames["$name[voteoption]"]
[] = '<a href="member.php?'
. $vbulletin->session->vars['sessionurl']
. "u=$name[userid]\">$name[musername]</a>";
In each line of the quote above, the opening and closing quotes are highlighted in red.

The one that's throwing you off is the green one, preceeded with a backslash. The backslash indicates to PHP to "keep this intact, don't interpret it as code". This needs to be done when including a double-quote character within double-quote marks.

The double-quote before member.php (line 2 in quote above) doesn't need a backslash in front of it because it's not inside a pair of double-quotes, it's inside single quotes. Hence the difference.


Refer to php.net for further information.
Reply With Quote
  #4  
Old 07-21-2009, 01:17 AM
DJ29Joesph DJ29Joesph is offline
 
Join Date: Jan 2009
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Personally that doesn't make any sense.

Why would u=$name be part of </a>???
Reply With Quote
  #5  
Old 07-21-2009, 01:19 AM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats part of the link that allows you to go to the users profile when clicked
Reply With Quote
  #6  
Old 07-21-2009, 01:21 AM
JamesC70 JamesC70 is offline
 
Join Date: Jun 2007
Posts: 219
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The code is creating a clickable link.... embedding a variable into HTML.

HTML uses <a href="_____">click this part</a> -- "click this part" is what you see on the screen; the code in brackets is what tells the browser to interpret it as a link.
Reply With Quote
  #7  
Old 07-21-2009, 01:26 AM
DJ29Joesph DJ29Joesph is offline
 
Join Date: Jan 2009
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$allnames[START1$name[voteoption]END1]
[] = START2<a href=START3member.php?END2
. $vbulletin->session->vars[START4sessionurlEND4]
. END3u=$name[userid]\START5 OR NOTHING>$name[musername]</a>START5 OR END 5;

still doesnt make any sense.

I know how to make a link I have 2 years of web design on my belt

EDIT::::

ok, if I'm correct the only thing wrong is "u=$name should be a single quote not double
Reply With Quote
  #8  
Old 07-21-2009, 01:45 AM
JamesC70 JamesC70 is offline
 
Join Date: Jun 2007
Posts: 219
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DJ29Joesph View Post
ok, if I'm correct the only thing wrong is "u=$name should be a single quote not double
If $name is inside a single quote, PHP won't give it a value. It must be inside double quotes, or inside no quotes at all, for PHP to assign a value to $name.

This is why $allnames["$name[voteoption]"] uses double-quotes instead of single-quotes, too.

Quote:
Originally Posted by php.net
The most important feature of double-quoted strings is the fact that variable names will be expanded. See string parsing for details.
Reply With Quote
  #9  
Old 07-21-2009, 01:48 AM
DJ29Joesph DJ29Joesph is offline
 
Join Date: Jan 2009
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I believe the quote is "$allnames
not ["$name

I think im seeing things

u= is part of the link not the variable
Reply With Quote
  #10  
Old 07-21-2009, 01:50 AM
JamesC70 JamesC70 is offline
 
Join Date: Jun 2007
Posts: 219
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DJ29Joesph View Post
I believe the quote is "$allnames
not ["$name

I think im seeing things
You might be. I've been copying/pasting from your first post, and everything looks consistent here.

Yes, u= is part of the link. When a variable is inside double-quotes, PHP will replace the variable with it's value. In this case, the user's id would be inserted in place of $name[userid].
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:56 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.05097 seconds
  • Memory Usage 2,261KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete