Jump to content

TinkerMan

Senior Members
  • Content Count

    144
  • Joined

Posts posted by TinkerMan

  1. I dident, but that does not seem to be it, as after adding it the error is still shown.

     

    src/function/NewAccount.php (Other files remain the same as above post)

    <?php
    require __DIR__.'/Connect.php';
    require __DIR__.'/../handler/CookieHandler.php';
    require_once __DIR__.'/../handler/AreaHandler.php';
    require_once __DIR__.'/../modules/autoload.php';
    use \InfinityFree\MofhClient\Client;
    if(isset($_POST['submit'])){
    	$FormData = array(
    		'username' => substr(str_shuffle('qwertyuioplkjhgfdsazxcvbnm012345789QWERTYUIOPLKJHGFDSAZXCVBNM'),0,8),
    		'password' => substr(str_shuffle('?!qwertyuioplkjhgfdsazxcvbnm012345789QWERTYUIOPLKJHGFDSAZXCVBNM?!@#$%^&*/'),0,6),
    		'domain' => $_POST['domain'],
    		'email' => $ClientInfo['hosting_client_email'],
    		'plan' => $_POST['package'],
    		'label' => $_POST['label']
    	);
    	if(empty($FormData['domain'])){
    		$_SESSION['message'] = '<div class="alert alert-danger" role="alert">
    									  <button class="close" data-dismiss="alert" type="button" aria-label="Close">
    									    <span aria-hidden="true">&times;</span>
    									  </button>
    									  Domain cannot be <b>empty!</b>
    									</div>';
    		header('location: ../newaccount.php');
    	}
    	else{
    		$sql = mysqli_query($connect,"SELECT * FROM `hosting_account` WHERE `account_for`='".$ClientInfo['hosting_client_key']."'");
    		if(mysqli_num_rows($sql)<3){
    			$client = Client::create();
    			$request = $client->createAccount([
    			'username' => $FormData['username'],
    			'password' => $FormData['password'],
    			'domain' => $FormData['domain'],
    			'email' => $FormData['email'],
    			'plan' => $FormData['plan']
    			]);
    			$response = $request->send();
    			$Data = $response->getData();
    			$Result = array(
    				'username' => $Data['result']['options']['vpusername'],
    				'message' => $Data['result']['statusmsg'],
    				'status' => $Data['result']['status'],
    				'domain' => str_replace('cpanel', strtolower($FormData['username']), API_CPANEL_URL),
    				'date' => date('m-j-Y'),
    				'time' => date('G-i-s'),
    				'timeanddate' => date('m-j-Y-G-i-s'),
    				'label' => $FormData['label']
    			);
    			if($Result['status']==0 && strlen($Result['message'])>1){
    				$_SESSION['message'] = '<div class="alert alert-danger" role="alert">
    										  <button class="close" data-dismiss="alert" type="button" aria-label="Close">
    										    <span aria-hidden="true">&times;</span>
    										  </button>
    										  '.$Result['message'].'
    										</div>';
    				header('location: ../newaccount.php');
    				exit;
    			}
    			elseif($Result['status']==1 && strlen($Result['message'])>1){
    				$sql = mysqli_query($connect,"INSERT INTO `hosting_account`(`account_username`, `account_password`, `account_domain`, `account_key`, `account_status`, `account_date`, `account_time`, `account_timeanddate`, `account_for`, `account_label`) VALUES ('".$Result['username']."','".$FormData['password']."','".$FormData['domain']."','".$Result['username']."','1','".$Result['date']."','".$Result['time']."','".$Result['timeanddate']."','".$ClientInfo['hosting_client_key']."','".$Result['label']."')");
    
    ...

     

     

    The fist error message is the one triggered:

    				else{
    					$_SESSION['message'] = '<div class="alert alert-danger" role="alert">
    											  <button class="close" data-dismiss="alert" type="button" aria-label="Close">
    											    <span aria-hidden="true">&times;</span>
    											  </button>
    											  Something went <b>wrong!</b>
    											</div>';
    					header('location: ../newaccount.php');
    					exit;
    				}

     

  2. I'm trying to customize a bit, but it is not working. What am I doing wrong?

     

    ORIGINAL CODE:

    DATABASE:

    CREATE TABLE `hosting_account` (
    
    `account_id` INT(11) PRIMARY KEY AUTO_INCREMENT NOT NULL,
    
    `account_username` VARCHAR(22) NOT NULL,
    
    `account_password` VARCHAR(16) NOT NULL,
    
    `account_domain` VARCHAR(70) NOT NULL,
    
    `account_key` VARCHAR(8) NOT NULL,
    
    `account_status` INT(1) NOT NULL,
    
    `account_date` VARCHAR(20) NOT NULL,
    
    `account_for` INT(6) NOT NULL)

    src/function/NewAccount.php

    ...
    	else{
    		$sql = mysqli_query($connect,"SELECT * FROM `hosting_account` WHERE `account_for`='".$ClientInfo['hosting_client_key']."'");
    		if(mysqli_num_rows($sql)<3){
    			$client = Client::create();
    			$request = $client->createAccount([
    			'username' => $FormData['username'],
    			'password' => $FormData['password'],
    			'domain' => $FormData['domain'],
    			'email' => $FormData['email'],
    			'plan' => $FormData['plan']
    			]);
    			$response = $request->send();
    			$Data = $response->getData();
    			$Result = array(
    				'username' => $Data['result']['options']['vpusername'],
    				'message' => $Data['result']['statusmsg'],
    				'status' => $Data['result']['status'],
    				'domain' => str_replace('cpanel', strtolower($FormData['username']), API_CPANEL_URL),
    				'date' => date('d-m-Y')
    			);
    			if($Result['status']==0 && strlen($Result['message'])>1){
    				$_SESSION['message'] = '<div class="alert alert-danger" role="alert">
    										  <button class="close" data-dismiss="alert" type="button" aria-label="Close">
    										    <span aria-hidden="true">&times;</span>
    										  </button>
    										  '.$Result['message'].'
    										</div>';
    				header('location: ../newaccount.php');
    				exit;
    			}
    			elseif($Result['status']==1 && strlen($Result['message'])>1){
    				$sql = mysqli_query($connect,"INSERT INTO `hosting_account`(`account_username`, `account_password`, `account_key`, `account_domain`, `account_status`, `account_date`, `account_for`) VALUES ('".$Result['username']."','".$FormData['password']."','".$FormData['username']."','".$Result['domain']."','1','".$Result['date']."','".$ClientInfo['hosting_client_key']."')");
                    
    ...

     

    NEW CODE:

    DATEBASE: (Adds some info described below)

    CREATE TABLE `hosting_account` (
      `account_id` int(11) NOT NULL,
      `account_username` varchar(22) NOT NULL,
      `account_password` varchar(16) NOT NULL,
      `account_domain` varchar(70) NOT NULL,
      `account_key` varchar(8) NOT NULL,
      `account_status` int(1) NOT NULL,
      `account_date` varchar(20) NOT NULL,
      `account_time` varchar(20) NOT NULL,
      `account_dateandtime` varchar(100) NOT NULL,
      `account_for` int(6) NOT NULL,
      `account_label` varchar(255) NOT NULL
    )

    src/template/NewAccount.php (Added around line 77, basically another text field to fill out when creating an account)

    					<div class="col-md-6">
    						<div class="mb-10 px-10">
    							<label class="form-label required">Account Name</label>
    							<input type="text" name="label" placeholder="Name this account!" class="form-control" required="true">
    						</div>
    					</div>

     

    src/function/NewAccount.php (Now collects timestamp as well, and what was entered into the new text field).

    ...
    
    	else{
    		$sql = mysqli_query($connect,"SELECT * FROM `hosting_account` WHERE `account_for`='".$ClientInfo['hosting_client_key']."'");
    		if(mysqli_num_rows($sql)<3){
    			$client = Client::create();
    			$request = $client->createAccount([
    			'username' => $FormData['username'],
    			'password' => $FormData['password'],
    			'domain' => $FormData['domain'],
    			'email' => $FormData['email'],
    			'plan' => $FormData['plan']
    			]);
    			$response = $request->send();
    			$Data = $response->getData();
    			$Result = array(
    				'username' => $Data['result']['options']['vpusername'],
    				'message' => $Data['result']['statusmsg'],
    				'status' => $Data['result']['status'],
    				'domain' => str_replace('cpanel', strtolower($FormData['username']), API_CPANEL_URL),
    				'date' => date('m-j-Y'),
    				'time' => date('G-i-s'),
    				'timeanddate' => date('m-j-Y-G-i-s'),
    				'label' => $FormData['label']
    			);
    			if($Result['status']==0 && strlen($Result['message'])>1){
    				$_SESSION['message'] = '<div class="alert alert-danger" role="alert">
    										  <button class="close" data-dismiss="alert" type="button" aria-label="Close">
    										    <span aria-hidden="true">&times;</span>
    										  </button>
    										  '.$Result['message'].'
    										</div>';
    				header('location: ../newaccount.php');
    				exit;
    			}
    			elseif($Result['status']==1 && strlen($Result['message'])>1){
    				$sql = mysqli_query($connect,"INSERT INTO `hosting_account`(`account_username`, `account_password`, `account_domain`, `account_key`, `account_status`, `account_date`, `account_time`, `account_timeanddate`, `account_for`, `account_label`) VALUES ('".$Result['username']."','".$FormData['password']."','".$FormData['domain']."','".$Result['username']."','1','".$Result['date']."','".$Result['time']."','".$Result['timeanddate']."','".$ClientInfo['hosting_client_key']."','".$FormData['label']."')");
    
    ...

    Thanks

  3. 20 hours ago, Santiago said:

    Now 5

    Its not allowed.

     

    ME: So I am not allowed to build a client area that allows people to create 5 accounts each?

     

    Support Operator:
    Hi there,

    Correct, It is not allowed to register more than 3 free hosting accounts

    Thank you and stay safe !

    Please let us know if there is anything we can do.


    Best Regards

×
×
  • Create New...