Answers | Websites for Sale | Domain Names for sale

Your Question:

login php login a contact html contact a cars html cars a login html login a login html login a http login html login a li

Programming & Design :: How do you hide certain php code from users on a website?

Okay, I am quite the amateur at PHP to be honest, so bare with me. We are making a website about car rentals, and we are making a log in for users and employees, but on the page, we want to be able to hide certain php mysql scripts from the users but show them for the employees? below is an example of one of my pages with a query in it, which i want to show to customers, but say i wanted to hide it, how would i do that? or better yet, how do i hide certain pages from certain users? i really dont understand this log in stuff, we had a log in at the moment but it really isnt working well at the moment as we have created two different copies of each page and send users one way and employees the other, which is definatly not the way to do it. <!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=iso-8859-1" /> <title>Coalisland Car Rentals</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="container"> <div id="main"> <div id="header"></div> <div id="nav"> <ul> <li><a href="index.html">Home</a></li> <li><a href="Cars.html">Cars</a></li> <li><a href="dealers.html">Dealers</a></li> <li><a href="Prices.html">Prices</a></li> <li><a href="login.html">Login</a></li> <li><a href="Contact.html">contact</a></li> </ul> </div> <div id="content"> <div id="left"> <div class="post"> <h1>Please Choose The Type of Vehicle You Would Like To See Available Stock</h1> <br><br> <form action="findcartypes_back.php" method="post" onSubmit="return confirm('Are You Sure You Wish To Proceed?');"> <!--posts to the php file test1.php--> <select name="type">; <?php //open php $conn = mysqli_connect("127.0.0.1", "root", "") or die ("No connection"); // Defines the connection to the server, in this case local host mysqli_select_db($conn , "cars") or die ("db will not open"); //defines the database, in this case, givemoney $query = "SELECT distinct Type from cars order by Type asc"; //this selects all the charitynames, but displays them individually, and in ascending order $result = mysqli_query($conn, $query) or die("Invalid query"); while($rows = mysqli_fetch_array($result)) { //array of options echo "<option value=\"" . $rows[0] . "\">" . $rows[0] . "</option>"; } echo "</select>"; mysqli_close($conn); //close connection //close php ?> <input type="submit" value="Submit"> <!--submit button--> </form><br> </div> <div class="post"> </div> </div> <div id="right"> <table align="center"> <td> <P> Sponsored Adverts </P> <h2> looking for insurance? we recommend using </h2><br> <a href="http://www.gocompare.com"><img src="images/gologo.gif"></a><br> <BR><h2> Why not try this site?</p> <a href="http://www.embo.org"><img src="images/embo.jpg"></a> <BR><h2> Car Trouble?</p> <a href="http://www.carlube.co.uk"><img src="images/lube.gif"></a> </td> </table> <br></div> <div class="clear"></div> </div> </div> <div id="footer"> <ul> <li><a href="index.html">Home</a></li>| <li><a href="Cars.html">Cars</a></li>| <li><a href="dealers.html">Dealers</a></li>| <li><a href="Prices.html">Prices</a></li>| <li><a href="login.html">Login</a></li>| <li><a href="Contact.html">contact</a></li> </ul> <span>Coalisland Car Rental's : Drive her like you stole her &#169 </span> </div> </div> &lt I have tried serachin everywhere online but am going in circles so i have resorted to this and hope someone can help as it would be much appreciated, even if you can just tell me a method. Many Thanks to anyone Who answers. Ryan