function colCont($col, $string, $table) { $rows = getrows($table); $i = 0; while ($i < $rows) { $DATA = getDB($table, $i); if ($DATA[$col] == $string) { return $i; } $i++; } return -1; }
function getnewest($cat) { // Currently unused... $found = 0; $count = getrows('all'); while ($found == 0) { $DATA = getdb($count); if ($DATA['Category'] == $cat) { $found = 1; } else { $count--; } } return $count; }
<?php /****************************************************************************** * * This page is called by the Logins form and writes or removes an entry * ******************************************************************************/ include $_SERVER["DOCUMENT_ROOT"] . '/app/sql.php'; $action = $_REQUEST["action"]; $index = $_REQUEST["index"]; $name = $_REQUEST["name"]; $account = $_REQUEST["account"]; //$account = query("SELECT googleAccount FROM 'users' WHERE index = $index;"); //announceWrite($announcement, $by); if ($action == "add") { $id = getrows("users"); query("INSERT INTO users VALUES ({$id}, '{$name}', 1, '{$account}', '');"); } else { if ($action == "remove") { writeDB($index, "allowed", "0", "users"); } else { header('Location: http://www.aiesecmichigan.com/admin.php?written=-1'); } } header('Location: http://www.aiesecmichigan.com/admin.php?written=1');
function announceRead($which) { $index = getrows("announcements") - $which; $DATA = getDB("announcements", $index); return $DATA['text']; }
function getreplies($id) { global $smfserver, $smfusername, $smfpassword, $smfdb; $rows = getrows('smf_messages'); // The plus three is because there are some skipped ID_MSG's, so it wasn't looking at the highest numbers $rows = $rows + 3; $con = mysql_connect($smfserver, $smfusername, $smfpassword); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db($smfdb); $count = 0; $found = 0; while ($count <= $rows) { $QUERY = mysql_query("SELECT * FROM smf_messages WHERE ID_MSG = {$count}"); $DATA = mysql_fetch_array($QUERY); if ($DATA['ID_TOPIC'] == $id && $DATA['ID_MSG']) { $found++; } $count++; } mysql_close($con); // Because the algorithm above counted the thread itself, and we need only replies $found--; return $found; }