PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/donotdelte2024june28/pennwood.place/ajax/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/donotdelte2024june28/pennwood.place/ajax/subscribe.php

<?php
if (IS_LOGGED == false) {
    $data = array(
        'status' => 400,
        'error' => 'Not logged in'
    );
    echo json_encode($data);
    exit();
}
$data['status'] = 400;
if (!empty($_POST['user_id'])) {
    $id = PT_Secure($_POST['user_id']);
    $is_subscribed = $db->where('user_id', $id)->where('subscriber_id', $user->id)->getValue(T_SUBSCRIPTIONS, "count(*)");
    
    if ($is_subscribed > 0) {
        // if ($pt->config->payed_subscribers == 'on') {
        //     $check_if_payed = $db->where('user_id', $id)->where('paid_id', $user->id)->where('type','subscribe')->getValue(T_VIDEOS_TRSNS, 'count(*)');
        //     if ($check_if_payed > 0) {
        //         $db->where('user_id', $id)->where('paid_id', $user->id)->where('type','subscribe')->delete(T_VIDEOS_TRSNS);
        //     }
        // }
        $delete_sub = $db->where('user_id', $id)->where('subscriber_id', $user->id)->delete(T_SUBSCRIPTIONS);
        if ($delete_sub) {
            $data = array(
                'status' => 304
            );
        }

        $notif_data = array(
            'notifier_id' => $pt->user->id,
            'recipient_id' => $id,
            'type' => 'unsubscribed_u',
            'url' => ('@' . $pt->user->username),
            'time' => time()
        );

        pt_notify($notif_data);
    } 
    else {
        $pay_system = false;
        if ($pt->config->payed_subscribers == 'on') {
            $user_data = PT_UserData($id);
            if ($user_data->subscriber_price > 0) {
                $pay_system = true;
            }
        }

        if ($pay_system == false) {
            $insert_data         = array(
                'user_id' => $id,
                'subscriber_id' => $user->id,
                'time' => time(),
                'active' => 1
            );
            $create_subscription = $db->insert(T_SUBSCRIPTIONS, $insert_data);
            if ($create_subscription) {
                $data = array(
                    'status' => 200
                );

                $notif_data = array(
                    'notifier_id' => $pt->user->id,
                    'recipient_id' => $id,
                    'type' => 'subscribed_u',
                    'url' => ('@' . $pt->user->username),
                    'time' => time()
                );

                pt_notify($notif_data);
            }
        }
    }
}