Re: Hiding password in a class file (object-oriented programming)?
| From: | Ben Bleything | Date: | Mon, 09 Jul 2001 22:47:57 +0000 |
| Subject: | Re: Hiding password in a class file (object-oriented programming)? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57030@lists.php.net to get a copy of this message | ||
put <?php ?> tags around the file you include, and it
will parse it as PHP =>
I'm doing this now. I have a bunch of files in a subdir
of the published directory, that contain functions and
definitions to do these things, and I include them at
the beginning of each file. But, you do need <?php ?>
tags around the includes.
=>
Ben
Quoting Thomas David Kehoe <kehoe@casafuturatech.com>:
> How do I put my password into an external
> file?
>
> I have dozens of webpages with the line
>
> mysql_connect (localhost, username,
> password);
>
> What if I have to change my password? Rather
> then change dozens of scripts,
> I want to put this line into an external file
> and call it with "include".
>
> The problem is security. If I make the file a
> class, then the file
> extension must be .inc. Anyone can type in the
> URL and see the contents of
> the file.
>
> I've tried these solutions, without success:
>
> Changing the permission to "everyone-execute"
> and "owner-read" doesn't work,
> apparently because a .inc file is read, not
> executed.
>
> Using the .php file extension (instead of .inc)
> executes the script when the
> URL is accessed. The user sees nothing, if the
> file contains no HTML. But
> class only works with the .inc extension. Using
> "include" without making a
> class treats the file as HTML and it doesn't
> execute.
> --
> Thomas David Kehoe, author of
> "THE EVOLUTION OF INTIMATE RELATIONSHIPS"
> How Our Brains Are Hardwired For Relationships
> http://www.FriendshipCenter.com/TEIR/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
>