function doPost($strLine, $intLine, $fileName) { $strLine = str_replace("\\", "", $strLine); if (substr($strLine, 0, 1) != '"' or substr($strLine, -2) != '";') { showError('All lines must start with " and end with "; ', $strLine); } else { $flines = file($fileName); //Update the line $flines[$intLine] = substr($flines[$intLine], 0, 40) . $strLine . "\n"; //reWrite the file $fh = fopen($fileName, 'w'); while (1) { if (flock($fh, LOCK_EX)) { fwrite($fh, implode("", $flines)); flock($fh, LOCK_UN); break; } } } showEdit($fileName); }
echo "<br>"; showTeamProfile($curTeam, TRUE); echo "</center><br>"; } elseif (isset($_POST['edMake'])) { $result = mysql_query("SELECT id FROM user_teams WHERE id != " . $tid . " AND teamname = '" . addslashes(stripAllString(trim($_POST['teamname']))) . "'"); if (mysql_num_rows($result) > 0 || trim($_POST['teamname']) == '') { $preview = _("Preview"); output_header($preview, SHOW_STATSBAR, $theme_extra_args); $teamimages = uploadImages(1, $tid, "both"); $curTeam['avatar'] = $teamimages['avatar']; if (trim($_POST['teamname']) == "") { echo "<center><br>" . _("The team name must not be empty.") . "<br>"; } else { echo "<center><br>" . _("The team name must be unique. Please make any changes and resubmit.") . "<br>"; } showEdit(stripslashes($_POST['teamname']), stripslashes($_POST['text_data']), stripslashes($_POST['teamwebpage']), 0, $tid); echo "<br></center><br>"; } else { if (!empty($_POST['tavatar'])) { mysql_query("UPDATE user_teams SET avatar='" . $_POST['tavatar'] . "' WHERE id = {$tid}"); } elseif (!empty($_FILES['teamavatar'])) { uploadImages(0, $tid, "avatar"); } if (!empty($_POST['ticon'])) { mysql_query("UPDATE user_teams SET icon='" . $_POST['ticon'] . "' WHERE id = {$tid}"); } elseif (!empty($_FILES['teamicon'])) { uploadImages(0, $tid, "icon"); } mysql_query("UPDATE user_teams SET teamname='" . addslashes(stripAllString(trim($_POST['teamname']))) . "', team_info='" . addslashes(stripAllString($_POST['text_data'])) . "', webpage='" . addslashes(stripAllString($_POST['teamwebpage'])) . "' WHERE id='{$tid}'"); $title = _("Saving Team Update"); $desc = _("Updating team....");
<html> <head> <title>Quiz Machine</title> </head> <body> <center> <h1>Quiz Machine</h1> <?php getFiles(); showTest(); showEdit(); showLog(); function getFiles() { //get list of all files for use in other routines global $dirPtr, $theFiles; chdir("."); $dirPtr = openDir("."); $currentFile = readDir($dirPtr); while ($currentFile !== false) { $theFiles[] = $currentFile; $currentFile = readDir($dirPtr); } // end while } // end getFiles function showTest() { //print a list of tests for user to take
$otid = 0; if (!isset($_POST['teamall'])) { if ($userP['team_1'] == $_POST['tteams']) { $otid = 1; } elseif ($userP['team_2'] == $_POST['tteams']) { $otid = 2; } else { if ($userP['team_3'] == $_POST['tteams']) { $otid = 3; } } } dpsession_set_preferences_from_db(); $title = _("Join the Team"); $desc = _("Creating the team...."); metarefresh(0, "../members/jointeam.php?tid={$tid}&otid={$otid}", $title, $desc); } } elseif (isset($_POST['mkQuit'])) { $title = _("Quit Without Saving"); $desc = _("Quitting without saving..."); metarefresh(4, "{$code_url}/activity_hub.php", $title, $desc); exit; } else { $name = _("Create a New Team"); output_header($name, SHOW_STATSBAR, $theme_extra_args); echo "<center><br>"; showEdit("", "", "", 1, 0); echo "</center>"; } } // vim: sw=4 ts=4 expandtab