PHP Permissions / MySQL Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ast3r3x
Forum Commoner
Posts: 95
Joined: Thu Aug 19, 2004 8:36 pm

PHP Permissions / MySQL Error

Post by ast3r3x »

I'm building a website for my friends so they will stop using xanga.com, but besides running into several problems I can't say I have the slightest how to resolve.

First, since I'm going to have many user accounts with their own directory, how do I stop a script running in swigg.net/ast3r3x/ from messing anything up in swigg.net/ or any other directory that isn't inside of swigg.net/ast3r3x?

My second MySQL question is when I try to connect to my database it works, but when I try to query I get problems when I try to include() my database connect information. Normally I have this in my scripts...

Code: Select all

$link = mysql_connect('localhost', 'ast3r3x', 'pass'); 
if(!$link) 
{ 
    die('Not connected : ' . mysql_error()); 
} 

$db = mysql_select_db('swigg', $link); 
if(!$db) 
{ 
    die ('Can''t use foo : ' . mysql_error()); 
}
...and that works. But since I don't want to be repetitious, I normally like to take code like that and put it into a file, and then

Code: Select all

include("include/dbconenct.php");
But for some reason, when I use the include(), I get this error...
"Invalid query: Access denied for user: 'ast3r3x@localhost' (Using password: NO)"
I guess the main problem is that I am not using a password, but I have a password in there, so I don't know why it says that.

Any ideas on either of my painfully annoying problems?
ast3r3x
Forum Commoner
Posts: 95
Joined: Thu Aug 19, 2004 8:36 pm

Post by ast3r3x »

Well I fixed my one problem by just turning it into a function, and calling the function in the dbconnect.php file, so I can still include it like normal.

So now...any ideas on how to stop scripts from mucking my system? Should I just not allow the users to upload files that end in .php?
Post Reply