This question already has an answer here:
ive a problem with my input script. the check grind are broken and dont work right now.
The Script should look for the get over and should check it with db support.
In my case, the while grind are buggy.... they dont work right....
<?php
date_default_timezone_set('Europe/Berlin');
$mysqli = new MySQLi("localhost", "dbuser", "dbpass", "clantools");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: ({$mysqli->connect_errno}) {$mysqli->connect_error}";
}
$result = mysqli_query($mysqli,"SELECT * FROM clanmember_ra1se where '".$_GET['account_name']."' = Playername");
//while($row = mysqli_fetch_array($result))
// {
//
// if ($_GET['clantag'] = $row['Clantag']) {
if (mysqli_num_rows($result) != 0)
{
echo '
<!DOCTYPE html>
<html>
<head>
<title>Code Eingabe</title>
</head>
<body>
<form action="?" method="get">
<input type="hidden" name="account_name" value="'.$_GET['account_name'].'">
<input type="hidden" name="clantag" value="'.$_GET['clantag'].'">
<input type="hidden" name="role" value="'.$_GET['role'].'">
<input type="hidden" name="role_i18n" value="'.$_GET['role_i18n'].'">
<p>Code: <input type="text" name="code" /></p>
<p><input type="radio" name="activity" id="leitend" value="leitend" />Leitender FK</p>
<p><input type="radio" name="activity" id="gespielt" value="gespielt" />Gespielt</p>
<p><input type="radio" name="activity" id="bereit" value="bereit" />Bereit</p>
<p><input type="submit" name="absenden" value="Code senden"/></p>
</form>
</body>
</html>
';
if ( empty ($_GET['code']) != TRUE and isset($_GET['absenden']))
{
// wenn beide Bedingungen zutreffen,
// dann folgende Anweisungen ausführen
if (isset ($_GET['activity'])){
if ($_GET['activity']=="leitend"){
$status = 'leitend';
}
if ($_GET['activity']=="gespielt"){
$status = 'gespielt';
}
if ($_GET['activity']=="bereit"){
$status = 'bereit';
}
}
$eingabe = date("Y-m-d H:i:s", time());
//$mysqli = new MySQLi("localhost", "dbuser", "dbpass", "clantools");
//if ($mysqli->connect_errno) {
// echo "Failed to connect to MySQL: ({$mysqli->connect_errno}) {$mysqli->connect_error}";
//}
$result_code = mysqli_query($mysqli,"SELECT * FROM code_ra1se where '".$_GET['code']."' = code");
if (mysqli_num_rows($result_code) != 0)
{
echo '<br>';
echo '<center>Code wird geprüft</center>';
echo "<br>";
echo "<br>";
echo "<br>";
echo "<br>";
while($row = mysqli_fetch_array($result_code))
{
$result = mysqli_query($mysqli,"SELECT * FROM eingabe_code_ra1se where '".$_GET['account_name']."' = spielername");
while($row = mysqli_fetch_array($result))
{
if ($_GET['code'] != $row['code'] {
//echo ''.$row['gueltigkeit'].' > '.$eingabe.'';
if ($row_code['gueltigkeit'] > $eingabe){
$sql = "INSERT INTO eingabe_code_ra1se (spielername,code,clantag,eingabezeit,role,role_i18n,activity ) VALUES ('".$_GET['account_name']."', '".$_GET['code']."', '".$_GET['clantag']."', '".$eingabe."', '".$_GET['role']."', '".$_GET['role_i18n']."', '".$status."')";
if ($mysqli->query($sql) == TRUE) {
echo "<b><center>Code erfolgreich übermittelt!</center><br> BITTE SEITE SCHLIEßEN!!</b> <br>";
} else {
echo "Error: " . $sql . "<br>" . $mysqli->error;
}
$mysqli->close();
} else {
echo "<b><center>Code ist nicht gültig!</center></b> <br>";
}
} else {
echo "<b><center>Du hast den Code breits eingegeben!</center></b> <br>";
}
}
}
} else {
echo "<b><center>Der Code existiert nicht!</center></b> <br>";
}
}
} else {
echo "<b><center>Du bist nicht berechtigt den Code hier einzugeben!</center></b> <br>";
}
?>
The problem of this scripts are the while grind. how can i make this easier? i think the most of the while grind are usless.....
</div>