Jump to content

cgimusic

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by cgimusic

  1. Works great. I don't see why my code with salathe's modification didn't work but thanks for fixing the problem. Final code: <?php foreach($episodes as $episode){ $temp289[]=$episode["airdate"]; }; array_multisort($temp289,SORT_ASC,$episodes); ?>
  2. I'm still not getting the right result. The first four results are: 2008-09-23 2008-09-30 2008-10-14 2008-09-16
  3. Hi guys. I have a list of TV show episodes and air dates in the form of $episodes[x]["airdate"]=yyyy-mm-dd but I don't know how to sort the episodes by their air dates. Here is the code I attempted to use to sort by year but it doesn't seem to work. The episode order appears to be basically random. <?php function recordcompare($record1,$record2){ return strnatcmp($record1,$record2); }; usort($episodes,"recordcompare"); ?>
  4. Thank you. I completely forgot that == is the comparison operator. I said it would be a stupid mistake.
  5. I have a really weird problem with some code I wrote: <?php echo file_exists("includes/".$_GET["page"].".inc.php"); if($_GET["page"]=""||!isset($_GET["page"])){ include "includes/main.inc.php"; } elseif(file_exists("includes/".$_GET["page"].".inc.php")){ include "includes/".$_GET["page"].".inc.php"; }; ?> The elseif part does not execute despite the fact that echo file_exists("includes/".$_GET["page"].".inc.php"); returns "1" w/o quotes and the file definitely does exist. I believe it is the $_GET part that is causing the problem because when I do elseif(!file_exists("includes/".$_GET["page"].".inc.php")){ I get the error "Warning: include(includes/.inc.php) [function.include]: failed to open stream: No such file or directory" It is probably just a really stupid mistake but I can't figure out is wrong. I would much appreciate any enlightenment you may have to offer.
  6. Try 000webhost. They claim to support the PHP mailing functions.
  7. There is no reason why you shouldn't. It is a useful feature.
  8. I am using PHP to generate a random and unique 5 character, numerical ID. The code I am using is not very efficient as the more ID's are generated the more chance there is of getting more repeat ID's before a unique one is generated so I was wondering if there is a better way. The "Id_exists" function checks a MySQL database if that helps. <?php $Id=rand(10000,99999); while(Id_exists($Id)){ $Id=rand(10000,99999); }; ?>
  9. It probably expired. Here is my script currently. <?php error_reporting(E_ALL); $file = file("http://www.youtube.com/watch?v=".$_GET["id"]); for ($count=0;$count<count($file);$count+=1) { if (preg_match('/.*?(var swfArgs)/',$file[$count])) { $linestring=$file[$count]; }; }; $url=explode("\"",$linestring); $count=1; while(isset($url[$count])&&!$url[$count]==""){ $vars[$url[$count]]=$url[$count+2]; $count=$count+4; }; echo "http://www.youtube.com/get_video?video_id=".$_GET["id"]."&t=".$vars["t"]; //$ch=curl_init("http://www.youtube.com/get_video?video_id=".$_GET["id"]."&t=".$vars["t"]); //curl_exec($ch); //curl_close($ch); ?>
  10. I don't know how long it is valid for but here you go: http://www.youtube.com/get_video?video_id=-xlAyxtEMFk&t=vjVQa1PpcFNIY3tmSkt3E8BtQq2ELdBONL-JtVLCY30%3D
  11. I want to stream a YouTube video through my server to a flash FLV player. What is wrong with this code? I just get a blank page. $ch=curl_init("http://www.youtube.com/get_video?video_id=".$_GET["id"]."&t=".$vars["t"]); curl_exec($ch); curl_close($ch);
  12. I have an on another server. http://www.example.com/video.flv. I want to parse it streight to the user. Should I use curl or readfile. Any help is greatly appreciated.
  13. Can anyone tell me how to use wild chars in str_ireplace. I am trying to edit anything that follows the pattern: [NUMBER]F. I really just want to remove some Fahrenheit temperatures from a string.
  14. Actually I managed to work it out. I used str_ireplace. Thanks for your help.
  15. Great, thanks. I was trying that earlier but I didn't realize that you had to put the number down one. Does anyone have any idea to do something along the lines of a find and replace?
  16. I guess this is a lot of questions but it is all for one thing I am trying to accomplish. I basically want to get line 49 from a document on a remote server, save it as a variable then run something like a find and replace on that variable and save it as another variable and echo it. The only code I have so far is: <?php $file = implode('', file('http://server/dir/file.xml')); echo $file ?> Can anyone help me. I'm still quite new to this.
  17. All of them. It's specifically MySQL that I want. If the extensions are .dll then there compiled right? If so then yes.
  18. I can't use extensions with php. The same php.ini file works on other machines with php installed in the same directory. Thanks in advance to anyone who can help.
×
×
  • 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.