I just thought I'd update everyone on my progress. I had a spare few hours the other week and resolved this issue, in the end the solution was pretty straightforward.
Some back ground, why did I want to do this in the first place? Well on my website justflockto.com i wanted to allow users to upload pictures that were taken at a particular hotel, restaurant, attraction or even a town or city. All these entities are held in a separate database. So a user clicks on the upload.php link can either use the simple of many method to upload pictures, during the upload process the CPG would then update a separate database table with these passed in variables.
I first tried to pass in the variables in the upload.php form. The method works for the simple single upload method but not the bulk way. You can then change the db_input.php scripts to read these variables etc and update the database. As I said passing the data via the form for the flash method doesn't work.
I then got thinking of how practical passing multiple values between forms was, especially is a user were to click on the upload link from a hotel then from the upload page create new album or navigate away etc and then return to the upload page by some means. I suspect that the passed in variables would be lost and I don't want to change the CPG code all over the place.
So I decided to use PHP sessions. This method works for both upload methods

Basically I did the following.
added the following to the beginning of upload.php and db_input.php
if (isset($_REQUEST['appsessionid'])){
session_id($_REQUEST['appsessionid']);
}
session_start();
Added the following after the functions in upload.php
//################################# MAIN CODE BLOCK ##################################################
if (!isset($_REQUEST['appsessionid'])){
//
// Code to get JustFlockTo Functions
$appuservar = array();
// Check whether we are getting JF2Country-Id through _GET or _POST
if ($superCage->get->keyExists('appuservar0')) {
$appuservar[0] = $superCage->get->getInt('appuservar0');
} elseif ($superCage->post->keyExists('appuservar0')) {
$appuservar[0] = $superCage->post->getInt('appuservar0');
}
// Check whether we are getting JF2State-Id through _GET or _POST
if ($superCage->get->keyExists('appuservar1')) {
$appuservar[1] = $superCage->get->getInt('appuservar1');
} elseif ($superCage->post->keyExists('appuservar1')) {
$appuservar[1] = $superCage->post->getInt('appuservar1');
}
// Check whether we are getting JF2City-Id through _GET or _POST
if ($superCage->get->keyExists('appuservar2')) {
$appuservar[2] = $superCage->get->getInt('appuservar2');
} elseif ($superCage->post->keyExists('appuservar2')) {
$appuservar[2] = $superCage->post->getInt('appuservar2');
}
// Check whether we are getting JF2Link-Id through _GET or _POST
if ($superCage->get->keyExists('appuservar3')) {
$appuservar[3] = $superCage->get->getInt('appuservar3');
} elseif ($superCage->post->keyExists('appuservar3')) {
$appuservar[3] = $superCage->post->getInt('appuservar3');
}
// Check whether we are getting Category through _GET or _POST
if ($superCage->get->keyExists('appuservar4')) {
$appuservar[4] = $superCage->get->getInt('appuservar4');
} elseif ($superCage->post->keyExists('appuservar4')) {
$appuservar[4] = $superCage->post->getInt('appuservar4');
}
// Set uservar sessions.Only set these is at least one is set. If none are set the user could be navigating back to upload.php from somewhere else within the gallery directory.
if (!empty($appuservar[0]) || !empty($appuservar[1]) || !empty($appuservar[2]) || !empty($appuservar[3]) || !empty($appuservar[4])) {
if (!empty($appuservar[0])){
$_SESSION['appuservar0'] = $appuservar[0];
} else {
$_SESSION['appuservar0'] = null;
}
if (!empty($appuservar[1])){
$_SESSION['appuservar1'] = $appuservar[1];
} else {
$_SESSION['appuservar1'] = null;
}
if (!empty($appuservar[2])){
$_SESSION['appuservar2'] = $appuservar[2];
} else {
$_SESSION['appuservar2'] = null;
}
if (!empty($appuservar[3])){
$_SESSION['appuservar3'] = $appuservar[3];
} else {
$_SESSION['appuservar3'] = null;
}
if (!empty($appuservar[4])){
$_SESSION['appuservar4'] = $appuservar[4];
} else {
$_SESSION['appuservar4'] = null;
}
}
}
// End
in the include file picmgmt.inc.php there is an add_picture function I added the following
if (isset($_SESSION["appuservar0"])) {
$var0 = $_SESSION["appuservar0"];
}
if (isset($_SESSION["appuservar1"])) {
$var1 = $_SESSION["appuservar1"];
}
if (isset($_SESSION["appuservar2"])) {
$var2 = $_SESSION["appuservar2"];
}
if (isset($_SESSION["appuservar3"])) {
$var3= $_SESSION["appuservar3"];
}
if (isset($_SESSION["appuservar4"])) {
$var4 = $_SESSION["appuservar4"];
}
// Update SQL to what ever db table here
cpg_db_query($query);
// End of JustFlockTo
In the file setup_swf_uploads.js I change the line
post_params: {"process" : "1", "user" : js_vars.user},
post_params: {"process" : "1", "user" : js_vars.user, "appsessionid" : js_vars.appsessionid},
I did this as the Swf program pass creates a different PHP session variable to that of the upload.php. If you don't pass the session variable in and set the session the the correct session value then all your session variables are empty.
In upload.php I made the slight change
if ($upload_form == 'swfupload') {
// Get the user password hash
$user_pass = $cpg_udb->get_user_pass(USER_ID);
// Serialize and base64 encode the password
set_js_var('user', base64_encode(serialize($user_pass)));
$appsessionid = session_id();
set_js_var('appsessionid', $appsessionid);
set_js_var('user_id', USER_ID);
set_js_var('allow_guests_enter_file_details', $CONFIG['allow_guests_enter_file_details']);
}
Here I pass in the correct $appsessionid to the Javascript.
Put it all together and it should work (It works for me on JustFlockTo) There could be a few things missing but you should get the idea