-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrnrstn_form_db_sql_testing.php
575 lines (394 loc) · 27.5 KB
/
crnrstn_form_db_sql_testing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<?php
/*
// J5
// Code is Poetry */
# CRNRSTN Suite :: An Open Source PHP Class Library to both facilitate, augment, and enhance basic operations of code base for an application across multiple hosting environments.
# Copyright (C) 2012-2021 eVifweb development
# VERSION :: 2.00.0000 on Sun May 31, 2020 at 1259
# RELEASE DATE (v1.0.0) :: July 4, 2018 - Happy Independence Day from my dog and I to you...wherever and whenever you are.
# AUTHOR :: Jonathan 'J5' Harris, Lead Full Stack Developer
# URI :: http://crnrstn.evifweb.com/
# # C # R # N # R # S # T # N # : : # # ##
#
// NOTE: THIS IS ALL OLD DEV AND TESTING CODE...SOME METHOD NAMES MAY HAVE CHANGED.
require('_crnrstn.root.inc.php');
include_once(CRNRSTN_ROOT . '/_crnrstn.config.inc.php');
$oCRNRSTN_USR->returnSrvrRespStatus(503);
exit();
$test = '';
$test_append = '';
$oQueryProfileMgr = new crnrstn_query_profile_manager($oCRNRSTN_USR);
//
// ENABLE THIS PAGE TO RECEIVE HTTP POST/GET DATA
if($oCRNRSTN_USR->receiveFormIntegrationPacket()){
if($oCRNRSTN_USR->isValid_dataValidationCheck('POST')){
//
// PREPARE RECEIVED INPUT PARAMETERS FOR DATABASE QUERY
$tmp_personal_preference = $oCRNRSTN_USR->returnHTTP_FormIntegration_InputVal('personal_preference');
$tmp_animal_type = $oCRNRSTN_USR->returnHTTP_FormIntegration_InputVal('animal_type');
$tmp_php_sessionid = $oCRNRSTN_USR->returnHTTP_FormIntegration_InputVal('php_sessionid');
//
// ACQUIRE NECESSARY DATABASE CONNECTION(S) AND SERIALIZE THEIR QUERIES...TO THEM, RESPECTIVELY.
$oCRNRSTN_MySQLi = $oCRNRSTN_USR->returnConnection_MySQLi();
$mysqli = $oCRNRSTN_MySQLi->returnConnObject();
$query1 = 'SELECT `colors_hex`.`COLOR_ID` AS `THA_BOSS_COLORID`,`colors_hex`.`COLOR_HEX`,`colors_hex`.`COLOR_NAME`,`colors_hex`.`CREATOR_IP`,`colors_hex`.`DATECREATED` FROM `colors_hex`;';
if(strlen($tmp_php_sessionid)==26){
$tmp_delete_session = true;
$query2 = 'SELECT `sessions`.`SESSIONID`, `sessions`.`USERID`, `sessions`.`REMOTE_ADDR_IPV4`, `sessions`.`REMOTE_ADDR_IPV6`, `sessions`.`ISACTIVE`, `sessions`.`DATEMODIFIED`,`sessions`.`DATECREATED` FROM `sessions` WHERE `sessions`.`SESSIONID`!="'.$mysqli->real_escape_string($tmp_php_sessionid).'" ORDER BY `sessions`.`DATEMODIFIED` DESC;';
$query3 = 'DELETE FROM `sessions` WHERE `sessions`.`SESSIONID`="'.$mysqli->real_escape_string($tmp_php_sessionid).'" LIMIT 1;';
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'SESSION_DATA_DELETE');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr, 'SESSION_DATA_DELETE', $query3);
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->updateTTL(3600);
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->returnTTL_wallTime();
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->expireQuery(ttl=-3000);
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->updateQuery();
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->getQueryStatus();
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->cacheQuery(); # SESSION
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->cacheQueryResults(); # SESSION
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->returnQuery();
#$oCRNRSTN_USR->oCRNRSTN_QueryMgr->returnConnection(type=mysqli);
}else{
$query2 = 'SELECT `sessions`.`SESSIONID`, `sessions`.`USERID`, `sessions`.`REMOTE_ADDR_IPV4`, `sessions`.`REMOTE_ADDR_IPV6`, `sessions`.`ISACTIVE`, `sessions`.`DATEMODIFIED`,`sessions`.`DATECREATED` FROM `sessions` ORDER BY `sessions`.`DATEMODIFIED` DESC;';
}
//
// addDatabaseQuery() WILL SERIALIZE THE QUERY TO THE CONNECTION PROVIDED. CRNRSTN :: SUPPORTS n+1 MYSQLI DATABASE CONNECTIONS.
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'COLOR_TYPES');
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'NEW_OR_KEEPALIVE_SESSION');
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'SESSION_DATA');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'COLOR_TYPES', $query1);
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'NEW_OR_KEEPALIVE_SESSION');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'SESSION_DATA', $query2);
//
// PROCESS ALL QUERY TO CONNECTION(S)
$oCRNRSTN_USR->processQuery(true);
$tmp_record_cnt_COLOR = $oCRNRSTN_USR->returnRecordCount($oQueryProfileMgr, 'COLOR_TYPES');
error_log('76 demo - result record count[COLOR_TYPES]='.$tmp_record_cnt_COLOR);
$tmp_record_cnt_SESSION = $oCRNRSTN_USR->returnRecordCount($oQueryProfileMgr, 'SESSION_DATA');
error_log('79 demo - result record count[SESSION_DATA]='.$tmp_record_cnt_SESSION);
$desired_color = 'White';
if($oCRNRSTN_USR->pingValueExistence($oQueryProfileMgr, 'COLOR_TYPES', 'COLOR_NAME', $desired_color)){
$test .= $desired_color.' is in the data set!<br>';
}else{
$test .= $desired_color.' is <strong>NOT</strong> in the data set!<br>';
}
if($oCRNRSTN_USR->pingValueExistence($oQueryProfileMgr, 'SESSION_DATA', 'SESSIONID', session_id())){
$test .= 'Your session is ACTIVE!<br>';
}else{
//if(strlen($tmp_php_sessionid)==26){
$test .= 'Your session has been <strong class="the_R">DESTROYED!</strong><br>';
//}
}
for($i=0; $i<$tmp_record_cnt_SESSION; $i++){
$tmp_SESSIONID = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'SESSION_DATA', 'SESSIONID', $i);
$tmp_DATEMODIFIED = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'SESSION_DATA', 'DATEMODIFIED', $i);
$tmp_DATECREATED = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'SESSION_DATA', 'DATECREATED', $i);
if($tmp_SESSIONID == session_id()){
$test .= '<span class="the_R" style="font-size:10px;">'.$tmp_SESSIONID.' '.$tmp_DATEMODIFIED.' '.$tmp_DATECREATED.'</span><br>';
}else{
$test .= '<span style="font-size:10px; color:#ccc;">'.$tmp_SESSIONID.' '.$tmp_DATEMODIFIED.' '.$tmp_DATECREATED.'</span><br>';
}
}
//
// RECEIVE AND PROCESS DATABASE RESULTS
// retrieveDataByID()
// keyDataByID()
// data_prep_flagUserAssociations()
// returnDatabaseValue()
// pingValueExistence()
// ping_profile_existence()
// $oDB_RESP->returnRecordCount($oDB_RESP->return_serial($tmp_serial_handle), 'USERS');
$test_append = '';
for($i=0;$i<$tmp_record_cnt_COLOR;$i++){
$tmp_name = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'COLOR_TYPES', 'COLOR_NAME', $i);
$test .= $tmp_name.'<br>';
if($tmp_name == $desired_color){
$oCRNRSTN_MySQLi = $oCRNRSTN_USR->returnConnection_MySQLi();
$mysqli = $oCRNRSTN_MySQLi->returnConnObject();
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI_TWO', '!jesus_is_my_dear_lord!!', 'COLOR_TYPES_NEW');
$query2 = 'SELECT `colors_hex`.`COLOR_ID`,`colors_hex`.`COLOR_HEX`,`colors_hex`.`COLOR_NAME`,`colors_hex`.`CREATOR_IP`,`colors_hex`.`DATECREATED` FROM `colors_hex` WHERE `colors_hex`.`COLOR_NAME`="'.$tmp_name.'" LIMIT 1;';
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'COLOR_TYPES_NEW', $query2);
//
// PROCESS ALL QUERY TO CONNECTION(S)
error_log('152 [POST] demo - process 2 round to database...');
$oCRNRSTN_USR->processQuery(true);
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI_TWO', '!jesus_is_my_dear_lord!!', 'COLOR_TYPES_NEW');
$tmp_loop_count2 = $oCRNRSTN_USR->returnRecordCount($oQueryProfileMgr,'COLOR_TYPES_NEW');
error_log('156 demo - twice fire (COLOR_TYPES_NEW LIMIT 1) result count = '.$tmp_loop_count2);
//
// TODO :: CONSIDER $oCRNRSTN_USR->connectionLock($oCRNRSTN_MySQLi) CONNECTION ARRAY
// TODO :: (CONTINUED) OR SOMETHING PASSED IN TO SPECIFY CONNECTION FOR DUP SERIAL USE-CASE
$tmp_desired_color_hex = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'COLOR_TYPES_NEW', 'COLOR_NAME');
$test_append = '<br>Desired Color Hex As In the System ::<br>= = =<br>'.$tmp_desired_color_hex.'<br>= = =<br>';
}
}
if($oCRNRSTN_USR->pingResultSetExistence($oQueryProfileMgr, 'COLOR_TYPES')){
$test .= '<br>COLOR_TYPES has been returned!<br>';
}else{
$test .= '<br>COLOR_TYPES has NOT been returned!<br>';
}
if($oCRNRSTN_USR->pingResultSetExistence($oQueryProfileMgr, 'COLOR_TYPES_NEW')){
$test .= '<br>COLOR_TYPES_NEW has been set!<br>';
}else{
$test .= '<br>COLOR_TYPES_NEW has NOT been returned!<br>';
}
}else{
if($oCRNRSTN_USR->isValid_dataValidationCheck('GET')){
$tmp_personal_preference = $oCRNRSTN_USR->returnHTTP_FormIntegration_InputVal('personal_preference');
$tmp_animal_type = $oCRNRSTN_USR->returnHTTP_FormIntegration_InputVal('animal_type');
$tmp_php_sessionid = $oCRNRSTN_USR->returnHTTP_FormIntegration_InputVal('php_sessionid');
//
// ACQUIRE NECESSARY DATABASE CONNECTION(S) AND SERIALIZE THEIR QUERIES...TO THEM, RESPECTIVELY.
$oCRNRSTN_MySQLi = $oCRNRSTN_USR->returnConnection_MySQLi();
$mysqli = $oCRNRSTN_MySQLi->returnConnObject();
$query1 = 'SELECT `colors_hex`.`COLOR_ID`,`colors_hex`.`COLOR_HEX`,`colors_hex`.`COLOR_NAME`,`colors_hex`.`CREATOR_IP`,`colors_hex`.`DATECREATED` FROM `colors_hex`;';
if(strlen($tmp_php_sessionid)==26){
$query2 = 'SELECT `sessions`.`SESSIONID`, `sessions`.`USERID`, `sessions`.`REMOTE_ADDR_IPV4`, `sessions`.`REMOTE_ADDR_IPV6`, `sessions`.`ISACTIVE`, `sessions`.`DATEMODIFIED`,`sessions`.`DATECREATED` FROM `sessions` WHERE `sessions`.`SESSIONID`!="'.$mysqli->real_escape_string($tmp_php_sessionid).'" ORDER BY `sessions`.`DATEMODIFIED` DESC;';
$query3 = 'DELETE FROM `sessions` WHERE `sessions`.`SESSIONID`="'.$mysqli->real_escape_string($tmp_php_sessionid).'" LIMIT 1;';
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'SESSION_DATA');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'SESSION_DATA', $query3);
$tmp_delete_session = true;
}else{
$query2 = 'SELECT `sessions`.`SESSIONID`, `sessions`.`USERID`, `sessions`.`REMOTE_ADDR_IPV4`, `sessions`.`REMOTE_ADDR_IPV6`, `sessions`.`ISACTIVE`, `sessions`.`DATEMODIFIED`,`sessions`.`DATECREATED` FROM `sessions` ORDER BY `sessions`.`DATEMODIFIED` DESC;';
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'NEW_OR_KEEPALIVE_SESSION');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'NEW_OR_KEEPALIVE_SESSION');
}
//
// addDatabaseQuery() WILL SERIALIZE THE QUERY TO THE CONNECTION PROVIDED. CRNRSTN :: SUPPORTS n+1 MYSQLI DATABASE CONNECTIONS.
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'COLOR_TYPES');
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'SESSION_DATA');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'COLOR_TYPES', $query1);
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'SESSION_DATA', $query2);
//
// PROCESS ALL QUERY TO CONNECTION(S)
$oCRNRSTN_USR->processQuery(true);
$desired_color = 'White';
if($oCRNRSTN_USR->pingValueExistence($oQueryProfileMgr, 'COLOR_TYPES', 'COLOR_NAME', $desired_color)){
$test .= $desired_color.' is in the data set!<br>';
}else{
$test .= $desired_color.' is <strong>NOT</strong> in the data set!<br>';
}
$tmp_loop_count = $oCRNRSTN_USR->returnRecordCount($oQueryProfileMgr,'SESSION_DATA');
if($tmp_loop_count>0){
if($oCRNRSTN_USR->pingValueExistence($oQueryProfileMgr, 'SESSION_DATA', 'SESSIONID', session_id())){
$test .= 'Your session is ACTIVE!<br>';
}else{
if(strlen($tmp_php_sessionid)==26){
//$test .= 'Your session has been <strong class="the_R">DESTROYED!</strong><br>';
}
}
}
for($i=0;$i<$tmp_loop_count;$i++){
$tmp_SESSIONID = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'SESSION_DATA', 'SESSIONID', $i);
$tmp_DATEMODIFIED = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'SESSION_DATA', 'DATEMODIFIED', $i);
$tmp_DATECREATED = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'SESSION_DATA', 'DATECREATED', $i);
if($tmp_SESSIONID==session_id()){
$test .= '<span class="the_R" style="font-size:10px;">'.$tmp_SESSIONID.' '.$tmp_DATEMODIFIED.' '.$tmp_DATECREATED.'</span><br>';
}else{
$test .= '<span style="font-size:10px; color:#ccc;">'.$tmp_SESSIONID.' '.$tmp_DATEMODIFIED.' '.$tmp_DATECREATED.'</span><br>';
}
}
$tmp_loop_count = $oCRNRSTN_USR->returnRecordCount($oQueryProfileMgr,'COLOR_TYPES');
$test_append = '';
for($i=0;$i<$tmp_loop_count;$i++){
$tmp_name = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'COLOR_TYPES', 'COLOR_NAME', $i);
$test .= $tmp_name.'<br>';
if($tmp_name == $desired_color){
$oCRNRSTN_MySQLi = $oCRNRSTN_USR->returnConnection_MySQLi();
error_log('266 demo - Add second query...');
$query2 = 'SELECT `colors_hex`.`COLOR_ID`,`colors_hex`.`COLOR_HEX`,`colors_hex`.`COLOR_NAME`,`colors_hex`.`CREATOR_IP`,`colors_hex`.`DATECREATED` FROM `colors_hex` WHERE `colors_hex`.`COLOR_NAME`="'.$mysqli->real_escape_string($tmp_name).'" LIMIT 1;';
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI_THREE', '!jesus_is_my_dear_lord!!', 'COLOR_TYPES_NEW');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'COLOR_TYPES_NEW', $query2);
//
// PROCESS ALL QUERY TO CONNECTION(S)
error_log('272 [GET] demo - process 2 round to database...');
$oCRNRSTN_USR->processQuery(true);
$tmp_loop_count2 = $oCRNRSTN_USR->returnRecordCount($oQueryProfileMgr,'COLOR_TYPES_NEW');
error_log('276 [GET] demo - returnRecordCount() fire (COLOR_TYPES_NEW LIMIT 1) result count = '.$tmp_loop_count2);
//
// TODO :: CONSIDER $oCRNRSTN_USR->connectionLock($oCRNRSTN_MySQLi) CONNECTION ARRAY
// TODO :: (CONTINUED) OR SOMETHING PASSED IN TO SPECIFY CONNECTION FOR DUP SERIAL USE-CASE
$tmp_desired_color_hex = $oCRNRSTN_USR->returnDatabaseValue($oQueryProfileMgr, 'COLOR_TYPES_NEW', 'COLOR_NAME');
$test_append = '<br>Desired Color Hex As In the System ::<br>= = =<br>'.$tmp_desired_color_hex.'<br>= = =<br>';
}
}
//
// FORM INPUT ERROR HANDLING. CAN MANUALLY HANDLE REDIRECTS HERE IF DESIRED.
$tmp_err_array = $oCRNRSTN_USR->returnErr_dataValidationCheck('POST');
foreach($tmp_err_array as $key=>$val){
$test .= $val.'<br>';
}
//
// FORM INPUT ERROR HANDLING. CAN MANUALLY HANDLE REDIRECTS HERE IF DESIRED.
$tmp_err_array = $oCRNRSTN_USR->returnErr_dataValidationCheck('GET');
foreach($tmp_err_array as $key=>$val){
$test .= $val.'<br>';
}
if($oCRNRSTN_USR->pingResultSetExistence($oQueryProfileMgr, 'COLOR_TYPES')){
$test .= '<br>COLOR_TYPES has been returned!<br>';
}else{
$test .= '<br>COLOR_TYPES has NOT been returned!<br>';
}
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI_THREE', '!jesus_is_my_dear_lord!!', 'COLOR_TYPES_NEW');
if($oCRNRSTN_USR->pingResultSetExistence($oQueryProfileMgr, 'COLOR_TYPES_NEW')){
$test .= '<br>COLOR_TYPES_NEW has been set!<br>';
}else{
$test .= '<br>COLOR_TYPES_NEW has NOT been returned!<br>';
}
}else{
//
// FORM INPUT ERROR HANDLING. CAN MANUALLY HANDLE REDIRECTS HERE IF DESIRED.
$tmp_err_array = $oCRNRSTN_USR->returnErr_dataValidationCheck('POST');
$test = '';
foreach($tmp_err_array as $key=>$val){
$test .= $val.'<br>';
}
//
// FORM INPUT ERROR HANDLING. CAN MANUALLY HANDLE REDIRECTS HERE IF DESIRED.
$tmp_err_array = $oCRNRSTN_USR->returnErr_dataValidationCheck('GET');
//$test = '';
foreach($tmp_err_array as $key=>$val){
$test .= $val.'<br>';
}
$test .= '<br>'.session_id().'<br>';
}
}
}else{
//
// ACQUIRE NECESSARY DATABASE CONNECTION(S) AND SERIALIZE THEIR QUERIES...TO THEM, RESPECTIVELY.
$oCRNRSTN_MySQLi = $oCRNRSTN_USR->returnConnection_MySQLi();
$mysqli = $oCRNRSTN_MySQLi->returnConnObject();
$query1 = 'SELECT `colors_hex`.`COLOR_ID` AS `THA_BOSS_COLORID`,`colors_hex`.`COLOR_HEX`, `colors_hex`.`COLOR_APPLICATION_KEY`,`colors_hex`.`COLOR_NAME`,`colors_hex`.`ISACTIVE`,`colors_hex`.`CREATOR_IP`,`colors_hex`.`DATECREATED` FROM `colors_hex`;';
$oQueryProfileMgr->loadQueryProfile($oCRNRSTN_MySQLi, 'DEMO_MYSQLI', '!jesus_is_my_dear_lord!', 'COLOR_TYPES');
$oCRNRSTN_USR->addDatabaseQuery($oQueryProfileMgr,'COLOR_TYPES', $query1);
//
// PROCESS ALL QUERY TO CONNECTION(S)
$oCRNRSTN_USR->processQuery(true);
$tmp_color_hex = $oCRNRSTN_USR->retrieveDataByID($oQueryProfileMgr,'COLOR_TYPES','COLOR_NAME|COLOR_HEX|COLOR_APPLICATION_KEY|ISACTIVE','Black|#172B16|BACKGROUND|1','THA_BOSS_COLORID');
$test .= '<br>Color Lookup By ID: <br>8GQLUBH4aedQ9l7c71DPb66U6t4QvCd2CqC23lpsAGqPSKjrVQYu12VbvYN5BWUbOaTS5R = <br>'.$tmp_color_hex.'<br>';
}
if($test==''){
$test .= '<br>'.session_id().'<br>';
}
$tmp_http_root = $oCRNRSTN_USR->get_resource("ROOT_PATH_CLIENT_HTTP").$oCRNRSTN_USR->get_resource("ROOT_PATH_CLIENT_HTTP_DIR");
//
// INITIALIZE CRNRSTN TO CATCH THE FORM(S) ON THIS PAGE. THEREFORE, NEED TO THROW SOME THINGS.
// ID THE FORM FOR ALL PARAMS TO BE ASSOCIATED.
# SHOULD BE A UNIQUE HANDLE TO THE FORM PROFILE. IT DETERMINES WHAT POTENTIAL POST/GET
# PARAMETERS FOR WHICH CRNRSTN SHOULD BE LISTENING.
# $oCRNRSTN_USR->initializeFormHandling({CRNRSTN_FORM_HANDLE}, {TRANSPORT_PROTOCOL});
$oCRNRSTN_USR->initFormHandling('crnrstn_form_db_demo');
$oCRNRSTN_USR->initFormHandling('crnrstn_form_db_demo_GET');
//
// THESE ARE THE INPUT FIELDS TO WHICH WE WILL LOOK
# THESE FIELDS ARE NOT HIDDEN. THEY WILL NOT/CANNOT BE
# ENCRYPTED INITIALLY.
# $oCRNRSTN_USR->addFormInputParamListener({CRNRSTN_FORM_HANDLE}, {HTML_DOM_FORM_INPUT_NAME}}, {IS_REQUIRED});
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo', 'username', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo', 'firstname', false);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo', 'lastname', false);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo', 'mobilenumber', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo', 'email', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo', 'zipcode', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo', 'php_sessionid', false);
# php_sessionid
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo_GET', 'animal_type', false);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo_GET', 'mineral_type', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo_GET', 'plant_type', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo_GET', 'automobile_type', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo_GET', 'aircraft_type', true);
$oCRNRSTN_USR->addFormInputParamListener('crnrstn_form_db_demo_GET', 'php_sessionid', false);
$err_uri = $tmp_http_root.'newfeatures/mysql_database/crnrstn_form_demo.php?submission=error';
$success_uri = $tmp_http_root.'newfeatures/mysql_database/crnrstn_form_demo.php?submission=success';
$oCRNRSTN_USR->addValidationRedirect('crnrstn_form_db_demo', '*', '*', $err_uri, $success_uri);
$oCRNRSTN_USR->addValidationRedirect('crnrstn_form_db_demo_GET', 'mineral_type|plant_type|automobile_type|aircraft_type', 'IS_REQUIRED', $err_uri.'&form=crnrstn_form_db_demo_GET', $success_uri.'&form=crnrstn_form_db_demo_GET');
$oCRNRSTN_USR->outputValidationErrMsg('crnrstn_form_db_demo','username', 'Username is a required field.');
//
// THESE FIELDS ARE HIDDEN INPUT FIELDS. WE CAN TUNNEL
// ENCRYPT THE DATA GOING HERE.
# $oCRNRSTN_USR->addHiddenFormInputParamListener({CRNRSTN_FORM_HANDLE}, {HTML_DOM_FORM_INPUT_NAME}, {HTML_DOM_FORM_INPUT_ID <-notrequired}, {IS_REQUIRED}, {DEFAULT_VALUE <-notrequired});
$oCRNRSTN_USR->addHiddenFormInputParamListener('crnrstn_form_db_demo', 'account_number', 'account_number', true, '1234567890');
$oCRNRSTN_USR->addHiddenFormInputParamListener('crnrstn_form_db_demo', 'account_balance', 'account_balance', false, '100000.01');
$oCRNRSTN_USR->addHiddenFormInputParamListener('crnrstn_form_db_demo', 'personal_preference', 'personal_preference', true, 'pink panties');
$oCRNRSTN_USR->addHiddenFormInputParamListener('crnrstn_form_db_demo_GET', 'account_number', 'account_number', true, '1234567890');
$oCRNRSTN_USR->addHiddenFormInputParamListener('crnrstn_form_db_demo_GET', 'account_balance', 'account_balance', false, '100000.01');
$oCRNRSTN_USR->addHiddenFormInputParamListener('crnrstn_form_db_demo_GET', 'personal_preference', 'personal_preference', true, 'pink panties');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CRNRSTN Suite :: MySQL/Form Integration</title>
<?php
include_once($oCRNRSTN_USR->get_resource("DOCUMENT_ROOT").$oCRNRSTN_USR->get_resource("DOCUMENT_ROOT_DIR").'/common/inc/head/head.inc.php');
?>
</head>
<body>
<div style="padding:20px;">
<div class="body_content_title">C<span class="the_R">R</span>NRSTN Suite :: Form Integration Test #1 [$_POST] <span class="content_results_subtitle"> <a href="<?php echo $tmp_http_root; ?>newfeatures/mysql_database/crnrstn_form_demo.php" target="_self">home</a></span><span class="content_results_subtitle"> <a href="<?php echo $tmp_http_root; ?>crnrstn_config_debug.php" target="_self">clear session</a></span></div>
<form action="#" method="post" name="crnrstn_db_demo" id="crnrstn_db_demo" enctype="multipart/form-data">
<div class="crnrstn_example_title">username</div>
<label><input type="text" name="username" value="soundboy420"></label>
<div><?php echo $oCRNRSTN_USR->outputValidationErrMsg('crnrstn_form_db_demo','username', 'Username is a required field.'); ?></div>
<div class="cb_5"></div>
<div class="crnrstn_example_title">firstname</div>
<label><input type="text" name="firstname" value="<?php echo $oCRNRSTN_USR->formPrepopulateInputValue('crnrstn_form_db_demo','firstname', false, 'enter first name'); ?>"></label>
<div class="cb_5"></div>
<div class="crnrstn_example_title">lastname</div>
<label><input type="text" name="lastname" value="<?php echo $oCRNRSTN_USR->formPrepopulateInputValue('crnrstn_form_db_demo','lastname',true, 'enter last name'); ?>"></label>
<div class="cb_5"></div>
<div class="crnrstn_example_title">mobilenumber</div>
<label><input type="text" name="mobilenumber" value="<?php echo $oCRNRSTN_USR->formPrepopulateInputValue('crnrstn_form_db_demo','mobilenumber'); ?>"></label>
<div><?php echo $oCRNRSTN_USR->outputValidationErrMsg('crnrstn_form_db_demo','mobilenumber', 'Mobile number is a required field.'); ?></div>
<div class="cb_5"></div>
<div class="crnrstn_example_title">email</div>
<label><input type="text" name="email" value="<?php echo $oCRNRSTN_USR->formPrepopulateInputValue('crnrstn_form_db_demo','email'); ?>"></label>
<div><?php echo $oCRNRSTN_USR->outputValidationErrMsg('crnrstn_form_db_demo','email', 'Email is a required field.'); ?></div>
<div class="cb_5"></div>
<div class="crnrstn_example_title">zipcode</div>
<label><input type="text" name="zipcode" value="<?php echo $oCRNRSTN_USR->formPrepopulateInputValue('crnrstn_form_db_demo','zipcode'); ?>"></label>
<div><?php echo $oCRNRSTN_USR->outputValidationErrMsg('crnrstn_form_db_demo','zipcode', 'Zipcode is a required field.'); ?></div>
<div class="cb_5"></div>
<div class="crnrstn_example_title">SESSION ID (FOR DELETE)</div>
<label><input type="text" name="php_sessionid" value=""></label>
<div class="cb_20"></div>
<button type="submit">SUBMIT</button>
<?php
echo $oCRNRSTN_USR->injectInputSerialization('crnrstn_form_db_demo');
?>
</form>
<div style="width:100%; height:35px;"> </div>
<div class="body_content_title">C<span class="the_R">R</span>NRSTN Suite :: Form Integration Test #2 [$_GET] <span class="content_results_subtitle"> <a href="<?php echo $tmp_http_root; ?>newfeatures/mysql_database/crnrstn_form_demo.php" target="_self">home</a></span><span class="content_results_subtitle"> <a href="<?php echo $tmp_http_root; ?>crnrstn_config_debug.php" target="_self">clear session</a></span></div>
<form action="#" method="get" name="crnrstn_db_demo" id="crnrstn_db_demo" enctype="multipart/form-data">
<div class="crnrstn_example_title">animalType</div>
<label><input type="text" name="animal_type" value="Wolf"></label>
<div class="cb_5"></div>
<div class="crnrstn_example_title">mineralType</div>
<label><input type="text" name="mineral_type" value="Jasper"></label>
<div class="cb_5"></div>
<div class="crnrstn_example_title">plantType</div>
<label><input type="text" name="plant_type" value="Cannabis"></label>
<div class="cb_5"></div>
<div class="crnrstn_example_title">automobileType</div>
<label><input type="text" name="automobile_type" value="Porsche 911 Turbo S"></label>
<div class="cb_5"></div>
<div class="crnrstn_example_title">aircraftType</div>
<label><input type="text" name="aircraft_type" value="A-10 Warthog Thunderbolt"></label>
<div class="cb_5"></div>
<div class="crnrstn_example_title">SESSION ID (FOR DELETE)</div>
<label><input type="text" name="php_sessionid" value=""></label>
<div class="cb_20"></div>
<button type="submit">SUBMIT</button>
<?php
echo $oCRNRSTN_USR->injectInputSerialization('crnrstn_form_db_demo_GET');
?>
</form>
<div class="cb_10"></div>
<?php
if(isset($test)){
echo '<div class="crnrstn_code_output_wrapper">
<div class="crnrstn_code_output_copy">'.$test.$test_append.'</div></div>';
}
?>
</div>
</body>
</html>