split code for use username and password to connect to MySQL into other 
file and use include in every php program instead have username and 
password code.

connect.inc.php
<?
// define database connect variable
$hostname = "localhost";
$username = "root";
$password = "password";
$tblname = "yourtablename";
$dbName = "yourdbname";
MYSQL_CONNECT($hostname, $username, $password)
         OR DIE("Unable to connect to database");
@mysql_select_db("$dbName")
         or die("Unable to select database");
print "Succesful connect...";
?>

readfile.php
<?
include ("connect.inc.php");
...
other php code
...
?>

Regards,
Sommai Fongnamthip

At 22:37 5/6/2001 +0100, Jorge Oliveira wrote:
>Hi again,
>
>You are right, your username and password will have to be on every PHP
>script that needs to use database.
>
>However, you don't have to be afraid because nobody can access the source of
>your PHP scripts - unless they are a good hacker!
>
>I think you should pay a visit to http://www.php.net to understand how PHP
>works. Start with the basics and you will see that is reallY VERY simple.
>
>Be cool,
>
>
>Jorge Oliveira
>[EMAIL PROTECTED]
>
>----------------------------------------
>© webfroggie.com - Recursos Online!
>web: http://www.webfroggie.com
>wap: http://www.webfroggie.com
>
>
>
>
>
>-----Mensagem original-----
>De: Ed Peddycoart [mailto:[EMAIL PROTECTED]]
>Enviada: Quarta-feira, 6 de Junho de 2001 0:29
>Para: Jorge Oliveira; Mysql@Lists. Mysql. Com
>Assunto: RE: Need help on mysql/php
>
>
>Thanks...this helped...Just had success in connecting to the MySQL server
>and dumping the db contents to the screen....One worrisome bit though...My
>username and password for connecting to the db on my host is my username and
>password for the web account.  If I want to create dynamic webpages by
>pulling data from my db, won't I have to put this information (usersname and
>pw) in the php file and leave it on the server?  Sounds pretty darn scary to
>me...maybe I am confused.
>Ed
>
>-----Original Message-----
>From: Jorge Oliveira [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, June 05, 2001 12:47 PM
>To: Mysql@Lists. Mysql. Com
>Subject: RE: Need help on mysql/php
>
>
>Hi,
>
>Please refer to http://www.php.net/manual/en/ref.mysql.php
>
>
>Jorge Oliveira
>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>--------------------------------------------------------
>© webfroggie.com - Recursos Online!
>web: http://www.webfroggie.com
>wap: http://www.webfroggie.com
>
>
>
>
>-----Mensagem original-----
>De: Ed Peddycoart [mailto:[EMAIL PROTECTED]]
>Enviada: Terça-feira, 5 de Junho de 2001 21:31
>Para: [EMAIL PROTECTED]
>Assunto: Need help on mysql/php
>
>
>I recently move my website to FastWebServers.com.  MySQL and PHP is
>provided.  I have a control panel which allows me to initialize MySQL for my
>use.  The initialization creates a db, named celticblues_com (my domain is
>celticblues.com).  So far, I have added a table to my database, and added
>the neccessary fields.  Now I am at a total loss at what to do.  I want to
>use PHP scripts to pull info from the db and search the db etc.  I have
>contacted my support from FWS, but they point me to MySQL.com for "Mysql
>commands technical support".  Seems to me I would need to know how to set
>username/password to access the db from script etc.   The bottom line
>question is can someone point me to information on what I need to do to be
>able to access(open/close) the db, retrieve/store information, etc. in this
>type of environment (i.e. MySQL provide by my host service, not installed by
>me....)?
>Ed
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to