
<?php

session_start(); 
    $u_uname = '';
    if (isset($_COOKIE['auth_token']))
    {
        $u_uname = $_COOKIE['auth_token'];
    }else{
        header("location:../login.php");
    }

include '../include/connection.php';

// Check if all required parameters are set

    $package_name = $_POST['package_name'];
    $domain = $_POST['domain'];
    $montly_price = $_POST['montly_price'];
    $validity = $_POST['visit'];
    $ssd = $_POST['ssd'];
    $ssl_certificate = $_POST['ssl_certificate'];
    $email_account = $_POST['email_account'];
    $bandwidth = $_POST['bandwidth'];
    $ip = $_POST['ip'];
    $support = $_POST['support'];
    $uniqueNumber = mt_rand(10000000, 99999999);

    $package_id = $uniqueNumber;
    

    // SQL query
    $sql = "INSERT INTO `webhosting`(`package_name`, `domain`,`montly_price`,`visit`,`ssd`, `ssl_certificate`, `email_account`,`bandwidth`,`ip`,`support`,`package_id`) VALUES ('$package_name', '$domain', '$montly_price', '$visit', '$ssd', '$ssl_certificate', '$email_account', '$bandwidth', '$ip', '$support', '$package_id')";
   
    // Execute the query
    if ($link->query($sql) === TRUE) {
        header('Location:../newserver.php?success=68565489');
    } else {
        header('Location:../newserver.php?error=68565488');
       
    }

?>


