JezK
Edit File: app_settings.php
<?php //include('menuheader.php'); //include_once("connect.php"); include_once("adm_operations.php"); $operations = new adm_operations(); if (isset($_POST['submit'])) { $sender_mail = $_POST['sender_mail']; $app_name = $_POST['app_name']; $support_mail = $_POST['support_mail']; if ($_FILES["app_logo"]["name"]) { $t = $_FILES["app_logo"]["tmp_name"]; $n = $_FILES["app_logo"]["name"]; $p = strtotime(date('d-m-Y H:i:s')); $k = substr(str_shuffle($p), 0, 5); $tfname = $k . $n; if (move_uploaded_file($t, "uploads/" . $tfname)) { $im_url = $tfname; } } $result = $operations->updatingAppDetails($sender_mail, $support_mail, $app_name, $im_url); if ($result) { if ($result == 1) { echo "<script>alert('Settings updated successfully');</script>"; } else { echo "<script>alert('Updation failed');</script>"; } } } ?> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-aFq/bzH65dt+w6FI2ooMVUpc+21e0SRygnTpmBvdBgSdnuTN7QbdgL+OapgHtvPp" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha2/dist/js/bootstrap.min.js" integrity="sha384-heAjqF+bCxXpCWLa6Zhcp4fu20XoNIA98ecBC1YkdXhszjoejr5y9Q77hIrv8R9i" crossorigin="anonymous"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script> function validation() { var app_name = document.getElementById('app_name').value; var sender_mail = document.getElementById('sender_mail').value; var support_mail = document.getElementById('support_mail').value; var app_logo = document.getElementById('app_logo').value; var uploadedFile = document.getElementById('app_logo'); var fileSize = uploadedFile.files[0]; //alert(fileSize.size); //var file = app_logo.files[0]; var re = /(\.png)$/i; var regex1 = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/; var regexs = /^[a-zA-Z ]*$/; if (app_name == '') { alert('Please Enter Application Name') document.getElementById('app_name').focus(); return false; } else if (!regexs.test(app_name)) { alert('Please Enter Valid Application Name') document.getElementById('app_name').focus(); return false; } else if (sender_mail == "") { alert('Please Enter Sender Email Mail') document.getElementById('sender_mail').focus(); return false; } else if (!regex1.test(sender_mail)) { alert('Please Enter Valid Sender Email Mail') document.getElementById('sender_mail').focus(); return false; } else if (support_mail == '') { alert('Please Enter Support Email Mail') document.getElementById('support_mail').focus(); return false; } else if (!regex1.test(support_mail)) { alert('Please Enter Valid Support Email Mail') document.getElementById('support_mail').focus(); return false; } else if (app_logo == '') { alert('Please Select Application Logo') document.getElementById('support_mail').focus(); return false; } else if (!re.exec(app_logo)) { alert("Image not supported format!"); //alert(fileSize); return false; } else if (fileSize.size > 2097152) { alert("File size must under 2mb!"); return false; } } </script> <html> <body> <div class="row" style="margin-top:30px; margin-bottom:30px;"> <div class="col-md-9 text-left " style="font:Arial, Helvetica, sans-serif;font-style:normal;font-size:24px;"> <i class="fa fa-wrench" title="Change Password" style="font-size:20px;margin: 0px 0px 0px 21px;"></i> Application settings </div> </div> <form class="form-horizontal" enctype="multipart/form-data" method="post" action=""> <div class="box-body" style="background-color:#fff; padding: 10px; font-family:Arial, Helvetica, sans-serif; font-size:13px; "> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-5 col-md-offset-1 text-right "> <b style="color:#666666;">App Name</b><span style="color:#FF0000; margin:2px; ">*</span> </div> <div class="col-md-6"> <input type="text" class="form-control" id="app_name" name="app_name" style="height:29px;font-size:13px; width:300px!important;" tabindex="1"> </div> </div> </div> <div style="clear:both;"></div> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-5 col-md-offset-1 text-right "> <b style="color:#666666;">Sender Mail</b><span style="color:#FF0000; margin:2px; ">*</span> </div> <div class="col-md-6"> <input type="text" class="form-control" id="sender_mail" name="sender_mail" style="height:29px;font-size:13px; width:300px!important;" tabindex="2" autocomplete="off"> <!-- if there is an error--> <div class="col-md-12" id="err_current" style="color:#990000;margin-left:-15px;"></div> <!--- end error--> </div> </div> </div> <div style="clear:both;"></div> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-5 col-md-offset-1 text-right "> <b style="color:#666666;">Support Mail</b><span style="color:#FF0000; margin:2px; ">*</span> </div> <div class="col-md-6"> <input type="text" class="form-control" id="support_mail" name="support_mail" autocomplete="off" style="height:29px;font-size:13px; width:300px!important;" tabindex="3" value=""> <!-- if there is an error--> <div class="col-md-12" id="err_new" style="color:#990000;margin-left:-15px;"></div> <!--- end error--> </div> </div> </div> <div style="clear:both;"></div> <div class="clear"> <div class="form-group col-md-6" style="margin-bottom:1.0%;"> <div class="col-md-5 col-md-offset-1 text-right "> <b style="color:#666666;">App Logo</b><span style="color:#FF0000; margin:2px;">*</span> </div> <div class="col-md-6"> <input type="file" class="form-control" id="app_logo" name="app_logo" style="font-size:13px; width:300px!important;" tabindex="4" value=""> <!-- if there is an error--> <div class="col-md-12" id="err_cnew" style="color:#990000;margin-left:-15px;"></div> <!--- end error--> </div> </div> </div> </div> <div class="col-md-6" align="left"> <input type="submit" onclick=" return validation()" name="submit" class="btn btn-outline-secondary custom-button-width .navbar-right" tabindex="19" style="font-family:Arial, Helvetica, sans-serif;font-style:normal;font-size:13px; margin:20px; " value="Update"> </div> </form> </body> </html>