Advertisement
Guest User

Untitled

a guest
Jan 4th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.04 KB | None | 0 0
  1. <?
  2. $db_host = "localhost";
  3. $db_user = "web112";
  4. $db_pass = "vertrieb";
  5. $db_name = "usr_web112_1";
  6.  
  7. mysql_connect($db_host,$db_user,$db_pass);
  8. mysql_select_db($db_name);
  9. ?>
  10.  
  11. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
  12. <html>
  13. <head>
  14. <link rel="stylesheet" type="text/css" href="style.css">
  15. <title>Tarifvergleich VA Leipzig</title>
  16. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
  17. </head>
  18. <body>
  19.  
  20. <div id="mainwrapper">
  21.  
  22. <div style="font-size:25px;text-decoration:bold"><img src="logo.png" alt="Logo"> - Tarifvergleich</div><br />
  23.  
  24. <form method="post" action="index.php">
  25. <div class="angabe">
  26. <div class="suchen">Kosten berechnen f&uuml;r:</div>
  27. <div class="suchen">PLZ <input type="text" name="plz" value="<?=$_POST['plz'];?>" /></div>
  28. <div class="suchen">Verbrauch: <input type="text" name="verbrauch" value="<?=$_POST['verbrauch'];?>" />KWh</div>
  29. <div class="suchen">
  30. <input type="radio" name="art" value="Strom" <? if ($_POST['art'] == "Strom") { echo "checked=\"checked\""; } ?> />Strom<br />
  31. <input type="radio" name="art" value="Gas" <? if ($_POST['art'] == "Gas") { echo "checked=\"checked\""; } ?> />Gas<br />
  32. </div>
  33. <div class="suchen">
  34. <input type="radio" name="nutzung" value="privat" <? if ($_POST['nutzung'] == "privat") { echo "checked=\"checked\""; } ?> />Privat<br />
  35. <input type="radio" name="nutzung" value="gewerblich" <? if ($_POST['nutzung'] == "gewerblich") { echo "checked=\"checked\""; } ?> />Gewerbe<br />
  36. </div>
  37. <div class="suchen">
  38. <input type="submit" name="jump" value="Abschicken" style="width:90px" />
  39. </div>
  40. </div>
  41. </form>
  42.  
  43. <div class="clear"></div><br /><br />
  44. <?php
  45. if ($_POST['jump'] == "Abschicken") {
  46.  
  47. #$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");
  48. $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");
  49. $anbieter_anzahl = mysql_num_rows($anbieter_query);
  50.  
  51. $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");
  52.  
  53. #echo "<p>Insgesamt <span class=\"hinweis\">".$anbieter_anzahl."</span> Anbieter für ".$_POST['suche_plz']." gefunden!</p>";
  54. ?>
  55. <h1>Tarifangebote f&uuml;r PLZ: <?=$_POST['plz'];?></h1><br />
  56.  
  57. <table border="1" cellspacing="0" cellpadding="50" class="vergleich_ergebnis">
  58. <tr class="vergleich">
  59. <th>Anbieter/Tarif</th>
  60. <th>Preis Brutto</th>
  61. <th>Preis bei <?=$_POST['verbrauch'];?> kWh Verbrauch</th>
  62. <th>Vertragdetails</th>
  63. </tr>
  64. <?
  65. while ($anbieter_res = mysql_fetch_assoc($anbieter_query)) {
  66. $sprung++;
  67. $ug = ($sprung & 1 ? 'ungerade':'gerade');
  68. if ($ug == "gerade") {
  69. $zeilenfarbe = "#DCE1F1";
  70. } else {
  71. $zeilenfarbe = "#CBD1E1";
  72. }
  73. $monat = str_replace(",",".",$anbieter_res['gesamt']) / 12;
  74.  
  75. $gp_test = str_replace(",",".",$anbieter_res['gp']) * 100;
  76.  
  77. ?>
  78.  
  79.  
  80. <tr <? if ($anbieter_res['grundversorger'] == "Ja") { echo "style=\"background-color:red;\""; } else { echo "style=\"background-color:".$zeilenfarbe.";\""; } ?>>
  81. <? if (($anbieter_res['name'] == "Vattenfall Easy") AND ($_POST['verbrauch'] > "10000")){ echo "<td class=\"anbieter\">".$anbieter_res['name']."></td>"; } ?>
  82. <td><b> <?=$anbieter_res['gp'];?> €</b> Grundpreis (Euro / Jahr)<br />
  83. <b> <?=$anbieter_res['ap'];?></b> Arbeitspreis (ct/kWh) <br />
  84. <b> <?=$anbieter_res['bonus'];?> €</b> Bonus
  85. </td>
  86. <td>Jahrespreis (Euro/Jahr) <?=sprintf("%01.2f",$anbieter_res['gesamt']);?><br />
  87. Monatsabschlag <?=sprintf("%01.2f",$monat);?><br />
  88. Einsparung (Euro/Jahr) <?=sprintf("%01.2f",$spar);?><br />
  89. in Prozent: 17%
  90. </td>
  91. <td>
  92. <? if ($anbieter_res['name'] == "switch") { echo "Tarifdetails switch<br />Zeile 1<br />Zeile 2"; } ?>
  93. <? if ($anbieter_res['name'] == "EWE AG") { echo "Tarifdetails EWE AG<br />Zeile 1<br />Zeile 2"; } ?>
  94. <? if ($anbieter_res['name'] == "Vattenfall NATUR") { echo "Tarifdetails Vattenfall NATUR<br />Zeile 1<br />Zeile 2"; } ?>
  95. <? if ($anbieter_res['name'] == "Vattenfall Easy") { echo "Tarifdetails Vattenfall Easy<br />Zeile 1<br />Zeile 2"; } ?>
  96. <? if ($anbieter_res['name'] == "switch all-in") { echo "Tarifdetails switch all-in<br />Zeile 1<br />Zeile 2"; } ?>
  97. <? if ($anbieter_res['name'] == "switch blue power") { echo "Tarifdetails switch blue power<br />Zeile 1<br />Zeile 2"; } ?>
  98. <? if ($anbieter_res['name'] == "Lekker Strom") { echo "Tarifdetails Lekker Strom<br />Zeile 1<br />Zeile 2"; } ?>
  99. <? if ($anbieter_res['name'] == "E WIE EINFACH") { echo "Tarifdetails E WIE EINFACH<br />Zeile 1<br />Zeile 2"; } ?>
  100. <? if ($anbieter_res['name'] == "Rheinenergie TradeGarant") { echo "Tarifdetails Rheinenergie TradeGarant<br />Zeile 1<br />Zeile 2"; } ?>
  101. <? if ($anbieter_res['name'] == "Rheinenergie TradeKlima") { echo "Tarifdetails Rheinenergie TradeKlima<br />Zeile 1<br />Zeile 2"; } ?>
  102. <? if ($anbieter_res['name'] == "Rheinenergie TradeGarantdirekt") { echo "Tarifdetails Rheinenergie TradeGarantdirekt<br />Zeile 1<br />Zeile 2"; } ?>
  103. <? if ($anbieter_res['name'] == "OptimalGrün Gewerbe") { echo "Tarifdetails OptimalGrün Gewerbe<br />Zeile 1<br />Zeile 2"; } ?>
  104. </td>
  105. </tr>
  106.  
  107. <?
  108. }
  109. }
  110. ?>
  111. </table>
  112. <br />
  113.  
  114. <input type="button" value="Drucken" onClick="document.print()" style="width:100px">
  115. <br /><br />
  116. </div>
  117. </body>
  118. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement