| | Yannis Exidaridis | | Alexandros Diamantidis | | | | Claroline Authors: Thomas Depraetere | | Hugues Peeters | | Christophe Geschι | | | +----------------------------------------------------------------------+ */ include('../claroline/include/config.php'); function file_to_get() { $fileprefix = '/d2/downloads/eclass-1.2'; if (p('type') == 'tgz' or $_GET['get'] == 'tgz') { return "$fileprefix.tar.gz"; } else { return "$fileprefix.zip"; } } $idiotites = array( 0 => ' - επιλέξτε - ', 1 => 'Καθηγητής', 2 => 'Επιστημονικός συνεργάτης', 3 => 'Μεταπτυχιακός φοιτητής', 99 => 'Άλλο' ); if (isset($_POST['download'])) { if (fields_missing()) { begin_page(); show_missing_fields(); show_form(); } else { $id = insert_values(); begin_page($id); show_download($id); } end_page(); } elseif (!empty($_GET['get']) and download_ok($_GET['id'])) { send_file(file_to_get()); } else { begin_page(); show_intro(); show_form(); end_page(); } function do_query($q) { $res = mysql_query($q) or die("Query failed"); return $res; } function db_connect() { global $mysqlServer, $mysqlUser, $mysqlPassword, $mysqlMainDb; mysql_connect($mysqlServer, $mysqlUser, $mysqlPassword) or die("Could not connect"); mysql_select_db($mysqlMainDb) or die("Could not select database"); } function send_file($f) { header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=".basename($f)); readfile($f); } function download_ok($id) { global $REMOTE_ADDR; db_connect(); $r = do_query("SELECT id FROM eclass_download WHERE ip = '" . mysql_escape_string($REMOTE_ADDR) . "' AND id = '" . mysql_escape_string($id) . "'"); if (mysql_num_rows($r) > 0) { return TRUE; } else { return FALSE; } } function fields_missing() { $empty = FALSE; foreach (array('name', 'surname', 'phone', 'email', 'idiotita', 'idryma') as $i) { if (!$_POST[$i]) { $empty = TRUE; } } return $empty; } function p($v) { if (isset($_POST[$v])) { return $_POST[$v]; } else { return ''; } } function show_idiotites_select() { global $idiotites; if (!isset($_POST['idiotita'])) { $_POST['idiotita'] = 0; } foreach ($idiotites as $n => $s) { echo "\n"; } } function show_missing_fields() { ?>  
Αφήσατε ένα ή περισσότερα από τα υποχρεωτικά πεδία κενά. Παρακαλούμε συμπληρώστε όλα τα πεδία που είναι σημειωμένα με (*).
Όνομα: