Jump to content

justlukeyou

Members
  • Posts

    957
  • Joined

  • Last visited

Posts posted by justlukeyou

  1. 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.

     

  2. 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?

  3. 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>&#163; $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;
    
    
    }
    ?> 

  4. 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;

  5. 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!!!

  6. 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: ?

  7. 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?

  8. 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%'";

  9. 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>&#163; $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;
    
    
    }
    ?> 

  10. 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 
    --------------------------------------------------------------------------------
    
    

  11. 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? 

     

     

     

     

  12. 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?

  13. 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>

×
×
  • 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.