Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsWeb Design & DevelopmentClient Side ScriptingJavaScript right
  Closed Topic Start new topic
left right
masterens
post Dec 11 2010, 10:44 AM
Post #1


Newbie
*

Group: Members
Posts: 11
Joined: 11-June 09
Member No.: 99,035



Hi all,

I am not sure if this is the right place to post this, because there is PHP and HTML and JS in it.
Some of the displayed text is in Dutch, not in English, but the main problem is not the language.
but anyway, this is my code:
CODE
<?php
session_start();
if (sha1($_POST['loginpassword']) == 'xxxxxxxx') { $_SESSION['admininthehouse']=sha1($_POST['loginpassword']); $LastAction="Aangemeld als administrator!"; }
if ($_SESSION['admininthehouse']=='xxxxxxxx') {
//commands first
if (!$_GET['command']=='') {

$LastAction="commando uitgelezen... ";

//clearDIY
if ($_GET['command']=='clearDIY') {
    
    $handle=fopen('DIY.log','w');
    fwrite($handle,' ');
    fclose($handle);
    $LastAction=$LastAction.'DIY-lijst gewist!';
    $refresh=2;
    
}

//clearOU
if ($_GET['command']=='clearOU') {
    
    $handle=fopen('OU.log','w');
    fwrite($handle,' ');
    fclose($handle);
    $LastAction=$LastAction.'OU-lijst gewist!';
    $refresh=2;
    
}

//logout
if ($_GET['command']=='logout') {
    
$_SESSION['admininthehouse']='';
$LastAction="Afgemeld!";
$refresh=1;

    
}
}

//then come the forms

if (isset($_GET['ApplyDIY'])) {

    $handle=fopen('DIY.log','w');
    fwrite($handle,$_GET['ContentDIY']);
    fclose($handle);
    $LastAction='DIY-Lijst succesvol aangepast!';
    $refresh=2;

}

if (isset($_GET['ApplyOU'])) {

    $handle=fopen('OU.log','w');
    fwrite($handle,$_GET['ContentOU']);
    fclose($handle);
    $LastAction='OU-Lijst succesvol aangepast!';
    $refresh=2;

}

//and then comes the configuration
$handle=fopen('DIY.log','r');
$startingvalueDIY=fread($handle,filesize('DIY.log'));
fclose($handle);

$handle=fopen('OU.log','r');
$startingvalueOU=fread($handle,filesize('OU.log'));
fclose($handle);
}
else
{
$LastAction = 'Je bent niet bevoegd om deze pagina te bekijken!';
$loginform=true;
}
?>
<html>

<head>
<meta http-equiv="Content-Language" content="nl">
<? if($refresh==1) {
echo '<META HTTP-EQUIV=Refresh CONTENT="2"; URL="adminpanel.php">'; } ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Controlepaneel</title>
</head>

<body link="#FFFF00" vlink="#FFFF00" text="#FFFFFF" bgcolor="#000000" <? if ($refresh==2) { echo 'onLoad="setTimeout('."'location.href=\'adminpanel.php\'','5000')" . ';"'; } ?>>

<p align="center">
<img border="0" src="/dttah/title.png" width="800" height="400"></p>

<p align="center"><b>Controlepaneel - Administrator</b></p>
<p align="center">Laatste Actie:</p>
<p align="center">
<input type="text" name="LastAction" size="64" value="<? echo $LastAction; ?>"></p><br><? if(isset($loginform)) {
echo '<form method="post" action="adminpanel.php"><input type="text" name="loginname"><br/><input type="password" name="loginpassword"><br/><input type="submit" value="Inloggen"></form>';
}
else {
echo '<form method="get" action="adminpanel.php"><input type="button" value="Afmelden als administrator" onclick="location.href=adminpanel.php?command=logout">';
}?>
<p align="center"><u>Lijstbeheer:</u></p>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1" height="1">
  <tr>
    <td width="50%" height="1">
<p align="center">DIY-Lijst:</p>
<form name="diy" method="get" id="diy" action="adminpanel.php">
<p align="left">
<a href="adminpanel.php?command=clearDIY">
<button onclick="alert('Je gaat nu de DIY-lijst legen. Als dit een fout is, maak dan voordag je op OK klikt een kopie van het bestand DIY.log in de map DTTAH op de server!'); location.href='adminpanel.php?command=clearDIY';">Leeg de DIY-Lijst</button></a></p>
<p align="left">
<i>Inhoud:</i></p>
<p align="left">
<textarea rows="9" name="ContentDIY" cols="20"><? echo $startingvalueDIY; ?></textarea></p>
<p align="left">
<input type="submit" value="Toepassen" name="ApplyDIY">  <input type="button" onClick="document.diy.reset();" value="Herladen"></p>
</form>
    </td>
    <td width="50%" height="1"><p align="center">Online Uitgaven-Lijst:</p>
<form name="ou" method="get" id="ou" action="adminpanel.php">
<p align="left">
<a href="adminpanel.php?command=clearOU">
<button onclick="alert('Je gaat nu de Online Uitgaven-lijst legen. Als dit een fout is, maak dan voordag je op OK klikt een kopie van het bestand OU.log in de map DTTAH op de server!'); location.href='adminpanel.php?command=clearOU';">Leeg de
Online Uitgaven-Lijst</button></a></p>
<p align="left">
<i>Inhoud:</i></p>
<p align="left">
<textarea rows="9" name="ContentOU" cols="20"><? echo $startingvalueOU; ?></textarea></p>
<p align="left">
<input type="submit" value="Toepassen" name="ApplyOU">  <input type="button" onClick="document.ou.reset();" value="Herladen"></p>
</form>
</td>
  </tr>
</table>
</body>

</html>





I know it is a bit messy, but I work alone, and no-one usually needs to understand my code laugh.gif

The problem is in the bit with the two forms called diy and ou:

<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber1" height="1">
<tr>
<td width="50%" height="1">
<p align="center">DIY-Lijst:</p>
<form name="diy" method="get" id="diy" action="adminpanel.php">
<p align="left">
<a href="adminpanel.php?command=clearDIY">
<button onclick="alert('Je gaat nu de DIY-lijst legen. Als dit een fout is, maak dan voordag je op OK klikt een kopie van het bestand DIY.log in de map DTTAH op de server!'); location.href='adminpanel.php?command=clearDIY';">Leeg de DIY-Lijst</button></a></p>
<p align="left">
<i>Inhoud:</i></p>
<p align="left">
<textarea rows="9" name="ContentDIY" cols="20"><? echo $startingvalueDIY; ?></textarea></p>
<p align="left">
<input type="submit" value="Toepassen" name="ApplyDIY"> <input type="button" onClick="document.diy.reset();" value="Herladen"></p>
</form>
</td>
<td width="50%" height="1"><p align="center">Online Uitgaven-Lijst:</p>
<form name="ou" method="get" id="ou" action="adminpanel.php">
<p align="left">
<a href="adminpanel.php?command=clearOU">
<button onclick="alert('Je gaat nu de Online Uitgaven-lijst legen. Als dit een fout is, maak dan voordag je op OK klikt een kopie van het bestand OU.log in de map DTTAH op de server!'); location.href='adminpanel.php?command=clearOU';">Leeg de
Online Uitgaven-Lijst</button></a></p>
<p align="left">
<i>Inhoud:</i></p>
<p align="left">
<textarea rows="9" name="ContentOU" cols="20"><? echo $startingvalueOU; ?></textarea></p>
<p align="left">
<input type="submit" value="Toepassen" name="ApplyOU"> <input type="button" onClick="document.ou.reset();" value="Herladen"></p>
</form>
</td>
</tr>
</table>



As you can see, the two forms differ in only a few ids and names.
The button that displays 'Herladen' is a button that resets the textarea to its beginning state, that is set by the PHP code. However, the reset(); function does only work in the ou form, and not in the diy.
Does anyone see a problem?

thank you in advance,

masteRens
Go to the top of the page 
 
  + Quote Post
zpcs
post Dec 11 2010, 12:34 PM
Post #2


Marvellous Ninja
******

Group: Members
Posts: 570
Joined: 10-May 09
From: Wisconsin state, United States of America
Member No.: 94,482



Hi Masterens,
I'm no php wizard, but $_GET doesn't handle large size files very well (have you tried using $_POST instead of $_GET in all the necessary places?).

Hope this helps you out.
Go to the top of the page 
 
  + Quote Post
 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 19th June 2013 - 06:28 AM