Ejemplo n.º 1
0
if (isset($DERECORD)) {
    derecord($DERECORD);
    header("Location: index.php");
}
/* Fetching the necessary info from the database and put them in 'unique' 
   global vars  (DB_NAME)
*/
if (isset($EDIT)) {
    $query = "SELECT *,DATE_FORMAT(start,\"%Y %m %d %H:%i\"), " . "DATE_FORMAT(stop,\"%Y %m %d %H:%i\") FROM program " . "WHERE pid='" . addslashes($EDIT) . "'";
    $result = $sql->query($query);
    while ($blah = $sql->fetch_array($result)) {
        $DB_PID = $blah[0];
        // PID is the program ID
        $DB_SID = $blah[1];
        // SID is the station ID
        $DB_STATION = getstation($DB_SID);
        $DB_PNAME = $blah[2];
        /* We'll have to split on a ' ' cause SQL gives us back 
        		   %y %m %d %H:%i (year month day hour:minute)
        		*/
        list($DB_STARTYEAR, $DB_STARTMONTH, $DB_STARTDAY, $DB_START) = split(" ", $blah[7]);
        list($DB_STOPYEAR, $DB_STOPMONTH, $DB_STOPDAY, $DB_STOP) = split(" ", $blah[8]);
    }
    // end looping through results
}
// end if isset EDIT
if (isset($ADDSTART)) {
    $sql->query("UPDATE program SET start=start + INTERVAL 1 minute " . "WHERE pid='" . addslashes($ADDSTART) . "'");
    header("Location: index.php");
    exit;
}
Ejemplo n.º 2
0
<?php

// $Id: show.php,v 1.1 2002/02/09 17:45:19 waldb Exp $
// $Author: waldb $
include "lib/functions.php";
print_header_open();
$show_station = getstation($station);
print_title("Program Listing for {$show_station}");
print_header_close();
if (isset($RECORD)) {
    if (isset($FLAG)) {
        record($RECORD, $FLAG);
    } else {
        record($RECORD, 0);
        // function in functions.php
    }
}
if (isset($FORCERECORD)) {
    record($FORCERECORD, 2);
}
if (isset($DERECORD)) {
    derecord($DERECORD);
}
?>


<center>
<table border=1><tr bgcolor="#006666"><td><center>
	<font color="#FFFFFF">Program Listing for <?php 
//$station = getstation($station);
if (!$station) {
Ejemplo n.º 3
0
if ($sql->results($result)) {
    ?>
	<table border=1><tr bgcolor="#006666"><td><center><font color="#FFFFFF">recorded programs</font></center></td></tr><tr bgcolor="#E0E0E0"><td>
	<table border=1 width=100%>
	<tr>
		<td>Station</td>
		<td>Program Name</td>
		<td>Start</td>
		<td>Stop</td>
		<td>Edit</td>
	</tr>
	<?php 
    $query = "SELECT *,DATE_FORMAT(start,'%H:%i %d/%m'), " . "DATE_FORMAT(stop,'%H:%i %d/%m') FROM program " . "WHERE (flag='0' or flag='1' or flag='2' or flag='3') " . "AND record='1' ORDER BY start";
    $result = $sql->query($query);
    while ($blah = $sql->fetch_array($result)) {
        $station = getstation($blah[1]);
        // We need a name not a number ;-)
        print "\n\t\t<tr><td>{$station}</td>\n\t\t \t<td>{$blah['2']}</td>\n\t        <td>{$blah['7']}</td>\n\t\t\t<td>{$blah['8']}</td>";
        #			if ($blah[6] == 0) {
        print "\n\t\t\t\t<td>\n\t\t\t\t<a href=force.php?ADDSTART={$blah['0']}>+1 start</a>\n\t\t\t\t<a href=force.php?DELSTART={$blah['0']}>-1 start</a><br>\n\t\t\t\t<a href=force.php?ADDSTOP={$blah['0']}>+1 end</a>\n\t\t\t\t<a href=force.php?DELSTOP={$blah['0']}>-1 end</a>\n\t\t\t\t</td>\n\t\t\t\t<td><a href=force.php?EDIT={$blah['0']}>edit</a></td>\n\t\t\t\t<td><a href=force.php?DERECORD={$blah['0']}>delete</a></td>";
        #			} else {
        #				print "
        #				<td><a href=force.php?EDIT=$blah[0]>edit</a></td>
        #				<td><a href=force.php?DELETE=$blah[0]>delete</a></td>";
        #			}
        print "</tr>";
    }
    ?>
	</table>
	</table>
<?php 
Ejemplo n.º 4
0
function record($id, $flag)
{
    global $sql;
    $result = $sql->query("SELECT start,stop FROM program " . "WHERE pid='" . addslashes($id) . "'");
    while ($blah = $sql->fetch_array($result)) {
        $start = $blah["start"];
        $stop = $blah["stop"];
    }
    // end of grabbing start/stop
    $result = $sql->query("SELECT * FROM program WHERE record='1' " . "AND ((start <= '" . addslashes($start) . "' AND " . "'" . addslashes($start) . "' <= stop) OR " . "(start <= '" . addslashes($stop) . "' AND " . "'" . addslashes($stop) . "' <= stop))");
    $num_rows = $sql->num_rows($result);
    if ($num_rows == 0) {
        $query = "UPDATE program SET record='1', flag='" . addslashes($flag) . "' " . "WHERE pid='" . addslashes($id) . "'";
        $sql->query($query);
    } else {
        while ($blah = $sql->fetch_array($result)) {
            $station = getstation($blah[1]);
            print "<b>{$blah['2']} on {$station} @ {$blah['3']} is conflicting, not recorded.</b><br>";
        }
    }
    // end if num_rows = 0
}