-
Notifications
You must be signed in to change notification settings - Fork 8
/
get_custom_form_style.php
47 lines (42 loc) · 1.13 KB
/
get_custom_form_style.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
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
//include "chech_restricted.php";
$isGetCustomFormStyle = true;
if(!isset($isSetDBclass)){
require 'settings/database.class.php';
}
if(isset($_POST['formId'])){
$form_id = $_POST["formId"];
$type = $_POST["get_type"];
$echo_data = getCustomFormStyle($form_id,$type);
echo $echo_data;
}else{
echo ''; //must change to value --- TODO
}
function getCustomFormStyle($fromId,$type){
$data = "";
$db = new Database("formbuilder");
$conn = $db->getConnection();
$sql = "SELECT * FROM form_custom_style WHERE form_id='$fromId'";
if($result = $conn->query($sql)) {
$count = mysqli_num_rows($result);
if($count > 0){
while($row = mysqli_fetch_assoc($result)){
$data = $row['form_style'] ;
}
}else{
$data = "-1";
}
}else{
$data = "ERROR";
}
if($data != "ERROR" && $data != "-1" && $data != ""){
if($type == "style"){
$data = "<style>\n$data\n</style>\n";
}
}
return $data;
}
?>