You are missing our premiere tool bar navigation system! Register and use it for FREE!

•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
· Home
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 300 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Forums Error: Can't create a category without a name

3.10.4. Forums Error: Can't create a category without a name

You want to create a category in the Forum (see Section 7.1.1), but you get the error:

General Error 
Can't create a category without a name

Your strategy in coping with error messages, in case your error is not obvious or not well explained by the message, is to search the whole code tree for the error text (just as you would search for a link text in Section 26.5). In this case, it turns out that there is only one occurence, in modules/Forums/admin/admin_forums.php:

case 'addcat':
        // Create a category in the DB
        if( trim($HTTP_POST_VARS['categoryname']) == '')
                message_die(GENERAL_ERROR, "Can't create a category without a name");

As you can easily see, the error is issued if the category name contains only "white space"[1] (which is what the PHP trim function strips from the beginning and end of a string), in simple words: if you did not enter any name for the category. Logical, isn't it?

But what happens if you swear that you did enter a name there? Isn't this error going to drive you nuts then?

In such situations, you should keep your calmness and try to think further than the obvious: what could be happenning behind the scenes in PHP-Nuke? Here are some possibilities (see Can't create a category without a name):

  1. You entered an empty name - O.K., you already checked that, but let's include it, just for the sake of completeness. This means that $HTTP_POST_VARS['categoryname'], the value of the POST variable that holds the category name, is empty, or contains at most some white space.

  2. Your browser does not send POST variables back to the server, e.g. it does not support forms. Also quite unlikely.

  3. $HTTP_POST_VARS['categoryname'] was not empty when it arrived at PHP-Nuke, but PHP-Nuke changed it. In fact, PHP-Nuke subjects the POST and GET variables to some sanity checks (see Section 23.4.3 for details), to see if they contain malicious code. If your category name contained any "forbidden" characters, it may be that some check routine in PHP-Nuke deleted it. Try a name that will not raise suspicions of SQL injection (Section 23.3.2) and similar attacks.

  4. You are logged in as the administrator and as a user. In this case, you browser has stored two cookies (Section 23.4.5) on your computer and it is not clear under what ID your action has been evaluated by PHP-Nuke. Try to avoid such situations. If you must me logged in as both a user and an administrator at all costs, you might try to use two different browsers for each ID (not two instances of the same browser, but two different products). They will store the cookies in different locations and will (hopefully) not mess them up.

Of course, YMMV.



"White space", in the setting of the PHP trim(), function can contain only the following characters:

  • " " (ASCII 32 (0x20)), an ordinary space.

  • "\t" (ASCII 9 (0x09)), a tab.

  • "\n" (ASCII 10 (0x0A)), a new line (line feed).

  • "\r" (ASCII 13 (0x0D)), a carriage return.

  • "\0" (ASCII 0 (0x00)), the NUL-byte.

  • "\x0B" (ASCII 11 (0x0B)), a vertical tab.

Help us make a better PHP-Nuke HOWTO!

Want to contribute to this HOWTO? Have a suggestion or a solution to a problem that was not treated here? Post your comments on my PHP-Nuke Forum!

Chris Karakas, Maintainer PHP-Nuke HOWTO

Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.078 Seconds - 210 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded ( ::