/extremedating/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/extremedating/trunk

« back to all changes in this revision

Viewing changes to adduser.php

  • Committer: Daniel Johansson
  • Date: 2013-04-14 00:37:18 UTC
  • Revision ID: maila@danieljohansson.nu-20130414003718-kpkym00e9p91uub7
Added feed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!DOCTYPE html>
2
2
<html>
3
 
<!--
4
 
    ExtremeDating - a Hackathon 2013 project.
5
 
    Copyright (C) 2013 Gustav Hartvigsson <gustav.hartvigsson@gmail.com>
6
 
    Copyright (C) 2013 Daniel Johansson <maila@danieljohansson.nu>
7
 
 
8
 
 
9
 
    This program is free software: you can redistribute it and/or modify
10
 
    it under the terms of the GNU Affero General Public License as
11
 
    published by the Free Software Foundation, either version 3 of the
12
 
    License, or (at your option) any later version.
13
 
 
14
 
    This program is distributed in the hope that it will be useful,
15
 
    but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
    GNU Affero General Public License for more details.
18
 
 
19
 
    You should have received a copy of the GNU Affero General Public License
20
 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
 
-->
22
3
<head>
23
4
        <title>Extreme Dating - Create User</title>
24
5
        <link rel="stylesheet" type="text/css" href="css/main.css"/>
26
7
<head>
27
8
<?php
28
9
include "php/db.php";
29
 
include "php/salt.php";
30
10
if(isset($_POST['hiddenStuff']) && $_POST['hiddenStuff'] == "Something Strange") {
31
 
  $password = sha1($_POST['passwd'].$pwd_salt);
 
11
  $password = sha1($_POST['passwd']."salt");
32
12
  //If there is a $_POST that indicates that the add userscript should be run.
33
13
  $query = "";
34
14
  $output = "";
35
 
  if(isset($_FILES["image"]["tmp_name"])){
 
15
  if(!isset($_FILES["image"]["tmp_name"])){
36
16
    $tmpFile = $_FILES["image"]["tmp_name"];
37
17
    $handle = fopen($tmpFile,"r");
38
18
    $fileSize = $_FILES['image']['size'];
39
 
    $output = fread($handle, filesize($tmpFile));
 
19
    var_dump ($handle);
 
20
    //var_dump($_FILES);
 
21
    //echo $_FILES["image"]["tmp_name"];
 
22
    $output = $content = fread($handle, filesize($tmpFile));
40
23
    $output = base64_encode ($output);
41
24
  }
 
25
  //$output = NULL;
 
26
  /*
 
27
  if ($handle) {
 
28
      while (($buffer = fgets($handle, 4096)) !== false) {
 
29
      //$buffer = str_replace("&", "&amp;", $buffer);
 
30
      //$buffer = str_replace("<", "&lt;", $buffer);
 
31
      //$buffer = str_replace(">", "&gt;", $buffer);
 
32
      $output .= $buffer;
 
33
     }
 
34
      if (!feof($handle)) {
 
35
      $output .= "Error: unexpected fgets() fail\n";
 
36
        }
 
37
    fclose($handle);
 
38
    var_dump($output);
 
39
  }
 
40
  */
 
41
  
 
42
 
42
43
  if (isset($_SESSION['userType']) && $_POST['isSuperUser'] == true && $_SESSION['userType'] == 1) {
43
44
    $query = "INSERT INTO Users (
44
45
    loginName,
98
99
        <div id="frame">
99
100
    <h1> Create a new user </h1>
100
101
    <hr />
101
 
        <form action="./adduser.php" method="POST" enctype="multipart/form-data">
 
102
        <form action="./adduser.php" method="POST"enctype="multipart/form-data">
102
103
          <table border="0">
103
104
            <?php
104
105
              if(isset($_SESSION['userType']) && $_SESSION['userType'] == 1 ) {