egroupware/preferences/changeprofile.php

98 lines
3.8 KiB
PHP
Raw Normal View History

2000-08-18 05:24:22 +02:00
<?php
/**************************************************************************\
* phpGroupWare - preferences *
* http://www.phpgroupware.org *
* Written by Joseph Engo <jengo@phpgroupware.org> *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
Header("Cache-Control: no-cache");
Header("Pragma: no-cache");
//Header("Expires: Sat, Jan 01 2000 01:01:01 GMT");
$phpgw_info["flags"]["currentapp"] = "preferences";
2000-08-18 05:24:22 +02:00
include("../header.inc.php");
if ($phpgw_info["user"]["permissions"]["anonymous"]) {
Header("Location: " . $phpgw->link($phpgw_info["server"]["webserver_url"] . "/"));
$phpgw->common->phpgw_exit();
2000-08-18 05:24:22 +02:00
}
if ($submit) {
if ($picture_size) {
$fh = fopen($picture,"r");
$picture_raw = fread($fh,$picture_size);
fclose($fh);
$phone_number = addslashes($phone_number);
$comments = addslashes($comments);
$title = addslashes($title);
if ($phpgw_info["server"]["db_type"] == "mysql") {
$picture_raw = addslashes($picture_raw);
} else {
$picture_raw = base64_encode($picture_raw);
}
2000-09-05 04:45:44 +02:00
$phpgw->db->query("delete from profiles where owner='" . $phpgw_info["user"]["userid"] . "'");
2000-08-18 05:24:22 +02:00
$phpgw->db->query("insert into profiles (owner,title,phone_number,comments,"
2000-09-05 04:45:44 +02:00
. "picture_format,picture) values ('" . $phpgw_info["user"]["userid"] . "','"
2000-09-04 01:38:11 +02:00
. "$title','$phone_number','$comments','$picture_type','$picture_raw')");
2000-08-18 05:24:22 +02:00
} else {
$phone_number = addslashes($phone_number);
$picture_raw = addslashes($picture_raw);
$comments = addslashes($comments);
$title = addslashes($title);
$phpgw->db->query("update profiles set title='$title',phone_number='$phone_number',"
2000-09-05 04:45:44 +02:00
. "comments='$comments' where owner='" . $phpgw_info["user"]["userid"] . "'");
2000-08-18 05:24:22 +02:00
}
echo "<center>Your profile has been updated</center>";
}
2000-09-05 04:45:44 +02:00
$phpgw->db->query("select * from profiles where owner='" . $phpgw_info["user"]["userid"] . "'");
2000-08-18 05:24:22 +02:00
$phpgw->db->next_record();
?>
2000-09-05 04:45:44 +02:00
<form method="POST" ENCTYPE="multipart/form-data" action="<?php echo $phpgw->link("changeprofile.php"); ?>">
2000-08-18 05:24:22 +02:00
<table border="0">
<tr>
2000-09-05 04:45:44 +02:00
<td colspan="2"><?php echo $phpgw->common->display_fullname($phpgw_info["user"]["userid"],$phpgw_info["user"]["firstname"],$phpgw_info["user"]["lastname"]); ?></td>
2000-08-18 05:24:22 +02:00
<td>&nbsp;</td>
</tr>
<tr>
<td>Title:</td>
<td><input name="title" value="<?php echo $phpgw->db->f("title"); ?>"></td>
<td rowspan="2">
2000-09-05 05:35:42 +02:00
<img src="<?php echo $phpgw->link($phpgw_info["server"]["webserver_url"] . "/hr/view_image.php","con=" . $phpgw_info["user"]["con"]); ?> width="100" height="120">
2000-08-18 05:24:22 +02:00
</td>
</tr>
<tr>
<td>Phone number:</td>
<td><input name="phone_number" value="<?php echo $phpgw->db->f("phone_number"); ?>"></td>
</tr>
<tr>
<td>Comments:</td>
<td><textarea cols="60" name="comments" rows="4" wrap="virtual"><?php echo $phpgw->db->f("comments"); ?></textarea></td>
</tr>
<tr>
<td>Picture:</td>
<td><input type="file" name="picture"><br>Note: Pictures will be resized to 100x120.</td>
</tr>
<tr>
<td colspan="3" align="center"><input type="submit" name="submit" value="Submit">
</tr>
</table>
</form>