I made a simple form that pulls from a MySQL database, it worked fine and dandy. I tried to password protect it and it just keeps giving me the error message that I defined for a wrong password.
#1 Here's my code:
Expand|Select|Wrap|Line Numbers
- <?php
- include 'dbc.php';
- $passfromhtml = $_POST["passhtml"];
- $emailfromhtml = $_POST["emailhtml"];
- $password_select = mysql_query("SELECT pwd FROM client WHERE client_email = '$emailfromhtml'");
- if($passfromhtml == $password_select)
- {
- $q=$_GET["q"];
- $data_array = mysql_query("SELECT * FROM client WHERE client_email = '".$q."'");
- while($row = mysql_fetch_array($data_array))
- {
- $id = $row['id'];
- $full_name = $row['full_name'];
- $company_name = $row['company_name'];
- $client_email = $row['client_email'];
- $designer_email = $row['designer_email'];
- $user_level = $row['user_level'];
- $pwd = $row['pwd'];
- $address = $row['address'];
- $country = $row['country'];
- $tel = $row['tel'];
- $fax = $row['fax'];
- $website = $row['website'];
- $temp_website = $row['temp_website'];
- $price = $row['price'];
- $price_per_hour = $row['price_per_hour'];
- $percent_done = $row['percent_done'];
- $hours_worked = $row['hours_worked'];
- $services = $row['services'];
- $additional = $row['additional'];
- $status = $row['status'];
- }
- $total_cost = $price_per_hour * $hours_worked ;
- echo <<<HTML
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Admin Panel</title>
- <link href="css/admin.css" rel="stylesheet" type="text/css">
- <script type="text/javascript">
- function showUser(str)
- {
- if (str=="")
- {
- document.getElementById("panel").innerHTML="";
- return;
- }
- if (window.XMLHttpRequest)
- {// code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp=new XMLHttpRequest();
- }
- else
- {// code for IE6, IE5
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function()
- {
- if (xmlhttp.readyState==4 && xmlhttp.status==200)
- {
- document.getElementById("panel").innerHTML=xmlhttp.responseText;
- }
- }
- xmlhttp.open("GET","admin_cp.php?q="+str,true);
- xmlhttp.send();
- }
- </script>
- </head>
- <body>
- <div id="panel">
- <p> </p>
- <p>
- <form>
- <select name="users" onchange="showUser(this.value)">
- <option value="">Select a person:</option>
- <option value="biondizzle@gmail.com">Michael Biondi</option>
- <option value="saltolve@gmail.com">Salvatore Tolve</option>
- <option value="3">Glenn Quagmire</option>
- <option value="4">Joseph Swanson</option>
- </select>
- </form>
- $company_name | <a href=http://$temp_website target=_blank>My Websites progress</a> | Send Message to my designer |</p>
- <hr />
- <ol>
- <li>
- <div class="left">
- <p>
- <b>Client ID:</b> $id <br />
- <b>Company Name:</b> $company_name <br />
- <b>Email:</b> $client_email <br />
- <b>Website Price:</b> $price <br />
- <b>Price Per Hour:</b> $price_per_hour <br />
- <b>Percentage Done:</b> $percent_done <br />
- <b>Services:</b><br />
- $services<br />
- <b>Additional Comments:</b><br />
- $additional<br />
- <b>Hours Worked:</b> $hours_worked <b>Total Cost:</b> $total_cost
- </p>
- </div>
- </li>
- <li>
- <div class="middle">
- <p>
- <h2>Status Update to Client:<h2><br />
- <textarea name="textarea" id="textarea" cols="25" rows="5"></textarea>
- </p>
- </div>
- </li>
- <li>
- <div class="right">
- <p>
- <h2>Status:<h2><br />
- $status
- </p>
- </div>
- </li>
- </ol>
- </div>
- </body>
- </html>
- HTML;
- }
- else
- {
- echo "Wrong password dipshit";
- }
- ?>
and #2:
here's the link for you guys to see what I mean:
http://btdstudios.com/login.html
Try to log in as me:
<removed for your safety>
Like I said, I'm pretty new to PHP, so take it easy on me :) Thanks a bunch guys!