tech4biz/admin/includes/functions.php
2024-10-24 17:20:08 +05:30

41 lines
850 B
PHP

<?PHP
function sanitizeData($data): string
{
$data = trim($data);
$data = stripslashes($data);
$data = addslashes($data);
$data = htmlspecialchars($data);
return $data;
}
function showSweetAlert($type, $message)
{
echo "
<script>
window.onload = () => {
if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ) };
toastr['$type']('$message');
}
</script>
";
}
function showBootstrapAlert($type, $message)
{
echo '<div class="alert alert-' . $type . ' alert-dismissible fade show" role="alert">
' . $message . '
<button class="btn-close" type="button" data-bs-dismiss="alert" aria-label="Close" data-bs-original-title="" title=""></button>
</div>';
}