Jump to content

Recommended Posts

  • Replies 260
  • Created
  • Last Reply

Top Posters In This Topic

12 hours ago, BabiHost said:

I used MOFH on MyOwnFreeHost hosting, but when the user registers my friend gives the same error. Not only in MOFH LITE but also in PROJECT-HUSTAL

You need to enable error inorder to get errors and then post error here so that we can help you. 

Link to post
Share on other sites
On 10/25/2021 at 2:53 PM, PrimeKoder said:

AFAIK, this can be solved by using MOFH API Callbacks. But I can't find any documentation regarding it except the following post:

So have a look if you can implement this in MOFHY!!

I already implemented it and will be uploaded soon. 

Link to post
Share on other sites
4 hours ago, TinkerMan said:

ALERT!

If incorrect CSR code in entered into the new SSL page, info that should remain secret is displayed. Try entering "fff" into the box and click "enter" to test it out yourself. 

Oh I see it is displaying error code

Link to post
Share on other sites

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

Edited by TinkerMan
Made more clear
Link to post
Share on other sites
6 hours ago, TinkerMan said:

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

Did you added post fields in FormData array? 

Edited by Shen Wei
Link to post
Share on other sites

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;
				}

 

Edited by TinkerMan
Link to post
Share on other sites
On 11/3/2021 at 6:40 PM, TinkerMan said:

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;
				}

 

Enable errors and then check what is wrong

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...