Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by son

  1. son

    Loop help needed

    I got the following the display categories in two levels as: // get the top level halos first$haloQuery = 'SELECT haloID, halo FROM haloTable WHERE haloParent = 0';$haloResult = mysqli_query($dbc, $haloQuery);if (mysqli_num_rows($haloResult) > 0){ while ($row = mysqli_fetch_array ($haloResult, MYSQL_ASSOC)) { $haloID = $row['haloID']; $halo = $row['halo']; echo "<option value=\"halos.php?hid={$haloID}\">" . $halo . "</option>\n"; // get the sub halos now $haloQuery2 = "SELECT haloID, halo FROM haloTable WHERE haloParent = $haloID"; $haloResult2 = mysqli_query ($dbc, $ha
  2. Actually, just an important improvement for this great funtion. Use: $extVar = explode('.',$src);$ext = strtolower(array_pop($extVar)); instead of: $ext = strtolower(array_pop(explode('.', $src))); I got "Only variables should be passed by reference" when I used the function on another page with image upload and the small change solved the issue... Son
  3. Have the following in .htaccess ErrorDocument 401 /401.phpErrorDocument 403 /401.phpErrorDocument 404 /404.phpErrorDocument 500 /500.php and works fine for web root requests. However, does not work if wrong file accessed within a directory. Have tried to have full system paths and is the same situation. Do I need to have .htaccess for each folder then? Or how can I improve this? Thanks,Son
  4. Thanks a lot. Have it working now:-) Son
  5. I am trying to use the function: function resize_image($opts){ $src = isset($opts['source']) ? $opts['source'] : ''; $dest = isset($opts['dest']) ? $opts['dest'] : ''; $w = isset($opts['w']) ? intval($opts['w']) : 0; $h = isset($opts['h']) ? intval($opts['h']) : 0; if ($src == '') { return; } if ($w == 0 && $h == 0) { return; } if ($dest == '') $dest = $src; // resize in place // open the image $ext = strtolower(array_pop(explode('.', $src))); switch ($ext) { case 'jpg': case 'jpeg': $i = imagecreatefromjpeg($src); break; case 'gif':
  6. They did not let me do this without signing a contract that says that we are responsible if there are any issues arising (is this normal?), but could get the script working with their help. Thanks,Son
  7. Yes. There it is a Javascript Gallery and I will certainly try to figure this out... Thanks for your suggestion. Son
  8. Ok. Will do and see what they say... Many thanks,Son
  9. I have found one issue which was that the file did not have permission which I fixed. Now running the schedule it says:Your script returned the following:X-Powered-By: PHP/5.2.17Content-type: text/htmlwhich looked promising, but no backup generated. I tried to remove the path, but no difference and also tried passthru to see if it works when run in a browser. No luck with this either. You say I should run the script inside a shell... I have nver done this before and believe it is when you run something in MS DOS or similar. Is this correct and how would I do this? Also, in what general cases i
  10. Now I got you, but still not working. I have now: /usr/bin/php5<?phpecho exec('mysqldump -h localhost -p[data] -u [data] [data] > testdump.sql');?> Also tried shell_exec and path to PHP inside php tags, but same result.... Son
  11. I had it within php tags, but not within function. However, still not working as <?php/usr/bin/php5function exec(){mysqldump -h localhost -p[pass] -u [user] [db] > testdump.sql}exec();?> Where am I going wrong? Son
  12. I would like to run a scheduled task via server (hosted) that generates a backup. I uploaded for this reason a file called backup.php to root directory and it has the following code: /usr/bin/php5mysqldump -h localhost -p[PASSWORD] -u [USERNAME] [DATABASENAME] > testdump.sql I cannot get it work and wondered where am I going wrong... Son
  13. Thanks guys. Your inputs really gave me some good pointers... However, if we even assumed the 5 sec rule was true, then the images would all be well within this and the page would load quick. But this is not the case. I tested on different machines with different internet providers and it takes ages for the 1139ms image for example to load... Son
  14. Thanks for this... I have bookmarked the web page and will delve in and out whenever I can... Very helpful!Son
  15. I had a look in Firefoxes web and error console and it shows on page load:[09:24:37.601] GET http://www.domain.com/ [HTTP/1.1 200 OK 188ms][09:24:37.856] GET http://www.domain.com/img/small/info.php?id=1 [HTTP/1.1 200 OK 124ms] (file that brings in the images for gallery) Then clicking to next photo (on load of website the first image of default photo cat shows immediately)[09:30:07.048] GET http://www.domain.co.uk/img/main/holiday.jpg [HTTP/1.1 200 OK 1139ms]Going to server and checking the sizefor photo, the photo is 366KB (710px/493px)Checking a quicker one ([09:30:19.572] GET http://www.do
  16. I use Javascript as this p is directly under a javascript generated slideshow and I only want to show text if javascript is enabled... Son
  17. Thanks. That is very helpful. I will create a homepage, one for the ones you can update/delete and another one for the gallery... I am not to verses in object-oriented programming, but have great includes for header and footer that include all the general stuff and might just need some tweaking here and there. Would it be better to learn object-oriented programming? Till now, I have not used this at all as there was no need... Son
  18. Images have varying sizes, anything in between 39KB and 433KB at present... Son
  19. I have build basic options for user to update the content on their websites and think now it the time to build one global version that I can use again and again without me spending hours each time to do a new system... This will also be better to update when needed. The parts I have so far are great and with some mod rewrite all also very URL-friendly. However, I have a theoretical question that I find hard to solve with my pen and paper here. Maybe some of you can share their experience when you build systems like this... As for the websites in general: Thee homepage is a bit different from t
  20. On a photo gallery site the photos we have issues as it simply takes too long. I am not sure if the issues is too large image size, the Javascript is causing it or the server is too slow (or whatever else the reason might be). What is a sensible way to go along testing and find the "real" cause? Thanks,Son
  21. It complainsdocument type does not allow element "p" hereThe Javascript is embedded in between <div> and </div> Son
  22. I have some trouble validating code that I generated via PHP as: echo "document.write('<p id=\"slidesHint\">Info Text</p>')"; Where is the issue with this? Thanks,Son
  23. son

    Headers From Mail Function

    Thanks. Will do... Son
  24. Sending headers as $headers = 'From: My Website <info@mywebsite.com>' . "\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n"; I cannot figure out why the 'From part' arrives in actual email as:mywebsite.com [mywebsite.com@web864.extcp.com; on behalf of; My Website [info@mywebsite.com] Where am I going wrong? Thanks,Son
  • Create New...