Login   Register  
PHP Classes
elePHPant
Icontem

File: keyprop.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Claudia Neu  >  HTTP class  >  keyprop.php  >  Download  
File: keyprop.php
Role: Example script
Content type: text/plain
Description: solution output in html
Class: HTTP class
Retrieve data from remote servers via HTTP
Author: By
Last change:
Date: 8 years ago
Size: 15,012 bytes
 

Contents

Class file image Download
<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
       <title>key properties</title>
       <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<link href="../common/si_admin.css" type="text/css" rel="stylesheet">
       
</head>
<body class="si">
	<form action="keyprop.php" method="post" name="getkeyproperties">
			<table align="center" cellSpacing="0" cellPadding="0" width="100%" border="0" ID="Table2">
				<colgroup>
					<col width="10%">
					<col width="30%">
					<col width="25%">
					<col width="35%">
				
				</colgroup>
				<caption class="caption">
					Key properties anzeigen
				</caption>
				<tr>
					<td>&nbsp;</td>
					<td class="label">
						<font class="label">&nbsp;Eingabe Key&nbsp;<br><br><input type="text" name="keyproperties" size=30 maxlength="29">&nbsp;&nbsp;<input class="button" type="submit" value="Anzeigen" name="show">
					</td>
					
					<td align="left" class="label"><br>
						<font class="properties_normal">Keyliste:&nbsp;<font class="label">Fehler >&nbsp;
						<input type="text" name="bid" size="4" maxlength="5"></td><td align="left" class="label">&nbsp;&nbsp;oder Fehler genau:&nbsp;&nbsp;<input type="text" name="bidgenau" size="4" maxlength="5" values="10">&nbsp;&nbsp;<input class="button" type="submit" value="Anzeigen" name="list">
					</td>
					
					</form>
				</tr>


<?php
require_once("../common/mysql.php");
require_once("../common/si_define.php");
require_once("../common/errorhandler.php");

		$keyId = 0;
		$db = &new CMySql;
		$id = 0;
		if (isset($_GET['id']))
		$id = $_GET['id'];
		if ($db->Connect(SI_DB_SERVER, SI_DB_LOGIN_USER, SI_DB_LOGIN_PASS))
			{
			
			if ($db->SelectDatabase(SI_DATABASE))
				{
			if ($keyproperties)
				{
				$key=$keyproperties; // auf Länge prüfen, wenn Bindestriche, dann Bindestriche rausziehen
				// und Abfrage nach ähnlichen Keys nach dem 1-5. Zeichen
				$keysplit=(substr($key,5,1));
				if ($keysplit=="-")
					{
					$key=str_replace( "-", "", $key);
					}
									
				$strSelect = "SELECT KeyVal, Start, ExpireDate, ExpireSpan, InitDownloads, Downloads, Enabled, BIDFailed FROM ".SI_KS_KEY_TABLE." WHERE KeyVal=".$db->MakeSqlString($key);
				if ($result = $db->Select($strSelect))
					{
					if ($data = $db->FetchArray($result))
						{
						if ($data['ExpireDate'] || $data['InitDownloads'] || $data['Start']  || $data['BIDFailed'] || $data['Downloads'] || $data['Enabled'])
							{
							$key=$data['KeyVal'];
							$key1=substr($key,0,5);
							$key2=substr($key,5,5);
							$key3=substr($key,10,5);
							$key4=substr($key,15,5);
							$key5=substr($key,20,5);
							$keyges=sprintf("%05s-%05s-%05s-%05s-%05s", $key1, $key2, $key3, $key4, $key5);
							$dAdate=$data['Start'];
							$expirespan=$data['ExpireSpan'];
							$expiremain=$data['ExpireDate'];
							
							
							$dDownloads=$data['Downloads'];
							$gesdown=$data['InitDownloads'];
							$dEnabled=$data['Enabled'];
							$dBIDFailed=$data['BIDFailed'];
							echo "<table><form action=keymodify.php?id=$key&keyproperties=$keyproperties&expiremain=$expiremain&expirespan=$expirespan method=post name=andern><colgroup><col width=1%><col width=45%><col width=20%><col width=3%><col width=3%><col width=1%><col width=1%><col width=1%></colgroup><tr><br><br><td></td><td bgcolor=#C0C0C0 class=properties_normal>Aktueller Key </td><td bgcolor=#8F8F8F class=properties_normal>Beginndatum</td><td bgcolor=#C0C0C0 class=properties_normal>Ablaufdatum</td><td bgcolor=#8F8F8F class=properties_normal>Downloads gesamt</td><td bgcolor=#C0C0C0 class=properties_normal>Downloads verbleibend</td><td bgcolor=#8F8F8F class=properties_normal>Gültig</td><td bgcolor=#C0C0C0 class=properties_normal>Fehler</td></tr>";	
							echo "<tr><td></td><td class=properties_normal>$keyges</td><td class=properties_normal>$dAdate</td><td class=properties_normal>";
							if ($data['ExpireDate']==NULL) {
								$data['ExpireDate']="Null";
							}
							$dExpire=$data['ExpireDate'];
							echo "<input name=expire type=text class=properties_normal value=$dExpire></td><td class=properties_normal><input type=text name=gesdownloads class=properties_normal value=$gesdown></td><td class=properties_normal><input type=text name=downloads class=properties_normal value=$dDownloads></td><td class=properties_normal><input type=text name=enabled class=properties_normal value=$dEnabled></td><td class=properties_normal><input type=text name=bidfailed class=properties_normal value=$dBIDFailed></td></tr>";
							echo "<tr></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td align=right><input type=submit name=mod value=modify>&nbsp;&nbsp;<input type=submit name=del value=delete></td></tr></table></form>";


							}
						else echo "<table ><tr><td class=caption_err>Fehler in Abfrage</td></tr></table >";
						}
					else
 				    	{
 				    	echo "<table><colgroup><col width=1%><col width=18%><col width=8%><col width=11%><col width=11%><col width=11%><col width=12%><col width=11%></colgroup><tr><br><br><td></td><td bgcolor=#C0C0C0 class=properties_normal>Aktueller Key </td><td bgcolor=#8F8F8F class=properties_normal>Beginndatum</td><td bgcolor=#C0C0C0 class=properties_normal>Ablaufdatum</td><td bgcolor=#8F8F8F class=properties_normal>Downloads gesamt</td><td bgcolor=#C0C0C0 class=properties_normal>Downloads verbleibend</td><td bgcolor=#8F8F8F class=properties_normal>Gültig</td><td bgcolor=#C0C0C0 class=properties_normal>Fehler</td></tr></table>";
						$strSelect = "SELECT KeyVal, Start, ExpireDate,  ExpireSpan, InitDownloads, Downloads, Enabled, BIDFailed FROM ".SI_KS_KEY_TABLE." WHERE KeyVal like ".$db->MakeSqlString($key."%")." order by KeyVal";
     					if ($result = $db->Select($strSelect))
							{
							$anz=mysql_num_rows($result);
							for ($i=1;$i<=$anz;$i++)
							{
							if ($data = $db->FetchArray($result))
								{
								if ($data['ExpireDate'] || $data['Start']  || $data['BIDFailed']  || $data['InitDownloads'] || $data['Downloads'] || $data['Enabled'])
									{
									$key=$data['KeyVal'];
									$key1=substr($key,0,5);
									$key2=substr($key,5,5);
									$key3=substr($key,10,5);
									$key4=substr($key,15,5);
									$key5=substr($key,20,5);
									$keyges=sprintf("%05s-%05s-%05s-%05s-%05s", $key1, $key2, $key3, $key4, $key5);
									$dAdate=$data['Start'];
									
									$expirespan=$data['ExpireSpan'];
									if ($data['ExpireDate']==NULL) {
										$data['ExpireDate']="Null";
										}
									$dExpire=$data['ExpireDate'];
									$expiremain=$data['ExpireDate'];
									$dExpire=$data['ExpireDate'];
									$dDownloads=$data['Downloads'];
									$gesdown=$data['InitDownloads'];
									$dEnabled=$data['Enabled'];
									$dBIDFailed=$data['BIDFailed'];
									echo "<table><form action=keymodify.php?id=$key&keyproperties=$keyproperties&expiremain=$expiremain&expirespan=$expirespan method=post name=andern><colgroup><col width=1%><col width=24%><col width=10%><col width=10%><col width=10%><col width=10%><col width=10%><col width=10%></colgroup>";	
									echo "<tr><td></td><td class=properties_normal>$keyges</td><td class=properties_normal>$dAdate</td><td class=properties_normal><input name=expire type=text class=properties_normal value=$dExpire></td><td class=properties_normal><input type=text name=gesdownloads class=properties_normal value=$gesdown></td><td class=properties_normal><input type=text name=downloads class=properties_normal value=$dDownloads></td><td class=properties_normal><input type=text name=enabled class=properties_normal value=$dEnabled></td><td class=properties_normal><input type=text name=bidfailed class=properties_normal value=$dBIDFailed></td></tr>";
									echo "<tr></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td align=right><input type=submit name=mod value=modify>&nbsp;&nbsp;<input type=submit name=del value=delete></td></tr></table></form>";

							}
						else echo "<table ><tr><td class=caption_err>Fehler in Abfrage</td></tr></table >";
						}
					}
				}
			}
		}
				// else echo "keine Eingabe";
				}
				else if ($bid || $bidgenau) {
					echo "<table><colgroup><col width=1%><col width=18%><col width=8%><col width=11%><col width=11%><col width=11%><col width=12%><col width=11%></colgroup><tr><br><br><td></td><td bgcolor=#C0C0C0 class=properties_normal>Aktueller Key </td><td bgcolor=#8F8F8F class=properties_normal>Beginndatum</td><td bgcolor=#C0C0C0 class=properties_normal>Ablaufdatum</td><td bgcolor=#8F8F8F class=properties_normal>Downloads gesamt</td><td bgcolor=#C0C0C0 class=properties_normal>Downloads verbleibend</td><td bgcolor=#8F8F8F class=properties_normal>Gültig</td><td bgcolor=#C0C0C0 class=properties_normal>Fehler</td></tr>";
					echo "<tr><form action=keyprop.php?id=$key&bidgenau=$bidgenau&bid=$bid method=post name=sort><td></td><td align=center><input type=submit name=sortkey value=auf>&nbsp;<input type=submit name=sortkeyab value=ab></td><td align=center><input type=submit name=sortdate value=auf>&nbsp;<input type=submit name=sortdateab value=ab></td><td align=center><input type=submit name=sortexp value=auf>&nbsp;<input type=submit name=sortexpab value=ab></td><td align=center><input type=submit name=sortgesdown value=auf>&nbsp;<input type=submit name=sortgesdownab value=ab></td><td align=center><input type=submit name=sortdown value=auf>&nbsp;<input type=submit name=sortdownab value=ab></td><td align=center><input type=submit name=sortcurr value=auf>&nbsp;<input type=submit name=sortcurrab value=ab></td><td align=center><input type=submit name=sortfehler value=auf>&nbsp;<input type=submit name=sortfehlerab value=ab></td></form></tr></table>";
					if ($sortfehler) {
						//sortieren order by ...
						$sort=" order by BIDFailed";
					}
					if ($sortcurr) {
						//sortieren order by ...
						$sort=" order by Enabled";
					}
					if ($sortkey) {
						//sortieren order by ...
						$sort=" order by KeyVal";
					}
					if ($sortdate) {
						//sortieren order by ...
						$sort=" order by Start";
					}
					if ($sortexp) {
						//sortieren order by ...
						$sort=" order by ExpireDate";
					}
					if ($sortgesdown) {
						//sortieren order by ...
						$sort=" order by InitDownloads";
					}
					if ($sortdown) {
						//sortieren order by ...
						$sort=" order by Downloads";
					}
					if ($sortfehlerab) {
						//sortieren order by ...
						$sort=" order by BIDFailed desc";
					}
					if ($sortcurrab) {
						//sortieren order by ...
						$sort=" order by Enabled desc";
					}
					if ($sortkeyab) {
						//sortieren order by ...
						$sort=" order by KeyVal desc";
					}
					if ($sortdateab) {
						//sortieren order by ...
						$sort=" order by Start desc";
					}
					if ($sortexpab) {
						//sortieren order by ...
						$sort=" order by ExpireDate desc";
					}
					if ($sortgesdownab) {
						//sortieren order by ...
						$sort=" order by InitDownloads desc";
					}
					if ($sortdownab) {
						//sortieren order by ...
						$sort=" order by Downloads desc";
					}
					if ($bid) {
						if ($sortfehler || sortdown || sortgesdown || sortexp || sortkey || sortcurr || $sortfehlerab || sortdownab || sortgesdownab || sortexpab || sortkeyab || sortcurrab) {
						$strSelect = "SELECT KeyVal, Start, ExpireDate,  ExpireSpan, InitDownloads, Downloads, Enabled, BIDFailed FROM ".SI_KS_KEY_TABLE." WHERE BIDFailed > ".$db->MakeSqlString($bid).$sort;		
						}
						else
						$strSelect = "SELECT KeyVal, Start, ExpireDate,  ExpireSpan, InitDownloads, Downloads, Enabled, BIDFailed FROM ".SI_KS_KEY_TABLE." WHERE BIDFailed > ".$db->MakeSqlString($bid)." order by KeyVal";	
					}
					if ($bidgenau) {
						if ($sortfehler || sortdown || sortgesdown || sortexp || sortkey || sortcurr || $sortfehlerab || sortdownab || sortgesdownab || sortexpab || sortkeyab || sortcurrab) {
						$strSelect = "SELECT KeyVal, Start, ExpireDate,  ExpireSpan, InitDownloads, Downloads, Enabled, BIDFailed FROM ".SI_KS_KEY_TABLE." WHERE BIDFailed=".$db->MakeSqlString($bidgenau).$sort;		
						}
						else
						$strSelect = "SELECT KeyVal, Start, ExpireDate,  ExpireSpan, InitDownloads, Downloads, Enabled, BIDFailed FROM ".SI_KS_KEY_TABLE." WHERE BIDFailed=".$db->MakeSqlString($bidgenau)." order by KeyVal";	
					}
					
     					if ($result = $db->Select($strSelect))
							{
							$anz=mysql_num_rows($result);
							for ($i=1;$i<=$anz;$i++)
							{
							if ($data = $db->FetchArray($result))
								{
								if ($data['ExpireDate'] || $data['Start']  || $data['BIDFailed']  || $data['InitDownloads'] || $data['Downloads'] || $data['Enabled'])
									{
									$key=$data['KeyVal'];
									$key1=substr($key,0,5);
									$key2=substr($key,5,5);
									$key3=substr($key,10,5);
									$key4=substr($key,15,5);
									$key5=substr($key,20,5);
									$keyges=sprintf("%05s-%05s-%05s-%05s-%05s", $key1, $key2, $key3, $key4, $key5);
									$dAdate=$data['Start'];
									
									$expirespan=$data['ExpireSpan'];
									$expiremain=$data['ExpireDate'];
									$dExpire=$data['ExpireDate'];
									$dDownloads=$data['Downloads'];
									$gesdown=$data['InitDownloads'];
									$dEnabled=$data['Enabled'];
									$dBIDFailed=$data['BIDFailed'];
									echo "<table><form action=keymodify.php?id=$key&bidgenau=$bidgenau&bid=$bid&expiremain=$expiremain&expirespan=$expirespan method=post name=andern><colgroup><col width=1%><col width=24%><col width=10%><col width=10%><col width=10%><col width=10%><col width=10%><col width=10%></colgroup>";	
									echo "<tr><td></td><td class=properties_normal>$keyges</td><td class=properties_normal>$dAdate</td><td class=properties_normal><input name=expire type=text class=properties_normal value=$dExpire></td><td class=properties_normal><input type=text name=gesdownloads class=properties_normal value=$gesdown></td><td class=properties_normal><input type=text name=downloads class=properties_normal value=$dDownloads></td><td class=properties_normal><input type=text name=enabled class=properties_normal value=$dEnabled></td><td class=properties_normal><input type=text name=bidfailed class=properties_normal value=$dBIDFailed></td></tr>";
									echo "<tr></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td align=right><input type=submit name=mod value=modify>&nbsp;&nbsp;<input type=submit name=del value=delete></td></tr></table></form>";

							}
						else echo "<table ><tr><td class=caption_err>Fehler in Abfrage</td></tr></table >";
						}
					}
				}
			}	
		}			
	}$db->Close();
			
		
	


?>
</body>
</html>