Hello,

I started to do a php page with mysql connection..

My problem is:

I do query from a mysql, I try to setup usernames + passwords
to protect the database

They would need to use specific user+password+cities to be able to connect.
Bad passwd would just print an access denied messsage..

http://www.cmtsite.com/schedules/
name=1 passwd=1 city=HOU
name=2 passwd=2 city=LAX
name=3 passwd=3 city=TAM
pl: http://www.cmtsite.com/schedules/media.php?city=HOU&name=1&passwd=1

Actually its working ok but i have add more user+pass but then it just goes
to the }else statement ??

I really would like to store  the usernames, passwords in the php code for
simplicity...

ATLWL  31128595
ATLSM  31128576
DFWSS  31133977
HOUFA  31146832
HOUBL  31146825
LAXSC  31152972
MIAJJ  31164255
TAMVH  31182684
TAMTK  31182685


Below my php file...

Thanks for any help!

Andrew

> <?
> include ('../menu.html');
>
> if
> (
> (($name=="1") and ($passwd=="1") and ($city=="HOU"))
> or
> (($name=="2") and ($passwd=="2") and ($city=="LAX"))
> or
> (($name=="3") and ($passwd=="3") and ($city=="TAM"))
> )
> {
>
> echo "<br>";
>
> echo "<center><font face=verdana color=red size=2><b>";
>
> if (strstr($city,"HOU")) {
> echo "Market: Houston, Texas";
> }
> if (strstr($city,"LAX")) {
> echo "Market: Los Angeles, California";
> }
> if (strstr($city,"ATL")) {
> echo "Market: Atlanta, Georgia";
> }
> if (strstr($city,"TAM")) {
> echo "Market: Tampa, Florida";
> }
> if (strstr($city,"ORL")) {
> echo "Market: Orlando, Florida";
> }
> if (strstr($city,"DFW")) {
> echo "Market: Dallas/Fort Worth, Texas";
> }
> if (strstr($city,"BIR")) {
> echo "Market: Birmingham, Alabama";
> }
> if (strstr($city,"MIA")) {
> echo "Market: Miami, Florida";
> }
>
> echo "</b></font><center><br>";
>
> $db=mysql_connect("zz.com:3306","zz","zz");
> mysql_select_db("cmt",$db);
>
> if (strstr($city,"HOU")) {
> $aresult=mysql_query("select * from media where d like '%HOU%' or d like
'%MCA%' or d like '%BMT%' order by i" ,$db);
> }
> else {
> $aresult=mysql_query("select * from media where d like '$city' order by i"
,$db);
> }
>
> echo "
> <table align=center width=95% cellspacing=0 cellpadding=2 border=1>
> <tr>
> <td><font face=verdana size=2><b>Market</b></td>
> <td><font face=verdana size=2><b>Station</b></td>
> <td><font face=verdana size=2><b>Local Date</b></td>
> <td><font face=verdana size=2><b>TV Date</b></td>
> <td><font face=verdana size=2><b>Log Action</b></td>
> <td><font face=verdana size=2><b>Log Date</b></td>
> </tr>";
>
> while($amyrow = mysql_fetch_array($aresult))
>         {
>   echo "<Tr><td><font face=verdana size=1>";
>                echo $amyrow["d"];
> echo "</td><td><font face=verdana size=1>";
>                  echo $amyrow["c"];
>         echo "</td><td><font face=verdana size=1>";
>                  echo $amyrow["i"];
>         echo "</td><td><font face=verdana size=1>";
>                  echo $amyrow["j"];
>         echo "</td><td><font face=verdana size=1>";
>                  echo $amyrow["f"];
>         echo "</td><td><font face=verdana size=1>";
>                  echo $amyrow["k"];
>         echo "</td>";
>         }
>
> echo "</td></tr></table>";
>
> echo "<br>";
>
> include ('../sql-bottom.html');
>
> } else {
>
> echo "<br><br><center><font face=verdana size=2><b>Access Denied. Please
check your password.</b></font><center><br><br>";
>
> }
>
> echo "<br>";
>
>
> ?>


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

Reply via email to