Jump to content

plesh

Members
  • Posts

    3
  • Joined

  • Last visited

plesh's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. plesh

    Search Script

    This is my search facilty , hopefully it mite work for youThe form (search) <p>Search our cars </p> <form id="form1" name="form1" method="get" action="productSelectAction.php"> <div align="center"> <input name="letter" type="text" id="letter" size="15" maxlength="15" /> <input name="Submit" type="submit" id="Submit" value="Go" /> </p> </div> </form>productSelectAction.php </p> <p align="left" class="square">Product List </p><p align="left"><br /> Here you can find all the cars that we have in stock in our Beighton Warehouse, please feel free to search and if nessecary <a href="contact.php">ring us</a> for additional information regarding the used cars we sell.</p><blockquote> </blockquote><blockquote> <form action="productSelectAction.php" method="get" name="form1" id="form1"> <p> <input name="letter" type="text" id="letter" size="15" maxlength="15" /> <input type="submit" name="Submit2" value="Search" /> </p> <p> </p> </form> <p align="center"> <a href="productSelectAction.php?letter=">All</a> | <a href="productSelectAction.php?letter=A">A</a> <a href="productSelectAction.php?letter=B">B</a> <a href="productSelectAction.php?letter=C">C</a><a href="productSelectAction.php?letter=D"> D</a> <a href="productSelectAction.php?letter=E">E</a> <a href="productSelectAction.php?letter=F">F</a> <a href="productSelectAction.php?letter=G">G</a> <a href="productSelectAction.php?letter=H">H</a> <a href="productSelectAction.php?letter=I">I</a> <a href="productSelectAction.php?letter=J">J</a> <a href="productSelectAction.php?letter=K">K</a> <a href="productSelectAction.php?letter=L">L</a> <a href="productSelectAction.php?letter=M">M</a> <a href="productSelectAction.php?letter=N">N</a> <a href="productSelectAction.php?letter=O">O </a><a href="productSelectAction.php?letter=P">P</a> <a href="productSelectAction.php?letter=Q">Q</a> <a href="productSelectAction.php?letter=R">R</a> <a href="productSelectAction.php?letter=S">S</a> <a href="productSelectAction.php?letter=T">T</a> <a href="productSelectAction.php?letter=U">U</a> <a href="productSelectAction.php?letter=V">V</a> <a href="productSelectAction.php?letter=W">W</a> <a href="productSelectAction.php?letter=X">X</a> <a href="productSelectAction.php?letter=Y">Y</a> <a href="productSelectAction.php?letter=Z">Z</a> </p> <hr /></p> <p align="left"><br /> <?php include("connections.php");$initialLetter = $_GET["letter"]; // create query $query = "SELECT * FROM eshopproduct Name"; //Check initial letter if (!$initialLetter=="") { $query = $query." Where name like '$initialLetter%'"; } // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table border=0>"; print "<tr align=center> <th>More Info</th> <th>Make</th> <th>Model</th> <th>Description</th> <th>Price</th> <th>Picture</th> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr align=center>"; echo "<td width=17%><a href=productsInfo.php?id=".$row[ProductId].">Info</a></td>"; echo "<td width=11%>".$row['Name']."</td>"; echo "<td width=11%>".$row['Model']."</td>"; echo "<td width=30%>".$row['Description']."</td>"; echo "<td width=18%>".$row['UnitPrice']."</td>"; echo "<td width=20%><img src=images/".$row["ImageName"]." width=100/><td>"; echo "</tr>"; } echo "</table>"; } else { // no // print status message echo "Sorry no products found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?>All | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  2. Right its now Partially working, if i try to login it says theres errors on the loginAction.php but when i press back on the browser it takes me to the admin.php page which it has never done before! I can reach this admin page by loading up login.php now, because i think theres still a cookie! :S but i cant never directly login!heres the code forLOGIN.PHP<?php//Start-so-we-can-use-session-variablessession_start();//Check-if-we-have-already-created-a-authenticated-sessionif(isset($_SESSION["authenticatedUser"])){$_SESSION["message"]="You are already logged in as".$_SESSION['authenticatedUser'];//Redirect-to-loginheader("Location:admin.php");}//No-session-established,-no-POST-variables//Display-the-login-page?><!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd" ><html><head><title>Film Login Page</title></head> <body> <h2 align="center">Login Page (<a href="login.phps" target="_blank">source</a> + loginaction <a href="loginaction.phps" target="_blank">source</a>) </h2><p align="left"><?php//Include-the-formatted-error-messageif (isset($_SESSION['message']))echo "<h3><font color=red>".$_SESSION['message']."</font></h3>";//Generate-the-login-<form>-layout?></p><table width="55%" border="0"> <tr> <td height="77" valign="top"> <form method="post" action="loginAction.php"> <table width="401" border="0" cellpadding="1" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="191">User-name:</td> <td width="201"><input type="text" size=10 maxlength=10 name="formUsername"></td> </tr> <tr> <td>Password:</td> <td><input type="password" size=10 maxlength=10 name="formPassword"></td> <td width="3"></td> </tr> <tr> <td ><!--DWLayoutEmptyCell--> </td> <td><p> <input name="submit" type="submit" value="Log in"> </td> </tr> </table> </form></td> <td> </td> </tr></table><p> </p></body> </html>Heres the code for LOGINACTION.PHP<?phpinclude 'connections.php';//Mainsession_start();//Get-the-data-collected-from-the-user$appUsername=$_POST["formUsername"];$appPassword=$_POST["formPassword"];$query ="SELECT * FROM Users WHERE UserName = '$appUsername' AND Password = '$appPassword' ";$result =mysql_query($query) or die ("Error in query: $query. ".mysql_error());//see-if-any-rows-were-returnedif (mysql_num_rows($result) > 0){$_SESSION["authenticatedUser"] = $appUsername;//Relocate-to-the-logged-in-pageheader("Location:admin.php");}else{$_SESSION["message"] ="Could not connect to Admin as $appUsername ";header("Location:login.php");}mysql_free_result($result);mysql_close($connection);?>The error i get on the loginAction.php is as follows:Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at H:\xampplite\htdocs\eShop\tester\test_WEBCT\connections.php:7) in H:\xampplite\htdocs\eShop\tester\test_WEBCT\loginAction.php on line 4Warning: Cannot modify header information - headers already sent by (output started at H:\xampplite\htdocs\eShop\tester\test_WEBCT\connections.php:7) in H:\xampplite\htdocs\eShop\tester\test_WEBCT\loginAction.php on line 15thanks jlhaslipRegards Alex
  3. Hello all, Im using xampp for my university project and come across some frustrating and time consuming errors!I have created 3 pageslogin.php > entering username + passwordloginAction.php > action script to transfer you to loggeon.php if you authorised, or bak to login.php if you fail authorisation.admin.php > if you are found in Users SQL table you are transferred to this page.ERRORSLOGIN.PHPI have 2 errors on the pageWarning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at H:\xampplite\htdocs\eShop\tester\test\login.php:2) in H:\xampplite\htdocs\eShop\tester\test\login.php on line 4Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at H:\xampplite\htdocs\eShop\tester\test\login.php:2) in H:\xampplite\htdocs\eShop\tester\test\login.php on line 4session_start() should be before the HTML tags which they are so im confused alreadyLOGINACTION.PHPI get this error Warning: Cannot modify header information - headers already sent by (output started at H:\xampplite\htdocs\eShop\tester\test\loginAction.php:2) in H:\xampplite\htdocs\eShop\tester\test\loginAction.php on line 25header again is before the HTML tagIm really stuck >_<, I have tried lots of different things hopefully someone will have an ideaRegards Alex
×
×
  • Create New...