vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Escaping (https://vborg.vbsupport.ru/showthread.php?t=188838)

TheInsaneManiac 08-22-2008 04:46 PM

Escaping
 
I usually don't have a problem escaping, but for some reason I can't escape this to use in a php file. A little help?

PHP Code:

$tume = array('$vbulletin->options['tum']'); 


Opserty 08-22-2008 04:51 PM

Why don't you use PHP tags in your post? ;)

*hint hint*

TheInsaneManiac 08-22-2008 04:58 PM

Quote:

Originally Posted by Opserty (Post 1604583)
Why don't you use PHP tags in your post? ;)

*hint hint*

Lol, I'm still lost. Sorry for being so difficult. I am good at things, but when it comes to escaping, I suck.

Opserty 08-22-2008 05:06 PM

Read the instruction manual then. ;) http://uk2.php.net/types.string

TheInsaneManiac 08-22-2008 05:11 PM

Quote:

Originally Posted by Opserty (Post 1604598)
Read the instruction manual then. ;) http://uk2.php.net/types.string

Lol, I'm trying everything, some things don't give me errors, but the script still won't work. What am I suppose to use in my tume.php file:

Code:

$vbulletin->options['tum']
or

Code:

$vboptions[tume]

Opserty 08-22-2008 05:15 PM

What exactly are you trying to do? Are you trying to get the value or the actual name?

(Read the previous link and see how variables differ in single/double quotes. Note: If you want the value, there is no need to use quotes at all)

TheInsaneManiac 08-22-2008 05:27 PM

Quote:

Originally Posted by Opserty (Post 1604615)
What exactly are you trying to do? Are you trying to get the value or the actual name?

(Read the previous link and see how variables differ in single/double quotes. Note: If you want the value, there is no need to use quotes at all)

Ok to explain. I have a setting in my vbulletin called tum. I wish to retrieve this setting from the database and input it in place of tum. So if tum equaled 28:

$tume = array('$vbulletin->options['tum']');

Would become:

$tume = 28

So how would I go about this?

P.S. This code is going in the admin area and it's the first time I have messed around with the admin area for modifications. So I was kind of looking for a straight up answer, so I could fiddle around in the file and figure out EXACTLY where the script needs to execute. Sorry for being impatient, but if it's not in the right area to begin with the script won't work anyway so I have no idea if escaping worked. Get my drift?

MoT3rror 08-22-2008 07:34 PM

I really don't get what you mean but i am going to try.
PHP Code:

$db->query_write("UPDATE setting SET value = '" $db->escape_string($vbulletin->options['tum']) . "' WHERE varname = 'tum'");

require_once(
DIR '/includes/adminfunctions_options.php');
$vbulletin->options build_options(); 

Or

PHP Code:

$tume $vbulletin->option['tum']; 

You don't need quotes around the vbulletin options part and if you want it in a array.

PHP Code:

$tume = array($vbulletin->options['tum']); 


TheInsaneManiac 08-23-2008 12:36 AM

Quote:

Originally Posted by MoT3rror (Post 1604710)
I really don't get what you mean but i am going to try.
PHP Code:

$db->query_write("UPDATE setting SET value = '" $db->escape_string($vbulletin->options['tum']) . "' WHERE varname = 'tum'");

require_once(
DIR '/includes/adminfunctions_options.php');
$vbulletin->options build_options(); 

Or

PHP Code:

$tume $vbulletin->option['tum']; 

You don't need quotes around the vbulletin options part and if you want it in a array.

PHP Code:

$tume = array($vbulletin->options['tum']); 


I might try that if I need it later. For now I just used what I did in my previous modification and made it separate my info using |.

Dismounted 08-23-2008 05:23 AM

Quote:

Originally Posted by TheInsaneManiac (Post 1604856)
I might try that if I need it later. For now I just used what I did in my previous modification and made it separate my info using |.

Wait...So is $vbulletin->option['tum'] a list of values separated by a pipe? If so:
PHP Code:

$tume explode('|'$vbulletin->option['tum']); 


TheInsaneManiac 08-23-2008 02:31 PM

Quote:

Originally Posted by Dismounted (Post 1604962)
Wait...So is $vbulletin->option['tum'] a list of values separated by a pipe? If so:
PHP Code:

$tume explode('|'$vbulletin->option['tum']); 


Yea, but if you read my previous post carefully you will notice I said that lol. My way is a little different from yours, but it still works so I'm happy with it.


All times are GMT. The time now is 03:38 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.01127 seconds
  • Memory Usage 1,756KB
  • 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
  • (9)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)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