justlukeyou
-
Posts
957 -
Joined
-
Last visited
Posts posted by justlukeyou
-
-
Hi,
I have added product search links to my site:
www.domain.php?product=football
But now I want to add links which read the URL in the search so it adds the price search on:
get (www.domain.com.php?product=television)&price=1-100
That way people can view the products and then if they wish sort the product by price band. If I hand write the link in the URL bar and it does work, now I just need to form the links in clickable links.
This seems the simplest way to do it. Is it possible to do this or should I be doing another way?
-
Can I also use "&20" that performs the search and displays search term?
-
Hi,
This is the code. Am I worrying to much than someone can inject code?
<?php ini_set('display_errors', 1); error_reporting(-1); $query = "SELECT * FROM productfeed"; if(isset($_GET['description']) && !empty($_GET['description'] )) { $description = $_GET['description']; $query .= " WHERE description like '%$description%'"; } if(isset($_GET['price']) && !empty($_GET['price'])) { $price = explode('-', $_GET['price']); $lowPrice = (int)$price[0]; $highPrice = (int)$price[1]; $query .= " AND price BETWEEN $lowPrice AND $highPrice LIMIT 0, 15"; } $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; echo "<div class='productdisplayshell'> <div class='productdisplayoutline'> <div class='productborder'><center> <a href='$link' target='_blank'><img src='$image' width=\"95%\" /></a> </center> </div></div> <div class='productdescriptionoutline'> <div class='productdescriptionbox'> <a href='$link' target='_blank' >$description</a> </div> <div class='productfulldescriptionbox'>$fulldescription</div> </div> <div class='productpriceoutline'> <div class='productpricebox'> <center>£ $price</center> </div> <div class='productbuybutton'> <center><a href='$link' target='_blank' ><img src=/images/buybutton.png /></a></center> </div> </div> </div>"; } if ($_GET['description'] == $description ) { echo 'Sorry, this product is not available. Please visit our <a href="http://www.domain.co.uk">Homepage</a>.'; } if( !$result = mysql_query($query) ) { echo "<br>Query string: $query<br>Produced error: " . mysql_error() . '<br>'; } ?> <?php function sanitizeString($description) { $description = mysql_real_escape_string($description); $description = stripslashes($description); $description = htmlentities($description); return $var; $price = mysql_real_escape_string($price); $price = stripslashes($price); $price = htmlentities($price); return $var; } ?>
-
Thanks,
I am displaying data. Products and descriptions etc.
What measures would a page like this use so people dont insert code into the URL?
http://www.play.com/Search.html?searchstring=b1end&searchtype=clothingall&searchsource=0
-
The code I am using designed to display the terms I am using in my search.
For example:
.php?description=red&purple&widgets displays red and purple widgets.
However, I am also echoing the terms so people know what they are searching for:
"Your are searching for red and purple widgets"
However, by using the & sign it now displays "Your are searching for red"
If I using .php?description=red%purple%widgets then nothing is displayed.
function sanitizeString($description) { $description = mysql_real_escape_string($description); $description = stripslashes($description); $description = htmlentities($description); return $var;
-
Thanks,
But the code didn't include password masking. I'm sure that would be considered as implied.
I shall try again.
-
Thanks, I am a bit p****d off about because I got the code from someone with a PHPFreaks.com email address.
I did ask for email confirmation but it turns that you dont actually need to click the email link to get the login to work.
So basically could use someone elses email address to log into a site!!!
-
Its probably I start again to be honest.
I did get a log in system working by two tutorials together but it just wasn't reliable.
Can you quote me a price for a registration system covering all the points discussed?
I'm looking for one which is fully comprehensive, for example one I can include who the email is from.
I think the function is simply from: ?
-
I have added password masking, but the code to block pages and reset lost passwords sounds complicated.
Do you think its best to start again or just add these functions?
-
Thanks,
Where can I get a code from which includes
MD5
password masking
code to block pages which are not logged into
-
Hi,
I hired someone to provide me with a subcription script from this forum and I am very dissapointed with the results.
There is:
No password masking (now sorted)
No forgotten password retrieval
No code to block pages which are not logged into
Also and more worringly the MD5 code is on the second page which someone tells me is wrong because 'packet sniffing' programmes can capture the password before it enters the MD5.
Can someone please confirm how a password system should properly be structured. Should MD5 be on the login page?
-
Hi,
Got it work now, I was putting the limit in the wrong place.
Now I can go to bed.
-
Thanks, I dont know what you mean though.
Are you saying I should actually display the query and mysql_error()?
I didn't know I could do this, what will this give me?
-
Hi,
If I dont put the Limit 0,10 the query works but it prints everything in the database. Which could be thousands.
But if I put the Limit function in like I used to it fails.
-
Hi,
The following code used to work but I have changed this query:
$query = "SELECT * FROM productfeed WHERE description like '%$description%' LIMIT 0, 3";
However, if I add LIMIT 0, 3 to this or anyother query it creates an error
$query .= " WHERE description like '%$description%' LIMIT 0, 3";
mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource
$query .= " WHERE description like '%$description%'";
-
I had a piece of code which limited the number of items printed from a database. However, I can no longer get it to work.
$query = "SELECT * FROM productfeed WHERE description like '%$description%' LIMIT 0, 3";
This is the code I am trying to limit, but I cant get it to work.
<?php ini_set('display_errors', 1); error_reporting(-1); $query = "SELECT * FROM productfeed"; if(isset($_GET['description']) && !empty($_GET['description'] )) { $description = $_GET['description']; $query .= " WHERE description like '%$description%'"; } if(isset($_GET['price']) && !empty($_GET['price'])) { $price = explode('-', $_GET['price']); $lowPrice = (int)$price[0]; $highPrice = (int)$price[1]; $query .= " AND price BETWEEN $lowPrice AND $highPrice"; } $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { $id = $row['id']; $image = $row['awImage']; $link = $row['link']; $description = $row['description']; $fulldescription = $row['fulldescription']; $price = $row['price']; echo "<div class='productdisplayshell'> <div class='productdisplayoutline'> <div class='productborder'><center> <a href='$link' target='_blank'><img src='$image' width=\"95%\" /></a> </center> </div></div> <div class='productdescriptionoutline'> <div class='productdescriptionbox'> <a href='$link' target='_blank' >$description</a> </div> <div class='productfulldescriptionbox'>$fulldescription</div> </div> <div class='productpriceoutline'> <div class='productpricebox'> <center>£ $price</center> </div> <div class='productbuybutton'> <center><a href='$link' target='_blank' ><img src=/images/buybutton.png /></a></center> </div> </div> </div>"; } if ($_GET['description'] == $description ) { echo 'Sorry, this product is not available. Please visit our <a href="http://www.ukhomefurniture.co.uk">Homepage</a>.'; } ?> <?php function sanitizeString($description) { $description = mysql_real_escape_string($description); $description = stripslashes($description); $description = htmlentities($description); return $var; $price = mysql_real_escape_string($price); $price = stripslashes($price); $price = htmlentities($price); return $var; } ?>
-
Hi,
I have piece of code which should copy an XML in my root folder and then save it to another folder. And then update my MySQL database. I can get it to copy the file but not update my database. If anyone experienced in updated MySQL using XML could you please quote me a price for completing this function.
----Code so far---->$xmlReader = new XMLReader();$filename = "datafeed_98057.xml";$url = "http://www.domain.co.uk/datafeed.xml";file_put_contents($filename, file_get_contents($url));$xmlReader->open($filename);while ($xmlReader->read()){switch ($xmlReader->name){case'prod':$dom = new DOMDocument();$domNode = $xmlReader->expand();$element = $dom->appendChild($domNode);$domString = utf8_encode($dom->saveXML($element));$prod = new SimpleXMLElement($domString);$id = $prod->prod['id'];$description = $prod->name;$image = $prod->awImage;$fulldescription = $prod->desc;//insert queryif(strlen($prod) > 0){$query = mysql_query("REPLACE INTO productfeed(id, description, fulldescription, image)VALUES ('$id','$description','$image','$fulldescription') ");echo $id . "has been inserted </br>";}else{echo ("This does not work </br>");}}
- <merchant id="1829" name="Pinesolutions.co.uk">- <prod id="39920873" pre_order="no" web_offer="no" in_stock="yes" hotPick="no" adult="no">- <text lang="EN"> <name>Oakleigh Wall Mirror 60x90</name> <desc>Mirrors are useful anywhere in the house. Not only are they functional allowing you to see your reflection in order to look your best, they also add elegance to any room theyre placed in. We offer a variety of mirrors to fit your decorating tastes as well as wall space. The Oakleigh Wall Mirror radiates an elegant simplistic style, while offering a generous size glass. The Oakleigh Wall Mirror s frame is crafted from solid hardwood and is lacquered with a protective finish to guard against dust and unexpected stains. The Oakleigh Wall Mirror is versatile and can be hung portrait style at the top of a staircase or landscape. The Oakleigh Wall Mirrors light colour means it also complements all of the furniture in our Camden Painted Range because the range has ash tops. The Oakleigh Wall Mirror has fewer knots than traditional oak wood, but is built just as sturdy so you can be certain it will last you through the generations to come.</desc> </text>- <uri lang="EN"> <awTrack>http://www.awin1.com/pclick.php?p=39920873&a=98057&m=1829</awTrack> <awImage>http://images.productserve.com/preview/1829/39920873.jpg</awImage> <mLink>http://www.pinesolutions.co.uk/bedroom-furniture/mirrors/wall-mirrors/oakleigh-wall-mirror-60x90/</mLink> <mImage>http://media.pinesolutions.co.uk/images/products/903.333.3.4.jpg</mImage> </uri>- <price curr="GBP"> <buynow>40.00</buynow> </price>- <cat> <awCatId>424</awCatId> </cat> <brand /> </prod> </merchant> Report to moderator 82.29.168.222 --------------------------------------------------------------------------------
-
Thanks,
So how does the database work. I thought that all entries had to go into an individual field. How do I display each response individually?
-
Hi,
I am in the process of creating a discussion board. The have section in which someone can ask a question and add notes. However, I am slighlty stuck on the reply section. So I can display the question and notes.
I was planning to add fields "Answer 1" then "Answer 2" then "Answer 3" etc. However, means I have to create upto 100 fields and create response boxes for each one.
Does anyone know if there is a simpler way to do this?
-
Lets say you have a database which is packed with content. How can this be used for SEO purposes?
Does Google follow all the links on your site and read the echo and indexing that information. Or does the content in a database need to converted into HTML for Google to be able to read it?
I tried using Google Custom Search however it did not display anything in my database. If Google crawled my site and ranked it and then carried out the search using Google Custom Search would it then display using Google Custom Search?
-
Hi,
I came across this site from Techcrunch:
http://www.room77.com/index.html
The main text in the middle "Personal hotel room recommendations" appears to be in a div which shows it as a background text. Similiar to the background image.
Does anyone know how to do this?
-
Hi,
I would be very grateful if anyone can give me any advice on resolving this.
-
Hi,
Apologies to keep going on about this but I have hit a brick wall over updating my database with XML. I have spent around 100 hours on this and so far I can only copy the file, I am unable so far to update my database with the information from the XML file. I would be very grateful for any help you can offer to fix this.
----Code so far----> $xmlReader = new XMLReader(); $filename = "datafeed_98057.xml"; $url = "http://www.domain.co.uk/datafeed.xml"; file_put_contents($filename, file_get_contents($url)); $xmlReader->open($filename); while ($xmlReader->read()) { switch ($xmlReader->name) { case'prod': $dom = new DOMDocument(); $domNode = $xmlReader->expand(); $element = $dom->appendChild($domNode); $domString = utf8_encode($dom->saveXML($element)); $prod = new SimpleXMLElement($domString); $id = $prod->prod['id']; $description = $prod->name; $image = $prod->awImage; $fulldescription = $prod->desc; //insert query if(strlen($prod) > 0) { $query = mysql_query("REPLACE INTO productfeed (id, description, fulldescription, image) VALUES ('$id','$description','$image','$fulldescription') "); echo $id . "has been inserted </br>"; } else{echo ("This does not work </br>");} }
This is an outline of the XML feed I am using, it only includes one item which I am using as a test:
- <merchant id="1829" name="Pinesolutions.co.uk"> - <prod id="39920873" pre_order="no" web_offer="no" in_stock="yes" hotPick="no" adult="no"> - <text lang="EN"> <name>Oakleigh Wall Mirror 60x90</name> <desc>Mirrors are useful anywhere in the house. Not only are they functional allowing you to see your reflection in order to look your best, they also add elegance to any room theyre placed in. We offer a variety of mirrors to fit your decorating tastes as well as wall space. The Oakleigh Wall Mirror radiates an elegant simplistic style, while offering a generous size glass. The Oakleigh Wall Mirror s frame is crafted from solid hardwood and is lacquered with a protective finish to guard against dust and unexpected stains. The Oakleigh Wall Mirror is versatile and can be hung portrait style at the top of a staircase or landscape. The Oakleigh Wall Mirrors light colour means it also complements all of the furniture in our Camden Painted Range because the range has ash tops. The Oakleigh Wall Mirror has fewer knots than traditional oak wood, but is built just as sturdy so you can be certain it will last you through the generations to come.</desc> </text> - <uri lang="EN"> <awTrack>http://www.awin1.com/pclick.php?p=39920873&a=98057&m=1829</awTrack> <awImage>http://images.productserve.com/preview/1829/39920873.jpg</awImage> <mLink>http://www.pinesolutions.co.uk/bedroom-furniture/mirrors/wall-mirrors/oakleigh-wall-mirror-60x90/</mLink> <mImage>http://media.pinesolutions.co.uk/images/products/903.333.3.4.jpg</mImage> </uri> - <price curr="GBP"> <buynow>40.00</buynow> </price> - <cat> <awCatId>424</awCatId> </cat> <brand /> </prod> </merchant>
-
Thanks,
I thought the search form use $_POST and the display page used $_GET.
I really need a step by step guide to this sort of code. I bought a book but the examples are very poor and not based on commercial examples.
Get URL For Second Query
in PHP Coding Help
Posted
Do you mean a search box? I am looking to add that later but many sites such as www.mydeco.com enable people to search for products and then sort by price ranges by using links. I have the product links working but I want to add the price range query.
I thought forms were for entering data.