Skip to content

Commit

Permalink
sample changes
Browse files Browse the repository at this point in the history
  • Loading branch information
likithsai committed Jul 8, 2020
1 parent 9c020b1 commit 75de400
Show file tree
Hide file tree
Showing 6 changed files with 650 additions and 303 deletions.
727 changes: 444 additions & 283 deletions SQL File/hms.sql

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions hms/admin/include/page/editDoctor.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<?php
session_start();
include( '../../include/config.php' );
//include( '../../include/config.php' );

$did = intval( $_GET['id'] );// get doctor id

if( isset( $_POST['submit'] ) ) {

$target_dir = "../../uploads/";
$target_file = $target_dir . time();

if( !empty( $_FILES["image"]["name"] ) ) {

Expand All @@ -16,7 +19,7 @@
if( in_array( $fileType, $allowTypes ) ) {

$image = $_FILES['image']['tmp_name'];
$imgContent = addslashes(file_get_contents($image));
//$imgContent = addslashes(file_get_contents($image));

}

Expand All @@ -29,25 +32,26 @@
$doccontactno = $_POST['doccontact'];
$docemail = $_POST['docemail'];

$sql = mysqli_query($con,"Update doctors set specilization='$docspecialization',doctorName='$docname',address='$docaddress',docFees='$docfees',contactno='$doccontactno',docEmail='$docemail', profile_pic='$imgContent' where id='$did'");
if($sql) {

$msg="Doctor Details updated Successfully";
if( move_uploaded_file($image, $target_file) ) {
$sql = mysqli_query($con, "UPDATE doctors SET specilization='$docspecialization', doctorName='$docname', address='$docaddress', docFees='$docfees', contactno='$doccontactno', docEmail='$docemail', profile_pic='$target_file' WHERE id = '$did'");
if($sql) {
$msg="Doctor Details updated Successfully";
}
}

}
?>

<div class="row">
<div class="col-md-12">
<h5 style="color: green; font-size:18px; "><?php if($msg) { echo htmlentities($msg);}?></h5>
<h5 style="color: green; font-size:18px; "><?php if($msg) { echo htmlentities($msg); } ?></h5>
<div class="row margin-top-30">
<div class="col-lg-8 col-md-12">
<div class="panel panel-white" style="border: 1px solid #ccc;">
<div class="panel-body">
<?php
$sql=mysqli_query($con,"select * from doctors where id='$did'");
while($data=mysqli_fetch_array($sql)) {
$sql = mysqli_query($con, "SELECT * FROM doctors WHERE id = '$did'");
while( $data = mysqli_fetch_array($sql) ) {
?>

<h4><?php echo htmlentities($data['doctorName']);?>'s Profile</h4>
Expand All @@ -67,7 +71,7 @@
<select name="Doctorspecialization" class="form-control" required="required">
<option value="<?php echo htmlentities($data['specilization']);?>"><?php echo htmlentities($data['specilization']);?></option>
<?php
$ret=mysqli_query($con,"select * from doctorspecilization");
$ret=mysqli_query($con,"SELECT * FROM doctorspecilization");
while($row=mysqli_fetch_array($ret)) {
?>
<option value="<?php echo htmlentities($row['specilization']);?>"><?php echo htmlentities($row['specilization']);?></option>
Expand Down Expand Up @@ -102,7 +106,7 @@

<div class="form-group">
<label for="exampleInputPassword1">Profile Pic</label><br/>
<img width="100" height="100" src="data:image/jpg;charset=utf8;base64,<?php echo base64_encode($data['profile_pic']); ?>" />
<img width="100" height="100" src="<?php echo $data['profile_pic']; ?>" />
<input type="file" name="image" class="form-control" placeholder="Upload File" required="required">
</div>

Expand Down
22 changes: 14 additions & 8 deletions hms/admin/include/page/manageDoctor.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

// form submit
if( isset( $_POST['submit'] ) ) {

$target_dir = "../../uploads/";
$target_file = $target_dir . time();

if( !empty($_FILES["image"]["name"]) ) {

Expand All @@ -25,7 +28,7 @@
$allowTypes = array( 'jpg', 'png', 'jpeg', 'gif' );
if( in_array( $fileType, $allowTypes ) ){
$image = $_FILES['image']['tmp_name'];
$imgContent = addslashes( file_get_contents( $image ) );
//$imgContent = addslashes( file_get_contents( $image ) );
}

}
Expand All @@ -37,14 +40,17 @@
$doccontactno = $_POST['doccontact'];
$docemail = $_POST['docemail'];
$password = md5($_POST['npass']);
$sql = mysqli_query($con, "INSERT INTO doctors(specilization, doctorName, address, docFees, contactno, docEmail, password, profile_pic) VALUES ('$docspecialization', '$docname', '$docaddress', '1000', '$doccontactno', '$docemail', '$password', '$imgContent')");

echo mysqli_error($con);

if( move_uploaded_file($image, $target_file) ) {
//$sql = mysqli_query($con, "INSERT INTO doctors(specilization, doctorName, address, docFees, contactno, docEmail, password, profile_pic) VALUES ('$docspecialization', '$docname', '$docaddress', '1000', '$doccontactno', '$docemail', '$password', '$imgContent')");
$sql = mysqli_query($con, "INSERT INTO doctors(specilization, doctorName, address, docFees, contactno, docEmail, password, profile_pic) VALUES ('$docspecialization', '$docname', '$docaddress', '1000', '$doccontactno', '$docemail', '$password', '$target_file')");
echo mysqli_error($con);

if($sql) {
$msg = "Doctor Added successfully!";
} else {
$msg = mysqli_query($con);
if($sql) {
$msg = "Doctor Added successfully!";
} else {
$msg = mysqli_query($con);
}
}

}
Expand Down
88 changes: 88 additions & 0 deletions hms/pharma/include/page/changePassword.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
session_start();
//error_reporting(0);
include('../../include/config.php');
include('../../include/checklogin.php');
// check_login();

date_default_timezone_set('Asia/Kolkata');// change according timezone

$currentTime = date( 'd-m-Y h:i:s A', time () );
if(isset($_POST['submit'])) {
$sql=mysqli_query($con,"SELECT password FROM users where password='".md5($_POST['cpass'])."' && id='".$_SESSION['id']."'");
$num=mysqli_fetch_array($sql);

if($num>0) {
$con=mysqli_query($con,"update users set password='".md5($_POST['npass'])."', updationDate='$currentTime' where id='".$_SESSION['id']."'");
$_SESSION['msg1']="Password Changed Successfully !!";
} else {
$_SESSION['msg1']="Old Password not match !!";
}
}
?>

<script type="text/javascript">
function valid() {
if(document.chngpwd.cpass.value=="") {
alert("Current Password Filed is Empty !!");
document.chngpwd.cpass.focus();
return false;
} else if(document.chngpwd.npass.value=="") {
alert("New Password Filed is Empty !!");
document.chngpwd.npass.focus();
return false;
} else if(document.chngpwd.cfpass.value=="") {
alert("Confirm Password Filed is Empty !!");
document.chngpwd.cfpass.focus();
return false;
} else if(document.chngpwd.npass.value!= document.chngpwd.cfpass.value) {
alert("Password and Confirm Password Field do not match !!");
document.chngpwd.cfpass.focus();
return false;
}
return true;
}
</script>


<div class="wrap-content container" id="container">
<div class="container-fluid container-fullw bg-white">

<div class="row">
<div class="col-md-12">
<div class="row margin-top-30">
<div class="col-lg-12 col-md-12">
<div class="panel panel-white">
<div class="panel-heading"><h5 class="panel-title">Change Password</h5></div>
<div class="panel-body">
<p style="color:red;">
<?php echo htmlentities($_SESSION['msg1']);?>
<?php echo htmlentities($_SESSION['msg1']="");?>
</p>
<form role="form" name="chngpwd" method="post" onSubmit="return valid();">
<div class="form-group">
<label for="exampleInputEmail1">Current Password</label>
<input type="password" name="cpass" class="form-control" placeholder="Enter Current Password">
</div>

<div class="form-group">
<label for="exampleInputPassword1">New Password</label>
<input type="password" name="npass" class="form-control" placeholder="New Password">
</div>

<div class="form-group">
<label for="exampleInputPassword1">Confirm Password</label>
<input type="password" name="cfpass" class="form-control" placeholder="Confirm Password">
</div>

<button type="submit" name="submit" class="btn btn-o btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>

</div>
</div>
88 changes: 88 additions & 0 deletions hms/pharma/include/page/editProfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
session_start();
//error_reporting(0);
include('../../include/config.php');
include('../../include/checklogin.php');
// check_login();

if(isset($_POST['submit'])) {
$fname=$_POST['fname'];
$address=$_POST['address'];
$city=$_POST['city'];
$gender=$_POST['gender'];

$sql=mysqli_query($con,"Update users set fullName='$fname',address='$address',city='$city',gender='$gender' where id='".$_SESSION['id']."'");
if($sql) {
$msg="Your Profile updated Successfully";
}
}
?>

<div class="wrap-content container" id="container">
<div class="container-fluid container-fullw bg-white">

<div class="row">
<div class="col-md-12">
<h5 style="color: green; font-size:18px;">
<?php if($msg) { echo htmlentities($msg);}?></h5>
<div class="row margin-top-30">
<div class="col-lg-12 col-md-12">
<div class="panel panel-white">
<div class="panel-heading">
<h5 class="panel-title">Edit Profile</h5>
</div>

<div class="panel-body">
<?php
$sql=mysqli_query($con,"select * from users where id='".$_SESSION['id']."'");
while($data=mysqli_fetch_array($sql)) {
?>
<h4><?php echo htmlentities($data['fullName']);?>'s Profile</h4>
<p><b>Profile Reg. Date: </b><?php echo htmlentities($data['regDate']);?></p>
<?php if($data['updationDate']){?>
<p><b>Profile Last Updation Date: </b><?php echo htmlentities($data['updationDate']);?></p>
<?php } ?>
<hr />
<form role="form" name="edit" method="post">
<div class="form-group">
<label for="fname">User Name</label>
<input type="text" name="fname" class="form-control" value="<?php echo htmlentities($data['fullName']);?>" >
</div>

<div class="form-group">
<label for="address">Address</label>
<textarea name="address" class="form-control"><?php echo htmlentities($data['address']);?></textarea>
</div>

<div class="form-group">
<label for="city">City</label>
<input type="text" name="city" class="form-control" required="required" value="<?php echo htmlentities($data['city']);?>" >
</div>

<div class="form-group">
<label for="gender">Gender</label>
<select name="gender" class="form-control" required="required" >
<option value="<?php echo htmlentities($data['gender']);?>"><?php echo htmlentities($data['gender']);?></option>
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</div>

<div class="form-group">
<label for="fess">User Email</label>
<input type="email" name="uemail" class="form-control" readonly="readonly" value="<?php echo htmlentities($data['email']);?>">
<a href="change-emaild.php">Update your email id</a></div>
<button type="submit" name="submit" class="btn btn-o btn-primary">Update</button>
</div>
</form>
<?php } ?>
</div>
</div>
</div>
</div>
</div>

</div>
</div>

Binary file added uploads/1594191913
Binary file not shown.

0 comments on commit 75de400

Please sign in to comment.