Jump to content

willpower

Members
  • Posts

    296
  • Joined

  • Last visited

Everything posted by willpower

  1. here is an script...no particular reason to show this other than it was the shortest <?php // ver. 1.04 - added an example how to use this script with the filename from a query string // ver. 1.03 - moved the disposition header into the switch because the attachement attibute is sometimes needed // ver. 1.02 - use pathinfo() to get the fileinformation (extesnion) now // ver. 1.01 - Added the stringconv. to handle also extensions with caps // place this code inside a php file and call it f.e. "download.php" $path = $_SERVER['DOCUMENT_ROOT']."/assets/docs/"; // play with the path if the document root does noet exist $fullPath = $path.$_GET['f']; if ($fd = fopen ($fullPath, "r")) { $fsize = filesize($fullPath); $path_parts = pathinfo($fullPath); $ext = strtolower($path_parts["extension"]); switch ($ext) { case "pdf": header("Content-type: application/pdf"); // add here more headers for diff. extensions header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachement' to force a download break; default; header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); } header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly while(!feof($fd)) { $buffer = fread($fd, 2048); echo $buffer; } } fclose ($fd); exit; ?>
  2. HI OK so i have read the scripts and tried several. Each I have got to work. But I dont want to 'FORCE' a download, rather i want to suggest that thats what they do. I need the user to be able to download the document (not view it) but to chose where they should save it, possibly rename it etc. All the scrpits i have tried simple force the download without confirmation or location choice...so to a novie user, they may not even think it worked. How do i achieve this?
  3. $string = "foo bar"; echo ucwords($string) //prints Foo Bar but if $stringwithapostrope="mike o'leary"; how do i get correct capitalistion after the ' so i get "Mike O'Leary" rather than "Mike O'leary" Thanks
  4. Topics would include, tightehning up scripts n DB queries?? Just a thought. Will
  5. sessions are you r way forward...i just dont think you have set the session up correctly...code would be useful here
  6. Splitting $strings if i dont have a needle, only a haystack... how do i effectrively split: abcdefghi to ---- ab cdef g hi or 123456789 to ---- 12 3456 7 89 Thanks Will
  7. not quite. katie logs in...checked against your db and she passes your log in. we then set a session variable which is stored on the server (read up on these...you will need them for this) We can then say something like (in simplistic terms) $_Session['user']="Katie"; now when she tries to access the directory we can add another little script which will acertain which directory se is in...check out $_SERVER variables in the php manual. Then we can say if ($this_directory==$_Session['user']) { gets to see page} else { gets redirected} I'd personally look into MOD REWRITES for something like this. Its not php but the ability to use MOD REWRITE is kinda like the swiss army knife of webdesign when it comes to delivering dynamically driven websites.
  8. ohhhh now theres a thing i never knew...tyvm
  9. Ok so i have a db driven date yyyy-mm-dd lets say this is $date. what is the most code effiecient way to add 1 year to that date ideally without exploding the date components? Thanks as ever Will
  10. personally i would use $_session variables. So when katie signs in she is allocated a session var. Then you check to see if the domain dir and the var match if so allow else deny.
  11. To the very best of my knowledge this is not possible as PHP is a server side script. You could have the script send an email tho. To have a pop up appear etc would involve a client side script but i cant think of any way to do what you requested
  12. Hi I wondered if anyone has a script or can point me in the direction of such which is capable of taking an ad hoc XML document and can create a mysql db structure to match the node structure of the xml?? I know its a tall ask, but i dont believe i'd be the first to want to do this. All help greatfully received. Will
  13. i love when you try to help someone and they come back with a curt remark! With respect i asked you to advise which line 86 was. Simple
  14. i think that he is trying to remove them, either use str_replace or integrate a rte(rich text editor)
  15. im not sure that i understand fully what you are trying to achieve as what you suggest seems a little unusual. I'd explain in greater detail to achieve more responses
  16. id log when the user has posted something and measure that against all posts, then just show the icon(s) of posts that have a date/time after the users logged posting date/time
  17. line 86 is relevant tho, as i have no idea which one it is!
  18. perhaps you could actually let us know where to view the site?
  19. Code is clean appearance is a bit bland and the site is poorly balanced (the nav is to heavy for the text content) BUT I guess you'd kinda have to know these guys to want to visit the site...and then really who cares about the appearance, because its the content thats important...and you seem to have that! 6/10 At least you have clean code!!! Big Plus in my book
  20. The how do i add my forum is misaligned and spans two lines in FF
  21. WHOA....bit harsh dc This is a critique section...not a blow smoke up your arse section. His comments are valid. all you have done is create a graphic or two so there really isnt much to critique? Don't be offended though, just take the comments on board or ask your friends instead (you know... the ones that tell you what you want to hear) . Still wishing you good luck Will
  22. Thank you ...you have filled my monitor (22inch) sort those google adds out tho so that they match colours
  23. Listen I am grateful for the comments...I really am. Nice to see that it hasnt been savaged as many are. In truth many of the concepts have all put forward are on my lists of to-do's however I wanted second opinions before moving further. In particular the 2 column v projects scroller is a concern of mine. But as I knicked...sorry...borrowed the code I'm having a real issue squeezing it to fit. Thanks again and keep it coming. Will.
×
×
  • 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.