vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Using | as a separator (https://vborg.vbsupport.ru/showthread.php?t=188947)

TheInsaneManiac 08-24-2008 03:44 AM

Using | as a separator
 
I seem to have run into a snag with my product. Everything had been going smoothly using the current "|" script I have, but for some reason I can't figure out how to make allowedids be able to separate with the "|"

PHP Code:

$valid_ids $vbulletin->options['allowedids'];
if (
$vbulletin->userinfo['userid'] != $valid_ids

I also tried someone elses way:

PHP Code:

$valid_ids explode("|"$vbulletin->options['allowedids']);
if (
$vbulletin->userinfo['userid'] != $valid_ids

No success yet. Suggestions?

Digital Jedi 08-24-2008 03:54 AM

Will using the ASCII code for the pipe work? & # 1 2 4 ;

RLShare 08-24-2008 04:59 AM

explode returns an array of the elements that were seperated by the '|' therefore you should use the in_array function to check and see if the ID is in the array.

PHP Code:

$valid_ids explode("|"$vbulletin->options['allowedids']);
if (!
in_array($vbulletin->userinfo['userid'], $valid_ids))
{
//userid not in the option



TheInsaneManiac 08-24-2008 02:44 PM

Quote:

Originally Posted by RLShare (Post 1605536)
explode returns an array of the elements that were seperated by the '|' therefore you should use the in_array function to check and see if the ID is in the array.

PHP Code:

$valid_ids explode("|"$vbulletin->options['allowedids']);
if (!
in_array($vbulletin->userinfo['userid'], $valid_ids))
{
//userid not in the option



Thanks man. It worked. I remember trying an array to do it, but still couldn't get it to work. Maybe I missed something, I don't know. Anyway thanks a lot!


All times are GMT. The time now is 06:33 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.01119 seconds
  • Memory Usage 1,728KB
  • 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
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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