| Server IP : 192.169.170.185 / Your IP : 216.73.216.97 Web Server : Apache System : Linux p3plmcpnl495852.prod.phx3.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64 User : akhilnew ( 1712764) PHP Version : 5.6.40 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/akhilnew/public_html/medicinepaper.net/admin/inc/ |
Upload File : |
<?php
if($option === 'delete' OR $option === 'enabled' OR $option === 'disabled'):
if($idcount > 0):
for($i = 0; $i < $idcount; $i++):
$id = $dataid[$i];
$stmt = $mysqli->prepare("SELECT name FROM $table WHERE $firstcol = ? LIMIT 1") or die(output($mysqli->error));
$stmt->bind_param('i', $id);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->bind_result($name);
$stmt->fetch();
$stmt->close();
if($count_rows > 0):
if($option === 'delete'):
$stmt = $mysqli->prepare("DELETE FROM $table WHERE $firstcol = ? LIMIT 1") or die(output($mysqli->error));
$stmt->bind_param('i', $id);
$e = $stmt->execute();
$stmt->close();
if($e):
if($name && file_exists('../'.$name.'.php')):
@unlink('../'.$name.'.php');
endif;
$text = 'Content has been deleted.';
$stat = TRUE;
else:
die(output('Content has not been deleted.'));
endif;
elseif($option === 'enabled' OR $option === 'disabled'):
$stmt = $mysqli->prepare("UPDATE $table SET status = ? WHERE $firstcol = ? LIMIT 1") or die(output($mysqli->error));
$stmt->bind_param('si', $option, $id);
$e = $stmt->execute();
$stmt->close();
if($e):
$text = 'Selected element has been marked as '.$option.'.';
$stat = TRUE;
else:
die(output('Selected element has not been marked as '.$option.'.'));
endif;
else:
die(output('No valid action found.'));
endif;
else:
die(output('Content is not found.'));
endif;
endfor;
die(output(array('text' => $text, 'stat' => $stat)));
else:
die(output('Nothing selected.'));
endif;
elseif($option === 'add' OR ($option === 'edit' && $dataid)):
$name = strip_tags($fn->escape($_POST['name']));
$title = strip_tags($fn->escape($_POST['title']));
$title = stripslashes(stripcslashes(htmlentities($title, ENT_QUOTES)));
$h1heading = strip_tags($fn->escape($_POST['h1heading']));
$description = strip_tags($fn->escape($_POST['metadescription']));
$description = stripslashes(stripcslashes(htmlentities($description, ENT_QUOTES)));
$keyword = strip_tags($fn->escape($_POST['metakeyword']));
$keyword = stripslashes(stripcslashes(htmlentities(strtolower($keyword), ENT_QUOTES)));
$content = $fn->escape($_POST['content'], FALSE);
// $content = strip_tags($content, '<a><b><br><center><div><em><font><h1><h2><h3><h4><h5><h6><i><img><li><ol><p><span><strong><sub><sup><table><tbody><td><tfoot><th><thead><tr><u><ul>');
$content = str_replace(array(' ', '\r\n', '\r', '\n'), array(' ', ' ', ' ', ' '), $content);
$content = stripslashes(stripcslashes(htmlentities($content, ENT_QUOTES)));
$status = isset($_POST['status']) ? $fn->escape($_POST['status']) : 'disabled';
$creation= date('Y-m-d H:i:s');
$stmt = $mysqli->prepare("SELECT * FROM $table WHERE name = ?") or die(output($mysqli->error));
$stmt->bind_param('s', $name);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->close();
if(empty($name)):
die(output('Please enter page name.'));
elseif(preg_match('/[^A-Za-z0-9-_.]/', $name)):
die(output('Please enter a valid page name.'));
elseif(($option === 'add' && $count_rows > 0)):
die(output('Duplicate entry for page name '.$name.'.'));
elseif(empty($title)):
die(output('Please enter page title.'));
elseif(empty($description)):
die(output('Please enter meta description.'));
elseif(empty($keyword)):
die(output('Please enter meta keywords.'));
else:
if($option === 'add'):
$filename = $name.'.php';
if( ! file_exists('../'.$filename)):
$file = fopen('../'.$filename, 'w') or die(output('Unable to open file.'));
$text = '<?php'.PHP_EOL.'require_once(\'header.php\');'.PHP_EOL.'echo $page_content;'.PHP_EOL.'require_once(\'footer.php\');'.PHP_EOL.'?>';
fwrite($file, $text);
fclose($file);
endif;
$stmt = $mysqli->prepare("INSERT INTO $table(name, title, h1heading, metadescription, metakeyword, content, status, creation) VALUES(?, ?, ?, ?, ?, ?, ?, ?)") or die(output($mysqli->error));
$stmt->bind_param('ssssssss', $name, $title, $h1heading, $description, $keyword, $content, $status, $creation);
$e = $stmt->execute();
$stmt->close();
$mysqli->close();
if($e):
die(output(array('text' => 'Content has been added.', 'stat' => TRUE)));
else:
die(output('Content has not been added.'));
endif;
elseif($option === 'edit'):
$stmt = $mysqli->prepare("SELECT * FROM $table WHERE ($firstcol != ? AND name = ?)") or die(output($mysqli->error));
$stmt->bind_param('is', $dataid, $name);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->close();
if($count_rows > 0):
die(output('Duplicate entry for page name '.$name.'.'));
endif;
$stmt = $mysqli->prepare("UPDATE $table SET name = ?, title = ?, h1heading = ?, metadescription = ?, metakeyword = ?, content = ?, status = ? WHERE $firstcol = ? LIMIT 1") or die(output($mysqli->error));
$stmt->bind_param('sssssssi', $name, $title, $h1heading, $description, $keyword, $content, $status, $dataid);
$e = $stmt->execute();
$stmt->close();
$mysqli->close();
if($e):
die(output(array('text' => 'Your changes have been saved.', 'stat' => TRUE)));
else:
die(output('Your changes have not been saved.'));
endif;
else:
die(output('No valid action found.'));
endif;
endif;
elseif($option === 'savechanges'):
if($idcount > 0):
for($i = 0; $i < $idcount; $i++):
$id = $dataid[$i];
$title = strip_tags($fn->escape($_POST['title'][$id]));
$title = preg_replace_callback('/[a-zA-Z]+/', 'changecase', $title);
$title = stripslashes(stripcslashes(htmlentities($title, ENT_QUOTES)));
$stmt = $mysqli->prepare("SELECT * FROM $table WHERE $firstcol = ? LIMIT 1") or die(output($mysqli->error));
$stmt->bind_param('i', $id);
$stmt->execute();
$stmt->store_result();
$count_rows = $stmt->num_rows();
$stmt->close();
if($count_rows > 0):
$stmt = $mysqli->prepare("UPDATE $table SET title = ? WHERE $firstcol = ? LIMIT 1") or die(output($mysqli->error));
$stmt->bind_param('si', $title, $id);
$e = $stmt->execute();
$stmt->close();
if($e):
$text = 'Your changes have been saved.';
$stat = TRUE;
else:
die(output('Your changes have not been saved.'));
endif;
else:
die(output('Content is not found.'));
endif;
endfor;
die(output(array('text' => $text, 'stat' => $stat)));
else:
die(output('Nothing selected.'));
endif;
else:
die(output('No valid action found.'));
endif;
?>