christian11: Suchanfrage mit Link übergeben

Beitrag lesen

Hallo,

Meine Frage, ich starte eine Suchabfrage, das Ergebnis wird mit Bearbeitungslinks angezeigt. Wenn ich nun einen Datensatz über diesen Link bearbeite und speichere, komme ich zu meiner Suchseite zurück, nur meine Suchergebnisse sind nicht mehr verfügbar, sondern ich muss erneut eine Suche starten.

Ist es möglich, zur ursprünglichen Suchseite zurückzukehren. Obwohl ich Daten über ein Formular ändere.

Anbei meine Seite zur Suche. Mit einen Link über die ID, möchte ich eine Zeile bearbeiten und wieder zur ursprünglichen Suchabfrage zurückkehren. Link: <a href="kontrSTDoffGAkor.php?recordID=<?php echo $row_std['zf_id_ga']; ?>"><?php echo $row_std['datum']; ?></a>

<?php require_once('Connections/fahrtenbuch.php'); ?>
<?php
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}

// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
	
  $logoutGoTo = "../login1.html";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "admin,office,verw";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  // For security, start by assuming the visitor is NOT authorized.
  $isValid = False;

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  if (!empty($UserName)) {
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
    // Parse the strings into arrays.
    $arrUsers = Explode(",", $strUsers);
    $arrGroups = Explode(",", $strGroups);
    if (in_array($UserName, $arrUsers)) {
      $isValid = true;
    }
    // Or, you may restrict access to only certain users based on their username.
    if (in_array($UserGroup, $arrGroups)) {
      $isValid = true;
    }
    if (($strUsers == "") && false) {
      $isValid = true;
    }
  }
  return $isValid;
}

$MM_restrictGoTo = "berechtigung.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo);
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$maxRows_std = 70;
$pageNum_std = 0;
if (isset($_GET['pageNum_std'])) {
  $pageNum_std = $_GET['pageNum_std'];
}
$startRow_std = $pageNum_std * $maxRows_std;

$date = '';
if (isset($_POST['date']) && !is_array($_POST['date'])){
		$date = $_POST['date'];
}
$searchstring = '';
if (isset($_POST['search']) && !is_array($_POST['search'])){
		$searchstring = $_POST['search'];
}

mysql_select_db($database_fahrtenbuch, $fahrtenbuch);
$query_std = "SELECT zf_id_ga, DATE_FORMAT(`timestamp_ga`, '%Y-%m-%d' ' ' '%T') AS timestamp_ga, DATE_FORMAT(`datum`, '%d-%m-%Y') AS datum, user_ga, arbeitsbeginn_ga, arbeitsende_ga, anmerkung_ga, abwesend, koruser, DATE_FORMAT(`kortimestamp`, '%d-%m-%Y' ' ' '%T') AS kortimestamp, koranmerkung, korarbeitbeginn_ga, korarbeitsende_ga, kontrGL, kontr, kontruser, del FROM gazeiterfassung WHERE user_ga = '".mysql_real_escape_string($searchstring)."' && DATE_FORMAT(datum, '%m-%Y') ='".mysql_real_escape_string( $date )."' ORDER BY datum ASC";
$query_limit_std = sprintf("%s LIMIT %d, %d", $query_std, $startRow_std, $maxRows_std);
$std = mysql_query($query_limit_std, $fahrtenbuch) or die(mysql_error());
$row_std = mysql_fetch_assoc($std);

if (isset($_GET['totalRows_std'])) {
  $totalRows_std = $_GET['totalRows_std'];
} else {
  $all_std = mysql_query($query_std);
  $totalRows_std = mysql_num_rows($all_std);
}
$totalPages_std = ceil($totalRows_std/$maxRows_std)-1;

mysql_select_db($database_fahrtenbuch, $fahrtenbuch);
$query_daten = "SELECT loginoon.kennung, oonpersonal.nachname, oonpersonal.vorname, oonpersonal.gebnr, oonpersonal.username, oonpersonal.gebname, oonpersonal.persnr FROM `loginoon` LEFT JOIN oonpersonal ON loginoon.kennung=oonpersonal.kennung WHERE loginoon.kennung = '".mysql_real_escape_string($searchstring)."'";
$daten = mysql_query($query_daten, $fahrtenbuch) or die(mysql_error());
$row_daten = mysql_fetch_assoc($daten);
$totalRows_daten = mysql_num_rows($daten);

mysql_select_db($database_fahrtenbuch, $fahrtenbuch);
$query_gebiet = "SELECT gbid, kennung, gl, ga1, ga2, ga3, gbnr, del FROM gebiete ORDER BY gbid ASC";
$gebiet = mysql_query($query_gebiet, $fahrtenbuch) or die(mysql_error());
$row_gebiet = mysql_fetch_assoc($gebiet);
$totalRows_gebiet = mysql_num_rows($gebiet);

mysql_select_db($database_fahrtenbuch, $fahrtenbuch);
$query_monat = "SELECT id, monjahr, monjahrtext FROM monat";
$monat = mysql_query($query_monat, $fahrtenbuch) or die(mysql_error());
$row_monat = mysql_fetch_assoc($monat);
$totalRows_monat = mysql_num_rows($monat);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Druck STD office GA</title> <link href="css/ausgabe.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="css/print3.css" type="text/css" media="print" /> </head>

<body>
<div class="body">
  <div class="abfrage">
  <form id="myForm" name="myForm" method="post" action="<?php echo $_SERVER["PHP_SELF"] ?>">
    <table border="0" align="center">
      <tr>
        <td><span class="bold">Stunden</span>&nbsp;&nbsp;<?php echo $row_daten['username']; ?>:</td>
        <td><select name="search" id="search">
          <option value=" " <?php if (!(strcmp(" ", $searchstring))) {echo "selected=\"selected\"";} ?>></option>
            <?php
do {
?>
            <option value="<?php echo $row_gebiet['ga1']?>"<?php if (!(strcmp($row_gebiet['ga1'], $searchstring))) {echo "selected=\"selected\"";} ?>><?php echo $row_gebiet['ga1']?></option>
            <?php
} while ($row_gebiet = mysql_fetch_assoc($gebiet));
  $rows = mysql_num_rows($gebiet);
  if($rows > 0) {
      mysql_data_seek($gebiet, 0);
	  $row_gebiet = mysql_fetch_assoc($gebiet);
  }
?>
            <option value="" <?php if (!(strcmp(" ", $searchstring))) {echo "selected=\"selected\"";} ?>></option>
            <?php
do {
?>
            <option value="<?php echo $row_gebiet['ga2']?>"<?php if (!(strcmp($row_gebiet['ga2'], $searchstring))) {echo "selected=\"selected\"";} ?>><?php echo $row_gebiet['ga2']?></option>
            <?php
} while ($row_gebiet = mysql_fetch_assoc($gebiet));
  $rows = mysql_num_rows($gebiet);
  if($rows > 0) {
      mysql_data_seek($gebiet, 0);
	  $row_gebiet = mysql_fetch_assoc($gebiet);
  }
?>
          </select></td>
        <td>&nbsp;</td>
        <td>Monat-Jahr:
          <select name="date" id="date">
            <option value=" " <?php if (!(strcmp(" ", $date))) {echo "selected=\"selected\"";} ?>></option>
            <?php
do {
?>
            <option value="<?php echo $row_monat['monjahr']?>"<?php if (!(strcmp($row_monat['monjahr'], $date))) {echo "selected=\"selected\"";} ?>><?php echo $row_monat['monjahrtext']?></option>
            <?php
} while ($row_monat = mysql_fetch_assoc($monat));
  $rows = mysql_num_rows($monat);
  if($rows > 0) {
      mysql_data_seek($monat, 0);
	  $row_monat = mysql_fetch_assoc($monat);
  }
?>
          </select></td>
        <td><input type="submit" name="button" id="button" value="Suchen" /></td>
        <td><input type="button" value=" Drucken " onclick="javascript:window.print()" title="Übersicht drucken" class="print1" /></td>
        <td>&nbsp;</td>
      </tr>
      </table>
    </form>
        <h4 align="center">Stunden &nbsp;&nbsp;<?php echo $row_daten['username']; ?>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        Name: &nbsp;
        <?php echo $row_daten['nachname']; ?> &nbsp;&nbsp;<?php echo $row_daten['vorname']; ?>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <?php echo $row_daten['gebname']; ?>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        Pers.NR: &nbsp;
        <?php echo $row_daten['persnr']; ?>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        Monat-Jahr: &nbsp;
    	<?php echo $date; ?></h4>
  </div>
  <table border="1" cellpadding="0" cellspacing="0" id="ansicht" style="border-collapse:collapse; border:1px solid #666">
    <tr class="headlineweissblue">
      <td>Timestamp</td>
      <td>Datum</td>
      <td>Arb-Beg</td>
      <td>Arb-End</td>
      <td>Anmerkung</td>
      <td>Status</td>
      <td>K-Timestamp</td>
      <td>K-User</td>
      <td>K-Anmerk</td>
      <td>K-A-Beg</td>
      <td>K-A-End</td>
      <td>K-GL</td>
      <td>Kontr</td>
      <td>del</td>
    </tr>
    <?php do { ?>
      <tr>
        <td><?php echo $row_std['timestamp_ga']; ?></td>
        <td><a href="kontrSTDoffGAkor.php?recordID=<?php echo $row_std['zf_id_ga']; ?>"><?php echo $row_std['datum']; ?></a></td>
        <td><?php echo $row_std['arbeitsbeginn_ga']; ?></td>
        <td><?php echo $row_std['arbeitsende_ga']; ?></td>
        <td style="text-align: left"><?php echo $row_std['anmerkung_ga']; ?></td>
        <td><?php echo $row_std['abwesend']; ?></td>
        <td><?php echo $row_std['kortimestamp']; ?></td>
        <td><?php echo $row_std['koruser']; ?></td>
        <td style="text-align: left"><?php echo $row_std['koranmerkung']; ?></td>
        <td><?php echo $row_std['korarbeitbeginn_ga']; ?></td>
        <td><?php echo $row_std['korarbeitsende_ga']; ?></td>
        <td><?php echo $row_std['kontrGL']; ?></td>
        <td style="text-align: left"><?php echo $row_std['kontr']; ?> <?php echo $row_std['kontruser']; ?></td>
        <td><a href="kontrSTDoffGAdel.php?recordID=<?php echo $row_std['zf_id_ga']; ?>"><?php echo $row_std['del']; ?></a></td>
      </tr>
      <?php } while ($row_std = mysql_fetch_assoc($std)); ?>
  </table>
</div>
</body>
</html>

<?php mysql_free_result($std); mysql_free_result($gebiet); mysql_free_result($monat); ?>

lg

christian