Jump to content

deansatch

Members
  • Posts

    300
  • Joined

  • Last visited

Everything posted by deansatch

  1. This only happens in the latest Safari on mac Lion os when clicking back, or swiping back. Doesn't happen in chrome or FF! I randomly get syntax errors such as unexpected $end , syntax error, unexpected T_ENCAPSED_AND_WHITESPACE etc...- but refreshing the page is fine. This is only happening if I use htaccess to remove php extensions. So if I run the site with extensions, it doesn't happen. This is my htaccess for removing the extension... Options -MultiViews Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L,QSA] Any ideas???
  2. Thanks...I have just got it working though. mysql_query("UPDATE products t1 ,pickingLists t2 SET t1.qty = t1.qty-(SELECT t2.qty FROM pickingLists t2 WHERE t2.productName = t1.productName AND t1.size= t2.size AND t1.colour = t2.colour AND t2.listID = '$listID') WHERE t2.productName = t1.productName AND t1.size= t2.size AND t1.colour = t2.colour") or die(mysql_error()); This seems to work...hopefully it's not flawed!
  3. That's what I thought, but when I add the similar WHERE outside the select, it doesn't seem to recognise the pickingList table: mysql_query( "UPDATE products t1 SET qty = qty-(SELECT qty FROM pickingLists t2 WHERE t2.productName = t1.productName AND t1.size= t2.size AND t1.colour = t2.colour AND t2.listID = '$listID') WHERE t2.productName = t1.productName AND t1.size= t2.size AND t1.colour = t2.colour") or die(mysql_error()); I get error: Unknown column 't2.productName' in 'where clause'
  4. I have 2 tables, one for products (which includes ALL products and stock quantities) and one for picking lists (basically a shopping cart) When the query is submitted, I want it to get the quantities from 'pickingLists' table for each of the products in that query, and update the quantities of those products in the 'products' table. At the moment, what I have does exactly that, but it also sets the qty of every other product as 0. I just want it to perform the update on the relevant rows, not all of them. mysql_query("UPDATE products t1 SET qty = qty-(SELECT qty FROM pickingLists t2 WHERE t2.productName = t1.productName AND t1.size= t2.size AND t2.listID = '$listID')") or die(mysql_error()); Where am I going wrong?
  5. Thanks a lot! I managed to get it working by adding an A record and associating it with the IP address, but as you said, just for a single site. I would normally have xampp running locally on my mac, add a virtual host in my xampp config file, then add a domain in my hosts file so I can run several sites on several domains at the same time. I assume that if I just add a virtual host on the windows server's version of wamp, it will work the same? I was hoping to avoid that and thought that perhaps there was a way of associating a domain with ip/path_to_site in the A records. Are those differences applicable to xampp vs wamp - I assumed they would work exactly the same, but maybe only a php install on IIS would be different?
  6. Ok requinix! that sounds like the type of thing I am after! I have logged into the windows server and have found the DNS Manager. Let's say I have wamp on there and a site in a folder /htdocs/websiteOne/ Is it straight forward enough to assign that location to a domain www.websiteOne.dev so that all computers that are on our network and connected to the windows server would be able to type that domain into their web browser address bar and resolve to the test site? If it's a long winded solution, you can just point me in the direction of a tutorial or relevant section in the documentation. As far as I know it's an SPS windows server 2008 Thanks ***and on a side note...will a wamp setup on windows still handle php/mysql exactly the same as your average linux php web hosting? Or are there some subtle differences I should be aware of when shifting from the test server to a live linux one? (unfortunately, it is a windows server because they already had it before I started here so stuck with it for now)
  7. Hi Currently, the developers in the office have been building on their own local installations of xampp. To use a test domain we would set up a virtual host in the apache config files and link our ip to a test domain e.g. newsite.dev. In order for someone else to view the site, they would have to go through the same process on their mac. We now have a windows server installed so we can all connect to it. We are in the process of having wamp installed so we can all access the same version of each site. Is there a way we can quickly assign a test domain to each new site once...i.e. without having to do it manually on each computer that is going to connect to it? Some sort of local dns server???
  8. Nah! That doesn't work. It adds a closing ul in each main page li when I have no subpages! Doh! Any help please???
  9. Well, I did this and it seems to work... <ul> <li><a href="/">Home</a></li> <?php $i=0; $x=0; $q = mysql_query("SELECT * FROM tbl_pages ORDER BY ITEMORDER desc"); while($r = mysql_fetch_array($q)){ $x++; if($r['SUBPAGE'] == '1'){ $i++; if($i==1){echo '<ul>';} echo "<li><a href=\"#\">".$r['TITLE']."</a></li>\n"; }else{ $i=0; if($x>1){ echo "</ul></li>\n";} echo "<li><a href=\"#\">".$r['TITLE']."</a>"; } } ?> </li></ul> Still seems a bit crappy to me though. Any better ideas?
  10. there is a column ['itemorder'] so basically by selecting from the db and ORDER BY itemorder - stupid, I know...but I didn't write it....I just have to do the front end output.
  11. I have some rows in my DB and each has a ['subpage'] value of either 0 or 1 to indicate if it is a main page(0) or subpage(1) and they are ordered so the parent is above the children e.g. 1 home (0) 2 about(0) 3 about-sub(1) 4 about-another-sub(1) 5 page(0) 6 page-sub1(1) 7 contact(0) What would be the best way to loop through these as a nested ul? I would have personally preferred to give each sub page a parent id but the person that created the CMS just did it like this so I am stuck with it!
  12. Has anyone got any ideas on this?
  13. What do I change in xampp to allow me to use individual php.ini files within my virtual host directories to override the main php.ini settings - like most web hosts do? So I can switch different things on and off for different sites and directories that I am working on. Any help appreciated...thanks
  14. I am using a shared SSL server so sessions don't pass between my http and https versions of my pages. I was wondering if it is possible for a user on my normal http page to fill in their username and password then have the form post to https page to check for authentication then go back to http setting my 'logged in' session variables on the non secure part of the site. The only info that needs to be secure is passing the login details...after that there is no personal data to worry about. I noticed hotmail does something like this as I sign in on http...see https in the loading bar then http again to the inbox.
  15. Thanks anyway. I managed to do it in the end with this: $size = getimagesize($source); $image_width = $size[0]; $image_height = $size[1]; $dest_x = 220; $dest_y = 160; if ($image_width > $dest_x or $image_height > $dest_y) { if ($image_height >= $image_width){$new_image_width = $dest_x; $new_image_height = $image_height *($dest_x/$image_width);} else {$new_image_width = $image_width *($dest_y/$image_height); $new_image_height = $dest_y;} } else {$new_image_width = $image_width; $new_image_height = $image_height;} $new_image = imagecreatetruecolor(220,160); imagecopyresampled($new_image, $im ,0, 0, 0, 0, $new_image_width, $new_image_height, $image_width, $image_height); imagejpeg($new_image, $dest, 100);
  16. I need it to resize before cropping though. The code on that thread will just crop a portion of the full size image.
  17. That seems to be a thread about creating a square thumbnail which I have already done. I wam trying to figure out how to create a set-sized rectangle.
  18. I currently have this little bit of code which successfully resizes an image down then crops it square. I want it to crop the center of the image but as a set sized rectangle (220x160) but can't seem to figure it out. $thumb_sizex = 220; $thumb_sizey = 220; $size = getimagesize($source); $width = $size[0]; $height = $size[1]; if($width > $height) { $x = ceil(($width - $height) / 2 ); $width = $height; } elseif($height > $width) { $y = ceil(($height - $width) / 2); $height = $width; } $new_im = ImageCreatetruecolor($thumb_sizex,$thumb_sizey); imagecopyresampled($new_im,$im,0,0,$x,$y,$thumb_sizex,$thumb_sizey,$width,$height); imagejpeg($new_im,$dest2,100); If I change thumb_sizey to 160 it just stretches the image. It does work on landscape pics but not on portrait. Any help appreciated. NOTE: I don't want to simply shrink it down with a maximum width of 220 or a maximum height of 160. I want the finished dimensions to be 220x160 and crop off any excess.
  19. The file paths are all fine - most of which are relative. I forgot to mention that in the first example, when it says some items aren't secure, if I click refresh, it is fine. It only does this when landing on the page from that referring page, but if I come from the other referring page it is 100% securely loaded.
  20. Thanks for that - works great! A new problem now though. My ssl certificate doesn't show up if I arrive at the page from one page but it does from another. e.g. if I am at http://site.com/page/home with the link "/securepage.php" it takes me there and changes to https://etc... but no certificate is shown and clicking on the padlock tells me that some items are not secure. if I am at http://site.com/index.php with the same link "/securepage.php" it takes me there and changes to https:// etc... and the padlock is fine, the certificate shows in the address bar etc.. all perfect. Any ideas what is going on?
  21. That's spot on, thanks! If I were to add a few more files, is there a cleaner way than writing that for each one? i.e. RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} securepage\.php RewriteRule .* https://sharedssl.com/mydomain.com/user/securepage.php RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} securepage2\.php RewriteRule .* https://sharedssl.com/mydomain.com/user/securepage2.php RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} securepage3\.php RewriteRule .* https://sharedssl.com/mydomain.com/user/securepage3.php
  22. I am trying to force shared SSL on a specific page using htaccess but no matter what I try I keep getting a redirect loop I want visitors to: http://user.mydomain.com/securepage.php to be forced to: https://sharedssl.com/mydomain.com/user/securepage.php Does anyone know a good way to do this? I will have a couple more pages that need to follow this rule as well i.e. securepage2.php and securepage3.php EDIT: I don't want to have to specify the subdomain in my rewrite as this will probably be gone on the final site and I want it to work with or without www. e.g. I would prefer something like: ^securepage.php etc....
  23. Thanks for that - would checking the modification date of a file every 2-3 seconds have a serious effect on the server performance?
  24. What is the best way to check to see when a mysql db has been updated in a sort of realtime situation? e.g. I can have a page and using some ajax I can have it select and display stuff from the db every 2 seconds so I will see entries appearing on the page in realtime. I imagine this would put some strain on the server - I only need it to retrieve info if there is something new to show - what is the least stressful way of doing this?
×
×
  • 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.