Autor: Karpio
Licencja: public domain

total_shop.php
<?php
# Script by Karpio
echo '<html><head><title>ValturiaOTS - Total Shop</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>';
$koszta = 120;
$pass = "ProsteHaslo"; # Twoje hasło tutaj;

	if(empty($_REQUEST["pass"]))
	{
		echo '<form action="total_shop.php" method="POST"><input type="password" name="pass" />&nbsp;<input type="submit" value="Zaloguj" /></form>';
	}
	elseif($_REQUEST["pass"] !== $pass)
	{
		echo '<strong style="color:red;">Błędne hasło!</strong><br /><form action="total_shop.php" method="POST"><input type="password" name="pass" />&nbsp;<input type="submit" value="Zaloguj" /></form>';
	}
	else
	{
		include("config-and-functions.php");
		$cash = $SQL->query("SELECT * FROM `sms_cost`;")->fetchAll();
		if(empty($cash))
			echo 'Brak pieniędzy na koncie.';
		else
		{
			echo '<table style="border: 1px solid navy;">';
			$i = 0;
			$t = 0;
			$suma = 0;
			$tenMiesiac = 0;
			$za3zl = 0;
			$za6zl = 0;
			$za9zl = 0;
			$razempieniadze = array(0,0,0);
			foreach($cash as $kasa)
			{
				$suma += $kasa["cash"];
				$data = explode(" ", $kasa["date"]);
				$data = explode("-", $data[0]);
				if($data[0] == date("Y") && $data[1] == date("m"))
				{
					$tenMiesiac += $kasa["cash"];
					$t++;
					if(floor($kasa['cash']) == 1) { $za3zl++; $razempieniadze[0] += $kasa['cash']; }
					elseif(floor($kasa['cash']) == 2) { $za6zl++; $razempieniadze[1] += $kasa['cash']; }
					elseif(floor($kasa['cash']) == 3) { $za9zl++; $razempieniadze[2] += $kasa['cash']; }
				}
				$i++;
			}
			echo '<tr><td><strong>Suma:</strong></td><td>'.$suma.'zł</td></tr><tr><td><strong>Za ten miesiąc:</strong></td><td>'.$tenMiesiac.'zł</td></tr><tr><td><strong>Wysłano:</strong></td><td>'.$i.' sms\'ów</td></tr>
			<tr><td style="font-weight:bold;">Wysłano <small>(ten miesiąc)</small>:</td><td>'.$t.' sms\'ów</td></tr>
			<tr style="border-top: 1px solid navy;"><td><strong>Na czysto:</strong></td><td>'.round((($tenMiesiac * 0.81) - $koszta), 2).'zł</td></tr>';
			echo '</table>';
			echo '<br /><br />Liczba SMSów:<br /><ul><li>za 3zł: <strong>'.$za3zl.'</strong></li><li>za 6zł: <strong>'.$za6zl.'</strong></li><li>za 9zł: <strong>'.$za9zl.'</strong></li></ul><br />Pieniędzy z SMSów:<br /><ul><li>za 3zł: <strong>'.$razempieniadze[0].'</strong>zł</li><li>za 6zł: <strong>'.$razempieniadze[1].'</strong>zł</li><li>za 9zł: <strong>'.$razempieniadze[2].'</strong>zł</li></ul>';
		}
	}	
echo '</body>';
?>

Wrzucamy plik do folderu z naszą stroną www.

System wymaga skryptu Kowola na zliczanie SMSów.

otspub/statystyki_smsow.txt · Last modified: 2011/02/10 20:05 by karpio
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
 otosowy pasek