PDA

View Full Version : Escaping


TheInsaneManiac
08-22-2008, 04:46 PM
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?

$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
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
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:

$vbulletin->options['tum']

or

$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
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.

$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


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


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


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

TheInsaneManiac
08-23-2008, 12:36 AM
I really don't get what you mean but i am going to try.

$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


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


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


$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
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:
$tume = explode('|', $vbulletin->option['tum']);

TheInsaneManiac
08-23-2008, 02:31 PM
Wait...So is $vbulletin->option['tum'] a list of values separated by a pipe? If so:
$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.