Jump to content

John_A

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by John_A

  1. Is it possible (and if so, does anyone know of a script available) for a php script to check a pop3 mailbox and for any mail it finds: - 1. Take the attachment (expected to be a single image file) 2. Add anything written in the message as an EXIF comment to the attachment 3. Upload the result to a specified location, with the subject as a subfolder, for example the attachment from an email with subject "thisfolder" would be upload to www.mydomain.com/images/thisfolder/ 4. Delete the mail from the pop3 mailbox ?
  2. I did, but the galleries part was still there, i.e. I got errors about tryint to open galleries/galleries/wedding/album.txt (one too many "galleries" in the link"). Removing it from the path gave me errors elsewhere in the page, and rather than go round in circles I just did my clumsy fix!
  3. Hmmm, that gave some errors indicating that a path was wrong somewhere. Looking at the rest of the code in the page, it might be duplicating a variable with the code I use for displaying the thumbnails ($dir). So I took it a step back then used str_replace on $f. Clumsy I know, but it works :) Thanks again!
  4. Thanks! That returns: - galleries//wedding galleries//holiday galleries//family How would I strip the galleries// from the beginning of each?
  5. Thanks very much! Unfortunately I've no idea how to build the link array from subdirs found (of [galleries]), any pointers?
  6. Hi, I'm throwing together an image gallery script which doesn't use a database, but rather uses a variable passed in the URL (?album=xxx) to display images found in that dir. I've got the image display and autothumbnial working fine, but I want to add licks to any other galleries (dirs) that exist. The file structure is as follows: - [pre] public_html      |      |-index.php (the gallery)      |      |-[galleries]             |             |-[wedding]             |        |             |        |-album.txt             |        |-images (multiple image files)             |             |-[holiday]             |        |             |        |-album.txt             |        |-images (multiple image files)             |             |-[family]                      |                      |-album.txt                      |-images (multiple image files) [/pre] Ideally the album.txt file will be a text file with one line only - the album's description, which is displayed for the links. So I need some code for index.php which basically: - 1. looks for subfolders of [galleries] and for each one it finds: - [list] [*]read the contents of the album.txt file [*]use this description to display a link, the url would be index.php?album=subdirname [/list] Is this possible? And can I do it with a simple one line album.txt file or would that have to be a php file which declares an album title variable? EDIT: Forgot to say using php4.
  7. I just had a thought, what if I do the normal swfobject to detect flash, which if found displays a flash movie which writes the php variable? This assumes you can write a php session variable using flash. Can you?
  8. Cross posted with [url=http://www.phpfreaks.com/forums/index.php/topic,119081.0.html]this thread[/url], hope the mods don't mind! I need to have a PHP variable for flash installed (e.g. $hasFlashSupport='true'), I know I can't actually use PHP for the flash detection, but I've used [url=http://blog.deconcept.com/swfobject]swfobject[/url] before for this (the flash detection) without any problems. What I need to know how to do is take the flash / noflash variable from swfobject and put this as a session variable in PHP. Unfortunately the only thing I know less of than PHP is Javascript :( I can't actually use swfobject to display the flash / noflash content, as swfobject assumes you want to actually display a flash movie if it's found, when I actually want to show alternative content (i.e. a link to a flash microsite), for example: - [code] if ($hasFlashSupport=='true') {     //visitor has flash installed     echo "<a href='flashpages.php'>Flash content</a>"; } else {     //visitor doesnt have flash installed     echo "<a href='noflash.php'>HTML content</a>"; }[/code] I want to place a check in the header of every page, something like: - If (php session variable $hasFlashSupport isn't set) {   detect flash with swfobject   write php session variable   } I think it needs a modified version of swfobject.js, which would write a php sessions variable, but I don't even know if that's possible, much less how to go about doing it!
  9. Thanks, but I'm not using a form, I want to add this into the header of every page, although the check is only done if the session variable for flash support hasn't been set yet, kind of like: - If (php session variable $hasFlashSupport isn't set) {    detect flash with swfobject    write php session variable    } I think this may be as much a Javascript issue as php, so if the mods don't mind I'll double post in that forum....
  10. I need to have a PHP variable for flash installed (e.g. $hasFlashSupport='true'), I know I can't actually use PHP for the flash detection, but I've used [url=http://blog.deconcept.com/swfobject]swfobject[/url] before for this (the flash detection) without any problems. What I need to know how to do is take the flash / noflash variable from swfobject and put this as a session variable in PHP. Unfortunately the only thing I know less of than PHP is Javascript :( I can't actually use swfobject to display the flash / noflash content, as swfobject assumes you want to actually display a flash movie if it's found, when I actually want to show alternative content (i.e. a link to a flash microsite), for example: - [code] if ($hasFlashSupport=='true') {      //visitor has flash installed      echo "<a href='flashpages.php'>Flash content</a>"; } else {      //visitor doesnt have flash installed      echo "<a href='noflash.php'>HTML content</a>"; }[/code] I've tried this: -[code] //check for flash and set variable accordingly if(eregi("application/x-shockwave-flash", $_SERVER['HTTP_ACCEPT']))  {       //viewer has flash      $hasFlashSupport=true; } else {      //viewer doesnt have flash      $hasFlashSupport=false; }[/code]but that's proven to be rather unreliable :(
  11. [quote author=fenway link=topic=114732.msg466938#msg466938 date=1163359251] This is going to complicated because of the way you're designed the products table.  By classifying in columns, not rows, you can't join in the same row multiple times easily, which is where you're having the problem. [/quote] Nothing's set in stone, the products table can be changed as long as I can still list products by any criteria. But I can't see how it can be done any other way? [quote]With your current design, the only way would be to get back all of the matching products, pull back the criteria table and store it in PHP, and then do the translation yourself. [/quote] I was thinking in the worst case, keeping the product table as it is and hard code a series of if statements, for example: - if (fruit==1) echo 'fruit link' if (vegetable==1) echo 'veg link' etc. etc. for all the criteria (this is obviously just an example, the one I'm working in has nearly 40). This would work but it's rather clumsy, is there a better way?
  12. As a learning project (with a view to a site I have in mind for the future) I'm building a site which has dynamically generated navigation links down one side. In the code a variable ($pagetype) is defined for which type of page is being viewed - e.g. infopages, class, colour, buyby or product. Links on infopages are specific to the page and these are held in a separate table, which isn't a problem. class is either: fruit or vegetable colour: red, yellow, orange or green buyby: single, box or bunch Data for each product is stored in table "products" for example: - [code] |  product  | prod_url  | fruit | vegetable | red | yellow | orange | green | single | box | bunch | ----------------------------------------------------------------------------------------------------- | Apples    | apple.php  |  1  |    0    |  1  |  0    |  0    |  1  |  1    |  1  |  0  | | Oranges  | orange.php |  1  |    0    |  0  |  0    |  1    |  0  |  1    |  1  |  0  | | Bananas  | banana.php |  1  |    0    |  0  |  1    |  0    |  0  |  1    |  0  |  1  | | Lemons    | lemon.php  |  1  |    0    |  0  |  1    |  0    |  0  |  1    |  1  |  0  | | Carrots  | carrot.php |  0  |    1    |  0  |  0    |  1    |  0  |  1    |  0  |  1  | | Tomatoes  | tomato.php |  1  |    1    |  1  |  1    |  1    |  1  |  1    |  1  |  0  | [/code] When on a class, colour or buyby page, listing links to relevant products isn't a problem, I just pull everything direct from the "products" table. In the following example $pageid would be set to the products to list, say "fruit" : - [code]if ($pagetype=='class' || $pagetype=='colour' || $pagetype=='buyby'){ // We're on a product listing page //build and issue the query $sql ="SELECT * FROM products WHERE $pageid = '1' ORDER BY product"; $result = @mysql_query($sql,$connection) or die(mysql_error()); while ($menuitem = mysql_fetch_assoc($result)) { echo '<a href="'.$menuitem['prod_url'].'" target="_self">'.$menuitem['product'].'</a>'; } }[/code] This works fine, when $pageid='fruit' the links shown are for Apples, Oranges, Bananas Lemons and (controversially) Tomatoes! Likewise for the other headings, for example I can list "Red Stuff", or "Available by the Box" etc. However, I've hit a stumbling block when I want to generate the links when viewing a product page - I want the links to be for all the criteria pages we could possibly have come from (i.e. up one level). Apples for example, would show the following links: - Fruit Red Stuff Green Stuff Available Singly Available by the Box I've created another table which translates the column headings from the "products" table into the links to show, I've called this table "criteria" and it looks like this: - [code] | heading  | criteria |        linktext        |    linkurl    | ----------------------------------------------------------------- | fruit    |  class  | Fruit                  | fruit.php    | | vegetable |  class  | Vegetables            | vegetable.php | | red      |  colour  | Red Stuff              | red.php      | | yellow    |  colour  | Yellow Stuff          | yellow.php    | | orange    |  colour  | Orange Stuff          | orange.php    | | green    |  colour  | Green Stuff            | green.php    | | single    |  buyby  | Available Singly      | single.php    | | box      |  buyby  | Available by the Box  | box.php      | | bunch    |  buyby  | Available by the Bunch | bunch.php    | [/code] So, basically, what I want to do is when I'm on the "Apples" page, make a query which, for each "1" found in the "Apples" row of table "Products", displays the link from the "criteria" table from the row with the matching heading! But I don't have a clue where to start, although I think I might need the word "JOIN" in there somewhere!
×
×
  • 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.