-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
72 lines (63 loc) · 2.45 KB
/
index.php
File metadata and controls
72 lines (63 loc) · 2.45 KB
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
<?php
include('libs/phpqrcode/qrlib.php');
function getUsernameFromEmail($email) {
$find = '@';
$pos = strpos($email, $find);
$username = substr($email, 0, $pos);
return $username;
}
if(isset($_POST['submit']) ) {
$tempDir = 'temp/';
$email = $_POST['mail'];
$subject = $_POST['subject'];
$filename = getUsernameFromEmail($email);
$body = $_POST['msg'];
$codeContents = 'mailto:'.$email.'?subject='.urlencode($subject).'&body='.urlencode($body);
QRcode::png($codeContents, $tempDir.''.$filename.'.png', QR_ECLEVEL_L, 5);
}
?>
<!DOCTYPE html>
<html>
<head>
<title>OR Code Generator By Hardik Yewale</title>
<link rel="stylesheet" href="libs/css/bootstrap.min.css">
<link rel="stylesheet" href="libs/style.css">
</head>
<body>
<h3><strong>QR Code Generator using PHP libraries By Hardik</strong></h3>
<div class="input-field">
<h3>Please Fill-out All Fields</h3>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" >
<div class="form-group">
<label>Email</label>
<input type="email" class="form-control" name="mail" style="width:20em;" placeholder="Enter your Email" value="<?php echo @$email; ?>" required />
</div>
<div class="form-group">
<label>Subject</label>
<input type="text" class="form-control" name="subject" style="width:20em;" placeholder="Enter your Email Subject" value="<?php echo @$subject; ?>" required pattern="[a-zA-Z .]+" />
</div>
<div class="form-group">
<label>Message</label>
<textarea rows="15" cols="30" type="text" class="form-control" name="msg" style="width:20em;" value="<?php echo @$body; ?>" required pattern="[a-zA-Z0-9 .]+" placeholder="Enter your message"></textarea>
</div>
<div class="form-group">
<input type="submit" name="submit" class="btn btn-danger submitBtn" style="width:20em; margin:0;" />
</div>
</form>
</div>
<?php
if(!isset($filename)){
$filename = "yewale";
}
?>
<div class="qr-field">
<h2 style="text-align:center">QR Code Generator By Hardik: </h2>
<center>
<div class="qrframe" style="border:2px solid black; width:210px; height:210px;">
<?php echo '<img src="temp/'. @$filename.'.png" style="width:200px; height:200px;"><br>'; ?>
</div>
<a class="btn btn-default submitBtn" style="width:210px; margin:5px 0;" href="download.php?file=<?php echo $filename; ?>.png ">Download QR Code</a>
</center>
</div>
</body>
</html>