Hello!
I am fairly new to development. I am attempting a basic call to create an email address. There are three parts that I need for the liveapi, as far as I understand. I have the index.php with the form, the formhandler.php to reach the last script, addmail.livephp that is in the theme directory.
I am getting a 500 error, and there are no useful error logs as far as I can find that let me know what is going wrong.
(yes I know that I am not using best practices for form input right now, I will be sanitizing and validating input after I can get it working)
Here is what I have:
Any guidance would be greatly appreciated!
I am fairly new to development. I am attempting a basic call to create an email address. There are three parts that I need for the liveapi, as far as I understand. I have the index.php with the form, the formhandler.php to reach the last script, addmail.livephp that is in the theme directory.
I am getting a 500 error, and there are no useful error logs as far as I can find that let me know what is going wrong.
(yes I know that I am not using best practices for form input right now, I will be sanitizing and validating input after I can get it working)
Here is what I have:
Code:
addmail.livephp
located at /usr/local/cpanel/base/frontent/paper_lantern
<?php
require_once "/usr/local/cpanel/php/cpanel.php";
$domain = 'example.com';
$username = $_POST['username'];
$password = $_POST['password'];
$cpanel = new CPANEL();
$get_userdata = $cpanel->uapi(
'Email',
'add_pop',
array(
'email' => $username,
'password' => $password,
'quota' => '0',
'domain' => $domain,
'skip_update_db' => '1',
)
);
?>
------------------------------------------------
index.php
located at public_html
<form action="formhandler.php" method="post">
username: <br>
<input type="text" name="username"> <br>
Password: <br>
<input type="text" name="password">
<input type="submit" value="Submit">
</form>
--------------------------------------------------
formhandler.php
located at public_html
<?php
include "../../../usr/local/cpanel/base/frontend/paper_lantern/addmail.livephp";