
bschultz
Members-
Posts
486 -
Joined
-
Last visited
Everything posted by bschultz
-
nevermind...don't like my CPANEL's phpmyadmin new skin...can't find anything on it. I found it.
-
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?
-
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!
-
How can adjust this code to account for daylight savings time?
bschultz replied to bschultz's topic in PHP Coding Help
Well that was easy enough...learn something new each day! Thanks. -
How can adjust this code to account for daylight savings time?
bschultz replied to bschultz's topic in PHP Coding Help
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). -
<?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!
-
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!
-
The manufacturer said I had to POST to the authentication script...
-
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!
-
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 [email protected] stat -f %z '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log'"; $file_size = exec("$cmd", $results); $comma_separated = implode(",", $results); if ($comma_separated <= "175000") { mail ('[email protected]', 'My Subject', $message); echo "email sent"; } else { echo "file is large enough"; } ?>
-
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 [email protected] ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log' | awk '{ print $5}'"); //echo $filesize; $file_size = system("ssh [email protected] 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 ('[email protected]', '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!
-
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 [email protected] ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log' | awk '{ print $5}'"); echo system("ssh [email protected] ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $today\ Log', $retval"); echo $retval; if ($retval <= '175K') { mail ('[email protected]', 'My Subject', $message);} ?> How can I get rid of comma from the name?
-
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 [email protected] 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 [email protected] ls -lah '/MacRadio\ X/WMIS\ Logs/WMIS\ $tomorrow\ Log' | awk '{ print $5}'"); if ($5 <= '175K') { mail ('[email protected]', 'My Subject', $message)} //this line needs to be executed on the LINUX machine that inititated the ssh session...NOT on the Mac ?> Thanks again!
-
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 [email protected] 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!
-
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!
-
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?
-
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?
-
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?
-
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?
-
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!
-
Thanks for the help! After re-thinking this, I need to make sure that the mp3gain command only runs once per hour. I think I'll have to store the count in a flat file...and compare the count. Then, I won't have to compare the timestamp... Thanks again, though!
-
I need to check a file's timestamp (last modified) and if it's BEFORE 15 minutes past the current hour (xx:15:00) then run a shell command. Here's the code <?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)) { echo system('normalize-mp3 --mp3 '.escapeshellcmd($copy1)); $stamp1 = date ("n-j-Y g:i:s A.", filemtime($copy1)); $fifteenpastthishour = mktime(date("n"), date("j"), date("y"), date("g"), 15); if ($stamp1 <= $fifteenpastthishour) { echo system(escapeshellcmd("mp3gain -g 3 $copy1")); } } $copy2 = "/home/rpbroadcasting/audio/N$rename_date.mp3"; if (file_exists($copy2)) { echo system('normalize-mp3 --mp3 '.escapeshellcmd($copy2)); $stamp2 = date ("n-j-Y g:i:s A.", filemtime($copy2)); $fifteenpastthishour = mktime(date("n"), date("j"), date("y"), date("g"), 15); if ($stamp2 <= $fifteenpastthishour) { echo system(escapeshellcmd("mp3gain -g 1 $copy2")); } } $copy3 = "/home/rpbroadcasting/audio/W$rename_date.mp3"; if (file_exists($copy3)) { echo system('normalize-mp3 --mp3 '.escapeshellcmd($copy3)); $stamp3 = date ("n-j-Y g:i:s A.", filemtime($copy3)); $fifteenpastthishour = mktime(date("n"), date("j"), date("y"), date("g"), 15); if ($stamp3 <= $fifteenpastthishour) { echo system(escapeshellcmd("mp3gain -g 1 $copy3")); } } ?> The problem is, it's ALWAYS running the mp3gamin shell command...no matter what the timestamp of the file is. Where am I going wrong with this? Thanks. Brian
-
That did it...thanks!
-
I'm trying to print the results of an array inside an email message. It's working...accept that it prints the word Array before the values of the array. <?php $sql8 = "SELECT first_name, last_name, ump_id FROM ump_names WHERE `ump_id` IN (SELECT ump_id FROM scheduled_umps WHERE `game_id` = '$_SESSION[game_id_number]')"; //echo "$sql8<br />"; $rs8 = mysql_query($sql8,$dbc); $umps[] = array(); //while($row8 = mysql_fetch_array($rs8)) //{ //$umps[] = "$row8[first_name] $row8[last_name]."; //} while($row8 = mysql_fetch_array($rs8)){ $umps[] = "$row8[first_name]" . " " . "$row8[last_name]"; } $valuesgdf = implode(', ', $umps); // this sets the headers and other info for the email $headers = "From: $_SESSION[association_name] \n"; $headers .= "Reply-To: $_SESSION[association_name] \n"; $subject = "There has been a change in your $_SESSION[association_name] Schedule"; $message = "Here is the info for this date: \n\n Date - $day \n Game - $visitor at $home \n Start Time - $start \n GAME NOTES - $notes \n SCHEDULED OFFICIALS - $valuesgdf"; //this sends"SCHEDULED OFFICIALS - Array name1, name2, name3 etc" in the email... ?> How do I get "Array" to not show up prior to $valuesgdf? Thanks.
-
I have a page that has two forms. Form 1: - list baseball game information (who is playing, what time is the game, etc) Form 2: - lists umpires scheduled to work that game I would like to combine this to one form...to edit the info in the database (edit the start time, date etc...AND to edit the umpires scheduled to work the game...ON ONE FORM. Here's what I currently have: <?php $conn1 = mysql_connect($host, $username, $password); if (!$conn1) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db($db, $conn1)) { echo "Unable to select mydbname: " . mysql_error(); exit; } $sql = "SELECT * from games WHERE `game_id` = '$_GET[game]' AND `association_id` = '$_SESSION[association_id]'"; $rs = mysql_query($sql,$conn1); $matches = 0; while ($row = mysql_fetch_assoc($rs)) { $matches++; ?> <form method="POST" action="edit_db_1_game.php"> <p> <input name="game_id" type="hidden" id="game_id" size="10" maxlength="10" value="<?php echo $row[game_id]; ?>" /> <br /> <strong><br /> THIS SECTION OF THE PAGE WILL EDIT THE GAME INFO...IF YOU WANT TO EDIT OFFICIALS, DO SO BELOW.</strong><br /> <br /> Date of game - <input name="day" type="text" id="day" size="10" maxlength="10" value="<?php echo $row[day]; ?>" /> <br /> <br /> Sport - <input name="sport" type="text" id="sport" size="20" maxlength="20" value="<?php echo $row[sport]; ?>" /> <br /> <br /> Visitor <input name="visitor" type="text" id="visitor" size="50" maxlength="50" value="<?php echo $row[visitor]; ?>" /> <br /> <br /> Home <input name="home" type="text" id="home" size="50" maxlength="50" value="<?php echo $row[home]; ?>" /> <br /> <br /> Start <input name="start" type="text" id="start" size="10" maxlength="30" value="<?php echo $row[start]; ?>" /> <br /> <br /> Notes <input name="notes" type="text" id="notes" size="50" maxlength="200" value="<?php echo $row[notes]; ?>" /> <?php echo "<br /><br />Send Email? <label><input type='checkbox' name='send_email' id='send_email' value='1' /></label><br /><br />"; ?> <input name="submit" type="submit" value="Submit" /> </form> <?php } if (! $matches) { echo ("<br /><br />There are no matches for this game ID"); } ?> <br /> <br /> -----------------------------------------------------------------------------------------------<br /> </p> <p><strong>THIS SECTION OF THE PAGE WILL EDIT THE SCHEDULED OFFICIALS...IF YOU WANT TO EDIT GAME INFO, DO SO ABOVE.<br /> <br /> </strong>The officials scheduled for this game are: <br /><br /> <?php $dbc = mysql_pconnect($host, $username, $password); mysql_select_db($db,$dbc); $sql = "SELECT first_name, last_name, ump_id FROM ump_names WHERE `ump_id` IN (SELECT ump_id, row AS thisrow FROM scheduled_umps WHERE `game_id` = '$_GET[game]')"; //echo "$sql<br />"; $rs = mysql_query($sql,$dbc); $num_rows = mysql_num_rows($rs); echo "<form method='POST' action=''>"; $r = 1; while ($r <= $num_rows) { while($row = mysql_fetch_array($rs)) { echo "<label><input type='radio' name='tba[$r]' id='tba[$r]' value='1' /></label> Set <b>$row[first_name] $row[last_name]</b> to TBA<br />"; echo "<label><input type='hidden' name='tbarow[$r]' id='tbarow[$r]' value='thisrow' /></label>"; echo "<label><input type='radio' name='delete[$r]' id='delete[$r]' value='1' /></label> Delete the \"slot\" for <b>$row[first_name] $row[last_name]</b> permanently - (IE you need one fewer official than you thought)<br /><br />"; echo "<label><input type='hidden' name='deleterow[$r]' id='deleterow[$r]' value='thisrow' /></label>"; $r++; } } ?> This works...but it's on two forms (which makes the "update db" script kinda clumsy). I've never done a table join to anything like it (which I'm assuming is what will make this work better)...but how can I combine this to one form...and add an "update db" section to the code? Thanks.