[PHP-DB] Include File Syntax

2001-04-26 Thread James McLaughlin

This is my first time programming with PHP.  I have seen include files in
the beginning of a php block and wonder is there a specific syntax used in
these files and how secure this is vs code in my .php page?

Can someone show me a small example of what the include file might look like
that would contain variables for  $mysql server, $username $password and
$db_name.

Any comments you may have about security involving files containing these
variables and where to store them would be greatly appreciated.



Thanks In Advance.


Kat


-- 
PHP Database 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]




RE: [PHP-DB] Include File Syntax

2001-04-26 Thread Steve Brett

hi kat,

the include files are simply a way for repetitive code (like a connection to
a db) to be inserted into your pages.

the syntax for the files is the same as any php script and it is added to
the page at the point that you include it.

the format is 

include (page_name.php);

the pages that are included are as secure as your scripts.

Steve

 -Original Message-
 From: James McLaughlin [mailto:[EMAIL PROTECTED]]
 Sent: 26 April 2001 08:15
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Include File Syntax
 
 
 This is my first time programming with PHP.  I have seen 
 include files in
 the beginning of a php block and wonder is there a specific 
 syntax used in
 these files and how secure this is vs code in my .php page?
 
 Can someone show me a small example of what the include file 
 might look like
 that would contain variables for  $mysql server, $username 
 $password and
 $db_name.
 
 Any comments you may have about security involving files 
 containing these
 variables and where to store them would be greatly appreciated.
 
 
 
 Thanks In Advance.
 
 
 Kat
 
 
 -- 
 PHP Database 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 Database 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-DB] I'm using mysql. How can i resolv this error?.

2001-04-26 Thread hansol

This is Sample:

$conn= mysql_connect(localhost,login,passwd) or die (ERREUR de
connexion au Serveur);
$result = mysql($conn, SELECT id, name, salary FROM employees);

But,Error appear.

supplied argument is not a valid mysql/Link resource in line xx





-- 
PHP Database 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-DB] Query problem cont'd..

2001-04-26 Thread Russ Michell

Hi there:

I'm stil having problems with this query in that it doesn't bring up any results!
Here is the select menu that refreshes the page and deposites the var: 'sortedBy' 
into play:

form
select name=\sortMonth\ onChange=\MM_jumpMenu('parent',this,0)\;
option--select one--/option
option value=\$PHP_SELF?sortedBy=Jan\Jan/option
option value=\$PHP_SELF?sortedBy=Feb\Feb/option
option value=\$PHP_SELF?sortedBy=Mar\Mar/option
option value=\$PHP_SELF?sortedBy=Apr\Apr/option
option value=\$PHP_SELF?sortedBy=May\May/option
option value=\$PHP_SELF?sortedBy=Jun\Jun/option
option value=\$PHP_SELF?sortedBy=Jul\Jul/option
option value=\$PHP_SELF?sortedBy=Aug\Aug/option
option value=\$PHP_SELF?sortedBy=Sep\Sep/option
option value=\$PHP_SELF?sortedBy=Oct\Oct/option
option value=\$PHP_SELF?sortedBy=Nov\Nov/option
option value=\$PHP_SELF?sortedBy=Dec\Dec/option
/select
/form

The SQL qery:

if(
($sortedBy == 'Jan') || ($sortedBy == 'Feb') || ($sortedBy == 'Mar') || 
($sortedBy == 'Apr') || ($sortedBy == 'May') || ($sortedBy == 'Jun') ||
($sortedBy == 'Jul') || ($sortedBy == 'Aug') || ($sortedBy == 'Sep') || 
($sortedBy == 'Oct') || ($sortedBy == 'Nov') || ($sortedBy == 'Dec')
) 
{
$sql = SELECT * FROM $table_cal WHERE item_activity='$id' AND 
DATE_FORMAT('item_date','%b')='$sortedBy'; 
}

Thanks to Rasmus for helping me out so far!
Can anyone see what I may be doing wrong???

I'm using mysql-3.22.32 and the item_date column is a MySQL DATE() column..

Cheers:
Russ

#---#

 Believe nothing - consider everything
   Web Developers do it on-the-fly.

  Russ Michell
  Anglia Polytechnic University Webteam
  
  e: [EMAIL PROTECTED]
  w: www.apu.ac.uk/webteam
  t: +44 (0)1223 363271 x 2331

  www.theruss.com

#---#


-- 
PHP Database 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]




RE: [PHP-DB] Query problem cont'd..

2001-04-26 Thread Steve Brett

ok. try this.
ahven't tested it though ...

 form name=thisForm action = ?php print $PHP_SELF ?
 
?php

// to dump out the months
$months = Array(January, February, March, April, May, June,
July, August, September, October, November, December);
echo 'select name=sortMonth onChange=document.thisForm.Submit()';
for ($x=1; $x = count($months); $x++)
{
print \toption value=\$x\ ;
print ($x == $month) ?  SELECTED: ;
print .$months[$x-1].\n;
}
echo ' /select ';

?

then something like (pref before the dump of months)

?php

if (isset($sortMonth))
{
 $sql = SELECT * FROM $table_cal WHERE item_activity='$id' AND 
 DATE_FORMAT('item_date','%b')='$sortMonth';

// then the rest of the code for the query

}


the real crux is that the var whihc is the name of the select will be
populated when the form refreshes and then isset() will say it has a value
and drop inside to create the query. that way you avoid an expensive if or
or or or ...



Steve 

 -Original Message-
 From: Russ Michell [mailto:[EMAIL PROTECTED]]
 Sent: 26 April 2001 10:50
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Query problem cont'd..
 
 
 Hi there:
 
 I'm stil having problems with this query in that it doesn't 
 bring up any results!
 Here is the select menu that refreshes the page and 
 deposites the var: 'sortedBy' into play:
 

 option--select one--/option
 option value=\$PHP_SELF?sortedBy=Jan\Jan/option
 option value=\?sortedBy=Feb\Feb/option
 option value=\$PHP_SELF?sortedBy=Mar\Mar/option
 option value=\$PHP_SELF?sortedBy=Apr\Apr/option
 option value=\$PHP_SELF?sortedBy=May\May/option
 option value=\$PHP_SELF?sortedBy=Jun\Jun/option
 option value=\$PHP_SELF?sortedBy=Jul\Jul/option
 option value=\$PHP_SELF?sortedBy=Aug\Aug/option
 option value=\$PHP_SELF?sortedBy=Sep\Sep/option
 option value=\$PHP_SELF?sortedBy=Oct\Oct/option
 option value=\$PHP_SELF?sortedBy=Nov\Nov/option
 option value=\$PHP_SELF?sortedBy=Dec\Dec/option
 /select
 /form
 
 The SQL qery:
 
 if(
 ($sortedBy == 'Jan') || ($sortedBy == 'Feb') || ($sortedBy == 
 'Mar') || 
 ($sortedBy == 'Apr') || ($sortedBy == 'May') || ($sortedBy == 
 'Jun') ||
 ($sortedBy == 'Jul') || ($sortedBy == 'Aug') || ($sortedBy == 
 'Sep') || 
 ($sortedBy == 'Oct') || ($sortedBy == 'Nov') || ($sortedBy == 'Dec')
 ) 
 {
 $sql = SELECT * FROM $table_cal WHERE item_activity='$id' AND 
 DATE_FORMAT('item_date','%b')='$sortedBy'; 
 }
 
 Thanks to Rasmus for helping me out so far!
 Can anyone see what I may be doing wrong???
 
 I'm using mysql-3.22.32 and the item_date column is a MySQL 
 DATE() column..
 
 Cheers:
 Russ
 
 #---#
   
  Believe nothing - consider everything  
Web Developers do it on-the-fly.
   
   Russ Michell
   Anglia Polytechnic University Webteam
   
   e: [EMAIL PROTECTED]
   w: www.apu.ac.uk/webteam
   t: +44 (0)1223 363271 x 2331
 
   www.theruss.com
   
 #---#
 
 
 -- 
 PHP Database 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 Database 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]




RE: [PHP-DB] Sending the user their forgotten password via emal??

2001-04-26 Thread SOHH.com Webmaster

What I've done is I set up an INPUT box on the site, where you type in your
e-mail address.  Upon hitting submit, I query the database looking for the
persons e-mail address.  If it's there, I send it to them, if not I inform
them that they aren't in the database.  This is the code I use for
http://www.sohh.com/wireless

Hope this helps.

if ($email) {

$db = vb114;

include(../application_db_connect.php);

$query_checkemail = SELECT user.* FROM user WHERE user.email  = '$email';

$result_checkemail = mysql_query($query_checkemail);

if (!$result_checkemail) {

echo(Error performing query:   . mysql_error());

exit;

}

$recordcount_checkemail = mysql_num_rows($result_checkemail);

if ($recordcount_checkemail) {

while($row_checkemail = mysql_fetch_array($result_checkemail)) {

$username = $row_checkemail[username];

$password = $row_checkemail[password];

$mail_to = trim($email);

$mail_headers = From: [EMAIL PROTECTED]\r\nReply-to:
[EMAIL PROTECTED];

$mail_subject = Your login details for SOHH.com:;

$mail_body .= Username = $username\n;

$mail_body .= Password = $password\n\n;

$mail_body .= Don't forget that they are case sensitive!\n\n;

$mail_body .= To sign up to SOHH Wireless, go to:\n;

$mail_body .= http://www.upoc.com/sohh/\n\n;;

$mail_body .= Yours,\n\n;

$mail_body .= SOHH.com Team\n\n;

mail($mail_to, $mail_subject, $mail_body, $mail_headers);

$message = pYour e-mail address, b$email/b, is already 
in our
database.  This means you are already a member of SOHH.com and can join SOHH
Wireless./pnoscriptpYou're ready to a href=\upoc_offer.php\
target=\_top\sign up for SOHH Wireless!/a/p/noscriptpFor future
reference, we have sent your username and password to b$email/b./p;

}

} else {

$message = pYour e-mail address, b$email/b, is not in our 
database.
This means you are not a member of SOHH.com.  a
href=\sign_up.php?username=guestpassword=guest\You should join
now!/a/p;

}

} else {

$message = pYou didn't enter your e-mail address!/p;

}

-Original Message-
From: DC [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 26, 2001 12:04 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Sending the user their forgotten password via emal??


Hi all

I would like to offer my users the chance to have their username and
password sent to them via the email address stored.

As i see it i have two issues

(1) how do i do the verify email thing where the script send a click here to
confirm email address on registration application

(2) how do i then send their details (username / password) to the confirmed
stored email address.

I have looked around but cqnt find the answer.

5 books on the shelf give no clue either

Any help is most apreciated

Thanks in Advance

Dave C



--
PHP Database 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 Database 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]




Re: [PHP-DB] mail system

2001-04-26 Thread Andreas D. Landmark

At 26.04.2001 16:20, you wrote:
I was wondering if anyone had any ideas on how I can setup a email system ,
internal using php and mysql only .. No Imap Server, or POP. Can someone
please guide me in the right direction ,, this is email sysetm would be only
for registered members. I am setting up a dating site.. Any help would be
appreciated

Thank You

Store the email in some form of storage (database would be preferable) and then
use queries to fetch the mail.

To send mail just insert an entry into the table holding the mail.



-- 
andreas landmark / noXtension
[EMAIL PROTECTED]
We are Pentium of Borg.  Division is futile.  You will be approximated.


-- 
PHP Database 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]




Re: [PHP-DB] file and mail

2001-04-26 Thread kancha

That is not the problem. @ and . need not be escaped. It's got to do with
the array that stores the file. Just need to dump the array and try to
debug. 

Any idea on how I can dump an array

regards,
kancha


On Thu, 26 Apr 2001 00:30:40 +0530, Subodh Gupta wrote:

  Hi Kancha,
  
  Since you are putting the From: [EMAIL PROTECTED] in double quotes, I
believe that you need to esacape @ and (.) character by a
  slash.
  So you need to write From: sysadmin\@foo\.com
  
  Will anybody correct me if I am wrong?
  
  Subodh Gupta
  I have learned, Joy is not in things, it is in us.
  You will ultimately be known by what you give and not what you get.
  
  
  
  Hi all
  
  I have a text file with email addresses. Each line contains one email
  address. I read the file using file() function. Below is a snippet of my
  code
  
   $staff = file(staff);
   for($x=0; $xcount($staff); $x++){
 $to = $staff[$x];
 mail($to, New User Added, $mailBody, From: [EMAIL PROTECTED]);
   }
  
  
  the snippet does send mail to all the address listed in the file staff
but
  the header from of the mail is not [EMAIL PROTECTED], but when i replace
$to
  with a string like [EMAIL PROTECTED] everything works fine. The from  header
is
  set to [EMAIL PROTECTED] and the subject also appears.
  
  I'm using php 4.0.1pl1 with apache 1.3 in a linux box. what could be the
  problem??
  
  kancha
  





___
Send a cool gift with your E-Card
http://www.bluemountain.com/giftcenter/



-- 
PHP Database 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-DB] update problems

2001-04-26 Thread ns

hi
i got to have data from mysql database to drop down menues in html how do i
do that?
I can´t get any data to my drop down menues...



thanks to anyone who can do this...

ns



-- 
PHP Database 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]




Re: [PHP-DB] update problems

2001-04-26 Thread Paul Burney

on 4/26/01 11:16 AM, ns ([EMAIL PROTECTED]) wrote:

 hi
 i got to have data from mysql database to drop down menues in html how do i
 do that?
 I can´t get any data to my drop down menues...

You need to run a query, something like:

SELECT DISTINCT from TABLE where SOMETHING

and they run a while loop to drop the values into a select field, i.e.,

echo 'option value=' , $row['fieldname'] , '' , $row['fieldname'] ,
'/option';

You may want to check out a small script I wrote:

http://webdevel.burney.ws/code/id?14

Hope that helps,

Paul Burney

++
Paul Burney
Webmaster and Open Source Developer
Educational Technology Unit
Graduate School of Education and Information Studies
University of California, Los Angeles
(310) 825-8365
[EMAIL PROTECTED]
http://www.gseis.ucla.edu/
++


--
PHP Database 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]




Re: [PHP-DB] Can't connect to local MySQL server through socket '/tmp/mysql.sock'

2001-04-26 Thread Larry Hotchkiss

Providing additional information such as the OS your useing as well as
your mysql version can be a big help as well.

franky wrote:
 
 I have this error
 Can't connect to local MySQL server through socket '/tmp/mysql.sock'
  (111)
 
 what appening?
 
 AND I CANT connect to mysql for html page why??
 I'm comming crazy!
 
 --
 ---
  -= franky =-
 [EMAIL PROTECTED]
 ---
 
 --
 PHP Database 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]

-- 
Larry Hotchkiss
Universal Capital
612-551-9309
http://www.unicap.com/

-- 
PHP Database 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]




RE: [PHP-DB] Can't connect to local MySQL server through socket '/tmp/mysql.sock'

2001-04-26 Thread Andreas D. Landmark

At 26.04.2001 20:53, you wrote:
   I have this error
   Can't connect to local MySQL server through socket '/tmp/mysql.sock'
(111)

sounds like MySQL is not running on your server.. ensure it's installed
properly and has actually started, i think typing
   mysqladmin -p version

at the command line will tell you if it's running.

you might find some useful info here:
http://www.mysql.com/doc/S/t/Starting_server.html

good luck,
simon

or just run mysql -p and see if the client can connect through the
pipe, if not (and ps auxw | grep mysql returns a running process) your
pipe has been fiddled with...



-- 
andreas landmark / noXtension
[EMAIL PROTECTED]
#distributed :
20001003 [23:27:04] froggie_ I like the feeling of a TCP socket you get 
in a DCC chat.. 


-- 
PHP Database 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-DB] Really embarassing newbie question...

2001-04-26 Thread ~BD~

Sorry to do this to ya...
Ive been involved with PHP for a total of two days now, and I'm kinda
stumped. I've been looking in docs for about 4 hours now for this, and I'm
sure I'm slipping right by the obvious answer somewhere, but

What's the best (recommended) way to determine if a table exists in a
database? Is it to try a query on it, and check the returned error? that's
the way I'm set up now, but I can't help but think there's got to be a
better way...

TIA,
~BD~



http://www.bustdustr.net
Home of Radio Free Bd



-- 
PHP Database 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]




Re: [PHP-DB] Really embarassing newbie question...

2001-04-26 Thread ~BD~

Doh!
Sorry about that - yes, it's MySQL. And I complete blew by
mysql_list_tables - I mis-read what I thought it did, then didn't look at it
any further...

I told you it was embarrasing...
Thanks!

http://www.bustdustr.net
Home of Radio Free Bd



 You didn't mention what DBMS you are running... Assuming it is MySQL,
check
 page 686 in the PHP Manual, you're looking for mysql_list_tables()

 Enjoy...

 -Original Message-
 From: ~BD~ [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 26, 2001 9:33 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] Really embarassing newbie question...


 Sorry to do this to ya...
 Ive been involved with PHP for a total of two days now, and I'm kinda
 stumped. I've been looking in docs for about 4 hours now for this, and I'm
 sure I'm slipping right by the obvious answer somewhere, but

 What's the best (recommended) way to determine if a table exists in a
 database? Is it to try a query on it, and check the returned error? that's
 the way I'm set up now, but I can't help but think there's got to be a
 better way...

 TIA,
 ~BD~



 http://www.bustdustr.net
 Home of Radio Free Bd



-- 
PHP Database 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-DB] Sending the user their forgotten password via emal??

2001-04-26 Thread DC

Hi all

I would like to offer my users the chance to have their username and
password sent to them via the email address stored.

As i see it i have two issues

(1) how do i do the verify email thing where the script send a click here to
confirm email address on registration application

(2) how do i then send their details (username / password) to the confirmed
stored email address.

I have looked around but cqnt find the answer.

5 books on the shelf give no clue either

Any help is most apreciated

Thanks in Advance

Dave C



-- 
PHP Database 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-DB] mail system

2001-04-26 Thread Greg K

I was wondering if anyone had any ideas on how I can setup a email system ,
internal using php and mysql only .. No Imap Server, or POP. Can someone
please guide me in the right direction ,, this is email sysetm would be only
for registered members. I am setting up a dating site.. Any help would be
appreciated

Thank You



-- 
PHP Database 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]