Jump to content

tbare

Members
  • Posts

    198
  • Joined

  • Last visited

Everything posted by tbare

  1. solved with a simple $url = preg_replace('/ /', '%20', $url);
  2. well, i got the sending e-mail part... here's the problem: i'm sending a URL (e.g. http://www.domain.com/play.php?file=blah%20blah.avi&title=blah%20blah) problem is, somewhere on the e-mail send page, i'm losing everything after the first %20 <?php // --- CONFIG PARAMETERS --- // $url = $_POST['url']; $custom_message = $_POST['custom_message']; $custom_message = stripslashes($custom_message); $email_recipient = $_POST['recipient_email']; $recipient_name = $_POST['recipient_name']; $email_sender = $_POST['sender_name']; $email_return_to = $_POST['sender_email']; $email_content_type = "text/html; charset=us-ascii"; $email_client = "PHP/" . phpversion(); // --- DEFINE HEADERS --- // $email_header = "From: " . $email_return_to . "\r\n"; $email_header .= "Reply-To: " . $email_return_to . "\r\n"; $email_header .= "Return-Path: " . $email_return_to . "\r\n"; $email_header .= "Content-type: " . $email_content_type . "\r\n"; $email_header .= "X-Mailer: " . $email_client . "\r\n"; // --- SUBJECT AND CONTENTS --- // $email_subject = "$email_sender has sent you a link from wannafork.com"; $email_contents = "<html>"; $email_contents .= "<h2>Your friend ($email_sender) has sent you, $recipient_name, a link!</h2>"; $email_contents .= "<br><b>Sender: </b>" . $email_sender; $email_contents .= "<br><b>link: </b>" . $url; $email_contents .= "<br><br><b>Message from </b>" . $email_sender; $email_contents .= ":<br>\n" . $custom_message; $email_contents .= "</html>"; // --- SEND MAIL --- // $email_result = mail($email_recipient, $email_subject, $email_contents, $email_header); if ($email_result) echo "Email has been sent!"; else echo "Email has failed!"; ?> where: $url = http://www.domain.com/play.php?file=blah%20blah.avi&title=blah%20blah any ideas?
  3. here's how i did... i'm sure there's a much easier way, but this worked for me: <?php print "<form action='news2.php' method='POST'>\n"; print "<textarea NAME='news' ROWS=10 COLS=75>Insert News Here</textarea><br>\n"; print "<input type=submit value=Submit> <input type=reset value=Reset>\n"; print "</form>\n"; ?> where news2.php contains the code: <?php $newsfile = "news.txt"; $fh = fopen($newsfile , 'r'); //opens news.txt for reading $news = $_POST['news']; //gets information from post $news = str_replace(array("\r\n", "\r", "\n"), "", $news); // removes carriage returns at the end of the lines if (!file_exists("news.txt")) touch("news.txt"); $fcontent = fread($fh, filesize("news.txt")); //copies all data from news.txt $towrite = "$fcontent"; $fh2 = fopen('news.txt','w+'); //opens file to be written to fwrite($fh2,$news); //adds new content to file fwrite($fh2,$towrite); //adds old content to file fclose($fh); //closes file fclose($fh2); //closes file print "Yay!! News file successfully updated.<br>"; ?>
  4. <?php $newsfile = "news.txt"; $fh = fopen($newsfile , 'r'); //opens news.txt for reading $news = $_POST['news']; //gets information from post $news = str_replace(array("\r\n", "\r", "\n"), "", $news); // removes carriage returns at the end of the lines if (!file_exists("news.txt")) touch("news.txt"); $fcontent = fread($fh, filesize("news.txt")); //copies all data from news.txt $towrite = "$fcontent"; $fh2 = fopen('news.txt','w+'); //opens file to be written to fwrite($fh2,$news); //adds new content to file fwrite($fh2,$towrite); //adds old content to file fclose($fh); //closes file fclose($fh2); //closes file print "Yay!! News file successfully updated.<br>"; ?> here's how i did it from a POST to get it to append the new content to the top of the file... (r+ didn't seem to work for me). hope this helps
  5. so, you are wanting to add information to the txt file, but instead of adding, it's overwriting?
  6. yeah.. just figured it out... thanks! $size = filesize('files/video/' . $file);
  7. UPDATE: if i manually specify the file name like so: $size = filesize('files/video/CircleCircleDotDot.avi'); it works, but not if i pull the file name from $file like so: $size = filesize('files/video/$file'); why doesn't that work?
  8. here's the url: example.com/humor_video_play.php?file=CircleCircleDotDot.avi here's the code: $file = $_GET['file']; $size = filesize('files/video/$file'); print "$size"; here's the error: Warning: filesize() [function.filesize]: stat failed for files/video/$file in /home/tbare/wannafork/humor_video_play.php on line 37 any ideas?
  9. got it... i'm a dork $file = $_GET['file']; where the link is <a href='humor_video_play.php?file=fox_hat.avi'> Thanks for the help, though!
  10. sorry... most all of it, really... here's what i've got, and i'd really love to not have to make a separate page for every video file, but just change the link on "video_humor.php" <table border="0" cellspacing="0" cellpadding="15" align="center" width="100%"> <?php $file = "fox_hat.avi"; print "<tr><td>\n"; print "<center><embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' name='mediaplayer1' showstatusbar='1' EnableContextMenu='false' autostart='true' width='500' height='500' transparentstart='1' loop='0' controller='true' src='files/video/$file'></embed></center>\n"; print "</td></tr>\n"; print "<tr><td>\n"; print "<br><br>\n"; print "<center><a href='files/video/$file'>Download $file</a> | (Right click, save target as)</center>\n"; print "<br>\n"; print "<center><a href='humor_video.php'>Back to videos</a></center>\n"; print "<br><br>\n"; print "</td></tr>\n"; ?> </table> and right now, this is in "humor_video_fox_hat.php", i'd like to get it so the link that point to this file would point to "humor_video_play.php?file=fox_hat.avi" actually, is that all i do? now that i'm looking at it, i think i just answered my question...
  11. relatively new to php... pardon the horridly noobish question, please Here's what i want to do: when a user clicks a link, it takes them to a site AND sets the value of $file so i can have 1 page that plays all video files, just calling a different file name for each (be it in the form of humor_video.php?video=blah.avi or any other way, really... any ideas?
  12. well, thanks for tryin, anyway... i checked out the manual, and couldn't find it, either... at least i'm just not that lost :-D
  13. well, that sucks... are you familiar w/ ffmpeg at all? i'm not (in the least bit)...
  14. hello, all... i'm looking for something like: getimagesize() but for video files (avi, wmv, mpeg...) reason being is this: if i take the hard-coded ( width='x' height='x' ) out of the string of an embedded video, it shows up fine in IE, but firefox is all distorted. if i hard code ( width='500' height='500' ), and the video file is larger than either of those 2 dimensions, the video is distorted, so i would need to scale the video down to fit in the that size window. is there anything out there for this?.... please??
  15. Hello again. I have an upload script that works great... except that it's on a linux server, and the owner of the uploaded file is not me, but rather "www-data" This isn't a major problem (that i see), but it may be, and it also keeps me from having full control over said file. Is there a way to get an upload script to specify a user as the owner? any help would be greatly appreciated!
  16. he never said he "wouldn't" install sql, but rather, hasn't installed it after several attempts... and actually, i think he may have installed ffmpeg-php... if so (or if he would later), i'll read more into this at that point... this is more of a pre-lim to seeing if it's even possible before i start actually diving into it... i'm working on a re-design of my website, and trying to make it as easy to add content to as possible so that i will actually be encouraged to do it (as it is now, i have to manually create the thumbnails of the files, then add the links, add the cells in the table, etc... it's just a pain... hopefully i'll get this working... Thanks!! (btw, current site is: http://www.wannafork.com... good stuff if you're bored or just want to waste some time...)
  17. Hello, all... I'm wondering if there is a (good) way to auto-generate a thumbnails for video (.avi, .wmv, etc.) and flash (.swf) files and display them in a page. Basically, i want to be able to list the files in a directory containing these file types, and have a thumbnail displayed for the file, w/o having to create thumbnails for the files manually (thus, making the site easily updated). Is it possible? i do not have SQL installed on this server, and (as of now) the owner of said server has no plans on installing it. I'd complain, but he's hosting for free... soo... herein lies said problem. If anyone could point me in the right direction, it would be much appreciated... Thanks in advance, TBare
  18. Will you post the answer in case someone else is having the same issue? (i'm not yet, but i'm thinking about implementing this in the future, and if i have an idea of something look look out for, could save me some frustration later...) Thanks
  19. makes sense... just saved 5 lines of code. thanks!
  20. what are the benefits of your way over this: <?php //read data from the news file in /news_input/news.txt and prints it a line at a time if (!($newsfile = fopen("news_input/news.txt", "r"))) { die('Cannot open file'); } while ($line = fgets($newsfile,4096)) { list ($date, $content) = explode('~', $line); print "<tr><td valign='top'>"; print "<font color=#000000>$date</font>"; //print date in left cell print "<td align='left'> $content"; //print content in right cell print "</td>"; print "</tr>"; } fclose($newsfile); ?> sorry for the n00bish question, but i'm still somewhat new to php scripting and want to understand what works best aside from taking someone's word for it... (that's how i learn best). Thanks again
  21. will this return it a line at a time? basically, when info is entered into the txt file, it's in a specified order (date, separator, content, line break). i need to read the info a line at a time until eof.
  22. you are a god among men. Thanks!! i was beating my head over this one... my friend will thank you, too... (it took less time to register on this forum, post the question AND get the reply than i spent looking for this answer all day!!) thanks again!
  23. Sorry if this has been discussed before, but i can't find an answer anywhere... maybe it can't be done? Here's my issue: Currently, i am using a php script to write information to a text file. Upon submission of the form, the date is printed (form: yyyy.mm.dd), followed by a space, then the information entered in the form. This txt document is then read then printed line by line on a web page. //read data from the news file in /news_input/news.txt and prints it a line at a time if (!($newsfile = fopen("news_input/news.txt", "r"))) { die('Cannot open file'); } while ($line = fgets($newsfile,4096)) { //read first 10 characters of line an label as date $date = preg_replace('/(..........).*()/','$1$2',$line); //read all characters after date and label as content $content = substr($line, 10); $news = stripslashes($content); print "<tr><td valign='top'>"; print "<font color=#000000>$date</font>"; print "<td align='left'> $news"; print "</td>"; print "</tr>"; } fclose($newsfile); ?> Note that the date and the info are printed into separate cells of a table. my question: is there a way to do something similar, only reading up to a specified character (say '~' for example), and everything before said character be labeled $date, and everything after said character to be labeled $content? Let me know if you need more informatioin. i do not have access to a sql db, so that's out of the question (free web hosting, can't be picky...) (btw, the website this is on is http://www.wannafork.com). If you want the source code of how i wrote the information to the file, i'll post it, too
×
×
  • 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.