-
Notifications
You must be signed in to change notification settings - Fork 4
/
results.php
executable file
·144 lines (136 loc) · 8.94 KB
/
results.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php include'header.php'; ?>
<!-- Main -->
<header class="major">
<h2>Ciphers & Algorithms</h2>
<p><?php echo $_POST["cipherName"] ?></p>
</header>
<div class="container">
<div class="row">
<div class="4u">
<section>
<h3>Ciphers</h3>
<ul class="alt">
<?php echo getCipherList(); ?>
</ul>
</section>
</div>
<div class="8u skel-cell-important">
<section>
<?php
// date_default_timezone_set("Asia/Kolkata");
if($_POST["cipherName"]=='CAESAR CIPHER'){
if($_POST["caesarKey"])
{
if($_FILES["CipherFile"]["name"])
{
if(isset($_SESSION['userEmail'])){
$uemail=$_SESSION['userEmail'];
$target_dir = "CipherPlainUploads/";
$time = date("Y-m-d-His");
$target_file = $target_dir . "$uemail-".$time."-". basename($_FILES["CipherFile"]["name"]);
}
}
else
{
echo "<h3>Encrypted Text :  </h3>";
$reply = caesar($_POST["caesarPlaintext"],$_POST["caesarKey"]);
echo "<blockquote><b>".$reply."</b></blockquote>";
echo "<a href=\"http://twitter.com/share?text=$reply<--Encrypted using-->&url=http://web.engr.oregonstate.edu/~shahpri/OnlineCipher/&hashtags=Crypto,Encryption,NoOneKnowsWhatITwitted\" class=\"twitter-share-button\" data-show-count=\"true\">Tweet</a> <script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>";
}
}
else
echo "Please Enter Key for Caesar Cipher";
}
else if ($_POST["cipherName"]=='VIGENERE CIPHER') {
if($_POST["VigenereKey"])
{
if($_FILES["vCipherFile"]["name"])
{
if(isset($_SESSION['userEmail'])){
$uemail=$_SESSION['userEmail'];
$target_dir = "CipherPlainUploads/";
$time = date("Y-m-d-His");
$target_file = $target_dir . "$uemail-".$time."-". basename($_FILES["vCipherFile"]["name"]);
if(move_uploaded_file($_FILES["vCipherFile"]["tmp_name"],$target_file))
{
$readHandle = fopen($target_file,"r");
$string= fgets($readHandle);
fclose($readHandle);
echo "<h3>Encrypted Text :  </h3>";
echo "<blockquote><b>".VigenereCipher($string,$_POST["VigenereKey"])."</b></blockquote>";
$wtarget_dir = "CipherEncryptedUploads/";
$wtarget_file = $wtarget_dir . "$uemail-".$time."-". basename($_FILES["vCipherFile"]["name"]);
$writeHandle = fopen($wtarget_file,"w");
fwrite($writeHandle,VigenereCipher($string,$_POST["VigenereKey"]));
echo "<a href=$wtarget_file class=\"button special\" target=\"_blank\">Download File</a>";
}
else
echo "File Not Uploaded, May be invalid File Type! Please Try Again!";
}
}
else
{
echo "<h3>Encrypted Text :  </h3>";
$reply=VigenereCipher($_POST["VigenerePlaintext"],$_POST["VigenereKey"]);
echo "<blockquote><b>".$reply."</b></blockquote>";
echo "<a href=\"http://twitter.com/share?text=$reply<--Encrypted using-->&url=http://web.engr.oregonstate.edu/~shahpri/OnlineCipher/&hashtags=Crypto,Encryption,NoOneKnowsWhatITwitted\" class=\"twitter-share-button\" data-show-count=\"true\">Tweet</a> <script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>";
}
}
else
echo "Please Enter the correct Key for Cipher";
}
else if($_POST["cipherName"]=='Blowfish'){
if($_POST["blowfishKey"])
{
if($_FILES["CipherFile"]["name"])
{
if(isset($_SESSION['userEmail'])){
$uemail=$_SESSION['userEmail'];
$target_dir = "CipherPlainUploads/";
$time = date("Y-m-d-His");
$target_file = $target_dir . "$uemail-".$time."-". basename($_FILES["CipherFile"]["name"]);
}
}
else
{
echo "<h3>Encrypted Text :  </h3>";
$reply = blow($_POST["blowfishPlaintext"],$_POST["blowfishKey"]);
echo "<blockquote><b>".$reply."</b></blockquote>";
echo "<a href=\"http://twitter.com/share?text=$reply <--Encrypted using--> &url=http://web.engr.oregonstate.edu/~shahpri/OnlineCipher/&hashtags=Crypto,Encryption,NoOneKnowsWhatITwitted\" class=\"twitter-share-button\" data-show-count=\"true\">Tweet</a> <script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>";
}
}
else
echo "Please Enter inputs properly";
}
else if($_POST["cipherName"]=='rsa'){
if($_POST["rsaKey"])
{
if($_FILES["CipherFile"]["name"])
{
if(isset($_SESSION['userEmail'])){
$uemail=$_SESSION['userEmail'];
$target_dir = "CipherPlainUploads/";
$time = date("Y-m-d-His");
$target_file = $target_dir . "$uemail-".$time."-". basename($_FILES["CipherFile"]["name"]);
}
}
else
{
echo "<h3>Encrypted Text :  </h3>";
$reply = rsa($_POST["rsaPlaintext"],$_POST["rsaKey"]);
echo "<blockquote><b>".$reply["text"]."</b></blockquote>";
//echo "<input type=button value='copy encrypted text'>";
echo "<h3>Your Public Key :  </h3>";
echo "<blockquote id='blc'><b>".$reply["key"]."</b></blockquote>";
echo "<a href=\"http://twitter.com/share?text=$reply <--Encrypted using--> &url=http://web.engr.oregonstate.edu/~shahpri/OnlineCipher/&hashtags=Crypto,Encryption,NoOneKnowsWhatITwitted\" class=\"twitter-share-button\" data-show-count=\"true\">Tweet</a> <script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script>";
}
}
else
echo "Please Enter inputs properly";
}
?>
</section>
</div>
</div>
</div>
<?php include'footer.php'; ?>