".$row["name"]." - ".$row["city"].""; if ($row['embed']!== "") { echo $row['embed']; } else { echo ''; } } list_records($streamer_id); } function stream_show_record($rsid) { $query = "select streamer_id, stream_list.url as url, stream_list.embed as embed, date_format(from_unixtime(stream_list.stamp),'%Y-%m-%d %H:%i') as time, stream_list.name as name, city ".sprintf("from stream_list, streams WHERE stream_list.id='%d' and stream_list.streamer_id=streams.id limit 1", mysql_real_escape_string($rsid)); // echo "$query"; $result=mysql_query($query) or die; $streamer_id=""; while ($row = mysql_fetch_assoc($result)) { $streamer_id=$row['streamer_id']; echo "

Запись от ".$row['time']." ".$row['name']. " - ".$row['city']."

"; if ($row['embed'] !== NULL) { echo $row['embed']; } else { echo ''; } } list_records($streamer_id); } function stream_find_records ($page) { if (!isset($page)) { $page=1; } foreach($_GET as $k=>$v) { if ($k != "page") { $querystring .= $k.'='.$v.'&'; } } if (isset($_GET['city'])) { $query = "select count(*) as count ".sprintf("from stream_list, streams where stream_list.streamer_id=streams.id and city='%s' and stamp>unix_timestamp('%s 00:00:00') and stamp < unix_timestamp('%s 23:59:59')", mysql_real_escape_string($_GET['city']),mysql_real_escape_string($_GET['start_date']),mysql_real_escape_string($_GET['end_date'])); } else { $query = "select count(*) as count ".sprintf("from stream_list, streams where stream_list.streamer_id=streams.id and stamp>unix_timestamp('%s 00:00:00') and stamp < unix_timestamp('%s 23:59:59')", mysql_real_escape_string($_GET['start_date']),mysql_real_escape_string($_GET['end_date'])); } //echo $query; $result=mysql_query($query) or die; $row = mysql_fetch_assoc($result); $perPage = 25; $totalPages = ceil($row['count'] / $perPage); $startAt = $perPage * ($page - 1); $links = ""; $count=0; for ($i = 1; $i <= $totalPages; $i++) { if ($count>=30) { $links.=""; $count=0; } $count++; $links .= ($i != $page ) ? "$i " : "$i "; } if ($totalPages>1) { echo "$links"; echo "
Страницы
"; } if (isset($_GET['city'])) { $query = "select stream_list.*, streams.city, date_format(from_unixtime(stamp),'%Y-%m-%d %H:%i') as time ".sprintf("from stream_list, streams where stream_list.streamer_id=streams.id and city='%s' and stamp>unix_timestamp('%s 00:00:00') and stamp < unix_timestamp('%s 23:59:59') order by stamp asc limit $startAt, $perPage", mysql_real_escape_string($_GET['city']),mysql_real_escape_string($_GET['start_date']),mysql_real_escape_string($_GET['end_date'])); } else { $query = "select stream_list.*, streams.city, date_format(from_unixtime(stamp),'%Y-%m-%d %H:%i') as time ".sprintf("from stream_list, streams where stream_list.streamer_id=streams.id and stamp>unix_timestamp('%s 00:00:00') and stamp < unix_timestamp('%s 23:59:59') order by stamp asc limit $startAt, $perPage", mysql_real_escape_string($_GET['start_date']),mysql_real_escape_string($_GET['end_date'])); } //echo "$query"; $result=mysql_query($query) or die; if (mysql_num_rows($result)>0) { echo "";} echo "
Найдены записи:"; $i=0; while ($row = mysql_fetch_assoc($result)) { $i++; if ($i%2) { echo "
".$row['time']." - ".$row['name'].""; } } echo "
"; if ($totalPages>1) { echo "$links"; echo "
Страницы
"; } } function list_records ($streamer_id) { $query = "select *, date_format(from_unixtime(stamp),'%Y-%m-%d %H:%i') as time ".sprintf("from stream_list where streamer_id = %d order by stamp desc limit 25", mysql_real_escape_string($streamer_id)); $result=mysql_query($query) or die; if (mysql_num_rows($result)>0) { echo "";} echo "
Последние записи:"; $i=0; while ($row = mysql_fetch_assoc($result)) { $i++; if ($i%2) { echo "
".$row['time']." - ".$row['name'].""; } } echo "
"; } ?>