Jump to content

Recommended Posts

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

 

Sql query is not working

Link to post
Share on other sites
  • Replies 317
  • Created
  • Last Reply

Top Posters In This Topic

That does not change anything unfortunately. 

PHP errors are "ON" in the control panel, and my .htaccess file (In the /htdocs folder, there are no other .htaccess files on the site) is below.

 

php_flag display_errors on

php_value display_errors On
php_value mbstring.http_input auto
php_value date.timezone America/Chicago

 

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

That does not change anything unfortunately. 

PHP errors are "ON" in the control panel, and my .htaccess file (In the /htdocs folder, there are no other .htaccess files on the site) is below.

 


php_flag display_errors on

php_value display_errors On
php_value mbstring.http_input auto
php_value date.timezone America/Chicago

 

Give me your account information let me check it by myself

Link to post
Share on other sites

It is fairly easy to implement, so if you could create a pull request and make the changes that would be awesome. I don’t know when @Shen Wei is available, but I might be able to do this by the end of next week.

 

To Do

  • Add GitHub login/signup as SSO option
  • Display suspension reason in Client Area
  • Add Google ReCapcha functionality 
Link to post
Share on other sites
2 hours ago, TinkerMan said:

A Pull request has been opened on the GitHub Page

https://github.com/mahtab2003/MOFHY-Lite/pull/25

 

To Do

  • Add GitHub login/signup as SSO option
  • Display suspension reason in Client Area

       DONE! Add Google ReCapcha functionality 

Sorry but I can't directly commit it in main build. You can have your own separate build for this.

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...