63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
if ((!isset($_POST['dni'])) || (!isset($_SESSION['zalogowany3'])))
|
|
{
|
|
header('Location: voucher.php');
|
|
exit();
|
|
}
|
|
|
|
require_once "connect.php";
|
|
|
|
$polaczenie = @new mysqli($host, $db_user, $db_password, $db_name);
|
|
$dni=$_POST['dni'];
|
|
|
|
if ($polaczenie->connect_errno!=0)
|
|
{
|
|
echo "Error: ".$polaczenie->connect_errno;
|
|
}
|
|
else
|
|
|
|
{
|
|
$data=$_SESSION['dnipremium'];
|
|
$user=$_SESSION['user'];
|
|
|
|
if($dni==30)
|
|
{
|
|
$dni=$_POST['dni'];
|
|
$nowa_data = date( 'y-m-d', strtotime( $data .' +30 day' ));
|
|
$polaczenie->query("UPDATE uzytkownicy SET dnipremium='$nowa_data' WHERE user='$user'");
|
|
|
|
|
|
header('Location: klient.php');
|
|
|
|
}
|
|
elseif($dni==180)
|
|
{
|
|
$dni=$_POST['dni'];
|
|
$nowa_data = date( 'y-m-d', strtotime( $data .' +180 day' ));
|
|
$polaczenie->query("UPDATE uzytkownicy SET dnipremium='$nowa_data' WHERE user='$user'");
|
|
|
|
|
|
header('Location: klient.php');
|
|
|
|
}
|
|
elseif($dni==360)
|
|
{
|
|
$dni=$_POST['dni'];
|
|
$nowa_data = date( 'y-m-d', strtotime( $data .' +360 day' ));
|
|
$polaczenie->query("UPDATE uzytkownicy SET dnipremium='$nowa_data' WHERE user='$user'");
|
|
|
|
|
|
header('Location: klient.php');
|
|
|
|
}
|
|
else
|
|
|
|
|
|
header('Location: błąd.php');
|
|
|
|
$polaczenie->close();
|
|
}
|
|
|
|
?>
|