403Webshell
Server IP : 138.197.176.125  /  Your IP : 216.73.216.41
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.3.19
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/crm_easylife/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/crm_easylife//api/register_contact.php
<?php

        // is POST a request ?
        if ($_POST) {

                // get POST data from API request
                $vt_usr = $_SERVER['PHP_AUTH_USER'];
                $vt_pw = $_SERVER['PHP_AUTH_PW'];
                $vt_usr_key = $_POST['vt_usr_key'];
                $firstname = $_POST['firstname'];
                $lastname = $_POST['lastname'];
                $primary_email= $_POST['primary_email'];
		$usr_name = $_POST['usr_name'];
		$passwd = $_POST['passwd'];
		$link_ann = $_POST['link_ann'];

            // initialize variables
            $validated = true;

            $message = array();


                // Contact details to be inserted
                $params = array(
                'firstname' => $firstname, 
                'lastname' => $lastname, 
                'assigned_user_id' => 'administrator',
                'email' => $primary_email,
		'cf_875' => $usr_name,
		'cf_877' => $passwd,
		'cf_925' => $link_ann,
                );

                // validate POST data
            if ( empty($vt_usr) || empty($vt_pw) || empty($vt_usr_key) ) {
                $validated = false;
                array_push($message, "Authentication failed");
            } 

            // is POST data validated ?
            if ( $validated ) {

                        // Obtain CRM Token
                        //$serveraddress = 'http://crm.help360.it'; 
                        $serveraddress = 'https://localhost'; 
                        $crm_username = $vt_usr;
                        $crm_userpassword = $vt_pw;
                        $crm_useraccesskey = $vt_usr_key;

                        $token_url = $serveraddress."/webservice.php?operation=getchallenge&username=".$crm_username;
                        $token_data = json_decode(file_get_contents($token_url));

                        if ($token_data->success != 1) die('Access denied');

                        $crm_token = $token_data->result->token;

                        // Attempt Login
                        $service_url = $serveraddress."/webservice.php";
                        $curl = curl_init($service_url);
                        $curl_post_data = array(
                                'operation' => 'login',
                                'username' => $crm_username,
                                'accessKey' => md5($crm_token.$crm_useraccesskey),
                        );

                        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($curl, CURLOPT_POST, true);
                        curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data);

                        $curl_response = json_decode(curl_exec($curl));

                        if ($curl_response->success != 1) die('Invalid user credentials');

                        $crm_session = $curl_response->result->sessionName;

                        // Create Contact through API POST request
                        $curl1 = curl_init($service_url);

                        $objectJson = json_encode($params);
                        $moduleName = 'Contacts';
                        $curl_post_data1 = array(
                                'sessionName' => $crm_session,
                                'operation' => 'create',
                                'element' => $objectJson,
                                'elementType' => $moduleName,
                        );

                        curl_setopt($curl1, CURLOPT_RETURNTRANSFER, true);
                        curl_setopt($curl1, CURLOPT_POST, true);
                        curl_setopt($curl1, CURLOPT_POSTFIELDS, $curl_post_data1);

                        $curl_response1 = json_decode(curl_exec($curl1));
//curl_exec($curl1);
if (curl_errno($curl1)) {
    $error_msg = curl_error($curl1);
    echo 'Errore' .$error_msg;
}
curl_close($curl1); 


                        array_push($message, "Success");
            }

            // response to display
                $response = array(
                        'status' => 200,
                        'response' => $curl_response1
                );

                echo json_encode($response);
        } else {
echo "GET method";
}
?> 

Youez - 2016 - github.com/yon3zu
LinuXploit