amprodes
02-09-2008, 12:29 AM
Hi there !! hey am trying to make a flash app that login into oscommerce store using the id sessions the php works great but flash doesnt understands it... this is what am doing (i dont know flash scripts that much)...the flash is not an EMBEDED is an application that runs without the explorer!! so no java!... am trying SharedObject.getLocal to save into cookies!
//////////////////////////////START OF PHP/////////////////////////////////////
<?
require('includes/application_top.php');
if ($session_started == false) {
tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE)) ;
}
if (isset($_GET['action']) && ($_GET['action'] == 'process')) {
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
//connect to database
if ($email_address && $password){
mysql_pconnect("internal-db.s21827.gridserver.com","db21827","lyeVaRR8") or die ("didn't connect to mysql");
mysql_select_db("db21827_data_fullcopas") or die ("no database");
//make query
$query = "SELECT customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id FROM customers WHERE customers_email_address = '" . tep_db_input($email_address) . "' AND customers_id = '" . tep_db_input($password) . "'";
$result = mysql_query( $query ) or die ("didn't query");
//see if there's an EXACT match
$num = mysql_num_rows( $result );
if ($num == 1){
if (SESSION_RECREATE == 'True') {
tep_session_recreate();
print "status= Sesion Recreada = True&checklog=1";
}
$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$result['customers_id'] . "' and address_book_id = '" . (int)$result['customers_default_address_id'] . "'");
$check_country = tep_db_fetch_array($check_country_query);
$customer_id = $result['customers_id'];
$customer_default_address_id = $result['customers_default_address_id'];
$customer_first_name = $result['customers_firstname'];
$customer_country_id = $check_country['entry_country_id'];
$customer_zone_id = $check_country['entry_zone_id'];
tep_session_register('customer_id');
tep_session_register('osCsid');
tep_session_register('customer_default_address_id' );
tep_session_register('customer_first_name');
tep_session_register('customer_country_id');
tep_session_register('customer_zone_id');
print "status= Sesion Iniciada= True&checklog=1";
} else {
print "status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2";
}
}
if (tep_session_is_registered('customer_id')) {
print "&customer_id=" . $customer_first_name;
print "&osCsid=" . str_replace("osCsid=", "", $SID);
} else {
print "&customer_id=Guest";
print "&osCsid=" . str_replace("osCsid=", "", $SID);
}
if (sizeof($navigation->snapshot) > 0) {
$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
$navigation->clear_snapshot();
tep_redirect($origin_href);
}
tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");
}
$result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$check_result = tep_db_fetch_array($result);
print "&private_messages=". $check_result['customers_private_messages'];
?>
///////////////////////////////////END OF PHP//////////////////////////////////////
///////////////////////////ACTIONSCRIPTS START/////////////////////////////
and the flash scripts in the first key frame:
System.useCodepage = true;
userinput.restrict = "a-zA-Z0-9-@";
Selection.setFocus(userinput);
passinput.restrict = "a-zA-Z0-9";
status = "Enter your information and submit";
this.onEnterFrame = function() {
if (_root.checklog == 1) {
_root.gotoAndStop(2);
}
if (_root.checklog == 2) {
_root.gotoAndStop(3);
}
};
nuevo_so = SharedObject.getLocal("Usuario");
//Verificar Datos------------------
if (nuevo_so.data.user == undefined && nuevo_so.data.pass == undefined) {
trace("No Hay Datos");
} else {
status= "Si Hay Datos";
}
stop();
and the flash scripts in the bottom:
on (release, keyPress "<Enter>") {
nuevo_so = SharedObject.getLocal("Usuario");
nuevo_so.data.user = _root.userinput.text;
nuevo_so.data.pass = _root.passinput.text;
nuevo_so.flush();
if (email_address != "" && pass != "") {
status = "Begin Login Process - Wait...";
if ((osCsid != undefined) && (osCsid != '')) {
status = "hay variable";
loadVariablesNum("http://www.mydomain.com/newlogin.php?action=process&osCsid="+osCsid, 0, "POST");
} else {
status = "no hay variable";
loadVariablesNum("http://www.mydomain.com/newlogin.php?action=process", 0, "POST");
}
}
}
this send a id session empty and here am trying to tell the user if he or her have a private message then show it in the flash movie can anybody help me please????
/////////////////////////// ACTIONSCRIPTS END////////////////////////////////
PLEASE HELP MEE:confused:
//////////////////////////////START OF PHP/////////////////////////////////////
<?
require('includes/application_top.php');
if ($session_started == false) {
tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE)) ;
}
if (isset($_GET['action']) && ($_GET['action'] == 'process')) {
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$password = tep_db_prepare_input($HTTP_POST_VARS['password']);
//connect to database
if ($email_address && $password){
mysql_pconnect("internal-db.s21827.gridserver.com","db21827","lyeVaRR8") or die ("didn't connect to mysql");
mysql_select_db("db21827_data_fullcopas") or die ("no database");
//make query
$query = "SELECT customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id FROM customers WHERE customers_email_address = '" . tep_db_input($email_address) . "' AND customers_id = '" . tep_db_input($password) . "'";
$result = mysql_query( $query ) or die ("didn't query");
//see if there's an EXACT match
$num = mysql_num_rows( $result );
if ($num == 1){
if (SESSION_RECREATE == 'True') {
tep_session_recreate();
print "status= Sesion Recreada = True&checklog=1";
}
$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$result['customers_id'] . "' and address_book_id = '" . (int)$result['customers_default_address_id'] . "'");
$check_country = tep_db_fetch_array($check_country_query);
$customer_id = $result['customers_id'];
$customer_default_address_id = $result['customers_default_address_id'];
$customer_first_name = $result['customers_firstname'];
$customer_country_id = $check_country['entry_country_id'];
$customer_zone_id = $check_country['entry_zone_id'];
tep_session_register('customer_id');
tep_session_register('osCsid');
tep_session_register('customer_default_address_id' );
tep_session_register('customer_first_name');
tep_session_register('customer_country_id');
tep_session_register('customer_zone_id');
print "status= Sesion Iniciada= True&checklog=1";
} else {
print "status=Sorry, but your user name and password did not match a user name/password combination in our database. Usernames and passwords are entered in from a different file. Thank you for visiting test login script!!&checklog=2";
}
}
if (tep_session_is_registered('customer_id')) {
print "&customer_id=" . $customer_first_name;
print "&osCsid=" . str_replace("osCsid=", "", $SID);
} else {
print "&customer_id=Guest";
print "&osCsid=" . str_replace("osCsid=", "", $SID);
}
if (sizeof($navigation->snapshot) > 0) {
$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
$navigation->clear_snapshot();
tep_redirect($origin_href);
}
tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");
}
$result = tep_db_query("select customers_private_messages from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . " '");
$check_result = tep_db_fetch_array($result);
print "&private_messages=". $check_result['customers_private_messages'];
?>
///////////////////////////////////END OF PHP//////////////////////////////////////
///////////////////////////ACTIONSCRIPTS START/////////////////////////////
and the flash scripts in the first key frame:
System.useCodepage = true;
userinput.restrict = "a-zA-Z0-9-@";
Selection.setFocus(userinput);
passinput.restrict = "a-zA-Z0-9";
status = "Enter your information and submit";
this.onEnterFrame = function() {
if (_root.checklog == 1) {
_root.gotoAndStop(2);
}
if (_root.checklog == 2) {
_root.gotoAndStop(3);
}
};
nuevo_so = SharedObject.getLocal("Usuario");
//Verificar Datos------------------
if (nuevo_so.data.user == undefined && nuevo_so.data.pass == undefined) {
trace("No Hay Datos");
} else {
status= "Si Hay Datos";
}
stop();
and the flash scripts in the bottom:
on (release, keyPress "<Enter>") {
nuevo_so = SharedObject.getLocal("Usuario");
nuevo_so.data.user = _root.userinput.text;
nuevo_so.data.pass = _root.passinput.text;
nuevo_so.flush();
if (email_address != "" && pass != "") {
status = "Begin Login Process - Wait...";
if ((osCsid != undefined) && (osCsid != '')) {
status = "hay variable";
loadVariablesNum("http://www.mydomain.com/newlogin.php?action=process&osCsid="+osCsid, 0, "POST");
} else {
status = "no hay variable";
loadVariablesNum("http://www.mydomain.com/newlogin.php?action=process", 0, "POST");
}
}
}
this send a id session empty and here am trying to tell the user if he or her have a private message then show it in the flash movie can anybody help me please????
/////////////////////////// ACTIONSCRIPTS END////////////////////////////////
PLEASE HELP MEE:confused: