Hello Friends,

I got a problem
iam working on a module called employers in that the company people can only give the username and we have to place the possiblity that employer cant able to modify the username and emailid
can anyone please help me.

Thanks

Recommended Answers

All 3 Replies

if you are using text box.
then textbox has a property callled disabled
e.g: <input type="text" name="email id="emailid disabled="disabled"> now we cant edit this textbox.

i hope it works..

So, only certain users should be able to modify this data?

Then you simply need to figure out who should be able to modify it, check if the current user is a part of that group, and display the controls if he is.

This example assumes that:

  • You have loaded the user's name and role name (e.g. "Employee") into the session.
  • You want only members that have the role "Admin" to be able to edit user info.
<?php
/**
 * Function to check if the current client
 * can edit member info
 */
function canMemberEditUsers() {
  if(isset($_SESSION['User'])) {
    if($_SESSION['User']['Role'] == "Admin") {
      return true;
    }
  }
  return false;
}
?>
<?php
/**
 *File: updateMemberInfo.php
 *  The file used to update the member info.
 */
if(canMemberEditUsers()) {
  $uUsername = trim($_POST['username']);
  $uPassword = trim($_POST['passwd']);

  // Do whatever you need to do to update the data
}
else {
  echo "This is a restriced zone. You do not have permisssion to be here.";
}
?>
<?php
/**
 * File: updateForm.php
 * The form used to get the new member info.
 */
  if(!canMemberEditUsers()) {
    die("This is a restricted zone. You do not have permission to be here.");
  }
  
  // Assuming the Id of the member that is to be edited was passed inthe URL
  $memberID = $_GET['memberID'];
  if(!is_numeric($memberID) || $memberID <= 0) {
    die("Invalid member ID was passed");
  }

  // Not knowing how you get  your member data, I just invented this function.
  // You would replace it with whatever you use.
  $oldName = getMemberName($memberID);

  echo <<< HTML
<html>
  <head><title>Update member info</title></head>
  <body>
     <form action="updateMemberInfo.php" method="post">
       User: <input type="text" name="username" value="{$oldName}" /><br />
       Pass: <input type="password" name="passwd" /><br />
       <input type="submit" value="update" />
    </form>
  </body>
</html>
HTML;
?>

Hope this helps.

I hope I understood your question. It sounds to me like you do not want people to be able to change account information in a program. Please let us know the name of the program/applicaton.

In most cases you need to edit the "User Permissions" and resrtict access to spacific fucntions. In most Admin or Control Panels you should have User Settings or Group Settings. Dissable the fields you do not want the employees changing or being able to access.

Again please let us know the program or software you are using and the current version, someone might be able to assist you further.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.