vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Query assistance (https://vborg.vbsupport.ru/showthread.php?t=56082)

Sylvus 08-10-2003 05:50 PM

Query assistance
 
I have Firefly's query hack installed, which is great for running querys and has helped me a lot. I just downloaded a hack but the author did not give the full query to enter and I'm a little stumped.

What's the full query to do the following?

Code:

use phpMyAdmin to add a row to the user table.
filed : alias
type : varchar
length : 250

and

"then use phpmyadmin to edit 'allowmultiregs' in the settings table to change the description to:"

Code:

Normally, vBulletin will stop users signing up for multiple names by checking for a cookie on the user's machine. If one exists, then the user may not sign up for additional names.<br>If you wish to allow your users to sign up for multiple names, then select yes for this option, and they will not be blocked from registering additional usernames.<br>You may track also track multiples.  By using this option, the site will try to track and identify other screen names used by each member.
and change the optioncode to

Code:

<select name=\"setting[$setting[allowmultiregs]]\">
<option value=\"0\" ".iif($setting[value]==0,"selected","").">NO - Don't allow multiples</option>
<option value=\"1\" ".iif($setting[value]==1,"selected","").">YES - allow multiples</option>
<option value=\"2\" ".iif($setting[value]==2,"selected","").">YES - but track multiples</option>
</select>

Thanks,

Syl...

g-force2k2 08-10-2003 07:39 PM

i believe filed is the column name?

if so run this query:

Code:

ALTER TABLE user ADD alias varchar(250) NOT NULL
g-force2k2

Sylvus 08-11-2003 06:36 PM

Thanks g-force2k2. That worked. Any suggestions about the last two parts?

Dark_Wizard 08-12-2003 07:17 AM

UPDATE setting SET description=your description,optioncode=your optioncode WHERE varname=allowmultiregs

Sylvus 08-12-2003 04:42 PM

Thanks for the tip and I got the first part done correct (the description) but I'm having a heck of a time with the next query to add the select options.

If I use the code provided in the hack (which I must add is the worst documention I've come across in all the hacks I've installed), it works.

This is what the hack installer said to use:

Code:

<select name=\"setting[$setting[allowmultiregs]]\">
<option value=\"0\" ".iif($setting[value]==0,"selected","").">NO - Dont allow multiples</option>
<option value=\"1\" ".iif($setting[value]==1,"selected","").">YES - allow multiples</option>
<option value=\"2\" ".iif($setting[value]==2,"selected","").">YES - but track multiples</option>

But in the Control Panel, I receive this error:

Parse error: parse error, expecting `','' or `';'' in /mnt/web/guide/site/forum/admin/options.php(72) : eval()'d code on line 1

No modifications to options.php were ever done during the attempted install of this hack.

So I figured I'd give this a shot,

Code:

UPDATE setting SET optioncode '<select name=\"setting[$setting[allowmultiregs]]\"><option value=\"0\" \".iif($setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option><option value=\"1\" \".iif($setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option><option value=\"2\" \".iif($setting[value]==2,\"selected\",\"\").">YES - but track multiples</option>'
But it gives me this error:

mysql error: You have an error in your SQL syntax near ''<select name=\"setting[$setting[allowmultiregs]]\"><option value=\"0\" \".iif($' at line 1

Any help would be appreciated.

Syl...

Dark_Wizard 08-12-2003 05:28 PM

Hmmm, His code is correct...try this instead:

Code:

<select name=\\'setting[$setting[allowmultiregs]]\\'>
<option value=\\'0\\' '.iif($setting[value]==0,'selected','').'>NO - Dont allow multiples</option>
<option value=\\'1\\' '.iif($setting[value]==1,'selected','').'>YES - allow multiples</option>
<option value=\\'2\\' '.iif($setting[value]==2,'selected','').'>YES - but track multiples</option>


Sylvus 08-12-2003 05:53 PM

Ah I'm such a n00b. I'm sorry I made you ponder your time with this. Your second suggestion did not work but your first one did. It was all me :( If you check out the code I pasted above that did not work, you'll see I forgot to add this to the query.

optioncode='select name

I had optioncode 'select name

No = sign.

In the end, for your own curiosity, the following just worked like a charm:

Code:

UPDATE setting SET optioncode='select name=\"setting[$setting[allowmultiregs]]\"> NO - Dont allow multiples YES - allow multiples YES - but track multiples ' WHERE varname='allowmultiregs'
Thanks for the help. Learned to always double and triple check :)

The only problem I have is this. The query ran smoothly but I'm still getting:

Parse error: parse error, expecting `','' or `';'' in /mnt/web/guide/skullport/forum/admin/options.php(72) : eval()'d code on line 1

Under the Allow multiple registrations per user in the CP, which is exactly where that query would update to add the last option.

Should there be a ; perhaps in the query somewhere?

Syl...

Dark_Wizard 08-12-2003 07:00 PM

You forgot the <" in front of select...

g-force2k2 08-12-2003 07:09 PM

Code:

UPDATE setting SET optioncode='<select name=\"setting[\$setting[allowmultiregs]]\">
<option value=\"0\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\"1\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\"2\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs'

you have to escape the variables as well...

regards,
g-force2k2

Dark_Wizard 08-12-2003 07:22 PM

Quote:

Today at 05:09 PM g-force2k2 said this in Post #9
Code:

UPDATE setting SET optioncode='<select name=\"setting[\$setting[allowmultiregs]]\">
<option value=\"0\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\"1\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\"2\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs'

you have to escape the variables as well...

regards,
g-force2k2


Actually it should be:
Code:

UPDATE setting SET optioncode='<select name=\\"setting[\$setting[allowmultiregs]]\\">
<option value=\\"0\\" \".iif(\$setting[value]==0,\"selected\",\"\").\">NO - Dont allow multiples</option>
<option value=\\"1\\" \".iif(\$setting[value]==1,\"selected\",\"\").\">YES - allow multiples</option>
<option value=\\"2\\" \".iif(\$setting[value]==2,\"selected\",\"\").\">YES - but track multiples</option></select>' WHERE varname='allowmultiregs'



All times are GMT. The time now is 03:10 AM.

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.02496 seconds
  • Memory Usage 1,748KB
  • 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
  • (11)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete