vb.org Archive

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

geniuscrew 05-15-2002 04:08 PM

help with PHP
 
Hi

I'm trying to modify neo's 'admin avatar size' hack.

I'm changing it so that mods have different sizes to admins.

Could someone please tell me what is wrong this code (I'm gussing it's the wasy I structured it:

PHP Code:

 if ($bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==5) {
    
$customtext "Note: the maximum size of your custom image is $amw in width by $amh in height or $amfs bytes (whichever is smaller).";
  } else {
    
$customtext "Note: the maximum size of your custom image is $mmw in width by $mmh in height or $mmfs bytes (whichever is smaller).";
  } else {
    
$customtext "Note: the maximum size of your custom image is $avatarmaxdimension by $avatarmaxdimension pixels or $avatarmaxsize bytes (whichever is smaller).";
  } 

Thanx

Xenon 05-15-2002 04:29 PM

you cannot make a second else clause after one.
you must make it more specific like this:

PHP Code:

if ($bbuserinfo[usergroupid]==7) {
    
$customtext "Note: the maximum size of your custom image is $amw in width by $amh in height or $amfs bytes (whichever is smaller).";
} else {
  if (
$bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==5) {
    
$customtext "Note: the maximum size of your custom image is $mmw in width by $mmh in height or $mmfs bytes (whichever is smaller).";
  } else {
    
$customtext "Note: the maximum size of your custom image is $avatarmaxdimension by $avatarmaxdimension pixels or $avatarmaxsize bytes (whichever is smaller)."
  }


this should work

geniuscrew 05-15-2002 04:44 PM

Thanx xenon, that works :)

Now i've applied the same format to a piece of code to get this :

PHP Code:

if ($bbuserinfo[usergroupid]==6) {
        if (
$filesize>$amfs) {
          eval(
"standarderror(\"".gettemplate("error_avatartoobig")."\");");
          
// file size too big
          
exit;
        }
      } else {
    if (
$bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==5) {
         if (
$filesize>$mmfs) {
          eval(
"standarderror(\"".gettemplate("error_avatartoobig")."\");");
          
// file size too big
          
exit;
    }
      } else {
        if (
$filesize>$avatarmaxsize) {
          eval(
"standarderror(\"".gettemplate("error_avatartoobig")."\");");
          
// file size too big
          
exit;
        }
      } 

Is it correct?

Thanx again

Xenon 05-15-2002 04:53 PM

this code is correct, but you have forgotten an } at the end.

i cant see any other error

geniuscrew 05-15-2002 04:58 PM

Thanx that works too but one more error lol

towards the end at about line 1549

[PHP]
}

?>
[/PHP

There is another error.

Thankyou very much for your help

Xenon 05-15-2002 05:02 PM

what is the errormessage exactly?

errors in the last lines ar often } too much or too less :)

perhaps you haven't forgotten this } of my last post in your code, but have forgotten it in your post here :)

geniuscrew 05-15-2002 07:07 PM

it's not working still :(

The message i get is:

Parse error: parse error in /home/charmed/public_html/forums/member.php on line 1550

geniuscrew 05-15-2002 07:49 PM

Actually i got it working now :)

Vielen danken fur deine Hilfe Xenon!


Bye!

Xenon 05-15-2002 08:02 PM

fine :)

i'm glad i could help you :)

Nutt 05-15-2002 11:33 PM

PHP Code:

if ($bbuserinfo[usergroupid]==6) {

        if (
$filesize>$amfs) {
          eval(
"standarderror(\"".gettemplate("error_avatartoobig")."\");");
          
// file size too big
          
exit;
        }

} elseif (
$bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==5) {

        if (
$filesize>$mmfs) {
          eval(
"standarderror(\"".gettemplate("error_avatartoobig")."\");");
          
// file size too big
          
exit;

      } elseif (
$filesize>$avatarmaxsize) {
          eval(
"standarderror(\"".gettemplate("error_avatartoobig")."\");");
          
// file size too big
          
exit;

      }


You could have used a elseif statement


All times are GMT. The time now is 10:09 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.01162 seconds
  • Memory Usage 1,760KB
  • 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)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