PHP Classes

File: update_user.php

Recommend this page to a friend!
  Classes of Olaf Lederer   Access user Class   update_user.php   Download  
File: update_user.php
Role: Application script
Content type: text/plain
Description: An example for updating a user
Class: Access user Class
Site user registration and page access restriction
Author: By
Last change: added fields and variables for the new password check
Date: 18 years ago
Size: 2,519 bytes


Class file image Download

$update_member = new Access_user;
// $new_member->language = "de"; // use this selector to get messages in other languages

$update_member->access_page(); // protect this page too.
$update_member->get_user_info(); // call this method to get all other information

if (isset($_POST['Submit'])) {
$update_member->update_user($_POST['password'], $_POST['confirm'], $_POST['name'], $_POST['info'], $_POST['email']); // the update method
$error = $update_member->the_msg; // error message

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Update page example</title>
<style type="text/css">
label {
    display: block;
    float: left;
    width: 120px;

<h2>Update user information:</h2>
<p>Use this form to modify the account information (fields with a * are required).</p>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  <label for="login">Login:</label>
  <b><?php echo $update_member->user; ?></b><br>
  <label for="password">Password:</label>
  <input name="password" type="password" value="<?php echo (isset($_POST['password'])) ? $_POST['password'] : ""; ?>" size="6">
  * (min. 4 chars.) <br>
  <label for="confirm">Confirm password:</label>
  <input name="confirm" type="password" value="<?php echo (isset($_POST['confirm'])) ? $_POST['confirm'] : ""; ?>" size="6">
  * <br>
  <label for="name">Real name:</label>
  <input name="name" type="text" value="<?php echo (isset($_POST['name'])) ? $_POST['name'] : $update_member->user_full_name; ?>" size="30">
  <label for="email">E-mail:</label>
  <input name="email" type="text" value="<?php echo (isset($_POST['email'])) ? $_POST['email'] : $update_member->user_email; ?>" size="30">
  <label for="info">Extra info:</label>
  <input name="info" type="text" value="<?php echo (isset($_POST['info'])) ? $_POST['info'] : $update_member->user_info; ?>" size="50">
  <input type="submit" name="Submit" value="Update">
<p><b><?php echo (isset($error)) ? $error : "&nbsp;"; ?></b></p>
<!-- Notice! you have to change this links here, if the files are not in the same folder -->
<p><a href="<?php echo $update_member->main_page; ?>">Main</a></p>