crzipilot Posted January 9, 2011 Share Posted January 9, 2011 Simple website, to sort videos by date uploaded via a IP Camera. This thing was working, where user would click on the videos tab, the code would sort the videos in the directory by week, and make a table of sorts. Come back to the project this week, and it seems that the flip over to week one is producing errors. Spent the past weeks getting all the formats down so that user could also play video via embedded player. Now I'm ready to pull my hair out. Very novice at coding, know next to nothing at all, so not sure what the error is that's showing up, or why it's showing up. There are files in the sub dir that it's looking at, so don't have a clue.... Before I moved the video files around, it would show the weeks 48/49/50 etc and sort the videos and allow to play, EXCEPT week 1 would show an error...... Code is below, link to the website is. http://www.deercam.villagebears.com/Videos.php <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Live Hunting Cam</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta name="generator" content="Rvglobalsoft" /> <meta name="progid" content="Version: 4.51 PRO; Project name: Deer Cam; Project id: d459b29ead7a501690b6162e4b778867; Template Name: 23-586146-1_gold_DiyPicture_2; Published date: December 5, 2010, 3:37 42 (GMT -05:00" /> <link rel="stylesheet" href="http://deercam.villagebears.com/style.css" type="text/css" /> <link rel="stylesheet" href="http://deercam.villagebears.com/Verdana.css" type="text/css" /> <link rel="stylesheet" href="http://deercam.villagebears.com/Navigator.css" type="text/css" /> <link rel="stylesheet" href="http://deercam.villagebears.com/pathway.css" type="text/css" /> <script type="text/javascript" src="http://deercam.villagebears.com/rvsincludefile/rvsheadpage.js"></script> <script type="text/javascript" src="http://deercam.villagebears.com/rvsincludefile/rvsnavigator.js"></script> <script type="text/javascript" src="http://deercam.villagebears.com/js/publishNavigator/layersmenu-library.js"></script> <script type="text/javascript" src="http://deercam.villagebears.com/js/publishNavigator/layersmenu.js"></script> <script type="text/javascript" src="http://deercam.villagebears.com/rvsincludefile/rvscustomopenwindow.js"></script> </head> <body class="diybackground"> <table cellpadding="0" cellspacing="0" id="rv_top_adjust_width_0" width="100%" align="center" > <tr> <td align="left" valign="top"> <!-- START LOGO --> <div style="position: absolute;"> <div id="Layer1" style="position:relative; left:19px; top:65px; width:120; height:60; text-align:center; z-index:1; overflow:visible; white-space:nowrap;"><!-- START LOGO --><a href="http://deercam.villagebears.com/index.php" > <img src="http://deercam.villagebears.com/LOGO.JPG?3304648b01a7d6c9c1951d3d0794663c" width="120" height="70" border="0" alt="Logo" /> </a><!-- END LOGO --></div> </div> <div style="position: absolute;"> <div id="Layer2" style="position:relative; left:301px; top:47px; width:auto; height:auto; text-align:left; z-index:2; overflow:visible; white-space:nowrap;" class="company"><div><font style="font-size: 36px">Live Hunting Cam</font><br> </div></div> </div> <div style="position: absolute;"> <div id="Layer3" style="position:relative; left:363px; top:112px; width:auto; height:auto; text-align:left; z-index:3; overflow:visible; white-space:nowrap;" class="slogan"><div><font style="font-size: 24px">Hunting Tales....</font> </div></div> </div> <!-- END LOGO --> <table cellpadding="0" cellspacing="0" width="100%"> <tr><td class="topwhite"><img src="images/spacer.gif" width="1" height="40" /></td></tr> <tr><td class="header_line1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr> <tr><td class="header_line2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr> <tr> <td class="bgheader" align="left"><img src="images/headerimage.gif" width="780" height="134" /></td> </tr> <tr><td class="header_line3"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr> <tr><td class="header_line4"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr> <tr> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="bgnavigator" align="left" valign="top" height="32"><div class="navigator"> <ul class="navigator"> <li id="hormenu1L1" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="index.php" class="normal" onmouseover="shutdown();" target="_self" ><span>Home</span></a></li> <li id="hormenu1L2" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="Videos.php" id="current" onmouseover="shutdown();" target="_self" ><span>Videos</span></a></li> <li id="hormenu1L3" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="javascript:void(0);" class="normal" onmouseover="moveLayerX1('L3', 'hormenu1'); LMPopUp('L3', false);" target="_self" ><span>Live Access <img src="images/down-arrow.gif" border="0" alt=">" /></span></a></li> <li id="hormenu1L6" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="javascript:void(0);" class="normal" onmouseover="moveLayerX1('L6', 'hormenu1'); LMPopUp('L6', false);" target="_self" ><span>Install Info <img src="images/down-arrow.gif" border="0" alt=">" /></span></a></li> <li id="hormenu1L9" onmouseover="clearLMTO();" onmouseout="setLMTO();"><a href="Troubleshooting.php" class="normal" onmouseover="shutdown();" target="_self" ><span>Troubleshooting</span></a></li> </ul> </div> <!-- START SUBMENU DATA --> <!-- beginning of menu footer - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ --> <div id="L3" class="submenu" onmouseover="clearLMTO();" onmouseout="setLMTO();"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td nowrap="nowrap"> <div class="subframe"> <div id="refL4" class="item"> <a href="Internet-Explorer.php" onmouseover="LMPopUp('L3', true);" target="_self" ><span> Internet Explorer </span></a> </div> <div id="refL5" class="item"> <a href="Firefox%2C-Mobile.php" onmouseover="LMPopUp('L3', true);" target="_self" ><span> Firefox, Mobile </span></a> </div> </div> </td> </tr> </table> </div> <div id="L6" class="submenu" onmouseover="clearLMTO();" onmouseout="setLMTO();"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td nowrap="nowrap"> <div class="subframe"> <div id="refL7" class="item"> <a href="Quick-Install.php" onmouseover="LMPopUp('L6', true);" target="_self" ><span> Quick Install </span></a> </div> <div id="refL8" class="item"> <a href="Full-Install.php" onmouseover="LMPopUp('L6', true);" target="_self" ><span> Full Install </span></a> </div> </div> </td> </tr> </table> </div> <script language="JavaScript" type="text/javascript"> //<!-- loaded = 1; // --> </script> <!-- end of menu footer - PHP Layers Menu 3.2.0-rc (C) 2001-2004 Marco Pratesi - http://www.marcopratesi.it/ --> <!-- END SUBMENU DATA --> </td> </tr> <tr><td class="body_line1"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr> <tr><td class="body_line2"><img src="images/spacer.gif" alt="" width="1" height="1" /></td></tr> <tr><td class="bgtshadow"><img src="images/spacer.gif" alt="" width="1" height="12" /></td></tr> <tr> <td align="left" valign="top"> <table cellpadding="0" cellspacing="0" width="100%" class="bgbody"> <!-- Begin PATHWAY and ICON --> <tr> <td class="magin"> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <!-- Begin PATHWAY --> <td align="left" width="99%"><?php include("/home/villscom/public_html/deercam/rvsincludefile/pathway_c9503af737aba537d92048428cb98428.html"); ?></td> <!-- End PATHWAY --> <!-- Begin ICON --> <td align="right"><?php include("/home/villscom/public_html/deercam/rvsincludefile/icon_c9503af737aba537d92048428cb98428.html"); ?></td> <!-- End ICON --> </tr> </table> </td> </tr> <!-- End PATHWAY and ICON --> <tr> <td align="left" valign="top"> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" class="magin" id="rv_adjust_width_0" width="100%"> <style type="text/css"><!--.block_01{ font-size:11px;}h2.text16{ font-size:16px; padding:0px; margin:0px;} h3.text14{ font-size:14px; padding:0px; margin:0px;} h4.text12{ font-size:12px; padding:0px; margin:0px;} h5.text11{ font-size:11px; padding:0px; margin:0px;}h6.text10{ font-size:10px; padding:0px; margin:0px;}--></style><table cellpadding="0" cellspacing="0" width="100%" class="block_01"> <tr> <td align="left" valign="top" width="100%" id="layout_zone1" style = ""><table cellpadding="5" cellspacing="0" width="100%" class="rvblock76"> <tr> <html> <title>Deer Cam Video List</title> <head> <script language='javascript'> function show_list(d) { var sInline = 'inline'; if (document.getElementById(d).style.display == 'inline'){ sInline='none'; } document.getElementById(d).style.display = sInline; }//end func </script> </head> <body> <?php //preview video scripts //read in the dir files and display them as links //onclicking the link reloads the page with the video //organize the vids by date... if(isset($_GET['v'])) { show_video(); }else{ show_list2(); }//endif ?> </body> </html> <?php function show_video() { $file = ''; $type = ''; $file = @$_GET['v']; $type = stristr($file,"."); //check for file if (!file_exists("./vids/$file")) { //file doesn't exist confirm("File can't be found. Please try choosing it again from the list."); show_list(); die(); }//end if echo "<center>"; //check file type if (($type == ".mov")||($type == ".qt")||($type == ".mpeg")||($type == ".avi")||($type == ".mp4")) { //if quicktime (.mov, .qt, .mpeg, .avi, .mp4) ?> <OBJECT id=playera height=460 width=460 classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95> <PARAM NAME="AutoStart" VALUE="True"> <param name="src" value="<?php echo "./vids/$file" ?>"> <embed height="256" width="320" src="<?php echo "./vids/$file" ?>" <PARAM NAME="Balance" VALUE="False"> <PARAM NAME="DisplaySize" VALUE="True"> <PARAM NAME="Filename" VALUE=""> <PARAM NAME="Mute" VALUE="False"> <PARAM NAME="SelectionStart" VALUE="False"> <PARAM NAME="SelectionEnd" VALUE="False"> <PARAM NAME="ShowControls" VALUE="True"> <PARAM NAME="ShowAudioControls" VALUE="True"> <PARAM NAME="ShowDisplay" VALUE="False"> <PARAM NAME="ShowPositionControls" VALUE="False"> <PARAM NAME="Volume" VALUE="1"> <PARAM NAME="AudioStream" VALUE="False"> <PARAM NAME="AutoSize" VALUE="False"> <PARAM NAME="AnimationAtStart" VALUE="False"> <PARAM NAME="AllowScan" VALUE="False"> <PARAM NAME="AllowChangeDisplaySize" VALUE="False"> <PARAM NAME="AutoRewind" VALUE="True"> <PARAM NAME="BaseURL" VALUE=""> <PARAM NAME="BufferingTime" VALUE="5"> <PARAM NAME="CaptioningID" VALUE=""> <PARAM NAME="ClickToPlay" VALUE="True"> <PARAM NAME="CursorType" VALUE="0"> <PARAM NAME="CurrentPosition" VALUE="True"> <PARAM NAME="CurrentMarker" VALUE="True"> <PARAM NAME="DefaultFrame" VALUE="mainframe"> <PARAM NAME="DisplayBackColor" VALUE="True"> <PARAM NAME="DisplayForeColor" VALUE="16777215"> <PARAM NAME="DisplayMode" VALUE="1"> <PARAM NAME="Enabled" VALUE="-1"> <PARAM NAME="EnableContextMenu" VALUE="False"> <PARAM NAME="EnablePositionControls" VALUE="False"> <PARAM NAME="EnableFullScreenControls" VALUE="False"> <PARAM NAME="EnableTracker" VALUE="False"> <PARAM NAME="InvokeURLs" VALUE="False"> <PARAM NAME="Language" VALUE="False"> <PARAM NAME="PlayCount" VALUE="1"> <PARAM NAME="PreviewMode" VALUE="False"> <PARAM NAME="ShowStatusBar" VALUE="True"> <PARAM NAME="TransparentAtStart" VALUE="False"> </OBJECT> <?php }elseif($type == ".gif" || $type ==".jpeg" || $type == ".jpg") { echo "<img src='./vids/$file'>"; }//end if echo "<br><br><br><a href='Videos.php'>Back to list of weeks</a></center>"; }//end function function show_list2() { //organize vids by data //read into array //sort array //show folders in collapsed tables //onclick folder/date to 'show folder contents' echo "<center><h2>Current Deer Cam Videos<br /> Click on Week number to show videos sorted by week</h2></center>"; echo "<table width=75% cellpadding=5 cellspacing=0 align=center><tr valign=top><td>"; $dir = './vids/'; $aVids = array(); //get data into array //open the main video dir if ($handle = opendir($dir)) { //loop thru the files in the dir while (false !== ($file = readdir($handle))) { //check to make sure the file is not a directory if ($file != "." && $file != "..") { //reset the new var to empty string $new = ''; //clear the stats cache of file data clearstatcache(); //get the file name and find out if its a new file if (file_exists($dir.$file)) { //check to see if the video is 'new' and needs the new tag if ((time() - filemtime($dir.$file)) < 345600) { $new = "\n\t\t <span style=\"font-weight:bold; color:red; font-size:smaller;\">New!</span>"; } //add the video to the array $aVids[] = array('file'=>$file, 'dtime'=>filemtime($dir.$file), 'week'=>date("W",filemtime($dir.$file)), 'new'=> $new); }//end if }//end if }//loop }//end if // Turn array into a list of columns foreach ($aVids as $key => $row) { $file[$key] = $row['file']; $week[$key] = $row['week']; $new[$key] = $row['new']; } // sort the arays array_multisort($week,SORT_DESC,$aVids); $old_week = 0; $display = 10; $nCount = 0; //start table // echo "<table border=1>\n<tr valign='top'><td>\n"; for($x=0; $x < count($aVids); $x++) { if (($old_week != $aVids[$x]['week']) && ($old_week != 0)) { //close previous table echo "\n\t</table></div>\n"; //multiple columns $nCount++; if ( $nCount % $display == 0 ) { echo "</td><td>"; } echo "\n<img src=/images/folder.gif /><a href='#' onclick='show_list(" . $aVids[$x]['week'] . ");'> Week " . $aVids[$x]['week'] . "</a><br />\n"; //start new hidden span echo "\n\t<div id='" . $aVids[$x]['week'] . "' style='display:none;'>\n\t<table border=1>"; $old_week = $aVids[$x]['week']; }elseif ($old_week == 0){ //first run thru echo "\n<img src=/images/folder.gif /><a href='#' onclick='show_list(" . $aVids[$x]['week'] . ");'> Week " . $aVids[$x]['week'] . "</a><br />\n"; //start new hidden span echo "\n\t<div id='" . $aVids[$x]['week'] . "' style='display:none;'>\n\t<table border=1>"; $old_week = $aVids[$x]['week']; } //show the individual elements echo "\n\t\t<tr><td> <a href='" . $_SERVER['PHP_SELF'] . "?v=". $aVids[$x]['file'] . "'>". $aVids[$x]['file'] ."</a>"; if ($aVids[$x]['new']!=''){ echo "(" .$aVids[$x]['new']. ")</td></tr>"; } }//next echo "\n</td></tr></table>"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/ Share on other sites More sharing options...
BlueSkyIS Posted January 9, 2011 Share Posted January 9, 2011 WHAT IS THE ERROR? Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/#findComment-1157084 Share on other sites More sharing options...
crzipilot Posted January 9, 2011 Author Share Posted January 9, 2011 Sorry, should have included that. When viewing via Firefox, when you click on the link, "week 01" It does nothing, while it should open a list of video file names. (there are files there, and it worked previously until the time flipped to week 01" when viewing under IE It comes up with little error in lower left hand corner. Clicking on that it says "object required" videos.php Code: 0 URI: http://deercam.villagebears.com/videos.php Line 183 Char 3 Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/#findComment-1157098 Share on other sites More sharing options...
BlueSkyIS Posted January 9, 2011 Share Posted January 9, 2011 that's a javascript error. firefox writes the error to console, as does safari. in firefox, go to Tools > Error Console, and you'll see the error there. Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/#findComment-1157102 Share on other sites More sharing options...
crzipilot Posted January 9, 2011 Author Share Posted January 9, 2011 Ok, The line is : if (document.getElementById(d).style.display == 'inline'){ sInline='none'; } Error Firefox comes up with is: document.getElementByID(d) is Null.... So I guess I should post this in Java help? Or know a quick fix? I haven't touched any part of that code... Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/#findComment-1157117 Share on other sites More sharing options...
crzipilot Posted January 14, 2011 Author Share Posted January 14, 2011 anyone?!?!?! Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/#findComment-1159354 Share on other sites More sharing options...
haku Posted January 14, 2011 Share Posted January 14, 2011 Where is 'd' being set? Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/#findComment-1159367 Share on other sites More sharing options...
crzipilot Posted January 14, 2011 Author Share Posted January 14, 2011 Not really sure, I don't really know much about coding etc. This file sort array is something I found and it was working. As it looks, there doesn't seem to be anyplace where "d" is defined or set. Maybe remove that? Quote Link to comment https://forums.phpfreaks.com/topic/223880-sorting-videos-by-date-has-crashed/#findComment-1159400 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.