-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathattachimage.php
101 lines (76 loc) · 3.57 KB
/
attachimage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?
// message board script v.3
// include the configuration file
require('config.inc.php');
// establish a connection with the database or notify an admin with the error string
$mysqli_link = mysqli_connect($config['db_host'],$config['db_user'],$config['db_pass'],$config['db_name']) or error($config[db_errstr],$config[admin_email],"mysqli_connect($config[db_host],$config[db_user],$config[db_pass])\n".mysqli_error());
?>
<!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" lang="en" xml:lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Attach Image</title>
<link rel="stylesheet" type="text/css" href="<?=$locations[css]?>">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<script language="Javascript" type="text/javascript">
const currentTheme = localStorage.getItem('theme') ? localStorage.getItem('theme') : null;
if (currentTheme) {
document.documentElement.setAttribute('data-theme', currentTheme);
}
</script>
<script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="clipboard.min.js" type="text/javascript"></script>
</head>
<body>
<div class="container-fluid">
<form action='<?=$_SERVER[PHP_SELF]?>' method='post' enctype='multipart/form-data'>
<?
if (isset($_FILES[message_image_upload]) && $_FILES[message_image_upload][name] != '') {
require('fileupload-class.php');
$upload = new uploader('en');
$upload->max_filesize($config[image_max_filesize]);
//$upload->max_image_size($config[image_max_image_size_width],$config[image_max_image_size_height]);
$upload->upload('message_image_upload',$config[image_acceptable_file_types],$config[image_default_extension]);
$upload->save_file($config[image_path],$config[image_overwrite_mode]);
if (!$upload->error) {
?>
<div class="form-group">
<label for="url">Image URL:</label>
<div class="input-group">
<input type="text" id="image_url" class="form-control" value="<? echo 'http://' , $_SERVER['SERVER_NAME'] , '/' , $config['image_path'] , $upload->file['name']; ?>" readonly/>
<div class="input-group-btn">
<button class="btn btn-default" type="button" data-clipboard-target="#image_url">Copy</button>
</div>
</div>
</div>
<?
} else {
?>
<div class="alert alert-danger"><? echo $upload->error; ?></div>
<?
}
?>
<button type="button" class="btn btn-default" onclick="window.close(); return false">Close</button>
<?
} else {
?>
<div class="form-group">
<label for="file">Attach Image:</label>
<input type='file' class="form-control" id="message_image_upload" name="message_image_upload" />
</div>
<button type="submit" class="btn btn-default">Attach Image</button>
<?
}
?>
</form>
</div>
<script>
new Clipboard('.btn');
</script>
</body>
</html>