Jump to content


Photo

Connect to MySQL Problems


  • Please log in to reply
4 replies to this topic

#1 tbraley

tbraley
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 April 2006 - 01:24 PM

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

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 05 April 2006 - 02:12 PM

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

#3 tbraley

tbraley
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 April 2006 - 02:23 PM

Thanks wildteen88,
How I missed that I'll never know. But that did it.

Terry

#4 tbraley

tbraley
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 April 2006 - 03:36 PM

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?

#5 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 05 April 2006 - 06:08 PM

Are the files that you're adding
<? include ("access_control.php"); ?>
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:
<? include ("../access_control.php"); ?>

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users