PDA

View Full Version : addon domain subdirectory with mysql fails after good first page



suzan24k
12-26-2007, 09:23 PM
Hello,

I'm new to hostmonster and I'm having problems with an addon domain's subdirectory.

The addon domain name is www.suzank.com which at this lowest level isn't set up yet. I have a php/mysql recipe application that I want to work in the subdirectory of www.suzank.com/recipes.

Initially, everything looks good. The index.php page renders perfectly including calls to the MySQL to return recipe category names and record counts. The problem is once I click on a link, the follow up pages don't render. This is working code that I'm transferring from another host. I have seen this problem on another host when the subdirectory was beneath a drupal site and I couldn't figure it out there too. What I did to fix was move the recipe application from underneath the drupal site to file location not under a drupal site. I would like to add that the primary domain I have here on hostmonster is a drupal site, but I am hoping that it won't affect this addon domain.

I have tried tweaking the .htaccess files to no avail. I can't see how my application configuration is wrong since the mysql database calls retrieve properly on the first page. I believe that I should only need to work in the app's config file since all the php code references the config file.

I hope that makes sense to someone and that they know the fix. Seems like something a little trickier than what I know to fix and researching this problem's solution has also been very challenging. Please let me know any ideas on what to fix and if any code should be posted.

Much appreciation.

Suzan

linFox
12-26-2007, 11:14 PM
To start with, the series of 'Use of undefined constant' errors indicate that Array values are being called wrong.
You should always use quotes around a string array index. If you don't, PHP will think the string is a constant and as a result, output those errors and cause a bit of havoc.

Correct that first and try again (to do this, change the array calls from $array[example] to $array['example'] in vars_gbl.php on lines 15 through 22)

There is also one other error, showCat.php on line 23. A variable doesn't exist which apparently should. From the name, you should check that your cookies are being set and saved right.

suzan24k
12-27-2007, 10:08 AM
Thanks for looking. I corrected all of the notices that in the past had not affected the functionality. After correcting the notices, I notice that I still have the same problems.

Do you think that this php or MySQL code may be incompatible to the PHP on hostmonster? Even though the first page's php and mysql work.

By the way, I just added the error reporting php line of code to help identify any php errors that might be in the way.

Thanks for prompting me to correct the notices.

suzan24k
12-27-2007, 02:02 PM
Fixed. My genius nephew came to my rescue to help me troubleshoot. Turns out that the PHP version here on hostmonster requires that I update the php.ini file to include this statement below to pass variables between pages. This is what broke my application. With this statement all is well again.

register_globals = On

Much appreciation to my nephew Levent.

Suzan

r2b2
12-27-2007, 03:16 PM
Be careful - register_globals is extremely dangerous as it makes it easy for people to inject data into your application.

You should really see if you can get a version that doesn't rely on register_globals being turned on (i.e. a properly written app :D )

suzan24k
12-27-2007, 04:21 PM
Oh Great! I got the code off sourceforge a few years back. Guess I may have to figure out the code fixes. The good thing is that I don't have sensitive information in the recipe database or the site. At least, I hope nothing in the recipes database is sensitive.

Thank you for the alert.

shadmego
12-27-2007, 05:56 PM
Your database information might not be sensitive, but if someone can inject code into your database based on your current settings, they can potentially upload a virus to your website, and that would make you persona-non-grata with HM and all your users.

I would work very hard at getting this script updated as quickly as possible to plug the glaring security hole in your site right now ...

Not to make you nervous or anything .... ;)

~regards, and welcome to the Community!!!