/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 php/get_image.php

  • Committer: Daniel Johansson
  • Date: 2013-04-13 22:25:50 UTC
  • Revision ID: maila@danieljohansson.nu-20130413222550-4n2qx901s5vows0n
Made it possible to show interest for lunch with people. Kinda broken still thought.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<?php
2
 
 
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
 
 
23
 
include "php/db.php";
24
 
$def = "iVBORw0KGgoAAAANSUhEUgAAAXwAAAF8CAIAAABDhZedAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA
 
2
include "db.php";
 
3
header("Content-type: image/png");
 
4
if(isset($_GET['userName'])){
 
5
  $username = $_GET['userName'];
 
6
  $query = "SELECT profileImage FROM Users WHERE loginName = '{$username}'";
 
7
  $tuples = $db->query($query);
 
8
  $fetch = $tuples->fetchAll();
 
9
  print($fetch[0]['profileImage']);
 
10
} else {
 
11
  print("iVBORw0KGgoAAAANSUhEUgAAAXwAAAF8CAIAAABDhZedAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA
25
12
B3RJTUUH3QQNFCA1vYYwYQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAABpC
26
13
SURBVHja7d3/TxP3H8DxcghYFVJQo0RBiYtKE2OaJXYMEeMSXRTiEkekElwYMRiy3/jR/kz26ycx
27
14
DWGJSyVilrjgwiw6o9mqGKVRutowXKhog1WjFoIKxWHfnx8wzikg0N71vjwff4CR1937md5d+740
141
128
6MGDB8rHSJKkNWvWrF27trCwcN26devXry8qKtqwYcMnn3ySlpbGwSI60LmHDx8+evTo8ePHT548
142
129
efr06bNnz4aHh4eHh0dHR0dHR1+8ePHy5cvx8fFYLDYxMfHPP/9MTk6+fv166rRJS0tLT09ftGhR
143
130
RkZGVlbW4sWLzWbz0qVLly1blpOTk5OTk5ubm5ubu3z58hUrVqxcuXLVqlWrV6/mq8AG939VOwHR
144
 
iZcW9gAAAABJRU5ErkJggg==";
145
 
 
146
 
header("Content-type: image/png");
147
 
if(isset($_GET['userName'])){
148
 
  $username = $_GET['userName'];
149
 
  $query = "SELECT profileImage FROM Users WHERE loginName = '{$username}'";
150
 
  $tuples = $db->query($query);
151
 
  //var_dump($tuples);
152
 
  $fetch = $tuples->fetchAll();
153
 
  //var_dump($fetch);
154
 
  if(count($fetch) > 0 && $fetch[0]['profileImage'] != "" ) {
155
 
    echo(base64_decode($fetch[0]['profileImage']));
156
 
  } else {
157
 
    echo base64_decode($def);
158
 
  } 
159
 
} else {
160
 
  echo base64_decode($def);
 
131
iZcW9gAAAABJRU5ErkJggg==
 
132
");
161
133
}
162
134
 
163
135