Updates and fixes

This commit is contained in:
2020-08-01 23:51:54 -04:00
parent 3265ed85fb
commit 0e732b5891
9 changed files with 117 additions and 1905 deletions
-22
View File
@@ -1,22 +0,0 @@
- 16:51:40.916 INFO [20137]: Some text...
- 16:51:40.916 INFO [20137]: Some text...
- 16:51:43.361 INFO [20137]: Some text...
- 16:51:43.361 INFO [20137]: Some text...
- 16:51:43.635 INFO [20137]: Some text...
- 16:51:43.635 INFO [20137]: Some text...
- 16:51:43.651 INFO [20137]: Some text...
- 16:51:43.651 INFO [20137]: Some text...
- 16:51:43.658 INFO [20137]: Some text...
- 16:51:43.658 INFO [20137]: Some text...
- 16:51:48.730 INFO [20552]: Some text...
- 16:51:48.730 INFO [20552]: Some text...
- 16:51:48.746 INFO [20552]: Some text...
- 16:51:48.746 INFO [20552]: Some text...
- 16:51:48.751 INFO [20552]: Some text...
- 16:51:48.751 INFO [20552]: Some text...
- 16:51:51.166 INFO [15540]: Some text...
- 16:51:51.166 INFO [15540]: Some text...
- 16:51:51.352 INFO [15540]: Some text...
- 16:51:51.352 INFO [15540]: Some text...
- 16:51:51.358 INFO [15540]: Some text...
- 16:51:51.358 INFO [15540]: Some text...
File diff suppressed because it is too large Load Diff
+101
View File
@@ -0,0 +1,101 @@
#include "common_tool.h"
#include "clog.h"
#include "cgi.h"
#include "input.h"
#include "wrenchboard_api.h"
//#include "interswitch_sendmoney.h"
#include "safestring.h"
#include "cfg.h"
#include <string>
#include "pgsql_wrapper.h"
#include "pgsql.h"
//char confirmation[20] = "";
//Confirmation(payment_id, confirmation, sizeof (confirmation));
void GenerateConfirmationSeed( char * number, int sz, int seed );
void GenerateConfirmation( char * number, int sz )
{
GenerateConfirmationSeed(number,sz,1);
}
void GenerateConfirmationSeed( char * number, int sz, int seed )
{
char chars[] = "WRB01234WRB56789WRB";
int n = sizeof(chars);
int i;
/*
time_t t;
time( &t );
pid_t pid = getpid();
srand(t+pid);
*/
srand((unsigned int)time((time_t *)NULL));
for ( i=0; i<10 && i<sz-1; i++ )
{
int k = seed%n;
if (seed>1 && k==i) {
number[i] = chars[n-k];
} else {
number[i] = chars[ (int) ( (n-1.0)*rand()/(RAND_MAX+1.0)) ];
}
}
number[i] = 0;
}
void Confirmation( unsigned long payment_id, char * number, int sz )
{
SQLINTEGER rows;
char confirmation[11];
// Lock table to prevent generation of two identical confirmation numbers
pgsql_exec("BEGIN; LOCK TABLE members_payments;" );
int i = 0;
do
{
GenerateConfirmationSeed( confirmation, sizeof(confirmation), i++ );
//st.CloseCursor();
rows = 0;
const PGresult *res = pgsql_query("SELECT id FROM members_payments WHERE confirmation='%s'", confirmation );
if (res!=NULL )
{
rows = pgsql_num_rows(res);
}
} while ( rows>0 && i<100 );
pgsql_exec("UPDATE members_payments SET confirmation='%s', dt_confirmed=now() WHERE id=%lu", confirmation, payment_id );
pgsql_exec("COMMIT" ); // Unlock table 'data'
strsafecpy( number, confirmation, sz );
}
void GetOfferCode( unsigned long offer_id, char * number, int sz )
{
SQLINTEGER rows;
char offer_code[14];
// Lock table to prevent generation of two identical confirmation numbers
pgsql_exec("BEGIN; LOCK TABLE members_jobs_offer;" );
int i = 0;
do
{
GenerateConfirmationSeed( offer_code, sizeof(offer_code), i++ );
//st.CloseCursor();
rows = 0;
const PGresult *res = pgsql_query("SELECT id FROM members_jobs_offer WHERE offer_code='%s'", offer_code );
if (res!=NULL )
{
rows = pgsql_num_rows(res);
}
} while ( rows>0 && i<100 );
pgsql_exec("UPDATE members_jobs_offer SET offer_code='%s' WHERE id=%lu", offer_code, offer_id );
pgsql_exec("COMMIT" ); // Unlock table 'data'
strsafecpy( number, offer_code, sz );
}
+1 -1
View File
@@ -1,4 +1,4 @@
<?
<?php
include('def.php');
$USER = $_SERVER['SCRIPT_FILENAME'];
+11 -2
View File
@@ -1,7 +1,7 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
function __autoload($classname) {
/* function __autoload($classname) {
if (strpos($classname, 'CL_') !== 0) {
$file = APPPATH . 'libraries/' . $classname . '.php';
@@ -9,7 +9,16 @@ function __autoload($classname) {
@include_once($file);
}
}
}
} */
spl_autoload_register(function($classname) {
if (strpos($classname, 'CL_') !== 0) {
$file = APPPATH . 'libraries/' . $classname . '.php';
if (file_exists($file) && is_file($file)) {
@include_once($file);
}
}
});
/*
|--------------------------------------------------------------------------
+1 -1
View File
@@ -465,7 +465,7 @@
<div class="container">
<div class="row">
<div class="col-sm-6">
<p>Copyright &copy; 2017 WrenchBoard. All rights reserved.</p>
<p>Copyright &copy; 2020 WrenchBoard. All rights reserved.</p>
</div>
<div class="col-sm-6 pull-right ">
<ul class="list-inline pull-right ">
+1 -1
View File
@@ -170,7 +170,7 @@
<div class="container clearfix">
<div class="col_half">
Copyrights &copy; 2018 All Rights Reserved by WrenchBoard.<br>
Copyrights &copy; 2020 All Rights Reserved by WrenchBoard.<br>
<div class="copyright-links"><a href="#">Terms of Use</a> / <a href="#">Privacy Policy</a></div>
</div>
@@ -13,7 +13,7 @@
<div class="navbar-collapse collapse" id="footer">
<div class="navbar-text">
&copy; 2018. <a href="/dash" class="navbar-link">WrenchBoard</a>
&copy; 2020. <a href="/dash" class="navbar-link">WrenchBoard</a>
</div>
<div class="navbar-right">
+1
View File
@@ -5,6 +5,7 @@ if (!array_key_exists('wrenchboard', $GLOBALS)) {
$USER = strtok($USER, '/');
if ($USER=='opt') $USER = 'root';
// Load API class
// $USER = 'root';
$wrenchboard_class = 'wrenchboard_api_' . $USER . '\\WrenchBoard';
$wrenchboard = new $wrenchboard_class();
}