Jump to content

Omzy

Members
  • Posts

    314
  • Joined

  • Last visited

    Never

Everything posted by Omzy

  1. I'm after an easy, but secure way of generating and importing a MySQL dump from a remote server. The way I want to achieve this is as follows: 1) I will have a page on my localhost server with a form that submits to a script on the live server 2) The script on the live server receives the request and beings to generate the dump data 3) Once generated it sends back this data to a script on my localhost server 4) The script on my localhost server receives the data and runs the queries What methods can be used to achieve this? I know possibly the easiest method would be to just POST the data in a hidden form variable, but I'm not too convinced this is secure. I've heard I can use XML as an alternative option, but not too sure about this. Anyone got any suggestions?
  2. lol. i suggest u re-read my original post.
  3. I'm just after a sample solution. The code I posted above fetches all the links on a given page. Now I want it to go into each of those links and output the H1 tag of that page.
  4. I've created a scrape script which fetches all links on a page: $dom = new DOMDocument(); @$dom->loadHTML($html); $xpath = new DOMXPath($dom); $hrefs = $xpath->evaluate("/html/body//a"); for ($i = 0; $i < $hrefs->length; $i++) { $href = $hrefs->item($i); $url = $href->getAttribute('href'); echo "<br />Link: $url"; } I now need to extend this further - it needs to go in to each link and get for example the H1 tag on the page. Can someone provide any sample solution?
  5. Omzy

    EPC Graph

    I need to generate EPC Graphs like this: http://www.mandmhomeandenergysurveys.co.uk/resources/174_epcGraph3.jpg The position of the arrows on the graph need to correspond with their actual values on the graph. I'm trying to achieve this using a combination of 'height' and 'bottom' properties, but I do not get consistent results. The arrows are in their own divs and the main image is just a div with a background image. I'm not bothered about getting the arrows to display in their correct colours, I just want to get them positioned correctly first.
  6. What techniques can be used to prevent text/images from wrapping to the width of the screen when viewed on mobile browsers? Most mobile browsers will wrap the content to the width of the screen but you might nto always want want this to happen, for example if you have a row of images they will all get stacked on top of each other.
  7. Hi salathe. I was initially going to use strstr() but then I realised it only works with PHP 5.3. I've just tried strtok() and that seems to do the job. Thanks.
  8. I have a string variable, which for example can have the following values: $string="This is a normal description" $string="This is another description [advanced]" Basically I want to echo $string but if it finds a "[" (square bracket) character in the string it will not echo that part. The square braket, if there is one, will only appear at the end of the string.
  9. OK cool. How about if I limit it to check for certain extensions? The only ones I need to check for are .doc, .docx and .pdf
  10. lol yes i'm developing this site on apache localhost on windows. i take it'll work just fine on linux server.
  11. Cheers thorpe, that's perfect. Just one slight issue in that it returns true if there are hidden files in the folder. How can I exclude hidden files?
  12. Just having a little trouble creating the code to check if a directory is empty, if not then get the list of files in that directory excluding hidden/system files. Anyone able to advise?
  13. I have a datetime field in my database, I retrieve this in my script follows: $date=$row['date']; $status=$row['status']; echo $date; //outputs 2010-01-04 12:20:33 echo $status; //outputs 002 I now want to add an IF statement in my script that checks $date as follows: If today's date is 2 DAYS AFTER $date then set $status to 001. The check must also take in to account the time.
  14. " it would take the 'neat' URL and call the 'ugly' URL" Well yeah, that's exactly what I'm trying to do here. I've done this for normal links on my site, but this is for a form. By default a GET form appends query parameters to it's ACTION URL, for example even if my form URL was: http://localhost/mysite/search/ then if I submit that form I get something like http://localhost/mysite/search/?company=Microsoft, but I'd rather have http://localhost/mysite/search/Microsoft I want the ugly URL turned into a nice URL.
  15. Currently the form submits the following URL: /search.php?company=Microsoft I want the URL to be: /searchresults/Microsoft/ Does anybody know the correct rewrite rule to acheive this? Thanks.
  16. FaT3oYCG - cheers. i take it if there were several multi-select questions, you'd need a separate table for each multi-select question right?
  17. Thanks MrAdam. So you mean have a separate table for the checkboxes and populate that with the selections?
  18. This isn't strictly PHP related - more to do with object orientated design / database principles. Basically I'm creating a form that has a set of checkboxes (about 75 in total), the user can have multiple selections here. How should the database be designed to store multiple selections? Do I have one field that stores the selections in a comma-separated array, or do I create separate fields in the database for each checkbox? What is the recommended way of doing this for OO PHP?
  19. I managed to figure it out. You can also do: $randomImages = array_rand($imageList, 7); and then you don't even need to use array_keys(), shuffle() or array_slice()
  20. Cheers mjdamato, however your code does not output the alt text...
  21. OK I tried using array_rand() however I realised I need to output ALT text on the images. So I created an associative array ('$x'=>'alt text') and then ran a foreach loop over the array_rand() array. But I don't think array_rand() works with associatiave arrays. Is there a better way of doing this?
  22. I need help writing some code to display 7 random images from a folder. I have managed to make it display one random image but I just cannot figure out how to make it display multiple random images from a set of 20. The images in the folder will always be JPEG and are named 'image_x.jpg' (x = a number from 1-20) Optionally it could auto-count the number of images in the folder to dynamically assign the end value, but that isn't too important.
×
×
  • 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.