sapzero
Goto Top

Formular funktioniert nicht mehr nach Maskierung

Hi,
ich habe zwei Formulare die ohne Problem Funktionieren. Ich habe ein Listenfeld erstellt wo der user auswählen kann welches Formular er benutzen will. Am anfang wird kein Formualr angezeigt. Erst wenn der User das gewünschte Formular wählt und den submit Button klickt wird es angezeigt.
Jedoch wenn man das Formular abschicken will wird die Seite aktualisiert und man muss nochmal neu das Formular wählen und die Funktion des Formulars wird nicht erfüllt.
Ohne die Maskierung funktioniert das Formular.

Ich Hoffe ich konnte es verständlich erklären und jemand kann mir da weiter Helfen.

<?php
//--------------LiSTENFELD--------------
?>
<form action="" method="post">  
<select name="waehlen" size="1">  
      <option value="---">---</option>  
	  <option value="Form 1">Form 1</option>  
      <option value="Form 2">Form 2</option>  
</select>
<input name="submit" type="submit" value="OK">  
</form>

<?php 
$ok = $_POST['submit'];  
$anzeigen = $_POST['waehlen'];  
?>

<?php if($_POST["waehlen"] == "Form 1"):?>  
<table border=1 cellspacing=1 cellpadding=1>
<tr>
	<td>
		//----------------------FORMUALR 1--------------------------- 
		<b>Hier können sie ihre SQL abfragen eingeben!!!</b><br><br>
		
		<form name="sqlbefehl" action="" method="post" target="_self" >  
		<textarea name="textfeld" cols="50" rows="4"></textarea>  
		<input name="send" style="margin-left: 10px" type="submit" value="Send" />  
		</form>
		<?php
			$eingabe = $_POST['textfeld'];  
			$send = $_POST['send'];  
			echo "<b>Ihre Eingabe lautet:</b> $eingabe<br /><br />";  
		?>
	</td>
</tr>
</table>
<?php elseif($_POST["waehlen"] == "Form 2"):?>  
<table border=1 cellspacing=1 cellpadding=1>
<tr>
	<td>
		//---------------------FORMULAR 2----------------------- 
		<b>Hier können sie ihre SQL abfragen eingeben!!!</b><br><br>
		
		<form name="sqlbefehl2" action="" method="post" target="_self" >  
		<input name="select" type="text" value="" />  
		<input name="tbl" type="text" value="" />  
		<input name="where" type="text" value="" />  
		<input name="send2" style="margin-left: 10px" type="submit" value="Send" />  
		</form>	
		<?php
			$select = $_POST['select'];  
			$tbl = $_POST['tbl'];  
			$where = $_POST['where'];  
			$send2 = $_POST['send2'];  
			if($_POST['select'] && $_POST['tbl'])  
			{
				$eingabe2 = "SELECT $select FROM $tbl ";  
				if($_POST['where'])  
				{
					$eingabe2 .= "WHERE $where";  
				}
			}
			echo "<b>Ihre Eingabe lautet:</b> $eingabe2<br /><br />";  
		?> 
	</td>
</tr>
</table>
<?php else:?>
<h2>Bitte wählen Sie eine Eingabeform</h2>
<?php endif;?>

Gruß
Sapzero

Content-Key: 109873

Url: https://administrator.de/contentid/109873

Printed on: April 24, 2024 at 02:04 o'clock

Member: Enclave
Enclave Mar 11, 2009 at 20:40:26 (UTC)
Goto Top
Hi,

1. Du hast magic quotes an (daher die "automatische" Maskierung)
2. stripslashes()
3. Hast du hier ne schöne XSS Lücke drin (also eigentlich ist das alles hier ne riesen große XSS Lücke) => htmlspecialchars()
4. Das gleiche mit SQL => mysql_real_escape_string() & Mach dich schlau!

Mfg

Enclave