Flex 3 and PHP Sessions

I use PHP with my Flex application and I am trying to create a shopping cart. I have a PHP Session for the contents of the basket and tried to send data in XML shopping cart. However, this works if I am on the XML/PHP page, but not in the Flex application.

Here's my PHP file that produces the XML:
<? PHP
Header ("' Content-type: text/xml '");
echo "<?" XML version = "1.0"? > ';
session_start();
If (! isset($_SESSION['ShoppingBasket']))
{
$_SESSION ['cart'] = array();
}

If ((isset($_GET['BuyPalette'])) & & (isset($_GET['NoOfPalettes'])))
{
$_SESSION ['cart'] [] = array)
'PaletteNo' = > $_GET ['BuyPalette'],
'NoOfPalettes' = > $_GET ['NoOfPalettes']
);
}

$NoOfItems = count($_SESSION['ShoppingBasket']);
$Return = "< basket > < NoOfItems Total ="$NoOfItems"/ > < / basket > ';
print ($Return);
? >


It's my addition of basket in ActionScript function:
public void AddToBasket (): void {}
document. ShoppingBasketItems.url = "" http://localhost/Flex/Personalised%20Palettes-debug/Header.php?BuyPalette= "; "
document. ShoppingBasketItems.url = PaletteNumber;
document. ShoppingBasketItems.url = '& NoOfPalettes =';
document. ShoppingBasketItems.url = NumberOfPalettes;
document. ShoppingBasketItems.send ();
}

And it's the label that I want to update:
< mx:Repeater id = dataProvider = "{ShoppingBasketItems.lastResult.NoOfItems 'ShoppingBasketRepeater'} ' startingIndex = '0' >"
< mx:Label '640' = x y = '13' text = "Your Shopping Basket contains {ShoppingBasketRepeater.currentItem.@Total} Item (s)" color = "#FFFFFF" id = "ShoppingBasketLabel" / >
< / mx:Repeater >

Y at - it a particular way for the delivery of PHP sessions in a Flex application?

Thank you
Katy

Add each of your service url variables rather than crush them.

TS

Tags: Flex

Similar Questions

  • Multi and Flex HTTPService and PHP user access

    Hello

    I'm developing a Flex with PHP application as a technology of the side server. I use HTTPService to send and receive data at and fom PHP. When I want to get a result, I send the request to a specific URL of PHP and manage the result in the Resut the HTTP Service event, which is in the form of an XML th. The problem is that if more than 1 user tries to perform the same operation at the same time, then the result is to be send to the same PHP url. But each user may have requested the URL in a different way. So, how can I check the result sent to a user is identical to what he prayed for and is not in conflict with another user.

    No, they won't, it's the same thing as you when you browse the internet, your ISP must have thousands of users, but when you ask forums.adobe.com you will get this site, not what your neighbor has asked. It's like a phone call when you dial a number, it rings and then someone answers you, is a one to one conversation.

  • Connection with Flex and PHP

    Hello

    I write a login page that will serve as the front end of our main Flex application and hope someone can fill in the blanks here...

    The Flex login page composed of password entry fields, username and a "submit" button. When a user enters their credentials and hit sumbit, HTTPService will send the login information of the user to the PHP script. This script will handle authentication on the MySQL database. If verified, two random questions created by the user will be included in the resulting XML object. These two security issues will be displayed in the login page.

    I have already implemented these logics, but I was wondering...

    1. Assuming that HTTPS / SSL will be implemented in the production, is this OK/safe to include security responses in XML and let the Flex to validate the responses of the user?
    2. After successful validation, how to redirect to the homepage?
    3. I understand the idea of ID of session and token cookies, but what I have to implement this?
    4. How to sign out?

    Thank you very much in advance for your time and the suggestion.

    I currently have three projects on the go, so I can't really spend a lot of time on it. He ca

    n be a bit of a minefield for certain circumstances, but this link should be a good start

    http://corlan.org/2008/07/22/Flex-Air-PHP-and-user-authentication/

    Personally, I would probably support using the notion of token stick at its connection to the flex application and whenever the data request system is passed a token (baton), the token of the wand is also past and demand verified as a user that is logged by the PHP backend.

    Naturally, it all depends on how secure your application must be to decide exactly what appropriate measures. The data passed between client and server and back can be intercepted if a secure protocol is not used.

    Paul

  • FLex: Creation and access to session variables

    Hi all

    Good morning people.
    Am new on SDS and using Flex 2.0

    I have hotel_list in the collection. and have a mapped datagrid which has a "Book now" button on each row (hotel).
    Then click on the 'book now' button, I want to spend the more information in the same row to the next page.
    Can I create the session variable and access session variables in the next page side server.
    How do I do... ?


    Pls any one advice me on creating session variables and access even in another page?
    Can one after the code example?


    My code is as follows...

    < mx:Script >

    <! [CDATA]

    import flash.net.navigateToURL;
    public void OnBook_click(hcode:String):void {}
    ("var request: URLRequest = new URLRequest("/quick_search/booking.mxml ");
    var uv:URLVariables = new URLVariables();
    UV.hotelcode = hcode;
    Request.Data = UV;
    navigateToURL (request, "_self");
    }
    < / mx:Script >


    < mx:DataGrid id = "dg" width = '100% ', rowHeight = styleName "38" = "GridColumnText."
    "dataProvider ="{hotel_details}"enabled =" {! ds.commitRequired} "creationComplete =" fill_hotelDetails () ".
    verticalScrollPolicy = "{mx.core.ScrollPolicy.OFF}" rowCount = "10" height = "404" > ""
    < mx:columns >
    < mx:DataGridColumn dataField = "hotel_address" headerText = "name of the hotel.
    headerStyleName = "DynamicLabel" width = "300" wordWrap = "true" editable = "false" / >

    < mx:DataGridColumn id = "pr_rate" dataField = "prdt_rate" headerText = "rate."
    headerStyleName = "DynamicLabel" paddingRight = "10" editable = "false" width = "50" / >

    < mx:DataGridColumn dataField = "hotel_status" headerText = "availability".
    headerStyleName = "DynamicLabel" editable = "false" width = "75" / >

    < mx:DataGridColumn headerText = "book now" editable = "false" dataField = "hotel_code."
    headerStyleName = "DynamicLabel" width = "75" sortable = "false" >
    < mx:itemRenderer >
    < mx:Component >
    < mx:HBox width = "25%" horizontalCenter = "0" horizontalAlign = "center".
    styleName = paddingTop "GridColumnText" = "5" >
    < mx:Button id = "book" label = "book now" click = "outerDocument.OnBook_click (data.hotel_code)" / > "
    < / mx:HBox >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >
    < / mx:columns >
    < / mx:DataGrid >

    Instead of pass... is the values to booking.mxml as request parameters possible to define session variables?
    pls someone help me...


    THX in advance
    Raphael alboury

    Take a look at the shared objects, I think these are the kind of thing you're after. In my view, that the subtopic "By specifying a path" must be particularly pertinent for sharing variables/objects between two swf files.

    LiveDocs - shared objects

  • Security between Flash and PHP backend

    If you have a front end with flash/flex and a backend with PHP.

    How you then you ensure that casual browsers use not your swf file not get directly access the classes PHP backend providing the data?

    I guess it's about authentication and authorization and sessions. I would be grateful if someone could point me to some good material on securing the php backend which connects the SWF, such as only the swf file can access the backend PHP classes. Or maybe I need to ensure the backend PHP classes themselves? Can someone give me a little push in the right direction?

    All info session must be stored in the browser (cookies). If any part of your code handles the password/username etc - you do it wrong.

    PHP session needs to store information (username, token authenticated, etc.). So, Yes, it matters little if you use SWF on your JS/HTML client.

  • Strange behaviour of PHP session on IIS server

    Everything worked fine until tonight. PHP has started having a strange behavior with session variables. I use a test server for IIS.

    The session of a form is not deleted, it remains for always in the cache. Even when I restart the computer the session keeps being restored. Now, I have a forum running phpbb on the started testserver and phpbb to store the session variable in the string. I tried, but here's where I'm stuck.

    It has worked well so far and I didn't make any changes to the php.ini file.

    Here's a form part of the ini file to the session regarding:

    [Session]
    ; Manager used to store/retrieve data.
    session.save_handler = files

    ; Argument passed to save_handler.  In the case of files, this is the path
    ; where the data files are stored. Note: Windows users have to change this
    ; variable in order to use PHP's session functions.
    ;
    ; Since PHP 4.0.1 you can set the path as:
    ;
    ;     session.save_path = "N; ' / path '.
    ;
    ; where N is an integer.  Instead of storing all the session files in
    ; / path, what this will do is use subdirectories N-levels deep, and
    ; store session data in these directories.  This is useful if you
    ; or have problems with a lot of files in a directory of your operating system and is
    ; a more efficient layout for servers that handle a lot of sessions.
    ;
    ; NOTE 1: PHP will not automatically create this directory structure.
    ;         You can use the script in the directory ext/session to that end.
    ; NOTE 2: See the section on the garbage collection below if you choose to
    ;         use subdirectories for the session storage
    ;
    ; The file storage module creates files with mode 600 default.
    ; You can change this by using
    ;
    ;     session.save_path = "N; MODE; ' / path '.
    ;
    ; where the MODE is the octal representation of the mode. Note that this
    ; does not overwrite the umask of the process.
    ; session.save_path = "/ tmp".

    ; Whether to use cookies.
    data = 1

    ; session.cookie_secure =

    ; This option allows administrators to make their users invulnerable to the
    ; attacks which involve passing the ID of session in the URL; 0 by default.
    ; IDs = 1

    ; Name of the session (used as cookie name).
    session. Name = PHPSESSID

    ; Initialize the session at the start of the request.
    session.auto_start = 0

    ; Duration in seconds of cookie or, if there are 0, until the browser is restarted.
    session.cookie_lifetime = 0

    ; The path for which the cookie is valid.
    session.cookie_path = /.

    ; The domain for which the cookie is valid.
    session.cookie_domain =

    ; Whether you want to add to the cookie httpOnly flag or not, which makes it inaccessible to the browser JavaScript scripting languages, for example.
    session.cookie_httponly =

    ; Handler used to serialize data.  PHP is the standard serializer of PHP.
    session.serialize_handler = php

    ; Define the probability that the process of "garbage collection" is launched
    ; on every session initialization.
    ; The probability is calculated using gc_probability/gc_divisor,
    ; for example 1/100 means there is a 1% chance that the GC process starts
    ; at each request.

    session.gc_probability = 1
    session.gc_divisor = 1000

    ; After this number of seconds, the stored data will be considered as 'garbage' and
    ; cleaned up by the garbage collection process.
    session.gc_maxlifetime = 1440

    ; NOTE: If you use the subdirectory option to store session files
    ;       (see session.save_path above), then garbage does * not *.
    ;       be done automatically.  You need to do your own waste
    ;       collection using a shell script, input cron or any other method.
    ;       For example, the following script would be the equivalent of
    ;       definition of session.gc_maxlifetime on 1440 (1440 seconds = 24 minutes):
    ;          CD/path/to/sessions; find - cmin + 24 | XARGS rm

    ; PHP 4.2 and less have an undocumented feature/bug that allows you to
    ; to initialize a session variable in the global scope, even if register_globals
    ; is disabled.  PHP 4.3 and later you will warn, if this feature is used.
    ; You can disable the feature and warning separately. Right now,.
    ; the warning that, if bug_compat_42 is enabled.

    session.bug_compat_42 = 0
    session.bug_compat_warn = 1

    ; Check HTTP Referer to invalidate stored outside URL that contains identifiers.
    ; HTTP_REFERER must contain this substring for the session to be
    ; considered valid.
    session.referer_check =

    ; How many bytes to read from the file.
    session.entropy_length = 0

    ; Specified here to create the session id.
    is =

    ; session.entropy_length = 16

    ; is = / dev/urandom

    ; The value {nocache, private, public}, to determine aspects of HTTP caching
    ; or leave empty to avoid sending anti-mise headers cached.
    session.cache_limiter = nocache

    ; Document expires after n minutes.
    session.cache_expire = 180

    ; TRANS sid support is disabled by default.
    ; Use of trans sid may risk your safety for users.
    ; Use this option with caution.
    ; -L' user can send that URL contains the active session ID.
    ;   another person, under. e-mail/irc/etc.
    ; -The URL that contains the active session ID can be stored
    ;   in publicly accessible computer.
    ; -L' user can access your site with the same session ID
    ;   always using URL stored in the history or bookmarks in the browser.
    session.use_trans_sid = 0

    ; Selection of a hash function
    ; 0: MD5 (128 bits)
    ; 1: SHA - 1 (160 bits)
    session.hash_function = 0

    ; Set the number of bits for each character when converting
    ; the binary data to something readable.
    ;
    ; 4 bits: 0-9, a - f
    ; bit 5: 0-9, a - j
    ; bit 6: 0-9, a - z, A - Z, '-' "
    session.hash_bits_per_character = 5

    ; The engraver URL fetch URLs within a framework of HTML tags.
    ; form/fieldset are special; If you include them here, the recorder will
    ; Add an < input > hidden field with the info that is added in the opposite case
    ; to the URL.  If you want XHTML conformity, remove the form entry.
    ; Note that all valid entries require a '=', although no value follows.
    url_rewriter. Tags = 'a href, area = href, frame = src, input is is src, form = fakeentry'

    Can someone tell me please in the right direction?

    Some things to check after I google a bit.

    1. in the ini files, check these settings

    session. Lifetime

    session_gc_maxlifetime

    Also are the permissions correctly on the folder containing the session files.  Perhaps incorrect permissions are disabling php to delete the files.

    Finally,.

    What version of php?  Maybe it's a bug and you need to upgrade php?

    Post edited by: nstratton

  • Application on Win and PHP server

    Hello

    I created my first Flex very simple application that displays data from tables in my DB. I installed WAMP on my computer, but when I exported the liberation and uploaded it - it didn't work.

    I use ASP in my site, and it runs on Windows server. My implementation is based on PHP.
    I can do it again if necessary, but I don't know if it is possible to make the application work on my site.

    What should I install on my server (if any), to make it work? My site manager do not want to install Apache.

    Is there a way?

    Thank you for your help.

    There are many sites that will tell you how to set up PHP on a server of the ISS, but I recommend u to use ASP for all your backend in the future because looks like you know better or find a better hosting service because most good now supports all common scripting languages, including ASP and PHP. I went resonance to the data mart and I am very happy, but I recommend that u simply switch to one that supports ASP and PHP and uses the BAR Control Panel

  • Windows 7: the search does not find the files that should be, directory is indexed and *.php included on the list of extensions

    Windows 7: search does not find the files that should be. I have indexed directory and *.php included on the list of extensions, but search can't find files for Word searches that I know there are files with these words in them.

    If you're frustrated by research (aka Desktop Search), you are not alone. Click the Start button and type find and click the button 'change the way Windows search'. Now click on the Advanced button and select the tab file types scroll down and find your type of file (in your case .php) and make sure the radio button "index properties and the content of the file" is selected for the file type.

    Out the form by clicking on the OK button, but do not close the form when you click the Advanced button.

    Then, you may need to change the indexing locations. If the folder where your files are located is not known for indexing search, then search is not even bother looking for here (a source of frustration for many users). Maybe your files are located on another drive or partition without the knowledge of the indexing engine. Using the options icon and select/deselect expand, make sure that at least the files of interest are included for the indexed locations. I hope this helps.

    samc1

  • How to find the lock and kill session in order to release it?

    Hi all

    EBS R12.2

    "I met ' could not book record" in our case. How to release the session locked?

    I usually do this by bouncing the apps & db level. Is their subtle way?



    Capture.PNG



    Kind regards

    JC



    Ideally, you should check for locks on the table in question where records are trying to access.

    AFAIK, you must check the v$ locked_object and find sessions.

    Hope this helps!

    Kind regards

    Hugues

  • What are the differences between pga memory max session and pga session in memory?

    Hi all

    What are the differences between pga memory max session and pga session in memory?

    SELECT s.sid, n.name, s.value FROM v$ sesstat s, v$ statname n

    WHERE s.statistic # = n.statistic #.

    AND n.name = 'pga session in memory. "

    SELECT s.sid, n.name, s.value FROM v$ sesstat s, v$ statname n

    WHERE s.statistic # = n.statistic #.

    AND n.name = 'pga memory max session ";



    Note that I have read the documentation. However, it is not clearly explained.


    Thank you

    John Stegeman wrote:

    I agree with the comments of the Ed, NightWing.

    You do not have a story to ask questions that are clearly answered in the documentation.

    Mind your own business. If you answer the question, so answer! Otherwise, please stop the thread engrossing.

  • Looking for adobe certified companies that can create a web site of muse with java and PHP for me

    Looking for adobe certified companies that can create a web site of muse with java and PHP for me

    Relationship problems he...

    1: nothing like the Adobe Certified companies

    2: sites of Muse do no PHP support.

  • How to create a dynamic newsflash using dreamweaver and PHP

    Hello

    I would like to create a dynamic newsflash using dreamweaver and PHP because newsflash will be snapped up information from a MySQL database. The Bulletin-Flash should also have a link to view more information about the piece of news a user wants to learn more. What tools do I need to use in dreamweaver and how is the procedure to go about it. All opinions are appreciated. Thanks in advance!

    Sermon of Ras wrote:

    I tried using the spry effects, but it does not work. Is there a best way to do this?

    Google "jquery vertical newsticker" ;-)

  • iFrame and PHP ~ CSS generated content (Wordpress)

    Hello

    I have an IFRAME that calls a wordpress page. I don't want to use the browser scrollbars by default if I want to use the IFRAME script drop down located at this address: http://www.dynamicdrive.com/dynamici...amescroll.htm# but! the second stage of this duty to add this at the end of the HTML page loaded into the IFRAME:

    <!-DO NOT REMOVE the SCRIPT below. IT MUST ALWAYS APPEAR at the end of YOUR CONTENT.

    < script language = "JavaScript1.2" >

    Scrollable III content - by http://www.dynamicdrive.com

    var speed, currentpos is curpos1 = 0, alt = 1, curpos2 =-1

    function initialize() {}
    If {(window.parent.scrollspeed!=0)}
    Speed = Window.parent.scrollspeed
    ScrollWindow()
    }
    }

    function scrollwindow() {}
    Temp = (document. All)? document.body.scrollTop: window.pageYOffset
    ALT =(Alt==0)? 1: 0
    If (alt == 0)
    curpos1 = temp
    on the other
    curpos2 = temp

    window.scrollBy(0,speed)
    }

    setInterval ("initialize ()", 10)

    < /Script >
    the problem is that Wordpress pages strongly using PHP and CSS, so I don't know if it is even possible to add the script somewhere, or if there is another method... or maybe simply impossible.

    Hope someone can help me.

    Hello Christian Cruz,

    This is for pages in WP are cut back to ofer in CSS and PHP and JS but it is also true that everything is set to allow other scripts work.

    Is (almost) Save to put your sctipt in the servese the page theme file that you want to call. Of course, you should save a copy of this file and so on and do an extensive testings.

    Kind regards

    M.Zografski.

    -----------------------

    Geckozone.org

  • Flex 4 and Coldfusion 8

    Hi all

    I'm new to Flex. I just started a simple project whose type of Server Application Coldfusion Flash Remoting (using Flex 4 and Coldfusion 8). After the export release build in a coldfusion server folder all I see is "page is not found" if I use the URL http://localhost/test2/test2.html if I use this URL file:///C:/ColdFusion8/wwwroot/test2/test2.html it works very well. Can someone please help me solve this problem?

    Thank you very much!

    Don

    If you see a page not found error, then you try to access the bad page name / directory structure or you have not downloaded the file in a directory accessible from the web.

    Normally, you will place the release are used to build in a directory of your site web (for example, IIS or Apache), not a ColdFusion installation directory.  Did you do that?

    If you have access to a remote web server, you you FTP your Release version of your web server?  Just exporting on your local machine will not make remotely accessible to the public.

  • Flex application and component talk to each other?

    Hi all.

    I have built on a large flex project and try to condense a little downwards out of the code and put it in the individual components.  Can I call then.  Not only to reduce the number of lines of code, but to also make it easier to make improvements, and if others get involved with the project that they may be charged a component rather than all of the code.  In my view, it is logical to try to work this way.

    I should point out that I am using Flash Builder 4.

    To try it, I worked on an example.

    What I hoped to do, it is to pass variables and the values of a component to the main application, is it possible?

    That's what I've tried but I get an error the main code can not see the text field in the component.

    Code in the main file

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:Application ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" minWidth = minHeight = "955" "737" height = "600" width = "470" xmlns:ns1 = "*" >
    < s: states >
    < name s: State = "on" / >
    < name s: State = "two" / >
    < / s: states >
    < fx:Declarations >
    <! - Place non-visual elements (e.g., services, items of value) here - >
    < / fx:Declarations >

    < fx:Script >
    <! [CDATA]

    private function btn_submit (): void
    {
    If (txt_user.text = 'Hello')
    {
    currentState = "two";
    }
    on the other
    {
    currentState = "a";
    }
    }

    []] >
    < / fx:Script >

    < s:Label x = "10" y = "10" text = "Test Log In on component" width = "717" textAlign = "center" fontWeight = "bold" fontSize = "18" / >
    < ns1:Loginform = "190" x y = "71" >
    < / ns1:Loginform >
    < / s:Application >

    The component code

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:fx s:Group ' http://ns.Adobe.com/MXML/2009 "
    xmlns:s = "library://ns.adobe.com/flex/spark".
    xmlns:MX = "library://ns.adobe.com/flex/mx" width = "400" height = "300" >
    < fx:Declarations >
    <! - Place non-visual elements (e.g., services, items of value) here - >
    < / fx:Declarations >
    < s:TextInput = "53" x = "62" width = "298" id = "txt_user" / >


    < s:Button = "281" x = "92" label = "Button" click = "btn_submit ()" / >
    < / s:Group >

    I don't know if I want to do (spend data from a component to the application main and rear) is possible.

    If someone could develop on it, I would be grateful!

    If the "publishName" of the component property is writable, then Yes.

    Two solutions:

    -First if you always use the same file name:

    
    

    -So if you want to change it, you can always use:

    
    

    And then in the Script code:

    myRecorder.fileName = "myFileNameOrWhateverStringHere";
    

    If the property is not writable, because it has no Set accessor, you must provide one (that is if you can change the code of the component).

Maybe you are looking for