Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* $db = mysql_connect("localhost","l952453s_fqrmix","123456");
- mysql_set_charset("utf8");
- mysql_select_db("rasp" ,$db);
- $test = mysql_query("SELECT * FROM `Расписание`",$db); */
- $rasp = [
- 1 => '<table border="1">
- <tr>
- <td>Номер пары</td>
- <td>Название пары</td>
- <td>Корпус</td>
- <td>Аудитория</td>
- </tr>
- <tr>
- <td>1</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Физкультура</td>
- <td>4 корпус</td>
- <td>Спортзал</td>
- </tr> <tr>
- <td>3</td>
- <td>Физика</td>
- <td>5 корпус</td>
- <td>5303</td>
- </tr> <tr>
- <td>4</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>5</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>6</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- </table>',
- 2 => '<table border="1">
- <tr>
- <td>Номер пары</td>
- <td>Название пары</td>
- <td>Корпус</td>
- <td>Аудитория</td>
- </tr>
- <tr>
- <td>1</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Экология</td>
- <td>6 корпус</td>
- <td>6313</td>
- </tr> <tr>
- <td>3</td>
- <td>Экология</td>
- <td>6 корпус</td>
- <td>6313</td>
- </tr> <tr>
- <td>4</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>5</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>6</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- </table>',
- 3 => '<table border="1">
- <tr>
- <td>Номер пары</td>
- <td>Название пары</td>
- <td>Корпус</td>
- <td>Аудитория</td>
- </tr>
- <tr>
- <td>1</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Информационные технологии</td>
- <td>6 корпус</td>
- <td>6126</td>
- </tr> <tr>
- <td>3</td>
- <td>История</td>
- <td>6 корпус</td>
- <td>6126</td>
- </tr> <tr>
- <td>4</td>
- <td>Математика</td>
- <td>6 корпус</td>
- <td>6126</td>
- </tr> <tr>
- <td>5</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>6</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- </table>',
- 4 => '<table border="1">
- <tr>
- <td>Номер пары</td>
- <td>Название пары</td>
- <td>Корпус</td>
- <td>Аудитория</td>
- </tr>
- <tr>
- <td>1</td>
- <td>Русский язык и развитие речи</td>
- <td>6 корпус</td>
- <td>6125</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Русский язык</td>
- <td>6 корпус</td>
- <td>6125</td>
- </tr> <tr>
- <td>3</td>
- <td>Математика</td>
- <td>6 корпус</td>
- <td>6126</td>
- </tr> <tr>
- <td>4</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>5</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>6</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- </table>',
- 5 => '
- <table border="1">
- <tr>
- <td>Номер пары</td>
- <td>Название пары</td>
- <td>Корпус</td>
- <td>Аудитория</td>
- </tr>
- <tr>
- <td>1</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Физкультура</td>
- <td>6 корпус</td>
- <td>Спортзал</td>
- </tr> <tr>
- <td>3</td>
- <td>Англ. язык</td>
- <td>6 корпус</td>
- <td>6415/6433</td>
- </tr> <tr>
- <td>4</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>5</td>
- <td>Математика</td>
- <td>6 корпус</td>
- <td>6151</td>
- </tr> <tr>
- <td>6</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- </table>',
- 6 => '
- <table border="1">
- <tr>
- <td>Номер пары</td>
- <td>Название пары</td>
- <td>Корпус</td>
- <td>Аудитория</td>
- </tr>
- <tr>
- <td>1</td>
- <td>Информатика(3 часа)</td>
- <td>6 корпус</td>
- <td>6342/6339</td>
- </tr>
- <tr>
- <td>2</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>3</td>
- <td></td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>4</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>5</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr> <tr>
- <td>6</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- </table>',
- ];
- $time_of_end = [
- 1 => '13:15',
- 2 => '13:40',
- 3 => '13:40',
- 4 => '13:40',
- 5 => '17:10',
- 6 => '18:45',
- ];
- $current_time = date(H);
- $current_day = date(N);
- if ($current_time <= 15 and $current_day != 7) {
- echo 'У тебя сегодня - '.$rasp[$current_day];
- if ($current_day != 7){
- echo 'Время окончания пар '.$time_of_end[$current_day];
- }
- } elseif ($current_day != 7){
- $current_day_2 = $current_day + 1;
- echo 'Сегодня у тебя уже кончиились пары. <br> На след. день у тебя -'.$rasp[$current_day_2];
- echo 'Время окончания пар '.$time_of_end[$current_day_2];
- }
- if ($current_day == 7){
- echo 'Сегодня воскресенье. Завтра у тебя - '.$rasp[1];
- echo 'Время окончания пар '.$time_of_end[1];
- }
- if ($current_time <= 15){
- $before_update = abs(15-$current_time);
- } else{
- $before_update = abs(15 + (24 - $current_time));
- }
- if ($before_update != 0) {
- echo '<br>До обновления таблицы '.$before_update.' часа(-ов)';
- } else{
- $k = 1;
- echo '<br>Таблица была обновлена менее часа назад';
- }
- if ($k != 1){
- if ($current_time > 15 and $before_update != 0){
- $last_update = abs($current_time - 15);
- } elseif ($before_update != 0) {
- $last_update = abs($current_time + 9);
- }
- echo '<br>Таблица была обновлена '.$last_update.' час(-ов) назад<br>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement