Jump to content


This topic is now archived and is closed to further replies.


Connect to MySQL Problems

Recommended Posts

First I got this zip file from:
[a href=\"http://www.oscommerce.com/community/contributions,3062/category,5/search,password_protection.zip\" target=\"_blank\"]http://www.oscommerce.com/community/contri..._protection.zip[/a]

The readme file tells me to edit the config.php files to match my database. So I created a database in MySql and added the correct lines in the Config.phhp files. I uploaded the folder to my server and went to the intall file and I get an error telling me:
"Can't create database 'password'. Database exists"
Well, Yea. Thats what I thought I was I need to do.
What is the problem? Any Ideas?

Thanks, Terry

Share this post

Link to post
Share on other sites
I think you may have missed a step. if you look in admin/config.php file you should of noticed this line:
[code]$database_exists = 0;            // Set to 1, before installing, if database exists[/code] if you change 0 to 1 and save the config.php file you should be able to install whatever you're installing.

Share this post

Link to post
Share on other sites
Thanks wildteen88,
How I missed that I'll never know. But that did it.


Share this post

Link to post
Share on other sites
Well I got that working. Now it tell me to add :
To password protect any file, add this line of code to the top of the very top of the file:
<? include ("access_control.php"); ?>

On the page I wnt to protect I added this line. I tried adding it before the <?php and after the <?php
If you add it after the <?php all I get is an error page telling me theres an error on line (2) <the code.

Do the files I want to protect have to be in the same folded as the password protect folder or can the be in seperate folder. Here what I have:
A folder thats called password_protect. < admin area and all. Works fine.
A folder called photoalbum. In side this folder is picture.php that I want to protect. I added the code from above but it didn't seem to work. So I moved the "photoalbum folder" into the "password_protect folder" but that didn't seem to help.

Any suggestion?

Share this post

Link to post
Share on other sites
Are the files that you're adding
[code]<? include ("access_control.php"); ?>[/code]to in the same folder as access_control.php?

If they then that code is file, but if you add that code to a file that is not in the same folder as access_control.php you will need to do this instead:
[code]<? include ("../access_control.php"); ?>[/code]

NOTE you dont need to use that code in every file but only the pages you want password protected.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.