Jump to content
[MUST READ] Forum Rules ×

Free client area?


NHOST

Recommended Posts

Hi, 

 

I am starting a hosting company. I would like a client area, but I do not know how to code to that level. 

Are there any free solutions available? Even just templates? I know CSS so I can customise it myself, I just need the system to work. 

 

Are there any available? 

Link to comment
Share on other sites

On 8/8/2021 at 4:06 PM, NHOST said:

I haven't made it yet, I will start making it soon.  
I am going to try and use the Lets Encrypt system to somehow do it like @InfinityFree - if you could give your experience it would be great. 

I don't have much experience and I also tried to setup free ssl service but I couldn't get any api. Earlier freessl.space used to give api but they are not active anymore.

Edited by Pro Hostinga
Link to comment
Share on other sites

  • 5 months later...

I wouldn't recommend MOFHY, people have been saying that it's unsecure. I recommend coding your own client panel, it's actually pretty simple!

Make a folder named clients in your htdocs folder. Then make a file called login.php. Inside of it, paste this...

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<center>
    <h1>Log In to the Client Panel</h1>
    <form method="post" action="checkuser.php">
Username: <input name="uname" id="uname" type="text" class="inputbox" alt="username" minlength="7" required /><br>
Password: <input type="password" id="pass" name="pass" class="inputbox" alt="password" required /><br>
<input type="submit" value="Log In">
    </form>
    <p>Powered by <a href="https://ifastnet.com/">iFastNet</a>.</p>
    </center>

Make a new file named checkuser.php and make it this...

<?php
$username = $_POST['uname'];
$password = $_POST['pass'];
$conn = ftp_connect("ftpupload.net");
$result = ftp_login($conn, $username, $password);

if ((!$conn) || (!$result)) { 
    ftp_close($conn);
    echo '<h1>Login Failed!</h1><p>Your username or password is wrong or the FTP server is down. Contact your hosting provider if the error persists.</p>';
    die();
} else { 
    ftp_close($conn);
    setcookie("userAuth", base64_encode('{"user":"'.$username.'","pass":"'.$password.'"}'), time()+31536000,'/');
    header("p/home.php");
    die();
}
?>

Make a folder name p and makek a home.php file in it. I'm not gonna provide all of SmallHost's client panel source code because I want my client panel to stand out from other hosts, however you can pull a user's username and password like this. In this example, you can make a one-click login cPanel button.

<?php
if(!isset($_COOKIE['userAuth'])) {
    header("Location: ../login.php");
    die();
}else{
    $decodedB64 = base64_decode($_COOKIE['userAuth']);
    $decodedJson = json_decode($decodedB64);
    echo '<h1>Hello, '.$decodedJson->user.'!</h1>';
    //You can use $decodedJson->pass to get the user's password, however I strongly reccomend NOT echoing it as it will display it on the screen.
    //Let's try a one-click cPanel login button...
      echo '<form method="post">
    <input type="hidden" id="mod_login_username" name="uname" value="'.$decodedJson->user.'">
    <input type="hidden" id="mod_login_password" name="passwd" value="'.$decodedJson->pass.'">
    <input type="hidden" id="language" name="language" value="English">
    <input type="submit" value="cPanel" formaction="https://cpanel.YOUR_WEBHOST_DOMAIN/login.php" formtarget="_blank">
    </form>';

}
?>

 

Link to comment
Share on other sites

8 hours ago, smallhost said:

I wouldn't recommend MOFHY, people have been saying that it's unsecure. I recommend coding your own client panel, it's actually pretty simple!

Make a folder named clients in your htdocs folder. Then make a file called login.php. Inside of it, paste this...


<meta name="viewport" content="width=device-width, initial-scale=1.0">
<center>
    <h1>Log In to the Client Panel</h1>
    <form method="post" action="checkuser.php">
Username: <input name="uname" id="uname" type="text" class="inputbox" alt="username" minlength="7" required /><br>
Password: <input type="password" id="pass" name="pass" class="inputbox" alt="password" required /><br>
<input type="submit" value="Log In">
    </form>
    <p>Powered by <a href="https://ifastnet.com/">iFastNet</a>.</p>
    </center>

Make a new file named checkuser.php and make it this...


<?php
$username = $_POST['uname'];
$password = $_POST['pass'];
$conn = ftp_connect("ftpupload.net");
$result = ftp_login($conn, $username, $password);

if ((!$conn) || (!$result)) { 
    ftp_close($conn);
    echo '<h1>Login Failed!</h1><p>Your username or password is wrong or the FTP server is down. Contact your hosting provider if the error persists.</p>';
    die();
} else { 
    ftp_close($conn);
    setcookie("userAuth", base64_encode('{"user":"'.$username.'","pass":"'.$password.'"}'), time()+31536000,'/');
    header("p/home.php");
    die();
}
?>

Make a folder name p and makek a home.php file in it. I'm not gonna provide all of SmallHost's client panel source code because I want my client panel to stand out from other hosts, however you can pull a user's username and password like this. In this example, you can make a one-click login cPanel button.


<?php
if(!isset($_COOKIE['userAuth'])) {
    header("Location: ../login.php");
    die();
}else{
    $decodedB64 = base64_decode($_COOKIE['userAuth']);
    $decodedJson = json_decode($decodedB64);
    echo '<h1>Hello, '.$decodedJson->user.'!</h1>';
    //You can use $decodedJson->pass to get the user's password, however I strongly reccomend NOT echoing it as it will display it on the screen.
    //Let's try a one-click cPanel login button...
      echo '<form method="post">
    <input type="hidden" id="mod_login_username" name="uname" value="'.$decodedJson->user.'">
    <input type="hidden" id="mod_login_password" name="passwd" value="'.$decodedJson->pass.'">
    <input type="hidden" id="language" name="language" value="English">
    <input type="submit" value="cPanel" formaction="https://cpanel.YOUR_WEBHOST_DOMAIN/login.php" formtarget="_blank">
    </form>';

}
?>

 

Psst, this code itself is insecure! You need to have some degree of knowledge in PHP before attempting to make a client area on your own.

7 hours ago, TinkerMan said:

Actually, the biggest issues have now been fixed. 

And not to offend you, but MOFHY has way more features.

Yes, but there's still major problem left unfixed such as this one https://github.com/NXTS-Developers/MOFHY-Lite/issues/60 (at the time of writing this has been 7 days and this is easy fix as well....).

It is recommended to use MOFHY instead of making your own to save yourself from the hassle. Just be aware and check for issues often (and update as well). 

Link to comment
Share on other sites

On 1/28/2022 at 6:34 PM, BastelPichi2 said:

What is the most secure Way of PHP sessions actually? is The default $_SESSION good enough?

Yes, the default $_SESSION is good enough if you know what you're doing with it.

Do you let the user control the key of the session? This can be a flaw.
Do you trust the $_SESSION values (if value is controlled by user)? This can also be a flaw.

 

Link to comment
Share on other sites

  • 4 weeks later...

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...