ID;
$user_email = $current_user->user_email;
$servername = “localhost”;
$username = “admin”;
$password = “wazmaq8”;
$dbname = “guru_wp”;
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = “SELECT order_item_name FROM wp_woocommerce_order_items where order_item_id=’$order_item_id’ and order_id=’$post_id’ limit 1”;
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$hosting_type = $row[“order_item_name”];
$hosting_type = str_replace(” Web Hosting Plan”,””,$hosting_type);
if ($hosting_type == “Apprentice”) {
$quota = “100000”;
} elseif ($hosting_type == “Meager”) {
$quota = “20000”;
} else {
$quota = “0”;
}
if ($domain_name != “”) {
$account = file_get_contents(“http://www.guruinternetservices.com/wp-content/scripts/createacct.php?username=$user_name&password=$user_password&domain=$domain_name&email=$user_email"a=$quota&plan=$hosting_type”);
$acct = simplexml_load_string($account);
$status = (string) $acct->status;
$message = (string) $acct->message;
$message = str_replace(” in the Apache configuration”,””,$message);
$user_ip = (string) $acct->ip;
if ($status == 1) {
$setup = “yes”;
$sql = “INSERT wp_woocommerce_order_itemmeta (order_item_id, meta_key, meta_value) VALUES (‘$order_item_id’, ‘Username’, ‘$user_name’)”;
$result = $conn->query($sql);
$sql2 = “INSERT into wp_woocommerce_order_itemmeta (order_item_id, meta_key, meta_value) VALUES (‘$order_item_id’, ‘Domain’, ‘$domain_name’)”;
$result2 = $conn->query($sql2);
$sql3 = “INSERT wp_woocommerce_order_itemmeta (order_item_id, meta_key, meta_value) VALUES (‘$order_item_id’, ‘IP Address’, ‘$user_ip’)”;
$result3 = $conn->query($sql3);
$sql5 = “UPDATE wp_posts SET post_status=’wc-completed’ WHERE ID=’$post_id'”;
$result5 = $conn->query($sql5);
Print ‘
Your account setup is complete!
Please make a note of your credentials:
- Username: ‘.$user_name.’
- Password: ‘.$user_password.’
- IP Address: ‘.$user_ip.’
You can get started by logging into your cPanel.
If you have any questions, please submit a support ticket.
‘;
} else {
Print “
Your account setup failed for the following reason:
$message
Please try again…
“;
}
}
if ($setup == “”) {
if ($user_name == “”){
$user_name = $current_user->user_login;
$user_name = str_replace(“.”,””,$user_name);
$user_name = substr($user_name,0,16);
}
print ‘
Please provide the following information to setup your ‘.$hosting_type.’ hosting plan.