소스 검색

Domains: Token integration.

Nate 6 년 전
부모
커밋
205aa2be1f
1개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 13 0
      core/domains/domain_edit.php

+ 13 - 0
core/domains/domain_edit.php

@@ -73,6 +73,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 		$domain_uuid = $_POST["domain_uuid"];
 		$domain_uuid = $_POST["domain_uuid"];
 	}
 	}
 
 
+	//validate the token
+		$token = new token;
+		if (!$token->validate($_SERVER['PHP_SELF'])) {
+			message::add($text['message-invalid_token'],'negative');
+			header('Location: domains.php');
+			exit;
+		}
+
 	//check for all required data
 	//check for all required data
 		if (strlen($domain_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
 		if (strlen($domain_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
 		//if (strlen($domain_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
 		//if (strlen($domain_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
@@ -483,6 +491,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 		unset($sql, $parameters, $row);
 		unset($sql, $parameters, $row);
 	}
 	}
 
 
+//create token
+	$object = new token;
+	$token = $object->create($_SERVER['PHP_SELF']);
+
 //show the header
 //show the header
 	require_once "resources/header.php";
 	require_once "resources/header.php";
 	if ($action == "update") {
 	if ($action == "update") {
@@ -619,6 +631,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
 	if ($action == "update") {
 	if ($action == "update") {
 		echo "		<input type='hidden' name='domain_uuid' value='".escape($domain_uuid)."'>\n";
 		echo "		<input type='hidden' name='domain_uuid' value='".escape($domain_uuid)."'>\n";
 	}
 	}
+	echo "			<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
 	echo "			<br />";
 	echo "			<br />";
 	echo "			<input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
 	echo "			<input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
 	echo "		</td>\n";
 	echo "		</td>\n";