Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $db_host = "localhost";
- $db_user = "web112";
- $db_pass = "vertrieb";
- $db_name = "usr_web112_1";
- mysql_connect($db_host,$db_user,$db_pass);
- mysql_select_db($db_name);
- ?>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="style.css">
- <title>Tarifvergleich VA Leipzig</title>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
- </head>
- <body>
- <div id="mainwrapper">
- <div style="font-size:25px;text-decoration:bold"><img src="logo.png" alt="Logo"> - Tarifvergleich</div><br />
- <form method="post" action="index.php">
- <div class="angabe">
- <div class="suchen">Kosten berechnen für:</div>
- <div class="suchen">PLZ <input type="text" name="plz" value="<?=$_POST['plz'];?>" /></div>
- <div class="suchen">Verbrauch: <input type="text" name="verbrauch" value="<?=$_POST['verbrauch'];?>" />KWh</div>
- <div class="suchen">
- <input type="radio" name="art" value="Strom" <? if ($_POST['art'] == "Strom") { echo "checked=\"checked\""; } ?> />Strom<br />
- <input type="radio" name="art" value="Gas" <? if ($_POST['art'] == "Gas") { echo "checked=\"checked\""; } ?> />Gas<br />
- </div>
- <div class="suchen">
- <input type="radio" name="nutzung" value="privat" <? if ($_POST['nutzung'] == "privat") { echo "checked=\"checked\""; } ?> />Privat<br />
- <input type="radio" name="nutzung" value="gewerblich" <? if ($_POST['nutzung'] == "gewerblich") { echo "checked=\"checked\""; } ?> />Gewerbe<br />
- </div>
- <div class="suchen">
- <input type="submit" name="jump" value="Abschicken" style="width:90px" />
- </div>
- </div>
- </form>
- <div class="clear"></div><br /><br />
- <?php
- if ($_POST['jump'] == "Abschicken") {
- #$anbieter_query = mysql_query("SELECT plz,ort,name,gp,ap,bonus,nutzung,art,grundversorger FROM aa_vergleich WHERE plz = '".$_POST['plz']."' AND art = '".$_POST['art']."' AND nutzung = '".$_POST['nutzung']."' AND gp != '0' AND ap != '0' ORDER BY id");
- $anbieter_query = mysql_query("SELECT (ap*'".$_POST['verbrauch']."'+gp-bonus) AS gesamt,plz,ort,name,gp,ap,bonus,nutzung,art,grundversorger FROM aa_vergleich WHERE plz = '".$_POST['plz']."' AND art = '".$_POST['art']."' AND nutzung = '".$_POST['nutzung']."' AND gp != '0' AND ap != '0' ORDER BY gesamt");
- $anbieter_anzahl = mysql_num_rows($anbieter_query);
- $gp_query = mysql_query("SELECT plz,gp,ap,nutzung,art,grundversorger FROM aa_vergleich WHERE plz = '".$_POST['plz']."' AND art = '".$_POST['art']."' AND nutzung = '".$_POST['nutzung']."' AND grundversorger = 'JA' ORDER BY gesamt");
- #echo "<p>Insgesamt <span class=\"hinweis\">".$anbieter_anzahl."</span> Anbieter für ".$_POST['suche_plz']." gefunden!</p>";
- ?>
- <h1>Tarifangebote für PLZ: <?=$_POST['plz'];?></h1><br />
- <table border="1" cellspacing="0" cellpadding="50" class="vergleich_ergebnis">
- <tr class="vergleich">
- <th>Anbieter/Tarif</th>
- <th>Preis Brutto</th>
- <th>Preis bei <?=$_POST['verbrauch'];?> kWh Verbrauch</th>
- <th>Vertragdetails</th>
- </tr>
- <?
- while ($anbieter_res = mysql_fetch_assoc($anbieter_query)) {
- $sprung++;
- $ug = ($sprung & 1 ? 'ungerade':'gerade');
- if ($ug == "gerade") {
- $zeilenfarbe = "#DCE1F1";
- } else {
- $zeilenfarbe = "#CBD1E1";
- }
- $monat = str_replace(",",".",$anbieter_res['gesamt']) / 12;
- $gp_test = str_replace(",",".",$anbieter_res['gp']) * 100;
- ?>
- <tr <? if ($anbieter_res['grundversorger'] == "Ja") { echo "style=\"background-color:red;\""; } else { echo "style=\"background-color:".$zeilenfarbe.";\""; } ?>>
- <? if (($anbieter_res['name'] == "Vattenfall Easy") AND ($_POST['verbrauch'] > "10000")){ echo "<td class=\"anbieter\">".$anbieter_res['name']."></td>"; } ?>
- <td><b> <?=$anbieter_res['gp'];?> €</b> Grundpreis (Euro / Jahr)<br />
- <b> <?=$anbieter_res['ap'];?></b> Arbeitspreis (ct/kWh) <br />
- <b> <?=$anbieter_res['bonus'];?> €</b> Bonus
- </td>
- <td>Jahrespreis (Euro/Jahr) <?=sprintf("%01.2f",$anbieter_res['gesamt']);?><br />
- Monatsabschlag <?=sprintf("%01.2f",$monat);?><br />
- Einsparung (Euro/Jahr) <?=sprintf("%01.2f",$spar);?><br />
- in Prozent: 17%
- </td>
- <td>
- <? if ($anbieter_res['name'] == "switch") { echo "Tarifdetails switch<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "EWE AG") { echo "Tarifdetails EWE AG<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "Vattenfall NATUR") { echo "Tarifdetails Vattenfall NATUR<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "Vattenfall Easy") { echo "Tarifdetails Vattenfall Easy<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "switch all-in") { echo "Tarifdetails switch all-in<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "switch blue power") { echo "Tarifdetails switch blue power<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "Lekker Strom") { echo "Tarifdetails Lekker Strom<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "E WIE EINFACH") { echo "Tarifdetails E WIE EINFACH<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "Rheinenergie TradeGarant") { echo "Tarifdetails Rheinenergie TradeGarant<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "Rheinenergie TradeKlima") { echo "Tarifdetails Rheinenergie TradeKlima<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "Rheinenergie TradeGarantdirekt") { echo "Tarifdetails Rheinenergie TradeGarantdirekt<br />Zeile 1<br />Zeile 2"; } ?>
- <? if ($anbieter_res['name'] == "OptimalGrün Gewerbe") { echo "Tarifdetails OptimalGrün Gewerbe<br />Zeile 1<br />Zeile 2"; } ?>
- </td>
- </tr>
- <?
- }
- }
- ?>
- </table>
- <br />
- <input type="button" value="Drucken" onClick="document.print()" style="width:100px">
- <br /><br />
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement