Form.php
?>
Expand|Select|Wrap|Line Numbers
- <?php require_once('Connections/connection.php'); ?><?php
- if (!isset($_SESSION)) {
- session_start();
- }
- // ** Logout the current user. **
- $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
- if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
- $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
- }
- if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
- $_SESSION['MM_Username'] = NULL;
- $_SESSION['MM_UserGroup'] = NULL;
- $_SESSION['PrevUrl'] = NULL;
- unset($_SESSION['MM_Username']);
- unset($_SESSION['MM_UserGroup']);
- unset($_SESSION['PrevUrl']);
- $logoutGoTo = "login_option.php";
- if ($logoutGoTo) {
- header("Location: $logoutGoTo");
- exit;
- }
- }
- ?>
- <?php
- $colname_rsSearchJKM_sem = "-1";
- if (isset($_GET['sesi'])) {
- $colname_rsSearchJKM_sem = (get_magic_quotes_gpc()) ? $_GET['sesi'] : addslashes($_GET['sesi']);
- }
- mysql_select_db($database_connection, $connection);
- $query_rsSearchJKM_sem = sprintf("SELECT sesi FROM sesi");
- $rsSearchJKM_sem = mysql_query($query_rsSearchJKM_sem, $connection) or die(mysql_error());
- $row_rsSearchJKM_sem = mysql_fetch_assoc($rsSearchJKM_sem);
- $totalRows_rsSearchJKM_sem = mysql_num_rows($rsSearchJKM_sem);
- ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Untitled Document</title>
- <style type="text/css">
- <!--
- body {
- background-image: url(images/backgrounding.gif);
- background-repeat: no-repeat;
- background-attachment: fixed;
- }
- -->
- </style></head>
- <body>
- <div align="center">
- <table width="828" border="2">
- <!--DWLayoutTable-->
- <tr>
- <td width="822" height="148" valign="top" bgcolor="#6699FF"><form id="form1" name="form1" method="post" action="">
- <img src="banner/header.gif" width="822" height="128" />
- <?php include 'selamat_datang.php'; ?>
- <?php include 'jam.php'; ?>
- <?php include 'dropDOwn.php'; ?>
- </form></td>
- </tr>
- <tr>
- <td height="32" valign="top" bgcolor="#6699FF"><p align="right"> <a href="<?php echo $logoutAction ?>"><font color='#FF0000'>Keluar</font></a></p>
- <p align="center">
- <p align="center" style="font-family:'Lucida Handwriting'; font-size: 24px; color:#990000"><strong>JABATAN KEJURUTERAAN MEKANIKAL</strong></p>
- <p align="center">
- <p align="center">
- <form action="Upload.php" method="post">
- <div align="left"><strong>SESI:</strong>
- <select name="uploaded_file" type="file" id="uploaded_file" name="uploaded_file">
- <?php
- $sql="SELECT sesi FROM sesi";
- $result =mysql_query($sql);
- while ($data=mysql_fetch_assoc($result))
- {
- echo "<option value=\"{$data['sesi']}\">{$data['sesi']}</option>";
- }
- ?>
- </select>
- </p>
- <p>
- <div align="left">
- <p><strong>ABSTRAK:</strong>
- <input name="uploaded_file" type="file" size="40" id="uploaded_file" name="uploaded_file" />
- </p>
- <p><br />
- <input type="submit" value="Upload file" />
- </p>
- </p>
- </form>
- <p> </p>
- <p><a href="listJKM.php">Lihat semua abstrak</a>
- </p>
- *</p>
- <p> </p>
- <p> </p>
- <p> </p></td>
- </tr>
- <tr>
- <td height="18" valign="top" bgcolor="#6699FF"><form id="form4" name="form4" method="post" action="">
- <div align="center">
- <?php include 'copyright.php'; ?>
- </div>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </body>
- </html>
- <?php
- mysql_free_result($rsSearchJKM_sem);
- ?>
Expand|Select|Wrap|Line Numbers
- <?php
- if (!isset($_SESSION)) {
- session_start();
- }
- // ** Logout the current user. **
- $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
- if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
- $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
- }
- if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
- $_SESSION['MM_Username'] = NULL;
- $_SESSION['MM_UserGroup'] = NULL;
- $_SESSION['PrevUrl'] = NULL;
- unset($_SESSION['MM_Username']);
- unset($_SESSION['MM_UserGroup']);
- unset($_SESSION['PrevUrl']);
- $logoutGoTo = "login_option.php";
- if ($logoutGoTo) {
- header("Location: $logoutGoTo");
- exit;
- }
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
- <title>Untitled Document</title>
- <style type="text/css">
- <!--
- body {
- background-image: url(images/backgrounding.gif);
- background-repeat: no-repeat;
- background-attachment: fixed;
- }
- -->
- </style></head>
- <body>
- <div align="center">
- <table width="828" border="0">
- <!--DWLayoutTable-->
- <tr>
- <td width="822" height="148" valign="top" bgcolor="#6699FF"><form id="form1" name="form1" method="post" action="">
- <img src="banner/header.gif" width="822" height="128" />
- <?php include 'selamat_datang.php'; ?>
- <?php include 'dropDown.php'; ?>
- </form></td>
- </tr>
- <tr>
- <td height="32" valign="top" bgcolor="#6699FF"><p align="right"> <a href="<?php echo $logoutAction ?>"><font color='#FF0000'>Keluar</font></a></p>
- <p align="center">
- <?php
- if(isset($_FILES['uploaded_file']))
- {
- if($_FILES['uploaded_file']['error'] == 0)
- {
- $dbLink = mysqli_connect("localhost", "root", "", "inovasi");
- if(mysqli_connect_errno()) {
- die("MySQL connection failed: ". mysqli_connect_error());
- }
- $sesi = mysqli_real_escape_string($dbLink, $_FILES['uploaded_file']['sesi']);
- $name = mysqli_real_escape_string($dbLink, $_FILES['uploaded_file']['name']);
- $mime = mysqli_real_escape_string($dbLink, $_FILES['uploaded_file']['type']);
- $size = $_FILES['uploaded_file']['size'];
- $data = mysqli_real_escape_string($dbLink, file_get_contents($_FILES ['uploaded_file']['tmp_name']));
- $query = "
- INSERT INTO FileStorage (
- FileName, FileMime, FileSize, FileData, Created, sesi
- )
- VALUES (
- '{$name}', '{$mime}', {$size}, '{$data}', NOW(), '{$sesi}'
- )";
- $result = mysqli_query($dbLink, $query);
- if($result)
- {
- echo "Berjaya! Abstrak telah di upload.";
- }
- else
- {
- echo "Error! Failed to insert the file";
- echo "<pre>". mysqli_error($dbLink) ."</pre>";
- }
- }
- else
- {
- echo "Error!
- An error accured while the file was being uploaded.
- Error code: ". $_FILES['uploaded_file']['error'];
- }
- mysqli_close($dbLink);
- }
- else
- {
- echo "Gagal! Abstrak tidak berjaya di upload!";
- }
- echo '<p>Klik <a href="JKM_admin.php">di sini</a> untuk kembali</p>';
- ?>
- </p>
- </td>
- </tr>
- <tr>
- <td height="18" valign="top" bgcolor="#6699FF"><form id="form4" name="form4" method="post" action="">
- <div align="center">
- <?php include 'copyright.php'; ?>
- </div>
- </form>
- </td>
- </tr>
- </table>
- </div>
- </body>
- </html>