示例#1
0
//this is an api to show job leaderboard
// +-----------------------------------+
// + STEP 1: include required files    +
// +-----------------------------------+
require_once "../php_include/db_connection.php";
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$flag = $_REQUEST['flag'] ? $_REQUEST['flag'] : 2;
//flag values  1- prev week leader board and 2- current week leader board
//fetching kids leader board details ordering by position(maximum completed jobs on top)
$data = DataClass::get_leaderboard($flag) ? DataClass::get_leaderboard($flag) : [];
if ($data) {
    $success = '1';
    $msg = "Kids Jobs Leaderboard Details";
} else {
    $success = '0';
    $msg = "No data found";
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == '1') {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
}
示例#2
0
// +-----------------------------------+
require_once "../php_include/db_connection.php";
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$uid = $_REQUEST['user_id'];
global $conn;
if (!$uid) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $data = DataClass::get_saved_jobs($uid) ? DataClass::get_saved_jobs($uid) : [];
    if ($data) {
        $success = '1';
        $msg = "User Saved Job Details";
    } else {
        $success = '0';
        $msg = "No data found for this user";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
示例#3
0
    $sth->bindValue('kid_id', $kid);
    $sth->bindValue('day', $day_name);
    try {
        $sth->execute();
    } catch (Exception $e) {
    }
    $res = $sth->fetchAll();
    $stat = $res[0]['is_completed'];
    $is_completed = $stat ? 0 : 1;
    //all jobs set as complete/incomplete by kid for that day(multiple jobs)
    $sql = "UPDATE `job_status` set is_completed=:status where kid_id=:kid_id and day=:day";
    $sth = $conn->prepare($sql);
    $sth->bindValue('kid_id', $kid);
    $sth->bindValue('day', $day_name);
    $sth->bindValue('status', $is_completed);
    try {
        $sth->execute();
        $success = '1';
        $msg = 'Jobs Completed';
        $data = DataClass::get_week_jobs($uid, $flag) ? DataClass::get_week_jobs($uid, $flag) : [];
    } catch (Exception $e) {
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == '1') {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
}
示例#4
0
            $sth->execute();
        } catch (Exception $e) {
        }
        $result = $sth->fetchAll();
        if (count($result)) {
            $sql = "update friends set status=1 where kid_id2=:kid and buddy_key=:code";
            $sth = $conn->prepare($sql);
            $sth->bindValue("kid", $kid);
            $sth->bindValue("code", $code);
            try {
                $sth->execute();
                $success = '1';
                $msg = "Status Updated";
            } catch (Exception $e) {
            }
            $data = DataClass::get_buddy_details($kid, $code) ? DataClass::get_buddy_details($kid, $code) : [];
        } else {
            $success = '0';
            $msg = "No Result Found";
        }
    } else {
        $success = '0';
        $msg = "Invalid User";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == '1') {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
示例#5
0
文件: test1.php 项目: Gameonn/JS_API
// + STEP 2: get data				   +
// +-----------------------------------+
global $conn;
$day = date('w');
$week_start = date('Y-m-d', strtotime('-' . $day . ' days +8 days'));
$week_end = date('Y-m-d', strtotime('+' . (13 - $day) . ' days'));
for ($date = strtotime($week_start); $date <= strtotime($week_end); $date = strtotime("+1 day", $date)) {
    echo date('Y-m-d', $date) . " ";
    echo date("l", $date) . " ";
}
if (!$uid) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $data = DataClass::get_jobs_data($uid) ? DataClass::get_jobs_data($uid) : [];
    //$data = DataClass::get_week_jobs($uid,6)? DataClass::get_week_jobs($uid,6):[];
    if ($data) {
        $success = '1';
        $msg = "User Job Details";
    } else {
        $success = '0';
        $msg = "No data found for this user";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
示例#6
0
             $sth->bindValue("my_id", $myid);
             try {
                 $sth->execute();
             } catch (Exception $e) {
             }
         } else {
             $sql = "update connect set status=1 where user_id2=:uid and user_id1=:my_id";
             $sth = $conn->prepare($sql);
             $sth->bindValue("uid", $uid);
             $sth->bindValue("my_id", $myid);
             try {
                 $sth->execute();
             } catch (Exception $e) {
             }
         }
         $data = DataClass::get_details($uid, $code);
         if ($data) {
             $success = '1';
             $msg = "Result Found";
         } else {
             $success = '0';
             $msg = "No Result Found";
         }
     } else {
         $success = '0';
         $msg = "No Result Found";
     }
 } else {
     $success = '0';
     $msg = "Invalid User";
 }
示例#7
0
 /**
  * Remove this item by deleting it
  * 
  * @param DataClass $item 
  * @todo Allow for amendment of this behaviour - for example, we can remove an item from
  * an "ActiveItems" DataList by chaning the status to inactive.
  */
 public function remove($item)
 {
     // By default, we remove an item from a DataList by deleting it.
     if ($item instanceof $this->dataClass) {
         $item->delete();
     }
 }
示例#8
0
// +-----------------------------------+
// + STEP 1: include required files    +
// +-----------------------------------+
require_once("../php_include/db_connection.php");
require_once("DataClass.php");
$success=$msg="0";$data=array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+


global $conn;


	$data = DataClass::get_rewards()? DataClass::get_rewards():[];
	
	
	if($data){
	$success='1';
	$msg="Rewards Details";
	}
	else{
	$success='0';
	$msg="No data found";
	}	

// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if($success=="1"){
示例#9
0
// + STEP 1: include required files    +
// +-----------------------------------+
require_once "../php_include/db_connection.php";
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$flag = $_REQUEST['flag'] ? $_REQUEST['flag'] : 2;
$job_parameter = $_REQUEST['job_parameter'] ? $_REQUEST['job_parameter'] : 1;
$country = $_REQUEST['country'] ? $_REQUEST['country'] : "";
////flag values 1-prev week  2- current week  3- next week 4-this month 5- this year 6-all time
//job_parameter 1-completed jobs 2-approved jobs 3-bonus approved jobs 4-badges won
//fetching kids leader board details ordering by position(maximum completed jobs on top)
$data = DataClass::get_leaderboard($flag, $job_parameter, $country) ? DataClass::get_leaderboard($flag, $job_parameter, $country) : [];
if ($data) {
    $success = '1';
    $msg = "Kids Jobs Leaderboard Details";
} else {
    $success = '0';
    $msg = "No data found";
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == '1') {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
}
示例#10
0
文件: test.php 项目: Gameonn/ganger
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $sql = "select * from users where verification_code=:token and is_deleted=0";
    $sth = $conn->prepare($sql);
    $sth->bindValue('token', $token);
    try {
        $sth->execute();
    } catch (Exception $e) {
        echo $e->getMessage();
    }
    $res = $sth->fetchAll();
    $uid = $res[0]['id'];
    if (count($res)) {
        $tnt = DataClass::get_friends($contacts, $uid);
        $data['profile'] = $tnt ? $tnt : [];
        if ($data) {
            $success = 1;
            $msg = "Profile Active";
        } else {
            $success = 0;
            $msg = "No Records Found";
        }
    } else {
        $success = 0;
        $msg = "Invalid User";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
示例#11
0
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$uid = $_REQUEST['user_id'];
$flag = $_REQUEST['flag'] ? $_REQUEST['flag'] : 2;
//1-prev 2- current 3- next
global $conn;
if (!$uid) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $data = DataClass::get_day_jobs($uid, $flag) ? DataClass::get_day_jobs($uid, $flag) : [];
    if ($data) {
        $success = '1';
        $msg = "User Job Details";
    } else {
        $success = '0';
        $msg = "No data found for this user";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
示例#12
0
文件: login.php 项目: Gameonn/JS_API
$success=$msg="0";$data=array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+

$email=$_REQUEST['email'];
$password=$_REQUEST['password'];
$apn_id=$_REQUEST['apn_id']?$_REQUEST['apn_id']:"";

if(!($email && $password && $email!='null')){
	$success="0";
	$msg="Incomplete Parameters";
	$data=array();
}
else{
	$data = DataClass::get_profile($email,$password)? DataClass::get_profile($email,$password):[];
	if($data){
	$success='1';
	$msg="Login Successful";
	/*if($apn_id)
	$sql="update users set apn_id=:apn_id where email=:email";
	$sth=$conn->prepare($sql);
	$sth->bindValue('email',$email);
	if($apn_id) $sth->bindValue('apn_id',$apn_id);
	
	try{$sth->execute();}
	catch(Exception $e){} */
	}
	else{
	$success='0';
	$msg="Invalid Email or Password";
示例#13
0
	$result=$sth->fetchAll();
	
	if(count($result)){
	$success='1';
	$msg="Connection Removed";
	$rnd_code= DataClass::generateRandomString(12);
	
	$sql="DELETE from connect where user_id2 IN (:uid2,:uid) and user_id1 IN (:uid,:uid2) and kid_id=:kid_id";
	$sth=$conn->prepare($sql);
	$sth->bindValue("uid",$uid);
	$sth->bindValue("uid2",$uid2);
	$sth->bindValue('kid_id',$kid);
	try{$sth->execute();}
	catch(Exception $e){}
	
	$data= DataClass::get_connect_data($uid)? DataClass::get_connect_data($uid):[];
		/*$sql="update grownup_alias set access=0 where user_id=:uid and kid_id IN (select connect.kid_id from connect where user_id2=:uid2 and user_id1=:uid UNION
			select connect.kid_id from connect where user_id2=:uid and user_id1=:uid2)";
		$sth=$conn->prepare($sql);
		$sth->bindValue("uid",$uid);
		$sth->bindValue("uid2",$uid2);
		try{$sth->execute();}
		catch(Exception $e){}*/
		//$data=DataClass::get_details($uid,$code);
		
		/*if($data){
		$success='1';
		$msg="Result Found";
		}
		else{
		$success='0';
示例#14
0
$kid_id = $_REQUEST['kid_id'];
if (!$kid_id) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $sql = "select * from kids where id=:id";
    $sth = $conn->prepare($sql);
    $sth->bindValue('id', $kid_id);
    try {
        $sth->execute();
    } catch (Exception $e) {
    }
    $res = $sth->fetchAll();
    if (count($res)) {
        $data = DataClass::get_connected_friends($user_id) ? DataClass::get_connected_friends($user_id) : [];
        if ($data) {
            $success = '1';
            $msg = 'Records Found';
        } else {
            $success = '0';
            $msg = "No Records Found";
        }
    } else {
        $success = '0';
        $msg = "Invalid User";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
示例#15
0
// +-----------------------------------+
require_once "../php_include/db_connection.php";
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$kid = $_REQUEST['kid_id'];
global $conn;
if (!$kid) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $data = DataClass::getBadge($kid) ? DataClass::getBadge($kid) : [];
    if ($data) {
        $success = '1';
        $msg = "Kid Badge Details";
    } else {
        $success = '0';
        $msg = "No data found for this kid";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
示例#16
0
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$kid_id = $_REQUEST['kid_id'];
$flag = $_REQUEST['flag'] ? $_REQUEST['flag'] : 2;
//1-prev 2- current 3- next
global $conn;
if (!$kid_id) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $data = DataClass::get_kids_week_jobs($kid_id, $flag) ? DataClass::get_kids_week_jobs($kid_id, $flag) : [];
    if ($data) {
        $success = '1';
        $msg = "Kids Job Details";
    } else {
        $success = '0';
        $msg = "No data found for this kid";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
示例#17
0
require_once "../php_include/db_connection.php";
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$uid = $_REQUEST['user_id'];
global $conn;
if (!$uid) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    //$bonus_count= DataClass::get_bonus_job_count($uid)? DataClass::get_bonus_job_count($uid):0;
    $data = DataClass::get_dashboard_data($uid) ? DataClass::get_dashboard_data($uid) : [];
    if ($data) {
        $success = '1';
        $msg = "User Dashboard Details";
    } else {
        $success = '0';
        $msg = "No data found for this user";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
示例#18
0
     foreach ($tnt1 as $r) {
         foreach ($contacts as $row) {
             $a = substr_compare($r['phone_number'], $row, -10, 10);
             if ($a == 0) {
                 $dict[] = $row;
             }
         }
     }
     //matched contacts b/w device and database
     if ($dict) {
         foreach ($dict as $key => $val) {
             $m = $val;
             $post_nums .= $m . ',';
         }
         $num = rtrim($post_nums, ', ');
         $tnt = DataClass::get_friends_photos($num, $uid, $zone, $user_date, $date);
         $data = $tnt ? $tnt : [];
         if ($data) {
             $success = 1;
             $msg = "Profile Active";
         } else {
             $success = 0;
             $msg = "No Records Found";
         }
     } else {
         $success = 0;
         $msg = "No Records Found";
     }
 } else {
     $success = 0;
     $msg = "Invalid User";
示例#19
0
require_once "../php_include/db_connection.php";
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$kid_id = $_REQUEST['kid_id'];
$flag = $_REQUEST['flag'] ? $_REQUEST['flag'] : 2;
global $conn;
if (!$kid_id) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $counts = DataClass::get_bonus_counts($kid_id, $flag) ? DataClass::get_bonus_counts($kid_id, $flag) : [];
    if ($counts) {
        $success = '1';
        $msg = "Kids Job Details";
    } else {
        $success = '0';
        $msg = "No data found for this kid";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "extra_counts" => $counts));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
示例#20
0
                $sth->bindValue('kid_id', $kid);
                $sth->bindValue('kid2', $value['kid_id']);
                $c = 0;
                try {
                    $c = $sth->execute();
                } catch (Exception $e) {
                }
            } else {
                $success = '0';
                $msg = 'Already sent';
            }
        }
        if ($c) {
            $success = '1';
            $msg = 'Buddy Code sent.';
            $msg1 = "Buddy Code for Jobstars";
            DataClass::sendEmail($email, $msg1, $code, SMTP_EMAIL);
        }
    } else {
        $success = '0';
        $msg = "Invalid email or no kid is linked with it";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
/*if($success=='1'){
echo json_encode(array("success"=>$success,"msg"=>$msg,"data"=>$data));
}
else*/
echo json_encode(array("success" => $success, "msg" => $msg));
示例#21
0
// + STEP 2: get data				   +
// +-----------------------------------+


$uid=$_REQUEST['user_id'];

if(!($uid)){
	$success="0";
	$msg="Incomplete Parameters";
	$data=array();
}
else{

	$path=BASE_PATH."uploads/";
	
	$kid=DataClass::getKidsList($uid);
	
		foreach($kid as $row){
		
		$num.=$row.',';
		}
		
		$kid_ids=rtrim($num,',');

	$sql="SELECT kids_wishlist.kid_id,reward.id as reward_id,reward.category_id,reward.title,reward.description,reward.price,reward.status,category.name as category_name, category.filepath as category_image,
	(SELECT group_concat(concat('$path',rewardimages.image) SEPARATOR ',') 	FROM rewardimages WHERE rewardimages.reward_id=reward.id ORDER BY defaultImage DESC) as reward_image, 
	(SELECT group_concat(tags.name SEPARATOR ',') 	FROM tags WHERE tags.reward_id=reward.id) as tag_name FROM kids_wishlist join `reward` on reward.id=kids_wishlist.reward_id
	join category on category.id=reward.category_id where kid_id IN ($kid_ids)";
	
	$sth=$conn->prepare($sql);
	//$sth->bindValue('kid_id',$kid);
示例#22
0
    $success = "0";
    $msg = "Incomplete Parameters";
} else {
    $sql = "select * from users where phone_number=:phone_number and is_deleted=0";
    $sth = $conn->prepare($sql);
    $sth->bindValue("phone_number", $phone);
    try {
        $sth->execute();
    } catch (Exception $e) {
        //echo $e->getMessage();
    }
    $res = $sth->fetchAll();
    if (count($res)) {
        $token = $res[0]['verification_code'];
        $success = "1";
        $msg = "An reset link sent to you";
        $path = UPLOAD_PATH . 'reset-password.php?token=' . $token;
        $body = "Reset your Password using {$path}";
        try {
            DataClass::sendSMS($phone, $body);
        } catch (Exception $e) {
        }
    } else {
        $success = "0";
        $msg = "The phone number seems invalid";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
echo json_encode(array("success" => $success, "msg" => $msg, 'path' => $path));
示例#23
0
文件: signup.php 项目: Gameonn/ganger
            $count = $sth->execute();
            $uid = $conn->lastInsertId();
            $success = 1;
            $msg = "User Successfully registered";
        } catch (Exception $e) {
        }
        /*if($image){
        	$sql="INSERT INTO `codebrew_gander`.`photos` (`id`, `user_id`, `image`, `date`, `auto_approved`, `created_on`) VALUES (DEFAULT, :user_id, :image,NOW(), 0, NOW())";
        	
        		$sth=$conn->prepare($sql);
        		$sth->bindValue("user_id",$uid);
        		$sth->bindValue("image",$image_path);
        		try{$sth->execute();}
        		catch(Exception $e){}
        	}*/
        $tnt = DataClass::get_profile($phone);
        $data['profile'] = $tnt ? $tnt : [];
        /*if($count){
        	try{
        	DataClass::sendSMS($phone,$body);
        	}
        	catch(Exception $e){}
        	}*/
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == 1) {
    echo json_encode(array("success" => $success, "msg" => $msg, "verification_code" => $v_code, "status" => $phn_status, "data" => $data));
} else {
示例#24
0
	else
	$msg="You failed to achieve this raffle. Try Again next week";
	}
	else{
	$sql="INSERT INTO kid_raffles VALUES(DEFAULT,:raffle_id,:kid_id,:kid_answer,:status,NOW())";
	$sth=$conn->prepare($sql);
	$sth->bindValue('kid_id',$kid);
	$sth->bindValue('raffle_id',$raffle_id);
	$sth->bindValue('kid_answer',$answer);
	$sth->bindValue('status',$status);
	try{$sth->execute();
	$success='1';
	$msg='Raffle Answered';
	
	if($status)
	DataClass::AddBadge($kid,'raffle');
	
	}
	catch(Exception $e){}
	}
	

}

// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+


/*if($success=='1'){
echo json_encode(array("success"=>$success,"msg"=>$msg,"data"=>$data));
示例#25
0
            $type = 2;
            if (!empty($apnid)) {
                try {
                    $apns->newMessage($apnid);
                    $apns->addMessageAlert($msg);
                    $apns->addMessageSound('x.wav');
                    $apns->addMessageCustom('u', $uid);
                    $apns->addMessageCustom('k', $kid_id);
                    $apns->addMessageCustom('t', $type);
                    $apns->queueMessage();
                    $apns->processQueue();
                } catch (Exception $e) {
                }
            }
            if ($week_parameter == 1) {
                $data = DataClass::get_week_jobs($uid, 2) ? DataClass::get_week_jobs($uid, 2) : [];
            } else {
                $data = DataClass::get_day_jobs($uid, 2) ? DataClass::get_day_jobs($uid, 2) : [];
            }
        } catch (Exception $e) {
        }
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == '1') {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
}
示例#26
0
//0-none, 1-monthly,2-yearly
$kid = $_REQUEST['kid_id'];
$uid = $_REQUEST['user_id'];
if (!($kid && $uid)) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $sql = "delete from `kids` where id=:id";
    $sth = $conn->prepare($sql);
    $sth->bindValue('id', $kid);
    try {
        $sth->execute();
        $success = '1';
        $msg = 'Kid Deleted';
        $data = DataClass::get_all_kids_user($uid) ? DataClass::get_all_kids_user($uid) : [];
    } catch (Exception $e) {
    }
    $sql = "delete from `jobs` where kid_id=:kid";
    $sth = $conn->prepare($sql);
    $sth->bindValue('kid', $kid);
    try {
        $sth->execute();
    } catch (Exception $e) {
    }
    $sql = "delete from `job_status` where kid_id=:kid";
    $sth = $conn->prepare($sql);
    $sth->bindValue('kid', $kid);
    try {
        $sth->execute();
    } catch (Exception $e) {
示例#27
0
require_once "../php_include/db_connection.php";
require_once "DataClass.php";
$success = $msg = "0";
$data = array();
// +-----------------------------------+
// + STEP 2: get data				   +
// +-----------------------------------+
$uid = $_REQUEST['user_id'];
global $conn;
if (!$uid) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    //$data = DataClass::get_jobs_data($uid)? DataClass::get_jobs_data($uid):[];
    $data = DataClass::get_week_jobs($uid, 6) ? DataClass::get_week_jobs($uid, 6) : [];
    if ($data) {
        $success = '1';
        $msg = "User Job Details";
    } else {
        $success = '0';
        $msg = "No data found for this user";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == "1") {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
示例#28
0
$kid_id = $_REQUEST['kid_id'];
if (!$kid_id) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $sql = "select * from kids where id=:id";
    $sth = $conn->prepare($sql);
    $sth->bindValue('id', $kid_id);
    try {
        $sth->execute();
    } catch (Exception $e) {
    }
    $res = $sth->fetchAll();
    if (count($res)) {
        $data = DataClass::get_buddy_list($kid_id) ? DataClass::get_buddy_list($kid_id) : [];
        if ($data) {
            $success = '1';
            $msg = 'Records Found';
        } else {
            $success = '0';
            $msg = "No Records Found";
        }
    } else {
        $success = '0';
        $msg = "Invalid Kid";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
示例#29
0
    $sth->bindValue('user_id', $uid);
    try {
        $sth->execute();
    } catch (Exception $e) {
    }
    $res = $sth->fetchAll();
    if (count($res)) {
        $success = '1';
        $msg = "Already Liked";
    } else {
        $sql = "INSERT into likes values(DEFAULT,:job_id,:user_id,1,'like',0,NOW())";
        $sth = $conn->prepare($sql);
        $sth->bindValue('user_id', $uid);
        $sth->bindValue('job_id', $job_id);
        try {
            $sth->execute();
            $success = '1';
            $msg = 'Liked Job';
            $data = DataClass::get_likes_by_jobid($job_id);
        } catch (Exception $e) {
        }
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+
if ($success == '1') {
    echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data));
} else {
    echo json_encode(array("success" => $success, "msg" => $msg));
}
示例#30
0
$user_id = $_REQUEST['user_id'];
if (!$user_id) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    $sql = "select * from users where id=:id and is_deleted=0";
    $sth = $conn->prepare($sql);
    $sth->bindValue('id', $user_id);
    try {
        $sth->execute();
    } catch (Exception $e) {
    }
    $res = $sth->fetchAll();
    if (count($res)) {
        $data = DataClass::get_buddy_list($user_id) ? DataClass::get_buddy_list($user_id) : [];
        if ($data) {
            $success = '1';
            $msg = 'Records Found';
        } else {
            $success = '0';
            $msg = "No Records Found";
        }
    } else {
        $success = '0';
        $msg = "Invalid User";
    }
}
// +-----------------------------------+
// + STEP 4: send json data			   +
// +-----------------------------------+