Skip to content

Instantly share code, notes, and snippets.

View ronniengoda's full-sized avatar
🤓
Talk is cheap show me the CODE

Ronald Ngoda ronniengoda

🤓
Talk is cheap show me the CODE
View GitHub Profile
@ronniengoda
ronniengoda / simple-json-reponse.php
Created July 1, 2019 13:16 — forked from james2doyle/simple-json-reponse.php
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($message = null, $code = 200)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");
@ronniengoda
ronniengoda / global-search.php
Created October 1, 2022 12:34 — forked from bigprof/global-search.php
Basic script to perform global search on all tables of an AppGini application.
<?php
/**
* Basic script to perform global search on all tables of an AppGini application.
* Create a new file inside the hooks folder and name it 'global-search.php' then copy this code to it.
* Related post: https://forums.appgini.com/phpbb/viewtopic.php?f=2&t=1689&p=4510
*/
/* Assuming this custom file is placed inside 'hooks' */
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
@ronniengoda
ronniengoda / pagecodeeditor.php
Last active February 21, 2023 07:48
AdminLTE Plugin For Appgini Code Snippet: Page Code Editor
<!-- Write your custom page content in here, it could be anything and everything, you can also use AppginiLTE widget functions here-->
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Edit Page Code</h3>
</div>
<div class="card-body">
<!-- code mirror styles -->
<!-- CODE MIRROR BELOW -->
@ronniengoda
ronniengoda / translatortool.php
Last active March 5, 2023 06:36
Translation Tool For AdminLTE Plugin For Appgini-V2
<!-- Write your custom page content in here, it could be anything and everything, you can also use AppginiLTE widget functions here-->
<style>
#submitbtn {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
}
.sticky {
@ronniengoda
ronniengoda / encdec.php
Last active November 18, 2023 02:23
Bulk Data Encryption,Decryption Tool For AdminLTE Plugin For Appgini
<!-- Write your custom page content in here, it could be anything and everything, you can also use AppginiLTE widget functions here-->
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Bulk Encrypt Or Decrypt Data Tool</h3>
</div>
<div class="card-body">
<?php
$action = $_REQUEST['action'] ? $_REQUEST['action'] : '';
@ronniengoda
ronniengoda / customloginmethods.php
Last active November 23, 2023 21:51
Custom Login Methods Creator Tool For AdminLTE plugin for Appgini
<!-- Write your custom page content in here, it could be anything and everything, you can also use AppginiLTE widget functions here-->
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Setup Custom Login Methds</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-4">
@ronniengoda
ronniengoda / jsondatabase.php
Last active March 14, 2023 09:12
JSON DB TOOL
<!-- Write your custom page content in here, it could be anything and everything, you can also use AppginiLTE widget functions here-->
<div class="row">
<div class="col-md-12">
<div class="card card-primary">
<div class="card-header">
<h3 class="card-title">App JSON Database (Read Only)</h3>
</div>
<div class="card-body">
<table class="table table-hover">
<tbody>
@ronniengoda
ronniengoda / chatgpt.php
Last active March 14, 2023 09:29
Chat GPT Tool
<!-- Write your custom page content in here, it could be anything and everything, you can also use AppginiLTE widget functions here-->
<?php
$processing_page_id = ""; //Provide the page ID of the processor script;
?>
<div class="row">
<div class="col-md-12">
<div class="card card-primary direct-chat direct-chat-primary">
<div class="card-header">
<style> .spinit { animation: spin 1s infinite linear; } @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } </style>
<h3 class="card-title">ChatGPT Tool</h3>
@ronniengoda
ronniengoda / processchat.php
Last active March 14, 2023 09:17
CHAT GPT PROCESSOR SCRIPT
<?php
if (isset($_POST['content'])) {
//DEFINE YOUR OPEN AI CHAT API PARAMETERS HERE. API reerence: https://platform.openai.com/docs/api-reference/chat/create
$max_tokens = 4000; //The maximum number of tokens allowed for the generated answer. By default, the number of tokens the model can return will be (4096 - prompt tokens).
$n = 1; //How many chat completion choices to generate for each input message.
$temperature = 1.0; //What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.We generally recommend altering this or top_p but not both.
$model = "gpt-3.5-turbo-0301"; //ID of the model to use. Currently, only gpt-3.5-turbo and gpt-3.5-turbo-0301 are supported.
$frequency_penalty = 0; //Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
$
@ronniengoda
ronniengoda / newversionuploader.php
Last active March 14, 2023 18:33
New Version Uploader Tool
<!-- Write your custom page content in here, it could be anything and everything, you can also use AppginiLTE widget functions here-->
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">New Version Uploader Tool</h3>
</div>
<div class="card-body">
<?php $post_max_size = ini_get('post_max_size'); $upload_max_filesize = ini_get('upload_max_filesize'); echo showAlert('info','Upload File Size','Ensure your php ini configurations for: <b>post_max_size</b> is set to <b>100M</b> atleast and <b>upload_max_filesize</b> is set to <b>100M</b> at least for this tool to work.<br> Your current configuration is: <br>post_max_size: ' . $post_max_size . '<br>upload_max_filesize: ' . $upload_max_filesize . ''); ?>
<form action="" method="POST" enctype="multipart/form-data">