Jump to content

finestice

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by finestice

  1. thanks for all your replys but the if (!$name || !$email || !$email2 || !$tel || !$mobile || !$housenum || !$address || !$postcode){ had nothing to do with the problem i had. However i studied the code again and solved the problem i was having
  2. hello people just wondering if anyone can spot where im going wrong in this script.. If someone clicks the submit button when not entering any fields, for some reason its adding onto the total, the last item added... but if i refresh again it stays the same. probably something simpleany help will be appiceiated <? session_start(); include 'connect.php'; if (isset($_GET['reset'])){ session_destroy(); header ('location: /'); } if (isset($_POST['name'])){ $name = $_POST['name']; $email = $_POST['email']; $email2 = $_POST['email2']; $tel = $_POST['tel']; $mobile = $_POST['mobile']; $housenum = $_POST['housenum']; $address = $_POST['address']; $postcode = $_POST['postcode']; $total = number_format($_POST['total'], 2); $dof = $_POST['dof']; $tof = $_POST['tof']; $cart = $_POST['cart']; if (!$name || !$email || !$email2 || !$tel || !$mobile || !$housenum || !$address || !$postcode){ $error = "Please fill in all fields!!";} //check emails match else if ($email !=$email2){ $error = "Emails Dont Match!!"; } //check telephone number is proper length else if (strlen($tel) <6){ $error = "Please enter a Valid Telephone Number!!";} //check address is long enough else if (strlen($address) <6){ $error = "Address!! Not enough character to be valid";} //check postcode else if (strlen($postcode) <5){ $error = "Postcode Not Valid";} else{ //email to customer $to = ""; $from = "$email"; $subject = "Your Order - Pitstop Tyres Reading"; //email to user $emailmessage ="<html> <body> <H2>CUSTOMER BOOKING</H2> Your order is:<br><br> $cart<br> Name : $name<br> Email : $email<br> Telephone : $tel<br> Mobile : $mobile<br><br> Address : $housenum, $address<br><br> Postcode : $postcode<br> Date of fitting : $dof<br> Customer is available : $tof<br><br> <h2>Order total is : £$total</h2> </body> </html>"; //end message $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .="From: $from\r\n"; $headers .="Content-type: text/html\r\n"; $emailmessage = utf8_decode($emailmessage); //send email mail($to, $subject, $emailmessage, $headers); //email to us //email user activation link $to = "$email"; $from = ""; $subject = "Your Order - Pitstop Tyres Reading"; //email to user $emailmessage ="<html> <body> Hi, $name,<br><br> Thank you for using.<br><br> Your order is being processed and a technician will call you soon<br><br> Your order is:<br><br> $cart<br><br> Name : $name<br> Email : $email<br> Telephone : $tel<br> Mobile : $mobile<br><br> Address : $housenum, $address<br><br> Postcode : $postcode<br> Date of fitting : $dof<br> You are Available : $tof<br><br> </body> </html>"; //end message $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .="From: $from\r\n"; $headers .="Content-type: text/html\r\n"; $emailmessage = utf8_decode($emailmessage); //send email mail($to, $subject, $emailmessage, $headers); $message = "<strong style='color:green;'>Thank you.. Your order is being processed<br>We have emailed you confirming booking and will contact you soon</strong>"; session_destroy(); include_once 'messagetouser.php'; exit(); } } function paypal_items(){ $num = 0; foreach($_SESSION as $name => $value){ if ($value>0){ if (substr($name, 0, 5) =='cart_'){ $id = substr($name, 5, (strlen($name)-5)); $get = mysql_query('SELECT * FROM tyrelist WHERE id='.mysql_real_escape_string((int)$id)); while ($get_row = mysql_fetch_assoc($get)){ $num++; $price = $get_row["pricein"]; $price = $price*1.039+18.00; echo '<input type="hidden" name="item_number_'.$num.'" value="'.$id.'">'; echo '<input type="hidden" name="item_name_'.$num.'" value="'.$get_row['description'].'">'; echo '<input type="hidden" name="amount_'.$num.'" value="'.number_format($price, 2).'">'; echo '<input type="hidden" name="quantity_'.$num.'" value="'.$value.'">'; } } } } } foreach ($_SESSION as $name => $value) { if ($value>0){ if (substr($name, 0, 5) =='cart_'){ $id = substr($name, 5, (strlen($name)-5)); $get = mysql_query('SELECT * FROM tyrelist WHERE id='.mysql_real_escape_string((int)$id)); while ($get_row = mysql_fetch_assoc($get)){ $price = $get_row["pricein"]; $price = $price*1.039+18.00; $output .= $value.'x '.$get_row['description'].' @ £'.number_format($price, 2).'each<br>'; } } } } function cart(){ foreach($_SESSION as $name => $value){ if ($value>0){ if (substr($name, 0, 5) =='cart_'){ $id = substr($name, 5, (strlen($name)-5)); $get = mysql_query('SELECT * FROM tyrelist WHERE id='.mysql_real_escape_string((int)$id)); while ($get_row = mysql_fetch_assoc($get)){ $price = $get_row["pricein"]; $price = $price*1.039+18.00; $sub = number_format($price, 2)*$value; ?> <br><div id="booking"> <div id="size"><? echo $get_row['description']?></div> <div id="qty"><? echo $value ?></div> <div id="pricerow">£<? echo number_format($price, 2) ?></div> <div id="subtotal"> £<? echo number_format($sub, 2) ?></div> </div> <div class="clr"></div> <? } } $total += $sub; } } ?> <br><hr><div align="center">The total for this order is : <b>£<? echo number_format($total,2); ?></b></div> <? $_SESSION['emailtotal'] = $total; } ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> body { background-image: url(images/main_bg.gif); background-repeat: repeat-x; background-color: #e9e9e9; } </style> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="Tyres in Reading, tyres, car tyres, buy tyres online, buy batteries online, tyre prices, mobile tyre fitting, car batteries, car batteries online, van tyres, low price tyres, leading brand tyres, 4x4 tyres, run flat tyres, car recovery Reading, Reading car recovery" /> <meta name="description" content="Pit Stop Tyres in Reading specialise in the supply and fitting of tyres including car tyres, 4x4 tyres and run flat tyres at your home address or workplace. Our 24h mobile tyre fitting service will come to your home or work address and fit the car tyres leaving your time free for other things. We offer car recovery services" /> <meta name="ROBOTS" content="ALL" /> <meta name="Revisit-After" content="7 days"> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <link href="/styles/main.css" rel="stylesheet" type="text/css" /> <link href="style.css" rel="stylesheet" type="text/css" /> <script language="javascript" type="text/javascript" src="datetimepicker.js"></script> <title>Booking Fitment</title> </head> <body> <div id="searchtop">BOOK NOW ONLINE OR TELEPHONE 01189 560 003</div> <div class="clr"></div> <div id="searchtopright"><ul> <li><a href="index.php" class="active"><span>Home</span></a></li> <li><a href="about.html"><span> About Us</span></a></li> <li><a href="services.html"><span> Services </span></a></li> <li><a href=""><span> Shop OnLine</span></a></li> <li><a href="contact.html"><span> Contact Us</span></a></li> </ul></div> <div class="clr"></div> <div align="center"><b style="color:red;"><? echo $error; ?></b></div> <br> <form action="book.php" method="post" name="tstest"> <table id="booktext" align="center" width="700" border="0"> <tr> <th class="bookhead" colspan="2" scope="col" bgcolor="#666666">Online Booking</th> </tr> <tr> <td width="208"><div align="right">Name</div></td> <td width="478"><input name="name" type="text" id="name" value="<? echo $_POST['name']; ?>" size="50" maxlength="35"></td> </tr> <tr> <td><div align="right">Email</div></td> <td><input name="email" type="email" id="email" value="<? echo $_POST['email']; ?>" size="50"></td> </tr> <tr> <td><div align="right">Confirm Email</div></td> <td><input type="email" name="email2" id="email2" size="50"> </td> </tr> <tr> <td><div align="right">Telephone</div></td> <td><input name="tel" type="text" id="tel" value="<? echo $_POST['tel']; ?>"size="50" maxlength="15"></td> </tr> <tr> <td><div align="right">Mobile</div></td> <td><input name="mobile" type="text" id="mobile" value="<? echo $_POST['mobile']; ?>"size="50" maxlength="15"></td> </tr> <tr> <th class="bookhead" colspan="2" scope="col" bgcolor="#666666">Address Details</h1></th> <td width="0"></td> </tr> <tr> <tr> <td><div align="right">House Number/Name</div></td> <td><input name="housenum" type="text" id="housenum" value="<? echo $_POST['housenum']; ?>" size="50" maxlength="20"></td> </tr> <td valign="top"><div align="right">Address</div></td> <td><textarea name="address" cols="50" rows="6"><? echo $_POST['address']; ?></textarea></td> </tr> <tr> <td><div align="right">Postcode</div></td> <td><input name="postcode" type="text" id="postcode" value="<? echo $_POST['postcode']; ?>" size="50" maxlength="10"></td> </tr> <tr> <td><div align="right">Date of fitting</div></td> <td><input id="demo1" name="dof" type="text" size="25"><a href="javascript:NewCal('demo1','ddmmyyyy')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> </td> <tr> <td><div align="right">Availability</div></td> <td><label for="tof"></label> <select name="tof" id="select"> <option selected>All day</option> <option>Morning 8am - 12</option> <option>afternoon 12 - 17.00pm</option> <option>Call to discuss</option> </select></td> </tr> <tr> <td colspan="2" align="center"><br> You have ordered<hr></td> </tr> <tr> <td colspan="2"><b><? echo cart(); ?></b></td> </tr> <tr> <td colspan="2" align="center"></td> </tr> <tr> <td colspan="2" align="center"><input type="hidden" name="cart" value="<? echo $output;?>"><input type="hidden" name="total" value="<? echo $_SESSION['emailtotal'];?>"><? echo paypal_items()?><input name="submit" type="submit" value="Place Your Order" id="placeorder"><a style="text-decoration:none;" href="/"><input name="" id="moretyres" type="button" value="Add More Tyres"></a></td> </tr> </table> </form> <br> </body>
  3. yhh iv found the absolute path which is /home/stigros1/public_html/tyrehq.com/members/1/ and iv change the code to $pid = mysql_insert_id(); $newfile = $pid; $old_file = "/home/stigros1/public_html/tyrehq.com/members/{$_SESSION[id]}/123abc123.jpg"; $new_file = "/home/stigros1/public_html/tyrehq.com/members/{$_SESSION[id]}/{$newfile}.jpg"; if(is_dir($old_file)){ rename($old_file, $new_file); }else{ print "$old_file is not a valid directory"; } STILL NO JOY THOU how do i make the path http://tyrehq.com/members/1/$oldfile.jpg
  4. how would i find the full path of that file?
  5. thanks for your fast reply people iv ran that code and it comes up with /members/1/123abc123.jpg is not a valid directory
  6. yes the file does exist in /members/1/123abc123.jpg - like i said the file does orginally upload ok into that folder its just the renaming it thats a problem
  7. ok error im getting is: Warning: rename(/members/1/123abc123.jpg,/members/1/7.jpg) [function.rename]: No such file or directory in /home/stigros1/public_html/tyrehq.com/sell1.php on line 124 code im using is: $pid = mysql_insert_id(); $newfile = $pid; rename('/members/'.$_SESSION[id].'/123abc123.jpg', '/members/'.$_SESSION[id].'/'.$newfile.'.jpg'); any ideas iv been racking my brains out trying to figure it out
  8. ok iv searched the forum but cant find my anwser, this is my problem: iv uploaded a file and its successfully added it to /members/01/myfile.jpg now further down my script i want to rename it to /members/01/$newfile.jpg if tried using the the rename function but im thinking it only works when its in the temp folder on uploading the file. iv tried for example <? rename(/members/01/myfile.jpg, /members/01/$newfile.jpg) ?> I keep getting an error and 'file does not exist' please any ideas will be appriecated
  9. WOW Thankyou so much, this is just what iv been looking for... TOP MAN
  10. iv been looking throu the scripts available and even searched the paypal site but im getting the impression that i have to set MY paypal account ipn settings to allow the ipn script to work BUT paypal wont be accessing my paypal account. There doesnt seem to be any good examples even on youtube when the seller comes to my site to sell something a paypal button will be dynamically made for each item they are selling then once the item has sold i want to be able to update my database to either reduce the qty or set a field to sold so the item doesnt display anymore. any help or idea appiciated or if anyone knows how to do it i can pay
  11. Hey people, I just wondering how i would go about updating a item_quantity field. This is the dilemma: im building a site that allows people to sell there own items abit like ebay does, they will provide details of there item into a form that then gets entered into my database, they will have a paypal button that will pay into there paypal account, but im trying to figure out how can i update my database once their item has sold to update the quantity field. any ideas??
  12. Hi, i got this code online and amended to my needs but im having a problem getting the third field to dynamicly change when i click the second field(im gathering info from a database) goto http://tyrehq.com/dd1.php to see the code in action... iv managed to dynamicaly change the first and second field but need some help how to do the third as javascript 'onclick' is totally new to me table is id | make | model | Year etc... 1 audi a1 2001 2 bmw z4 2002 3 audi a4 2001 etc i want the year to change accord to the model choosen so if choose audi + a1 the third feild will only show 2001 and not list all whats in that column - HOPE THIS MAKE SENSE <?php include 'connect.php'; ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>Multiple drop down list box from plus2net</title> <SCRIPT language=JavaScript> function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='dd1.php?cat=' + val ; } </script> </head> <body> <? /* If register_global is off in your server then after reloading of the page to get the value of cat from query string we have to take special care. To read more on register_global visit. http://www.plus2net.com/php_tutorial/register-globals.php */ @$cat=$_GET['cat']; // Use this line or below line if register_global is off if(strlen($cat) > 0 and is_numeric($cat)){ // to check if $cat is numeric data or not. echo "Data Error"; exit; } //@$cat=$HTTP_GET_VARS['cat']; // Use this line or above line if register_global is off ///////// Getting the data from Mysql table for first list box////////// $quer2=mysql_query("SELECT DISTINCT make FROM pressures"); ///////////// End of query for first list box//////////// /////// for second drop down list we will check if category is selected else we will display all the subcategory///// if(isset($cat) and strlen($cat) > 0){ $quer=mysql_query("SELECT DISTINCT make, model FROM pressures WHERE make='$cat' ORDER BY model ASC"); } ////////// end of query for second subcategory drop down list box /////////////////////////// echo "<form action='dd-check.php' method='post'>"; /// Add your form processing page address to action in above line. Example action=dd-check.php//// ////////// Starting of first drop downlist ///////// echo "<select name='cat' onchange=\"reload(this.form)\"><option value=''>Select one</option>"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['make']==@$cat){echo "<option selected value='$noticia2[make]'>$noticia2[make]</option>"."<BR>";} else{echo "<option value='$noticia2[make]'>$noticia2[make]</option>";} } echo "</select>"; ////////////////// This will end the first drop down list /////////// ////////// Starting of second drop downlist ///////// echo "<select name='title'><option value=''>Select one</option>"; while($noticia = mysql_fetch_array($quer)) { echo "<option value='$noticia[model]'>$noticia[model]</option>"; } echo "</select>"; ////////////////// This will end the second drop down list /////////// $query = "SELECT DISTINCT year FROM pressures ORDER BY year DESC"; $result = mysql_query($query); ?> <select name="year"> <?php while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { ?> <option value="<?php echo $line['year'];?>"> <?php echo $line['year'];?> </option> <?php } ?> </select> <? //// Add your other form fields as needed here///// echo "<input type=submit value=Submit>"; echo "</form>"; ?> </body> </html>
  13. $query = "INSERT INTO upload (name, size, type, content ) VALUES ('$fileName', '$fileSize', '$fileType', '$content')"; mysql_query($query) or die('Error, query failed'); echo "<br>File $fileName uploaded<br>"; try this
  14. hi, i have a search engine that searches keywords in mysql database... i have a simple form but if someone enters a load of spaces it displays the whole database contents.. also i wanna remove any words less then 3 characters being searched for.. i have (strlen($search)<=3) what else should i add?? cheers
  15. ummmm im dont think that would actually stop the search.php from not working...its like it kills the script after it gets to 'no search results found' any idea if there is anything in the include file that would stop it...because if i remove it...it works!!!!
  16. the countertest.php works fine goto stigros.com to see the header but when try to included it the search.php it shows ok but the search doesnt search properly just always says 'no result found' but if i remove the include file it works!!!! cant figure it out
  17. nope not working or not displaying right... ok i was thinking of this. putting my include header at the top of the page...but now its not carrying on with the search....just dispplay no result...ahhhhhhh <? session_start(); ?> <link href="/styles/main.css" rel="stylesheet" type="text/css" /> <? include 'head_loggedin.php'; //get data $button = $_GET['submit']; $search = $_GET['search']; $search = strtoupper($search); $s = $_GET['s']; if (!$s) $s = 0; $e = 10; // Just change to how many results you want per page $next = $s + $e; $prev = $s - $e; if (strlen($search)<=2) echo "Must be greater then 3 chars $user"; else { echo " <form action='search.php' method='GET'> <center> <br> <input name='search' type='text' class='blacktext' size='50'> <input name='submit' type='submit' class='blacktext' value='Search Film'></font></p> </center> </form> "; //connect to db include('connect.php'); //explode out search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //construct query $x++; if ($x==1) $construct .= "keyword LIKE '%$search_each%'"; else $construct .= " OR keyword LIKE '%$search_each%'"; } //echo outconstruct $constructx = "SELECT * FROM movies WHERE $construct"; $construct = "SELECT * FROM movies WHERE $construct LIMIT $s,$e"; $run = mysql_query($constructx); $foundnum = mysql_num_rows($run); $run_two = mysql_query("$construct"); if ($foundnum==0) echo "No results found for <b>$search</b>"; else { echo "<table bgcolor='#000000' width='80%' height='1px' align='center'><br /></table><table bgcolor='#000000' width='80%' height='10px' align='center'><tr><td><div align='right'><font color='#E6E6E6'>Showing 1-10 of <b>$foundnum</b> results found for <b>$search.</b></font></div></td></tr></table><p>"; echo "<br>"; while ($runrows = mysql_fetch_assoc($run_two)) { //get data $title = $runrows['film']; $desc = $runrows['description']; $url = $runrows['dl_link']; $imdb = $runrows['imdb']; $pic = $runrows['pic']; $film = $runrows['film']; echo "<table width='900' border='1' align='center'> <tr> <td width='229' align='center'><IMG SRC='$pic'></td> <td class='blacktext' width='655' align='center'><b>$film</b><br /><br />$desc<br /><br /><a href='$url' target='_blank'><b>Download Now</b></a> | <a href='$imdb' target='_blank'><b>IMDb</b></a></td> </tr> </table> "; } ?> <table width='100%'> <tr> <td> <div align="center"> <?php if (!$s<=0) echo "<a href='search.php?search=$search&s=$prev'>Prev</a>"; $i =1; for ($x=0;$x<$foundnum;$x=$x+$e) { echo " <a href='search.php?search=$search&s=$x'>$i</a> "; $i++; } if ($s<$foundnum-$e) echo "<a href='search.php?search=$search&s=$next'>Next</a>"; } } ?> </div> </td> </tr> </table> heres the 'head_loggedin.php' file <? session_start(); require_once("connect.php"); // Check his status. if (empty($_SESSION[username])) //not logged in!! { header("Location: login.php"); } ?> <link href="/styles/main.css" rel="stylesheet" type="text/css" /> <table width="100%" border="0" height="80" cellpadding="4" bgcolor="#000000" > <tr> <td width="39%" height="76" valign="top"><p><span class="stigrosheadfont"><strong>www.StigRos.com</strong></span><strong><span class="headnocrap"><br /> ( No Crap - Just Quality Movie & Music Downloads )</span></span><br /> <a href="http://stigros.com" class="headerlinkcolor">Home</a> | <a href="register.php" class="headerlinkcolor">Register</a> | <a href="#" class="headerlinkcolor">Contact us</a></strong></td> <td width="47%" valign="bottom"><? echo "<p class='normalblacktext'>You are currently logged in, <b>$_SESSION[username]</b>.";?></td> <td width="14%" valign="top"><div align="center"> <div align="center"><span class="stigrosheadfont"><strong>Disclaimer</strong></span></div> <div align="center"> <?php include_once "countertest.php"; ?> <?php echo date("F d, Y"); ?></div></td> </tr> </table>
  18. <table width='100%' border='0' height='80' cellpadding='4' bgcolor='#000000' > <tr> <td width='39%' height='76' valign='top'><p><span class='stigrosheadfont'><strong>www.StigRos.com</strong></span><strong><span class='headnocrap'><br /> ( No Crap - Just Quality Movie & Music Downloads )</span></span><br /> <a href='http://stigros.com' class='headerlinkcolor'>Home</a> | <a href='register.php' class='headerlinkcolor'>Register</a> | <a href='#' class='headerlinkcolor'>Contact us</a></strong></td> <td width='47%' valign='bottom'><p class='normalblacktext'>You are currently logged in, <b>$_SESSION[username]</b></td> <td width='14%' valign='top'><div align='center'> <div align='center'><span class='stigrosheadfont'><strong>Disclaimer</strong></span></div> <div align='center'> <? include_once 'countertest.php'; ?> <? echo date('F d, Y'); ?></div></td> </tr> </table> <form action='search.php' method='GET'> <center> <br> <input name='search' type='text' class='blacktext' size='50'> <input name='submit' type='submit' class='blacktext' value='Search Film'></font></p> </center> </form> "; //connect to db include('connect.php'); the countertest php is : <?php $dataFile = "visitors.txt"; $sessionTime = 30; //this is the time in **minutes** to consider someone online before removing them from our file //Please do not edit bellow this line error_reporting(E_ERROR | E_PARSE); if(!file_exists($dataFile)) { $fp = fopen($dataFile, "w+"); fclose($fp); } $ip = $_SERVER['REMOTE_ADDR']; $users = array(); $onusers = array(); //getting $fp = fopen($dataFile, "r"); flock($fp, LOCK_SH); while(!feof($fp)) { $users[] = rtrim(fgets($fp, 32)); } flock($fp, LOCK_UN); fclose($fp); //cleaning $x = 0; $alreadyIn = FALSE; foreach($users as $key => $data) { list( , $lastvisit) = explode("|", $data); if(time() - $lastvisit >= $sessionTime * 60) { $users[$x] = ""; } else { if(strpos($data, $ip) !== FALSE) { $alreadyIn = TRUE; $users[$x] = "$ip|" . time(); //updating } } $x++; } if($alreadyIn == FALSE) { $users[] = "$ip|" . time(); } //writing $fp = fopen($dataFile, "w+"); flock($fp, LOCK_EX); $i = 0; foreach($users as $single) { if($single != "") { fwrite($fp, $single . "\r\n"); $i++; } } flock($fp, LOCK_UN); fclose($fp); if($uo_keepquiet != TRUE) { echo '<div style="padding:5px; margin:auto; background-color:#000"<b>' . $i . ' visitors online</div>'; } ?> dont know if the counteretest.php file is needed but it wont display in the include bit iv try incasing it in <?php ?> and <? ?> still dont dont... the header should look like this http://stigros.com
  19. how do i include the file iv removed the <? ?> tags but still doesnt show the date etc!!
  20. Hi peeps iv been trying to figure out this but i cant see it....its probably obvious!!! in the $header variable the include files dont show... any ideas here the php code <? session_start(); ?> <link href="/styles/main.css" rel="stylesheet" type="text/css" /> <? //get data $button = $_GET['submit']; $search = $_GET['search']; $search = strtoupper($search); $header = ("<table width='100%' border='0' height='80' cellpadding='4' bgcolor='#000000' > <tr> <td width='39%' height='76' valign='top'><p><span class='stigrosheadfont'><strong>www.StigRos.com</strong></span><strong><span class='headnocrap'><br /> ( No Crap - Just Quality Movie & Music Downloads )</span></span><br /> <a href='http://mysite' class='headerlinkcolor'>Home</a> | <a href='register.php' class='headerlinkcolor'>Register</a> | <a href='#' class='headerlinkcolor'>Contact us</a></strong></td> <td width='47%' valign='bottom'><p class='normalblacktext'>You are currently logged in, <b>$_SESSION[username]</b></td> <td width='14%' valign='top'><div align='center'> <div align='center'><span class='headfont'><strong>Disclaimer</strong></span></div> <div align='center'> <? include_once 'countertest.php'; ?> <? date('F d, Y'); ?></div></td> </tr> </table>"); $s = $_GET['s']; if (!$s) $s = 0; $e = 10; // Just change to how many results you want per page $next = $s + $e; $prev = $s - $e; if (strlen($search)<=2) echo "Must be greater then 3 chars $user"; else { echo $header; echo " <form action='search.php' method='GET'> <center> <br> <input name='search' type='text' class='blacktext' size='50'> <input name='submit' type='submit' class='blacktext' value='Search Film'></font></p> </center> </form> "; //connect to db include('db.php'); //explode out search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //construct query $x++; if ($x==1) $construct .= "keyword LIKE '%$search_each%'"; else $construct .= " OR keyword LIKE '%$search_each%'"; } //echo outconstruct $constructx = "SELECT * FROM movies WHERE $construct"; $construct = "SELECT * FROM movies WHERE $construct LIMIT $s,$e"; $run = mysql_query($constructx); $foundnum = mysql_num_rows($run); $run_two = mysql_query("$construct"); if ($foundnum==0) echo "No results found for <b>$search</b>"; else { echo "<table bgcolor='#000000' width='80%' height='1px' align='center'><br /></table><table bgcolor='#000000' width='80%' height='10px' align='center'><tr><td><div align='right'><font color='#E6E6E6'>Showing 1-10 of <b>$foundnum</b> results found for <b>$search.</b></font></div></td></tr></table><p>"; echo "<br>"; while ($runrows = mysql_fetch_assoc($run_two)) { //get data $title = $runrows['film']; $desc = $runrows['description']; $url = $runrows['dl_link']; $imdb = $runrows['imdb']; $pic = $runrows['pic']; $film = $runrows['film']; echo "<table width='900' border='1' align='center'> <tr> <td width='229' align='center'><IMG SRC='$pic'></td> <td class='blacktext' width='655' align='center'><b>$film</b><br /><br />$desc<br /><br /><a href='$url' target='_blank'><b>Download Now</b></a> | <a href='$imdb' target='_blank'><b>IMDb</b></a></td> </tr> </table> "; } ?> <table width='100%'> <tr> <td> <div align="center"> <?php if (!$s<=0) echo "<a href='search.php?search=$search&s=$prev'>Prev</a>"; $i =1; for ($x=0;$x<$foundnum;$x=$x+$e) { echo " <a href='search.php?search=$search&s=$x'>$i</a> "; $i++; } if ($s<$foundnum-$e) echo "<a href='search.php?search=$search&s=$next'>Next</a>"; } } ?> </div> </td> </tr> </table>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.