Re: [PHP] how to hide dbconnect file if its in publisheddirectory?

2001-07-10 Thread Thomas David Kehoe

The suggestion to use the .php extension instead of the .inc extension
doesn't work.  

I created to identical files, swordfish.php and swordfish.inc, containing
the following script:

?php
define(PASSWORD, swordfish);
?

When I use the following lines

include ('http://www.friendshipcenter.com/Objects/swordfish.inc');
echo Your password is , PASSWORD;

it works, i.e., prints Your password is swordfish.

When I use the following lines

include ('http://www.friendshipcenter.com/Objects/swordfish.php');
echo Your password is , PASSWORD;

it doesn't work, i.e., prints Your password is PASSWORD.

I tried putting swordfish.inc in my cgi-bin directory, which is outside my
www directory.  I can't figure out what pathname to call it with.  I.e.,

include ('cgi-bin/swordfish.inc');

can't find the file.

As I wrote earlier, my .inc files can be read by anyone typing in the URL.
It doesn't matter if there are ?php ? lines.  .inc files don't execute.

I rent server space from phpwebhosting.com, so I can't change the PHP
settings.

Any other ideas how to hide a password file?
-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Hiding password in a class file (object-oriented programming)?

2001-07-09 Thread Thomas David Kehoe

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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Missing arguments for function in class? (object-orientedprogramming)

2001-06-27 Thread Thomas David Kehoe

I have a function that works perfectly (from within a script).  But when I
make it a class (object) and call it from an external file, I get the
following error:

Warning: Missing argument 1 for display_records() in
http://www.friendshipcenter.com/Objects/display_records.inc on line 5

Warning: Missing argument 2 for display_records() in
http://www.friendshipcenter.com/Objects/display_records.inc on line 5

After the warnings, it executes the function without passing values to the
variables (i.e., it doesn't work), and then it executes the function a
second time perfectly (with the appropriate variables).

Line 5 is this: 

function display_records($row, $record_count)

It displays the first error message for $row, and the second error message
for $record_count.

I call the function with this:

$my_records = new Display_Records;
$my_records - display_records($row, $record_count);

The full scripts are below.

What I tried that didn't help was declaring the variables in the class with:

class Display_Records {

var $row;
var $record_count;

I also tried setting defaults for the variables (er, attributes) with this
(it didn't help):

$my_records = new Display_Records;
$my_records - row = $row;
$my_records - record_count = 1;
$my_records - display_records($my_records - row, $my_records -
record_count);

This is my first try at OOP.  The code is for a personal ad website
(FriendshipCenter.com).  Here's the full class script, followed by the
script I use to call the function.
-- 
Thomas David Kehoe, author of
THE EVOLUTION OF INTIMATE RELATIONSHIPS
How Our Brains Are Hardwired For Relationships
http://www.FriendshipCenter.com/TEIR/






?php

class Display_Records {

function display_records($row, $record_count) {

//Calculate age
$current_date = (date(Y-m-d));
$birthdate = $row[BIRTHDATE];
$age = ($current_date - $birthdate);

// Display record number.
echo Row number:nbsp;, ($record_count + $advance_row), p;

// Display username and e-mail address
echo font color=greenUsername: /font, $row[USER_NAME],
p;
echo font color=greenE-mail address: /fonta href=mailto:;,
$row[EMAIL_ADDRESS], , $row[EMAIL_ADDRESS], /ap;

// Display the information provided by the member.  Empty fields
aren't displayed.
if ($row[DISABILITY_1 OR DISABILITY_2 OR DISABILITY_3 OR
DISABILITY_4 OR DISABILITY_5 OR DISABILITY_6 OR DISABILITY_7 OR
DISABILITY_8]) {echo font color=greenDisability, disease, or condition:
/font, $row[DISABILITY_1], , , $row[DISABILITY_2], , ,
$row[DISABILITY_3], , , $row[DISABILITY_4], , , $row[DISABILITY_5], ,
, $row[DISABILITY_6], , , $row[DISABILITY_7], , , $row[DISABILITY_8],
p;}
if ($row[LIFE_STORY]){echo font color=greenLife story:
/font, $row[LIFE_STORY], p;}
if ($row[PHOTO_URL]){echo IMG HEIGHT=250 SRC=,
$row[PHOTO_URL], p;}
if ($row[PHOTO_URL]){echo font color=greenPhoto URL: /fonta
href=, $row[PHOTO_URL], , $row[PHOTO_URL], /ap;}
if ($row[HOMEPAGE_URL]){echo font color=greenPersonal website
URL: /fonta href=, $row[HOMEPAGE_URL], , $row[HOMEPAGE_URL],
/ap;}
if ($row[CITY]){echo font color=greenCity: /font,
$row[CITY], p;}
if ($row[STATE]){echo font color=greenState: /font,
$row[STATE], p;}
if ($row[COUNTRY]){echo font color=greenCountry: /font,
$row[COUNTRY], p;}
if (($row[BIRTHDATE]) != -00-00) {echo font
color=greenAge: /font, $age, p;}
if ($row[GENDER]){echo font color=greenGender: /font,
$row[GENDER], p;}
if ($row[EDUCATION]){echo font color=greenEducation: /font,
$row[EDUCATION], p;}
if ($row[PROFESSION]){echo font color=greenProfession:
/font, $row[PROFESSION], p;}
if ($row[MARITAL_STATUS]){echo font color=greenMarital status:
/font, $row[MARITAL_STATUS], p;}
if ($row[SEXUAL_ORIENTATION]){echo font color=greenSexual
orientation: /font, $row[SEXUAL_ORIENTATION], p;}
if ($row[RELIGION]){echo font color=greenReligion: /font,
$row[RELIGION], p;}
if ($row[RACE]){echo font color=greenRacial or ethnic group:
/font, $row[RACE], p;}
if ($row[HEIGHT]){echo font color=greenHeight: /font,
$row[HEIGHT],  inchesp;}
if ($row[WEIGHT]){echo font color=greenWeight: /font,
$row[WEIGHT],  poundsp;}
if ($row[SMOKING]){echo font color=greenSmoking: /font,
$row[SMOKING], p;}
if ($row[DRINKING]){echo font color=greenDrinking: /font,
$row[DRINKING], p;}
if ($row[LANGUAGE]){echo font color=greenLanguage: /font,
$row[LANGUAGE], p;}

// Display banner ad.
echo centeriframe
src=http://leader.linkexchange.com/1/X1258133/showiframe? width=468
height=60 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0
scrolling=noa href=http://leader.linkexchange.com/1/X1258133/clickle
target=_topimg width=468 height=60 border=0 ismap
src=http://leader.linkexchange.com/1/X1258133