Jump to content

subzerostudio

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

subzerostudio's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, I have a AJAX "product finder" script that I've written. It is working fine on the main domain: http://www.funkylittlefeet.com However does not work on the alternative domain: http://www.funkylittlefeet.co.uk Any advice on how to get it working would be appreciated. Code below. Thanks Mike var xmlHttp function changeMenu(str, menu) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="productfinder_core.php" var category = document.getElementById('occasionbox').value; var parent_cat = document.getElementById('parent_cat').value; if (category != '') { url=url+"?q="+str+"&menu="+menu+'&cat='+category } else if (parent_cat != '') { url=url+"?q="+str+"&menu="+menu+'&cat='+parent_cat+'&useParent=true' } else { url=url+"?q="+str+"&menu="+menu } url=url+"&sid="+Math.random() if (menu == 'category') { xmlHttp.onreadystatechange=stateChanged } else if (menu == 'occasion') { xmlHttp.onreadystatechange=stateChangedBrand } else { xmlHttp.onreadystatechange=stateChangedSize } xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { data = xmlHttp.responseText.split('|') document.getElementById("occasion").innerHTML=data[0] document.getElementById("brand").innerHTML=data[1]; document.getElementById("size").innerHTML=data[2]; } } function stateChangedBrand() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { data = xmlHttp.responseText.split('|') document.getElementById("brand").innerHTML=data[0] document.getElementById("size").innerHTML=data[1] } } function stateChangedSize() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("size").innerHTML=xmlHttp.responseText } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
  2. I have a job in which I'm setting up a CMS that will allow the client to allocate/organise submitted form details via a backend system. This data also needs to be downloadable / editable using Access on the clients system. So what I'm after is any knowledge on the way I can get mySQL and MS Access to communicate. I assume this is not simple to setup? I understand I could output as a CSV and then import into Access that way, but it needs to be a more cohesive solution then that (as the client isn't particularly web savvy). On a side note - if I were using ASP and MS Access on a Windows Server (I'm not going to, I don't have any experience with it, but just out of interest) - would it be a much simpler job? Mike
  3. I have a CSS expandable design that I'm creating. However the design doesn't work properly in IE6 or IE5.5. It works fine in IE7 and FF2. The site can be seen here: http://www.subzerostudio.com/Clients/etc/ I have positioned the left hand menu and the right hand sidebar absolutely. Then the middle content area should expand up to the edge of this elements - I have made sure they don't overlap by adding: margin-left: 190px; margin-right: 220px; I think it is the way I've positioned this content which is causing a problem in these browsers? Any help appreciated - my CSS code is given below. Thanks Mike -------- #container { background:url(images/content-background.gif) top left no-repeat #FFFFFF; } .prop { height:580px; float:right; width:1px; } .clear { clear: both; } #menu-container { position: absolute; top: 162px; left: 105px; width:152px; } #content { margin-top: 140px; margin-left: 190px; margin-right: 220px; float: left; } #sidebar { position: absolute; right: 0px; width:220px; margin-top: 140px; }
  4. Hi I have an SQL statement. What it does is look through all products for a specific manufacturer on an E-Commerce site, looking for a match of two things: size and colour. The query is given below: SELECT <list of selected files here> FROM <list of tables where> WHERE p.products_status = '1' AND pd.language_id = '1' AND fp.code = 'GBP' AND m.manufacturers_id = '1' AND pa.options_values_id in (108,696,698,705,709,710,716,713,731,734,735,755,756) AND p.products_id IN (SELECT products_id FROM products_attributes WHERE options_id=2 AND options_values_id=236) ORDER BY pd.products_name So the colour is matched by passing the query a list of colour ID's.. Using this line here: AND pa.options_values_id in (108,696,698,705,709,710,716,713,731,734,735,755,756) However the size is also stored in the same table as the colour (with a different options id) and this is leading to problems. The following line: AND p.products_id IN (SELECT products_id FROM products_attributes WHERE options_id=2 AND options_values_id=236) Is taking the query from a 0-1sec query, to a 30 sec query.. and thus bogging down the server very noticably. Is there a way that it can be rewritten without altering the database structure? Any help appreciated Mike
  5. Hi, I have a query which finds the lowest product price in all subcategories of a category (this is using oscommerce).. The way I am doing it at the moment is to first have a query to find all subcategory ids, then loop through each of these with another query to find the lowest product price in that category. This seems a little laborious - as if there are 20 subcategories in a category - it involves running 21 queries on the database! There must be a way to do this in one query, but I can't work out how. Any advice / help much apprecaited. Code is below. Thanks Mike //get all subcategories from this category $sub_category_query_raw = "SELECT c.categories_id " . "FROM categories c " . "WHERE c.parent_id=" . $categories['categories_id']; $sub_category_query = mysql_query($sub_category_query_raw); $lowest_price = 99999; //now loop through each category and find the product with the lowest price while ($subcat = mysql_fetch_array($sub_category_query)) { $lowest_price_in_cat_query_raw = "SELECT MIN(products_price) as min_price " . "FROM products p, products_to_categories p2c " . "WHERE p2c.products_id=p.products_id " . "AND p2c.categories_id = " . $subcat['categories_id']; $lowest_price_in_cat_query = tep_db_query($lowest_price_in_cat_query_raw); $lowest_price_in_cat_array = tep_db_fetch_array($lowest_price_in_cat_query); if ($lowest_price_in_cat_array['min_price'] < $lowest_price) $lowest_price = $lowest_price_in_cat_array['min_price']; }
  6. still trying to figure this out - anyone else got any ideas?
  7. no its set to 33MB: "Memory limit is 33M bytes" Mike
  8. I am having trouble creating zip files on the fly using PHP.  I can zip one file (about 5mb), however when i try and zip two files together (about 12mb) I get the following error in firefox: "The connection to the server was reset while the page was loading." I guess it's timing out somewhere or something??  The code i'm using is given below.  I thought it could be something in the php.ini file but max_execution_time is set to 60secs and the error comes up way before that Any ideas ?? Mike [code] <?php /** * Class to dynamically create a zip file (archive) * * @author Rochak Chauhan */ class createZip  {      var $compressedData = array();     var $centralDirectory = array(); // central directory      var $endOfCentralDirectory = "\x50\x4b\x05\x06\x00\x00\x00\x00"; //end of Central directory record     var $oldOffset = 0;     /**     * Function to create the directory where the file(s) will be unzipped     *     * @param $directoryName string     *     */         function addDirectory($directoryName) {         $directoryName = str_replace("\\", "/", $directoryName);          $feedArrayRow = "\x50\x4b\x03\x04";         $feedArrayRow .= "\x0a\x00";            $feedArrayRow .= "\x00\x00";            $feedArrayRow .= "\x00\x00";            $feedArrayRow .= "\x00\x00\x00\x00";         $feedArrayRow .= pack("V",0);         $feedArrayRow .= pack("V",0);         $feedArrayRow .= pack("V",0);         $feedArrayRow .= pack("v", strlen($directoryName) );         $feedArrayRow .= pack("v", 0 );         $feedArrayRow .= $directoryName;          $feedArrayRow .= pack("V",0);         $feedArrayRow .= pack("V",0);         $feedArrayRow .= pack("V",0);         $this -> compressedData[] = $feedArrayRow;                 $newOffset = strlen(implode("", $this->compressedData));         $addCentralRecord = "\x50\x4b\x01\x02";         $addCentralRecord .="\x00\x00";            $addCentralRecord .="\x0a\x00";            $addCentralRecord .="\x00\x00";            $addCentralRecord .="\x00\x00";            $addCentralRecord .="\x00\x00\x00\x00";         $addCentralRecord .= pack("V",0);         $addCentralRecord .= pack("V",0);         $addCentralRecord .= pack("V",0);         $addCentralRecord .= pack("v", strlen($directoryName) );         $addCentralRecord .= pack("v", 0 );         $addCentralRecord .= pack("v", 0 );         $addCentralRecord .= pack("v", 0 );         $addCentralRecord .= pack("v", 0 );         $ext = "\x00\x00\x10\x00";         $ext = "\xff\xff\xff\xff";          $addCentralRecord .= pack("V", 16 );         $addCentralRecord .= pack("V", $this -> oldOffset );         $this -> oldOffset = $newOffset;         $addCentralRecord .= $directoryName;          $this -> centralDirectory[] = $addCentralRecord;      }            /**     * Function to add file(s) to the specified directory in the archive     *     * @param $directoryName string     *     */         function addFile($data, $directoryName)  {         $directoryName = str_replace("\\", "/", $directoryName);              $feedArrayRow = "\x50\x4b\x03\x04";         $feedArrayRow .= "\x14\x00";            $feedArrayRow .= "\x00\x00";            $feedArrayRow .= "\x08\x00";            $feedArrayRow .= "\x00\x00\x00\x00";         $uncompressedLength = strlen($data);          $compression = crc32($data);          $gzCompressedData = gzcompress($data);          $gzCompressedData = substr( substr($gzCompressedData, 0, strlen($gzCompressedData) - 4), 2);         $compressedLength = strlen($gzCompressedData);          $feedArrayRow .= pack("V",$compression);         $feedArrayRow .= pack("V",$compressedLength);         $feedArrayRow .= pack("V",$uncompressedLength);         $feedArrayRow .= pack("v", strlen($directoryName) );         $feedArrayRow .= pack("v", 0 );         $feedArrayRow .= $directoryName;          $feedArrayRow .= $gzCompressedData;          $feedArrayRow .= pack("V",$compression);         $feedArrayRow .= pack("V",$compressedLength);         $feedArrayRow .= pack("V",$uncompressedLength);         $this -> compressedData[] = $feedArrayRow;         $newOffset = strlen(implode("", $this->compressedData));         $addCentralRecord = "\x50\x4b\x01\x02";         $addCentralRecord .="\x00\x00";            $addCentralRecord .="\x14\x00";            $addCentralRecord .="\x00\x00";            $addCentralRecord .="\x08\x00";            $addCentralRecord .="\x00\x00\x00\x00";         $addCentralRecord .= pack("V",$compression);         $addCentralRecord .= pack("V",$compressedLength);         $addCentralRecord .= pack("V",$uncompressedLength);         $addCentralRecord .= pack("v", strlen($directoryName) );         $addCentralRecord .= pack("v", 0 );         $addCentralRecord .= pack("v", 0 );         $addCentralRecord .= pack("v", 0 );         $addCentralRecord .= pack("v", 0 );         $addCentralRecord .= pack("V", 32 );         $addCentralRecord .= pack("V", $this -> oldOffset );         $this -> oldOffset = $newOffset;         $addCentralRecord .= $directoryName;          $this -> centralDirectory[] = $addCentralRecord;      }     /**     * Fucntion to return the zip file     *     * @return zipfile (archive)     */     function getZippedfile() {         $data = implode("", $this -> compressedData);          $controlDirectory = implode("", $this -> centralDirectory);          return              $data.              $controlDirectory.              $this -> endOfCentralDirectory.              pack("v", sizeof($this -> centralDirectory)).                pack("v", sizeof($this -> centralDirectory)).                pack("V", strlen($controlDirectory)).                        pack("V", strlen($data)).                            "\x00\x00";                                }     /**     *     * Function to force the download of the archive as soon as it is created     *     * @param archiveName string - name of the created archive file     */     function forceDownload($archiveName) {         $headerInfo = '';                 if(ini_get('zlib.output_compression')) {             ini_set('zlib.output_compression', 'Off');         }         // Security checks         if( $archiveName == "" ) {             echo "<html><title>Public Photo Directory - Download </title><body><BR><B>ERROR:</B> The download file was NOT SPECIFIED.</body></html>";             exit;         }         elseif ( ! file_exists( $archiveName ) ) {             echo "<html><title>Public Photo Directory - Download </title><body><BR><B>ERROR:</B> File not found.</body></html>";             exit;         }         header("Pragma: public");         header("Expires: 0");         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");         header("Cache-Control: private",false);         header("Content-Type: application/zip");         header("Content-Disposition: attachment; filename=".basename($archiveName).";" );         header("Content-Transfer-Encoding: binary");         header("Content-Length: ".filesize($archiveName));         readfile("$archiveName");             } } ?> [/code] The code to create the zip using the above class: [code] <?php include_once("createZip.php"); $createZip = new createZip;  $fileContents = file_get_contents("test/a.mp3");  $createZip -> addFile($fileContents, "a.mp3");  $fileContents = file_get_contents("test/b.mp3"); $createZip -> addFile($fileContents, "b.mp3");  $fileContents = file_get_contents("test/c.mp3");  $createZip -> addFile($fileContents, "c.mp3");  $fileName = "test/archive.zip"; $fd = fopen ($fileName, "wb"); $out = fwrite ($fd, $createZip -> getZippedfile()); fclose ($fd); ?> [/code]
  9. Hi a have a page on my site that is passed the following in the URL 'products_id=n' - where n is a number I use $_GET['products_id'] to get the id, and of course it works. However when I try and use this in some javascript in the head of my code, it doesn't work - it always interprets $_GET['products_id'] as 28 - even if the products_id passed is 29 or 30 The javascript code can be seen in the head of my document (see the link below) (for some reason I can't post it here - whenever i try it redirects me to a 'the connection with the server has been reset' page.. not sure what that is all about?? The relevant line is: [code]window.location.href = 'product_info.php?products_id=<?php echo $_GET['products_id']; ?>&colour=' + this.options[this.selectedIndex].value;[/code] So basically what is happening is that even if products_id=30; that line will be interpreted as: [code]window.location.href = 'product_info.php?products_id=28&colour={some colour value}[/code] Why is this happening?? You can view the site at [url=http://www.scooter.co.uk]http://www.scooter.co.uk[/url].  And the product_info.php page can be seen by clicking any of the bikes (the site has a url rewrite function on it so it won't display as product_info.php).  The problem means that if you select either of the 50cc scooters, and change the colour drop down - the bike will change to 125cc (as this has product id 28!!) Hope I explained myself ok  ::) Mike
  10. no the file is definetly in the correct place.  I know this as a test asp file I uploaded to the same place (as well as all html files) - work mike
  11. Hi, I've written a site using PHP - however when trying to upload to a new server (that i only have ftp access to) the php files don't seem to work. I tried creating a file with phpinfo(); in it - but it doesn't work. It simply says 'the page cannot be found' does this mean that php is not installed on the server? link is [url=http://www.ambient-graphics.com/index.php]http://www.ambient-graphics.com/index.php[/url] mike
  12. Still looking for a solution to this. So if anyone has any advice, that'd be great  ;)
  13. Hi Ken Code is posted above in the original post. Basically what I am trying to do is either: extract  the 'error' variable from the following URL that is passed [code]checkout_payment.php?payment_error=protx_direct&amp;error=The+credit+card+number+entered+is+invalid.%3Cbr%3EPlease+check+the+number+and+try+again.&amp;protx_direct_cc_owner=Mike+Collins&amp;protx_direct_cc_expires_month=01&amp;protx_direct_cc_expires_year=09&amp;osCsid=c90bf25c5c0bc13cc6466fc916a0c440[/code] or somehow rewrite the url so that & is not written as &amp; e.g. [code]checkout_payment.php?payment_error=protx_direct&error=The+credit+card+number+entered+is+invalid.%3Cbr%3EPlease+check+the+number+and+try+again.&protx_direct_cc_owner=Mike+Collins&protx_direct_cc_expires_month=01&protx_direct_cc_expires_year=09&osCsid=c90bf25c5c0bc13cc6466fc916a0c440[/code] The url given is achieved not via a href link, but rather a redirect using header() It may have something to do with the specific version of PHP on my server.. As the exact same code doesn't have the same problems on other sites that I've done.  It's running PHP 4.4.2 Thanks again, Mike
  14. excuse my ignorance.. but i've been trying for a while now and am unable to do it.. Latest attempt is: [code]<?php echo urldecode($_GET['error']); ?>[/code] But this doesn't work...
  15. an example of a URL i'm getting [code] checkout_payment.php?payment_error=protx_direct&amp;error=The+credit+card+number+entered+is+invalid.%3Cbr%3EPlease+check+the+number+and+try+again.&amp;protx_direct_cc_owner=Mike+Collins&amp;protx_direct_cc_expires_month=01&amp;protx_direct_cc_expires_year=09&amp;osCsid=c90bf25c5c0bc13cc6466fc916a0c440 [/code]
×
×
  • 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.