cvs: php-hosts-web / host-edit.php /clients host-edit.php
| From: | jim winstead | Date: | Thu, 25 Apr 2002 01:31:59 +0000 |
| Subject: | cvs: php-hosts-web / host-edit.php /clients host-edit.php | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-9849@lists.php.net to get a copy of this message | ||
jimw Wed Apr 24 21:31:59 2002 EDT
Added files:
/php-hosts-web host-edit.php
Removed files:
/php-hosts-web/clients host-edit.php
Log:
restore editing of the main host info
Index: php-hosts-web/host-edit.php
+++ php-hosts-web/host-edit.php
<?
require 'shared.inc';
$hostid = (int)$hostid;
/* just bounce requests with no hostid. */
if (!$hostid) {
header("Location: /");
exit;
}
$user = verify_host_login();
if ($user != $hostid && !verify_staff_login()) {
commonHeader("Not Authorized");
?>
<div class="errors">You are either not logged in as a staff member (someone
with a PHP CVS account) or as the contact for this hosting company. Please
<a href="login.php">log in</a> here to be able to delete the information
about this hosting company.</div>
<?php
commonFooter();
exit;
}
/* get information about the host */
$query = "SELECT * FROM hosts WHERE HostId = $hostid";
$res = mysql_query($query) or die("query failed: ".mysql_query());
$host = mysql_fetch_assoc($res);
$errors = array();
if ($mode=="edit") {
if (empty($hostname)) {
$errors[] = "Name of company left blank.";
}
if (empty($hosturl)) {
$errors[] = "URL of company left blank.";
}
if (empty($hostemail)) {
$errors[] = "Email for company left blank.";
}
if (empty($contact)) {
$errors[] = "Contact email left blank.";
}
if ((!empty($passwd) || !empty($passwd2)) && $passwd != $passwd2) {
$errors[] = "Passwords did not match.";
}
if ($user != $hostid && !empty($passwd)) {
$errors[] = "Only hosting company contacts may change the password.";
}
if (!$errors) {
if (!empty($passwd)) $passwd = crypt($passwd,randomstring(2));
$query = "UPDATE hosts SET"
. " HostName='$hostname',"
. " HostURL='$hosturl',"
. " HostInfoURL='$hostinfourl',"
. " HostEmail='$hostemail',"
. " HostPhone='$hostphone',"
. " HostFax='$hostfax',"
. " HostCity='$hostcity',"
. " HostState='$hoststate',"
. " HostCountry='$hostcountry',"
. ($passwd ? " password='$password'," : "")
. " contact='$contact',"
. " lastupdate=NOW()"
. " WHERE HostID=$hostid";
if (@mysql_query($query)) {
if ($passwd2) {
setcookie("HOSTID", "$hostid:".base64_encode($passwd2));
}
header("Location: showinfo.php?hostid=$hostid&edit=1");
exit;
}
$errors[] = "Something went wrong when updating the database.";
}
}
commonHeader("Edit: ".oneof(clean($hostname),htmlentities($host['HostName'])));
if ($errors) display_errors($errors);
?>
<form method="post" action="<?php echo $PHP_SELF;?>">
<table border="0" cellspacing="0" cellpadding="5">
<tr class="header">
<th colspan="2" align="left">Company Information <small>(* denotes
a required field)</small></th>
</tr>
<tr class="odd">
<th align="right">Name of Hosting Company:</th>
<td><input type="text" name="hostname" size="30"
maxlength="64" value="<?php echo
oneof(clean($hostname),htmlentities($host['HostName']));?>" />*</td>
</tr>
<tr class="even">
<th align="right">Main URL:</th>
<td><input type="text" name="hosturl" size="30"
maxlength="255" value="<?php echo
oneof(clean($hosturl),htmlentities($host['HostURL']));?>" />*<br
/><small>This is the main URL for your company.</small></td>
</tr>
<tr class="odd">
<th align="right">URL of phpinfo() page:</th>
<td>
<input type="text" name="hostinfourl" size="30"
maxlength="255" value="<?php echo
oneof(clean($hostinfourl),htmlentities($host['HostInfoURL']));?>" />
<br />
<small>In order to better assist people looking for PHP hosting
companies, we suggest that you put a page somewhere on your system
that simply calls <code>phpinfo()</code>. If you have such a page
on your system, enter it's URL here. For security reasons, the URL
for this page will <strong>not</strong> be shown to the public, but
may be used in the future to automagically parse out some information
on your system.</small>
</td>
</tr>
<tr class="even">
<th align="right">Info Email:</th>
<td><input type="text" name="hostemail" size="30"
maxlength="64" value="<?php echo
oneof(clean($hostemail),htmlentities($host['HostEmail']));?>" />*<br
/><small>Who people should email if they want more info on your
company.</small></td>
</tr>
<tr class="odd">
<th align="right">Info Phone:</th>
<td><input type="text" name="hostphone" size="15"
maxlength="32" value="<?php echo
oneof(clean($hostphone),htmlentities($host['HostPhone']));?>" /></td>
</tr>
<tr class="even">
<th align="right">Info Fax:</th>
<td><input type="text" name="hostfax" size="15"
maxlength="32" value="<?php echo
oneof(clean($hostfax),htmlentities($host['HostFax']));?>" /></td>
</tr>
<tr class="odd">
<th align="right">City:</th>
<td><input type="text" name="hostcity" size="30"
maxlength="32" value="<?php echo
oneof(clean($hostcity),htmlentities($host['HostCity']));?>" /></td>
</tr>
<tr class="even">
<th align="right">State/Province/Region:</th>
<td><input type="text" name="hoststate" size="30"
maxlength="32" value="<?php echo
oneof(clean($hoststate),htmlentities($host['HostState']));?>" /></td>
</tr>
<tr class="odd">
<th align="right">Country:</th>
<td><select name="hostcountry"><?php
listCountries("select",oneof($hostcountry,$host['HostCountry']));?></select></td>
</tr>
<tr class="even">
<th align="right">Contact Address:</th>
<td><input type="text" name="contact" size="30"
maxlength="64" value="<?php echo
oneof(clean($contact),htmlentities($host['contact']));?>" />*<br
/><small>This is the address you use to log in, as well as for us to contact
you.</small></td>
</tr>
<tr class="odd">
<th align="right">Password:<br /><small>Leave both fields blank to
leave password unchanged.</th>
<td><input type="password" name="passwd" size="16"
maxlength="16" value="" /><br /><input type="password"
name="passwd2" size="16" maxlength="16" value="" />
(again)</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="hidden" name="hostid" value="<?php echo
$hostid;?>" />
<input type="hidden" name="mode" value="edit" />
<input type="submit" value="Save Changes" />
</td>
</tr>
</table>
</form>
<?php
commonFooter();
?>