Skip to content

Instantly share code, notes, and snippets.

View InspectorGadget's full-sized avatar
☁️

RTG™ InspectorGadget

☁️
  • Kuala Lumpur, Malaysia
View GitHub Profile
@InspectorGadget
InspectorGadget / json.php
Last active May 27, 2017 03:27
A vote API
<?php
$uid = $_GET['uid'];
$int = '0'; // default int
$conn = mysqli_connect('localhost', 'root', 'admin', 'vote');
$sql = "SELECT uid FROM list WHERE uid = '$uid'";
$result = mysqli_query($conn, $sql);
$check = mysqli_num_rows($result);
@InspectorGadget
InspectorGadget / lib.php
Last active August 6, 2017 14:02
Docker
<?php
/**
* Created by PhpStorm.
* User: RTG
* Date: 6/8/2017
* Time: 9:23 PM
*/
function getStatus($value): string {
#!/usr/bin/env python
import requests
import json
import datetime
import csv
import time
import sys
@InspectorGadget
InspectorGadget / File.txt
Last active October 25, 2018 06:36
AR Pintar
SQL Configuration
- Admin Database: 'admin_data'
- Student Database: 'students_data'
SQL DB: 'admin_data'
- Parameters:
- Username, Password, Status(Coordinator, Admin, Finance)
- ```"CREATE TABLE `admin_data` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
public function onRegister(string $username, string $password, $email, $status = "0", $createdBy = "register"): bool { // createdOn and createdIP Internal
$createdOn = date("Y/m/d");
$createdIP = "0.0.0.0";
$stmt = $this->returnSQLConnection()->prepare("INSERT INTO `users` (`username`, `password`, `email`, `status`, `createdOn`, `createdBy`, `createdIP`) VALUES (?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("sssssss", $username, $password, $email, $status, $createdOn, $createdBy, $createdIP);
$result = $stmt->execute();
var_dump($result);
@InspectorGadget
InspectorGadget / file.php
Last active December 10, 2018 05:38
PHP
<?php
public function setFinance($month, $year, $param, $money) {
if ($this->checkFinance($month, $year) !== false) { // UPDATE
switch (strtolower($param)) {
case "inbound":
$previousInbound = $this->returnPrevInbound($month, $year);
$newInbound = $previousInbound + $money;
$run = $this->updateDatabase($month, $year, "inbound", $newInbound);
if ($run === true) {
return true;
<?php
// Information at below: I've explained
// Inside Website:
<?php
error_reporting(1);
require 'includes/Handler.php';
$api = new Handler();
@InspectorGadget
InspectorGadget / file.php
Created January 4, 2019 13:13
Help me here
<?php
$line = explode(", ", $api->returnCourseHandler()->returnPreviousCompletedCourse($username));
// The response I get from this array if I print_r is "Array ( [0] => C1 [1] => C2 )"
if (in_array("C1", $line)) {
echo "
<div class='col-md-4'>
<div class='card'>
<div class='card-header'>
@InspectorGadget
InspectorGadget / payout.php
Last active January 6, 2019 13:33
A Small Help for IG
// What I want to do
// Some teachers will have a lot of Levels, like S4, S5, S6
// Each Level has its own rate per hour
// I want to know how i can filter each level?
<?php
switch ($_GET['parameter']) {
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('max_execution_time', 300); //300 seconds = 5 minutes. In case if your CURL is slow and is loading too much (Can be IPv6 problem)
error_reporting(E_ALL);
define('OAUTH2_CLIENT_ID', '1234567890');
define('OAUTH2_CLIENT_SECRET', 'verysecretclientcode');