Hey cp,
ik wil binnenkort mijn change layout script vrij geven als ik hem af heb, maar ik zit steeds met 1 probleem, het opvragen van de url.
hier even de code`s van me
index
PHP
<?php
include "configure.php";
$query = "SELECT layout FROM site";
$result = mysql_query($query) or die(mysql_error());
?>
<?php
echo "$result";
?>
Toon Meer
change
PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE>Change layout</TITLE>
<meta name="description" content="Change layout">
<meta name="keywords" content="Change layout,php,javascript, dhtml, DHTML">
<style type="text/css">
BODY {margin-left:0; margin-right:0; margin-top:0;text-align:left}
p, li {font:13px Verdana; color:black;text-align:left}
h1 {font:bold 28px Verdana; color:black;text-align:center}
h2 {font:bold 24px Verdana;text-align:center}
h3 {font:bold 15px Verdana;}
</style>
</head><body>
<h1>Change layout</h1>
<div id='pw' style='position:absolute;top:150px;left:200px;width:300px'><table style="background-color:#8aa;border-color:#00f" border='6' cellspacing=0 cellpadding=6><tr><td>
<form id='formpw' name="formpw" method="post" action="change-username.php" onSubmit="return validateusername()">
<label for="User Name"></label>
<label for="newlayout"></label>
<select name="newlayout" id="newlayout">
<option value="http://intern.robbytu.net/~marco/template/nowhere/index.html" selected>layout 1</option>
<option value="http://intern.robbytu.net/~marco/template/1432/index.html">Layout 2</option>
</select>
<br><br>
<input type="hidden" name="username" value=" ">
<input type="submit" value="Change layout"><br><br>
<input type="reset" value="Reset"></form></td></tr></table>
<br><br>
<form name="MyForm" method="POST" action="administrator-page.php">
<input type="button" value="Return to Administrator Page" onClick="goback()">
<input type="hidden" name="username" value=" ">
</form>
</div>
<p><?php $Y = date("Y"); ?></p>
</body></html>
Toon Meer
change-username
PHP
<?php
include_once"configure.php";
$U=$_POST['layout'];
$A=$_POST['newlayout'];
if (isset($A)) {
mysql_query("UPDATE site SET layout = '$A' WHERE layout = '$U'") or die(mysql_error());
$rc = mysql_affected_rows();
if ($rc>0){
echo '<script language="javascript">alert("The change was successfully accomplished.");</script>';}
else{echo '<script language="javascript">alert("The change was unsuccessful.");</script>';}
$TheOldName=$U."_psb";
$TheNewName=$A."_psb";
mysql_query("RENAME TABLE $TheOldName TO $TheNewName");
$TheOldName=$U."_meaning";
$TheNewName=$A."_meaning";
mysql_query("RENAME TABLE $TheOldName TO $TheNewName");
$U=$A;
unset($A);
}
mysql_close();
?>
Toon Meer
en hier een plaatje van me database van wat de table naam is enzo.
m.v.g
Marco Boekholt