<?php session_start(); if (isset($_SESSION['login'])) { header("Location: index.php"); die(); } ?>
<!doctype html>
<head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="description" content=""> <title>注å</title>
<!-- Bootstrap core CSS --> <link href="./static/css/bootstrap.min.css" rel="stylesheet">
<style> .bd-placeholder-img { font-size: 1.125rem; text-anchor: middle; }
@media (min-width: 768px) { .bd-placeholder-img-lg { font-size: 3.5rem; } } </style> <!-- Custom styles for this template --> <link href="./static/css/std.css" rel="stylesheet"> </head>
<body class="text-center"> <form class="form-signin" action="register.php" method="POST"> <h1 class="h3 mb-3 font-weight-normal">Sign Up</h1> <label for="username" class="sr-only">Username</label> <input type="text" id="username" name="username" class="form-control" placeholder="Username" required autofocus> <br><label for="password" class="sr-only">Password</label> <input type="password" id="password" name="password" class="form-control" placeholder="Password" required> <button class="btn btn-lg btn-primary btn-block" type="submit" onclick="javascript:doRegister()" >Sign Up</button> <p class="mt-5 mb-3 text-muted">© 2018-2021</p> </form> </body> <div class="top" id="toast-container"></div>
<script src="./static/js/jquery.min1.js"></script> <script src="./static/js/bootstrap.bundle.min.js"></script> <script src="./static/js/toast.js"></script>
<script type='text/javascript'> function doRegister(){ var username = $("#username").val(); var password = $("#password").val(); if(username == "" || password == ""){ alert("Please enter the username and password!"); return; } var data = "<user><username>" + username + "</username><password>" + password + "</password></user>"; $.ajax({ type: "POST", url: "register.php", contentType: "application/xml;charset=utf-8", data: data, dataType: "xml", anysc: false, success: function (result) { var code = result.getElementsByTagName("code")[0].childNodes[0].nodeValue; var msg = result.getElementsByTagName("msg")[0].childNodes[0].nodeValue; if(code == "0"){ $(".msg").text(msg + " login fail!"); }else if(code == "1"){ $(".msg").text(msg + " login success!"); }else{ $(".msg").text("error:" + msg); } }, error: function (XMLHttpRequest,textStatus,errorThrown) { $(".msg").text(errorThrown + ':' + textStatus); } }); } </script> </html>
<?php ini_set("display_errors", "On"); error_reporting(E_ALL | E_STRICT); include "class.php";
libxml_disable_entity_loader(false); $xmlfile = file_get_contents('php://input');
if(!empty($xmlfile)) { try{ $dom = new DOMDocument(); $dom->loadXML($xmlfile, LIBXML_NOENT | LIBXML_DTDLOAD); $creds = simplexml_import_dom($dom);
$username = $creds->username; $password = $creds->password;
$user = new User();
if ($user->add_user($username, $password)) { echo "<script>alert('Registered successfully');window.location.href='login.php';</script>"; } else{ echo "<script>alert('Registration failed');window.location.href='register.php';</script>"; }
}catch(Exception $e) { $result = sprintf("<result><code>%d</code><msg>%s</msg></result>",4,$e->getMessage()); header('Content-Type: text/html; charset=utf-8'); echo $result; } }
?> <?php
session_start(); if (!isset($_SESSION['login'])) { header("Location: login.php"); die(); }
?>
<!DOCTYPE html> <html> <head> <title>File Uploader</title> <link href="./static/css/bootstrap.css" rel='stylesheet' type='text/css' /> <!-- Custom Theme files --> <link href="./static/css/style.css" rel="stylesheet" type="text/css" media="all" /> <!-- Custom Theme files --> <script src="./static/js/jquery.min.js"></script> <!-- Custom Theme files --> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="keywords" content="File Uploader Widget Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template, Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, Sony Ericsson, Motorola web design" /> <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</head> <body>
<h1>FILE UPLOADER</h1>
<div class="upload">
<div class="login-form">
<form id="upload" method="post" action="upload.php" enctype="multipart/form-data">
<div id="drop"> <a>Upload File</a> <input type="file" name="file" multiple /> </div>
<ul> <!-- The file uploads will be shown here --> </ul>
</form>
</div> <!-- JavaScript Includes --> <script src="./static/js/jquery.knob.js"></script> <!-- JavaScript Includes -->
<!-- jQuery File Upload Dependencies --> <script src="./static/js/jquery.ui.widget.js"></script> <script src="./static/js/jquery.iframe-transport.js"></script> <script src="./static/js/jquery.fileupload.js"></script> <!-- jQuery File Upload Dependencies --> <!-- Main JavaScript file --> <script src="./static/js/script.js"></script> <!-- Main JavaScript file -->
<div class="button">
<div class="cancel"><a href="#">Cancel</a></div> <div class="done"><a href="#">Done</a></div>
<div class="clear"> </div>
</div> </div>
<div class="footer"> <p>Copyright © 2021 File Uploader. All Rights Reserved | Design by <a href="#">File Uploader</a></p> </div> </body> </html>
|