Jump to content

bschultz

Members
  • Posts

    486
  • Joined

  • Last visited

Everything posted by bschultz

  1. I got it... $sql = "SELECT * FROM podcasts WHERE `type` = 'podcast' AND recap LIKE '% Men\'s Hockey%' OR recap LIKE '% Mens Hockey%' ORDER BY date DESC";
  2. I'm trying to write a select to match a few certain words... $sql = "SELECT * FROM podcasts WHERE `type` = 'podcast' AND recap LIKE 'Men%' AND recap LIKE '%Hockey%' ORDER BY date DESC"; That's what I have so far...which isn't working... I need to match the string "Mens" OR "Men's" with the word "Hockey" BUT...I can't match "Women's" or "Womens" Any idea what I'm doing wrong? The above code only returns 6 results...when it should return nearly 100. Thanks!
  3. I need to query a database for a starting time for a meeting, and if the start time is at 7pm, I need to allow access to a page from 6pm til 11pm. Not a problem. The problem lies when the ending time (4 hours after the start time) crosses over to a new day. Here's what I have: <?php elseif ($row['meeting'] == "7:00pm") { $starthour = 18; $endhour = 23; } elseif ($row['meeting'] == "8:00pm") { $starthour = 19; $endhour = 0; } if ($thishour <= $endhour && $thishour >= $starthour) { include "meeting_ok.php"; } else { echo "Meeting room is unavailable at this time...."; } ?> The "0" for endhour is throwing things off. How should I best account for a new day? Thanks!
  4. I need to rename several hundred mp3's in a directory. I've tried this php script...but it seems to have missed every file from 19 to 29 (119-129, 219-229, 319-329 etc). The original names are in no particular order or fashion in how they're named. What's my best choice to rename these files to song1.mp3, song2.mp3 song3.mp3 etc.? <?php $i = 1; foreach (glob("/xmas/*.mp3") as $filename) { copy ("$filename", "/newpopaudio/xmas$i.mp3"); $i++; } ?>
  5. nevermind...don't like my CPANEL's phpmyadmin new skin...can't find anything on it. I found it.
  6. I need to set up a DB so that only one entry can be made per time period (period's are set each half hour...) for each corporate entity. So, for 1:00am, I can only have 1 entry in the DB for Business A, one entry for Business B, and one entry for Business C The DB structure is as such: row_number (primary key, auto increment) date (varchar) - - - by the way, this isn't really a date, but a name (eve for Christmas eve, day for Christmas day) time (varchar) - - - entries will be from a form select of each half hour...12:00am, 12:30, 1:00am...etc) station (varchar) - - - this is where I need a unique field...I can only have have one match for station...for each TIME How can I set up these unique columns?
  7. I need to write a bit of code to select some mp3's (actually, just the titles) from a database...but I need to select them based on last play (which is a timestamp field in the DB) AND I need to select 14 minutes worth of them (and not more than 15 minutes). I currently do NOT know how long each song is... So, if every song was 2 minutes long, I would need 7 songs. If each song was 3 minutes long, I'd need to select 5 of them. I currently do NOT have a length field in the db (the boss sprung this on me after I designed the DB). A few questions: Would it be best to have a column of TIME (mysql time...not the name of the column)? Would it be best to have a column for the raw size of the file (each file is the same bitrate, so I could do the math - plus it would be probably be easier to import raw filesize using php into the db) Would it be easier to do something else? Once we answer that, I'll start with some code...and probably be back for help!
  8. Well that was easy enough...learn something new each day! Thanks.
  9. It's a two week calendar. Everything worked up until this week. The events for the 6th (Sunday - first day of daylight savings time) are showing up on the column for Sunday AND the column for Monday, and every other day's content is showing up one day late (in the calendar format).
  10. <?php if(date('w') == 0) $str = 'today'; else $str = 'last sunday'; $timestamp = strtotime($str); //echo $timestamp; echo "<img src='brn_masthead.gif' width='500' /><br /><table border='1'><tr>"; echo "<tr><td align='center' width='140'><b>Sunday</b></td><td align='center' width='140'><b>Monday</b></td><td align='center' width='140'><b>Tuesday</b></td><td align='center' width='140'><b>Wednesday</b></td> <td align='center' width='140'><b>Thursday</b></td><td align='center' width='140'><b>Friday</b></td><td align='center' width='140'><b>Saturday</b></td></tr><tr>"; $j = 0; for($i = 0; $i < 14; $i++) { $thisdate = date('Y-m-d', $timestamp + ($i * (60 * 60 * 24))); ?> I've looked into mktime and checked the manual, but can't find anything that seems to work inside the loop. Thanks!
  11. That code ends up sending me to the login page on the REMOTE webserver (on the audio hardware). I've run Firebug (debugging software from Firefox) and this is what the code is on the REMOTE webserver http://209.191.211.194/brian/login.php The code is too long to post here. I tried using this code and replacing the path to the REMOTE script in the form action...and clicking on SUBMIT did NOTHING!
  12. The manufacturer said I had to POST to the authentication script...
  13. I'm trying to have a form on MY webserver, connect to a form processing script on a REMOTE webserver (which is running on a piece of audio equipment...to control the audio equipment). The REMOTE script was written in AJAX. I've never even looked into AJAX, so I'm going in blind here. Here's what the manufacturer of the equipment sent me...but they won't help me anymore. Can anyone shed some light on where I need to go next? Thanks!
  14. I figured it out...thanks again for all the help! <?php $message = "The file size is too small...make sure every line of the log is included"; $nextday = mktime(0, 0, 0, date("n"), date("j")+1, date("y")); $tomorrow = date("n-j-y", $nextday); $today = date("n-j-y"); $cmd = "ssh root@192.168.2.169 stat -f %z '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log'"; $file_size = exec("$cmd", $results); $comma_separated = implode(",", $results); if ($comma_separated <= "175000") { mail ('address@domain.com', 'My Subject', $message); echo "email sent"; } else { echo "file is large enough"; } ?>
  15. Thanks again for all the help! We're getting close. <?php $message = "The file size is too small...make sure every line of the log is included"; $nextday = mktime(0, 0, 0, date("n"), date("j"), date("y")); $tomorrow = date("n-j-y", $nextday); $today = date("n-j-y"); //$file_size = system("ssh root@192.168.2.169 ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log' | awk '{ print $5}'"); //echo $filesize; $file_size = system("ssh root@192.168.2.169 stat -f %z '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log'"); $size = $filesize; echo $size; //this is echoing 309600, but is still sending the email if ($size <= "175000") { mail ('address@domain.com', 'My Subject', $message); echo "email sent"; } else { echo "file is large enough"; } ?> The email part isn't working yet...as you can see, the file size is larger than the if statement, and it's still sending the email. Any idea why? thanks again for all the help!
  16. Thanks Adam, The $5 variable is for awk...I was trying to use that to check. This is putting the , in the name of the file... <?php $message = "The file size is too small...make sure every line of the log is included"; $nextday = mktime(0, 0, 0, date("n"), date("j"), date("y")); $tomorrow = date("n-j-y", $nextday); $today = date("n-j-y"); //echo system("ssh root@192.168.2.169 ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log' | awk '{ print $5}'"); echo system("ssh root@192.168.2.169 ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $today\ Log', $retval"); echo $retval; if ($retval <= '175K') { mail ('bschultz@kkbj.com', 'My Subject', $message);} ?> How can I get rid of comma from the name?
  17. Thanks for the help...but the curl version won't work since a webserver or ftp server isn't involved...just a local filesystem that DOES have SSH. The local machine I'm checking on is a Mac...stat functions a bit differently on a Mac...and --format=%s failed. So, here's what I used... <?php $nextday = mktime(0, 0, 0, date("n"), date("j")+1, date("y")); $tomorrow = date("n-j-y", $nextday); echo system("ssh root@192.168.2.169 ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log' | awk '{ print $5}'"); ?> This is working. Thanks Abra for helping me with the location of the single and double quotes to make this work! Now, how can I add the email functionality to this? I'm running the command over ssh on the remote machine...but I need to store the filesize in a variable, and if it's below 175K, send an email from the LINUX machine that initiates the ssh session. Something along these lines...which doesn't work! <?php $message = "The file size is too small...make sure every line of the log is included"; $nextday = mktime(0, 0, 0, date("n"), date("j")+1, date("y")); $tomorrow = date("n-j-y", $nextday); echo system("ssh root@192.168.2.169 ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log' | awk '{ print $5}'"); if ($5 <= '175K') { mail ('address@example.com', 'My Subject', $message)} //this line needs to be executed on the LINUX machine that inititated the ssh session...NOT on the Mac ?> Thanks again!
  18. I need to check a file's size with php and ssh. Everything I've seen online for remote files uses curl and port 80. I'll be checking a LAN computer that isn't running a webserver, but is running an SSH server. How can I do this? I've tried this: <?php $tomorrow = date ('n-j-y'); echo system(ssh root@192.168.2.169 ls -lah "/MacRadio X/WMIS Logs/WMIS $tomorrow Log" | awk {print $5}); ?> but it didn't work. I got a T_VARIAABLE error. This was the same command I used right from the command line, and it worked. I'll also need to add a check to the file size, and if it's less than 175K, send me an email...but I'll work on that after I have the first part working. Thanks!
  19. Still plugging away at this. I've decide to try to search the array for the date (since the htm page is named by the date, I should be able to find it's value in the array). Here's the latest code: <?php foreach (glob("/home/briansch/public_html/testing/*.htm") as $filename) { //get all filenames that have a .htm extension $file = $filename; $find2[] = '.htm'; //remove the extension of the file to start the process of searching the html file for the date $replace2[] = ''; $text2 = str_replace($find2, $replace2, $filename); $new_date_line2 = $text2; //now we have the name of the file (which is a date)...with the directory path listed before it $find3[] = '/home/briansch/public_html/testing/'; // remove the directory path from the name of the file $replace3[] = ''; $text3 = str_replace($find3, $replace3, $new_date_line2); $new_date_line4 = $text3; //now we have the date of the file $mysql_date_format2 = date("F j, Y", strtotime($new_date_line4)); /// convert the file name (which is in m-d-y format) //echo $mysql_date_format3; $lines = file($filename); // put the lines of the file into an array $count = count($lines); // used below to remove the last three lines from the array //$key = array_search($mysql_date_format2, $lines); // this didn't do anything $findme[] = $mysql_date_format2; // tried this with and without the []...no difference...nothing echoed below $key = array_search( $findme, $lines ); echo "<br /><br />Line of Date is - $key<br />--------------<br />"; /// everything below this line works... $date_line = $lines[13]; // I will need to change the array number to the number found above in $key $find[] = '<br>'; $replace[] = ''; $text = str_replace($find, $replace, $date_line); $new_date_line = $text; $title_line = $lines[(14)]; // I will need to change the array number to the value of $key + 1 $find2[] = '</strong>'; $replace2[] = ''; $text2 = str_replace($find2, $replace2, $title_line); $new_title_line = $text2; $mysql_date_format = date("Y-m-d", strtotime($new_date_line)); foreach ($lines as $line_num => $line) { if ($line_num <= 14) { echo ""; } elseif ($line_num >= ($count - 3)) { echo ""; } else { $thisline = htmlspecialchars($line); $recipe .= $thisline; } } echo "$mysql_date_format<br />"; echo "$new_title_line<br />"; echo "$recipe<br /><br />---------------------------------<br /><br /><br /><br />"; } ?> As you can see in the comments, it's not finding the value of the date in the array. Am I off base in how I'm going about this? Thanks!
  20. Alright, I've figured out the code to do what I need it to...but as I've been looking through the static html pages, the code I want to start with doesn't always start on line 15. The line of code I want to start with is always the date (August 01, 2011 formatted)...how can I remove everything before the date when I don't know what line the date is on?
  21. I have a bunch of pages (recipes) that were hard coded a few years ago in straight html. Now, I put every NEW recipe into a database. I'd like to take all of these raw html files...and insert the data from them into the db. - The date is on line 15 of the html file (May 29, 2007<br>) - - - need to convert this to a mysql date format and remove the <br /> - I need to remove everything (not insert into db) lines 1-14 - The html files have <p> instead of <br />...I'd like to replace the <p> with <br /> - I need to ignore the last three lines (have closing </body> and </html> lines and some other pure html stuff What is this the best way to do this?
  22. I have a page that schedules officials for sporting events. It schedules based on the priority of the official (whose turn is it to work) and who has NOT asked for the day off...and who has not listed the home team as a "bad school" (can't get to the town before gametime because of "regular" work schedules. Here are all of the queries... <?php // this gets the info for the game (sport, date, home team, and game id...results are put into variables to be used later $sql = "SELECT sport,home,day,game_id FROM games WHERE `game_id` = '$_GET[game]'"; // get all officials already working today ($day_of_game is one of the variables returned in the above query)...results are put into an array $sql = "SELECT day,game_id FROM games WHERE `day` = '$day_of_game'"; // get all officials that can work at this level...where the home team is not a "bad school" (official can't get to the school by gametime)...and the official has not requested the day off. $values is an implode of the previous query results...these query results are put into a separate array $sql = "SELECT ump_id FROM ump_names WHERE `$what_sport` = '1' AND ump_id NOT IN (SELECT ump_id FROM bad_school WHERE `sport` = '$what_sport' AND `school` = '$home_team') AND ump_id NOT IN (SELECT ump_id FROM days_off WHERE `day` = '$day_of_game') AND ump_id NOT IN (SELECT ump_id FROM scheduled_umps WHERE `game_id` IN ($values) )"; // get the row numbers of the games that are still scheduled with a TBA official $sql = "SELECT row FROM scheduled_umps WHERE `game_id` = '$_GET[game]' AND `ump_id` = '0'"; // get the priorty of each offical that the previous query returns. The Highest priority will be returned first...results into a separate array $sql = "SELECT ump_id FROM ump_priority WHERE `ump_id` IN ($values) ORDER BY priority DESC"; // now, get all officials priorites...in case we have to schedule an official who usually doesn't work at this level...put results into a separate array $sql = "SELECT ump_id FROM ump_priority WHERE `association_id` = '$_SESSION[association_id]' ORDER BY priority DESC"; // get all officials names from the priority check two querys ago...and put the results into an html form drop box $sqlx = "SELECT ump_id, first_name, last_name FROM ump_names WHERE `ump_id` IN ($values2) ORDER BY find_in_set(ump_id, '$values2')"; //// this is the list of ALL officials...no matter what level they can work...for the same drop box...but located at the bottom of the list $sqlf = "SELECT * FROM ump_names WHERE `association_id` = '$_SESSION[association_id]' AND `is_active`= '1' AND `ump_id` NOT IN ($values2) ORDER BY find_in_set(ump_id, '$values3')"; ?> Here's all of the code... <?php session_start(); if( !isset( $_SESSION['is_admin']) ){ echo "You don't have access to this page, or you're not logged in...<meta http-equiv=Refresh content=0;url='/secure/index.php'>"; } echo "<LINK Rel='stylesheet' Href='calendar.css' Type='text/css'>"; //include "../config.php"; putenv("TZ=US/Central"); $_SESSION['game_id_number'] = $_GET['game']; //connect to database $dbc = mysql_pconnect($host, $username, $password); mysql_select_db($db,$dbc); //how many umps do we need to find? if none, exit $sql3 = "SELECT ump_id FROM scheduled_umps WHERE `game_id` = '$_GET[game]' AND `ump_id` = '0'"; //echo $sql3; $rs3 = mysql_query($sql3,$dbc); $num_rows = mysql_num_rows($rs3); if ($num_rows == '0') { echo "This game alread has the required number of officials."; exit; } //get info of game $sql = "SELECT sport,home,day,game_id FROM games WHERE `game_id` = '$_GET[game]'"; //echo "$sql<br />"; $rs = mysql_query($sql,$dbc); while($row = mysql_fetch_array($rs)) { $what_sport = $row['sport']; $home_team = $row['home']; $day_of_game = $row['day']; $weekday = date('w', strtotime($day_of_game)); $game_id = $row['game_id']; $_SESSION['game_id'] = $game_id; } //get all officials working today $sql = "SELECT day,game_id FROM games WHERE `day` = '$day_of_game'"; //echo "$sql<br />"; $rs = mysql_query($sql,$dbc); while($row = mysql_fetch_assoc($rs)) { $array_of_date[] = $row['game_id']; } $values = implode(', ', $array_of_date); $sql = "SELECT ump_id FROM ump_names WHERE `$what_sport` = '1' AND ump_id NOT IN (SELECT ump_id FROM bad_school WHERE `sport` = '$what_sport' AND `school` = '$home_team') AND ump_id NOT IN (SELECT ump_id FROM days_off WHERE `day` = '$day_of_game') AND ump_id NOT IN (SELECT ump_id FROM scheduled_umps WHERE `game_id` IN ($values) )"; //echo "$sql<br />"; $rs = mysql_query($sql,$dbc); while($row = mysql_fetch_assoc($rs)) { $available_umps_array[] = $row['ump_id']; } $values = implode(', ', $available_umps_array); //echo "available array - $values<br />"; if (empty($values)) { $values = '0'; } $sql3 = "SELECT row FROM scheduled_umps WHERE `game_id` = '$_GET[game]' AND `ump_id` = '0'"; //echo $sql3; $rs3 = mysql_query($sql3,$dbc); while($row = mysql_fetch_array($rs3)) { $row_number_array[] = $row['row']; } ////// how many umps need to be scheduled yet $sql3 = "SELECT ump_id FROM scheduled_umps WHERE `game_id` = '$_GET[game]' AND `ump_id` = '0'"; //echo $sql3; $rs3 = mysql_query($sql3,$dbc); $num_rows = mysql_num_rows($rs3); echo "You still need to schedule $num_rows "; if ($num_rows == '1') { echo "official"; } else { echo "officials"; } echo " for this game. Here are the officials that are NOT already working today, NOT on vacation, and CAN work at this level...and CAN work these teams."; echo "<br /><br /><b>Officials that can work this game. The officials in the list are prioritized from top to bottom (ie: the official listed first, has the highest priority to work this game) - - - NAMES IN RED DO NOT USUALLY WORK AT THIS LEVEL, OR ALREADY HAVE A GAME TODAY. Under normal situations, you wouldn't select the names in red, but you can if you need to.</b><br />-------------------------------------------------------------<br />"; ////////////get priorities $sql = "SELECT ump_id FROM ump_priority WHERE `ump_id` IN ($values) ORDER BY priority DESC"; //echo "priorities select = $sql<br />"; $rs = mysql_query($sql,$dbc); while($row = mysql_fetch_assoc($rs)) { $priority_array[] = $row['ump_id']; } //print_r ($priority_array); $values2 = implode(',', $priority_array); ///get priorities of all officials $sql = "SELECT ump_id FROM ump_priority WHERE `association_id` = '$_SESSION[association_id]' ORDER BY priority DESC"; //echo "priorities select = $sql<br />"; $rs = mysql_query($sql,$dbc); while($row = mysql_fetch_assoc($rs)) { $priority_array2[] = $row['ump_id']; } //print_r ($priority_array); $values3 = implode(',', $priority_array2); echo "<br /><br /><form id='form1$i' name='form1$i' method='post' action='edit_officials_1_game.php'>"; $i = 1; while ($i <= $num_rows) { $sqlx = "SELECT ump_id, first_name, last_name FROM ump_names WHERE `ump_id` IN ($values2) ORDER BY find_in_set(ump_id, '$values2')"; //echo "get names select = $sqlx<br />"; $rsx = mysql_query($sqlx,$dbc); echo "Official Slot # $i - <label><select name='officials$i' id='officials$i'>"; while($rowx = mysql_fetch_array($rsx)) { $full_name = "$rowx[first_name]" . " $rowx[last_name]"; echo "<option value='$rowx[ump_id]'>$full_name</option>"; } //echo "<option value=''>--------------------</option>"; //// this is the list of ALL officials...no matter what level they can work $sqlf = "SELECT * FROM ump_names WHERE `association_id` = '$_SESSION[association_id]' AND `is_active`= '1' AND `ump_id` NOT IN ($values2) ORDER BY find_in_set(ump_id, '$values3')"; //echo "get names select = $sqlx<br />"; $rsf = mysql_query($sqlf,$dbc); while($rowf = mysql_fetch_array($rsf)) { $full_namef = "$rowf[first_name]" . " $rowf[last_name]"; echo "<option class='maroon' value='$rowf[ump_id]'>$full_namef</option>"; } //// end all officials echo "</select></label><br /><br />"; $q = ($i - 1); echo "<label><input name='game_number$i' type='hidden' id='game_number$i' value='$row_number_array[$q]' /></label>"; $i++; } echo "<br /><br />Send Email? <label><input type='checkbox' name='send_email' id='send_email' value='1' /></label><br /><br />"; echo "<label><input type='submit' name='button' id='button' value='Submit' /></label></form>"; $number_of_officials = $num_rows; $_SESSION['number_of_officials'] = $number_of_officials; //} //echo "<br />-------------------------------------------------------------<br />If you need to schedule an official that DOES NOT ussually work this level, you can do so here.<br /><br />"; ?> This code works...kind of. If the $priority_array query... <?php ////////////get priorities $sql = "SELECT ump_id FROM ump_priority WHERE `ump_id` IN ($values) ORDER BY priority DESC"; //echo "priorities select = $sql<br />"; $rs = mysql_query($sql,$dbc); while($row = mysql_fetch_assoc($rs)) { $priority_array[] = $row['ump_id']; } //print_r ($priority_array); $values2 = implode(',', $priority_array); ?> Comes up with no matches (meaning nobody is available to work this game that NORMALLY works this level or this school)...I get an error (IMPLODE PASSING INVALID ARGUMENTS) ...and the query to return ALL officials names (the next query in the drop box) doesn't return anything. I can't help but think that there's a better way of doing this...I just don't know how. Anyone care to help shed some light on this for me?
  23. I have a page that allows a user to edit mysql data. It displays the current info in a form text field...but I want to switch that to a select box...with the current info "selected" in the form. I know that I can put "selected" in the form...but is there a better way than having almost 100 if statements (it's for the time...every 15 minutes would be the select options...so 24x4)? <option value="01:23:00" selected>TBA</option> <option value="00:00:00">12:00am</option> <option value="00:15:00">12:15am</option> <option value="00:30:00" <?php if ($row[time] = "00:30:00") { echo "selected='00:30:00' } ?>>12:30am</option> <option value="00:45:00">12:45am</option> This would select 12:30am...but like I said, is there a way to do this WITHOUT an if statement for each value?
  24. The script to download these mp3's runs at xx:05:xx of each hour (via cron) ...and then checks if the file exists every five minutes after that (xx:10:00, xx:15:xx, xx:20:xx...etc) to accommodate a file not being present on the remote server at xx:05:xx of the hour. The normalize script (also runs via cron) also needs to run every five minutes...to accommodate a file not being present on the remote server at xx:05:xx of the hour....but I only want to normalize the mp3 file once in the hour...not every five minutes that the file exists...so was going to check the timestamp. Then, I realized that method wouldn't work either...if the file downloaded after 15 minutes past the hour...it would normalize every five minutes. So...that's why I went with a flat file and a counter on that file. <?php ///////// start of time constants ///////// date_default_timezone_set('US/Central'); $fullyear = date('Y'); $year = date('y'); $month = date('m'); $day = date('d'); $now = date('Y-m-d-h'); $hour = date('g'); $hourplus1 = date('g', strtotime("Now +1 hour")); $hourminus1 = date('g', strtotime("Now -1 hour")); $ampm = date('A'); $rename_date = date('mdg'); $nowis = date('m'); $copy1 = "/home/rpbroadcasting/audio/S$rename_date.mp3"; if (file_exists($copy1)) { $fp = fopen("/var/www/sportscount.txt", "r"); $count = fread($fp, 1024); fclose($fp); $count = $count + 1; if ($count == 1) { echo system('normalize-mp3 --mp3 '.escapeshellcmd($copy1)); echo system(escapeshellcmd("mp3gain -g 3 $copy1")); //$count = 0; echo "Count is 1...I have to normalize\n"; } $fp = fopen("/var/www/sportscount.txt", "w"); fwrite($fp, $count); fclose($fp); } $copy2 = "/home/rpbroadcasting/audio/N$rename_date.mp3"; if (file_exists($copy2)) { $fp = fopen("/var/www/newscount.txt", "r"); $count = fread($fp, 1024); fclose($fp); $count = $count + 1; if ($count == 1) { echo system('normalize-mp3 --mp3 '.escapeshellcmd($copy2)); echo system(escapeshellcmd("mp3gain -g 1 $copy2")); //$count = 0; echo "Count is 1...I have to normalize\n"; } $fp = fopen("/var/www/newscount.txt", "w"); fwrite($fp, $count); fclose($fp); } $copy3 = "/home/rpbroadcasting/audio/W$rename_date.mp3"; if (file_exists($copy3)) { $fp = fopen("/var/www/weathercount.txt", "r"); $count = fread($fp, 1024); fclose($fp); $count = $count + 1; if ($count == 1) { echo system('normalize-mp3 --mp3 '.escapeshellcmd($copy3)); echo system(escapeshellcmd("mp3gain -g 1 $copy3")); //$count = 0; echo "Count is 1...I have to normalize\n"; } $fp = fopen("/var/www/weathercount.txt", "w"); fwrite($fp, $count); fclose($fp); } ?> The above is working as I want it to...then I run another (via cron) script at the the top of the hour to reset the counts to 0. Thanks again everyone!
×
×
  • 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.