-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkk_setup.php
40 lines (34 loc) · 1.02 KB
/
kk_setup.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
<?php
require_once('inc/global.inc.php');
if (isset($_GET["id"])) $id = $_GET["id"]; else $id = "";
if (isset($_GET["keyring_name"])) $keyring_name = $_GET["keyring_name"]; else $keyring_name = "";
if (isset($_POST["step"])) $step = $_POST["step"]; else $step = "";
$smarty->assign("keyring_id",$id);
$smarty->assign("keyring_name",$keyring_name);
$smarty->assign("title","Keyrings and keys Association");
if($step != '1')
{
$all_keys=get_available_keys();
$smarty->assign("allkeys",$all_keys);
$smarty->display('kk-setup.tpl');
}
else
{
$error_list = "";
if( empty( $error_list ) )
{
$keyring_id = $_POST['id'];
$key_id = $_POST['key'];
mysqli_query($GLOBALS['mysql_link'], "INSERT INTO `keyrings-keys` (`id_keyring`, `id_key`) VALUES('$keyring_id','$key_id')" )
or die(mysqli_error()."<br>Couldn't execute query: $query");
header("Location:keyrings.php");
echo ("key Added, redirecting...");
exit ();
}
else
{
// Error occurred let's notify it
echo( $error_list );
}
}
?>