Location: PHPKode > projects > PHPmyEXIM > domain_edit.php
<?php
require("session.php");
?>
<?php
if (isset($_GET['domain']))
{
	$domain = $_GET['domain'];
}
else
{
	$domain = "";
}

if($_POST['action'] == "yes")
{

	//Form-Data
	$domain = $_POST['domain'];
	$domain_old = $_POST['domain_old'];
	$passwort1 = $_POST['passwort1'];
	$passwort2 = $_POST['passwort2'];

	require("config.php");
	$tabelle = "domains";

	/* Connection to the Database */ 
	MYSQL_CONNECT($server, $user, $passw) or die ( "<H3>unable to connect to database server</H3>");
	MYSQL_SELECT_DB($datenbank) or die ( "<H3>database does not exist</H3>");

//Update with no password change
if ($passwort1 == '' && $passwort2 == '' && $domain != '')
{
	$update_domain=mysql_query("Update $tabelle SET domain_name = '$domain' where domain_name = '$domain_old'");
	echo"
	<html><head><title></title>
	<link rel=stylesheet type=\"text/css\" href=\"global.css\">
	</head><body>
	<p>Your changes have been saved successfully.<p><a href=\"domain_overview.php?domain=$domain\"><img src=\"images/home.gif\" border=\"0\"></a></p>
	</body>
	</html>";
}else
{
//Update with passwort change
if($passwort1 != '' && $passwort1 == $passwort2 && $domain != '')
{
	$update_domain1=mysql_query("Update $tabelle SET domain_name = '$domain', password = PASSWORD('$passwort1') where domain_name = '$domain_old'");
	echo"
	<html><head><title></title>
	<link rel=stylesheet type=\"text/css\" href=\"global.css\">
	</head><body>
	<p>Your changes have been saved successfully.<p><a href=\"domain_overview.php?domain=$domain\"><img src=\"images/home.gif\" border=\"0\"></a></p>
	</body>
	</html>";
}
else
{
	echo"<html><head><title></title>
	<link rel=stylesheet type=\"text/css\" href=\"global.css\">
	</head><body>
	<p>The passwords you 've typed in are different or domain is empty. Please go<p></p>
	 <a href=\"javascript:history.back()\"><img src=\"images/back.gif\" border=\"0\"></a></p>
	</body>
	</html>";
}
}
}
else
{
	require("config.php");
	$tabelle = "domains";

	/* Connection to the Database */ 
	MYSQL_CONNECT($server, $user, $passw) or die ( "<H3>Datenbankserver nicht erreichbar</H3>");
	MYSQL_SELECT_DB($datenbank) or die ( "<H3>Datenbank nicht vorhanden</H3>");

	$result1=MYSQL_QUERY("select domain_name from $tabelle where domain_name='$domain'");
	$row1 = mysql_fetch_row($result1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<title></title>
	<link rel=stylesheet type="text/css" href="global.css">
</head>
<body> 
<form name="edit_domain" action="<?php echo $PHP_SELF; ?>" method="POST">
<table border="0" cellpadding="4" cellspacing="0" align="center">
<tr>
	<input type="hidden" name="action" value="yes">
	<input type="hidden" name="domain_old" value="<?php echo $domain; ?>">
	<th colspan="2" class="tab">Edit domain</th>
</tr>
<tr>
	<td class="tab1" valign="middle">domain</td>
	<td><input type="text" size="50" name="domain" value="<?php echo $row1[0]; ?>"></td>
</tr>
<tr>
	<td class="tab1">Password</td>
	<td><input type="password" size="50" name="passwort1" value=""></td>
</tr>
<tr>
	<td class="tab1">rewrite Password</td>
	<td><input type="password" size="50" name="passwort2" value=""></td>
</tr>
<tr>
	<td colspan="2" align="center"><input type="image" src="images/change.gif" name="submit" value="change"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
}
?>
Return current item: PHPmyEXIM