3.9.8. Security code is not showing up

Figure 3-28. Security code in the User Login screen.

Security code in the User Login screen.

Security code in the User Login screen.



You just installed PHP-Nuke for the first time, created a super user, and you can't log in because the security code graphic (see Figure 3-28) is coming up as a dead image.Inline graphic

This is a frequent error, but it seems that the reasons (and cures) may be multiple (see Security code graphic not showing up, security image stopped working):

Figure 3-29. phpinfo(): GD library information.

phpinfo(): GD library information.

phpinfo(): GD library information.



For more thoughts on this problem, read Humpa's PHP-Nuke FAQ on the security code.

If you want to use a PNG or GIF image for the security code, consult the solution in Using a png or gif for security code image. If you want to display the security code as text, rather than an image, see security code in plain text format - but then there is no point to it (the idea is to display an image that makes automatic number recognition difficult to robots), then you can disable it just as well.

Figure 3-30. analyze.php: GD library information.

analyze.php: GD library information.

analyze.php: GD library information.



3.9.8.1. How to bypass the security code

Another approach could be to bypass the security code altogether. This is probably the only option you have (unless you are willing to display it as plain text - see the links at the end of this section for this), if your ISP refuses to load the GD library: without GD, no security code image - without security code image, you cannot enter anything in the security code field, and you get an "Access denied" error.

Here is how you disable the security code:

Find the 7 occurences of:

extension_loaded("gd")

For the Admin login, there is one in the admin.php, and one in the auth.php. For Users, there will be five in the modules/Your_Account/index.php (and there might be one in the block-Login.php, and/or one in the block-User_Info.php, if they are modified). Replace all of the occurances with this:

$user == "whatever"

Follow the above instruction exactly.

Caution Be careful not to introduce syntax errors!
 

Changes like the last one (bypassing the security code) require extreme caution on your part. All too big is the risk of introducing new errors, while trying to correct old ones! If you get an error, it does't mean the solution ceased to work for you. Check for syntax errors that you might have introduced with your editing. Most probably, you will find something. Inline graphic See syntax error, security modules/PHP-Nuke_HOWTO/images removed for a real world example.

If you have one of the later versions of PHP-Nuke, you can try a trick: edit the config.php file and if you find a line there, like this one:

$gfx_chk = 7;

and change it to (see How to disable the security code):

$gfx_chk = 0;

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