PHP and Opera compatibility

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Marri
    New Member
    • Oct 2006
    • 2

    #1

    PHP and Opera compatibility

    I'm working on a fairly simple website, built in PHP, to allow members to post their old items for sale. I've been beta testing it for two weeks, and everything has worked perfectly so far- but then one of my beta testers came to tell me it's not working properly in Opera.

    I know many people here have said that problems in PHP with different browsers must be the HTML rather than the PHP, but this is not the case here. I've only been looking into this for a day or so but the two problems I've found are:

    -Once logged in, all the menus visible only to users logged in appear properly. Users can also submit an item, which is an option only available to registered users as well. But when they go to the User Account page, they receive an error message- even though the script to check for Not Logged In is the same for all three items. And it's all in PHP.

    [PHP]
    $alreadyin=$_GE T["userid"];
    if(!$alreadyin) {
    echo '<font color="blue"><b >Error</b>: You are not logged in!</font>';
    }
    if($alreadyin){
    [/PHP]
    And the viewable code goes in the $alreadyin loop.

    -I had an item waiting to be approved on the database- an Admin presses a button, and a section of the database is changed from process=0 to process=1. I ran this script in Firefox, and the item appeared in the Items for Sale list and disappeared from the Items to Approve list. But when I went back to Opera, the item appeared in BOTH lists. It then disappeared a couple minutes later. Similarly, if I submit an item it takes a minute or two for Opera to register it on the Items to Approve list. This is almost closer to a SQL problem, but based on the first issue I'd guess that this is due to the PHP code as well.

    Is there a time lag using PHP in Opera? Does anyone know anything that could be causing this problem that would allow me to fix this delay? I don't want my users to have to wait two minutes after they click the log in button to be able to use their accounts!
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    PHP is server side coding would have nothing todo with the clients browser... I am going to assume it has something todo with cookies and cache in the opera browser.

    Comment

    • TheMadMidget
      New Member
      • Oct 2006
      • 98

      #3
      I'm having problems with Opera aswell, but by problems are related to the cache and cookies, people appeared logged in when out or even worse, appeared as the last user on that computer and can sometimes see some unvital info.

      The only problem I can perceived from the code you posted is the you are using $GET["userid"] to get the information, that means that the url includes ?userid=somethi ng which is either just carried over from the last page or came from a form (method=get), either way is a security risk if that's the only verification you have.

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Your code (as shown) does not show any security verification at all! You simply take any userid that is passed in the url and when it is passed you assume that the user is valid.

        So in my browser I could type in your url followed by '?userid=johndo e' and I am in. I hope this was just part of the code and you have some checking based on sessions, database or cookies implemented.

        Ronald :cool:

        Comment

        • Marri
          New Member
          • Oct 2006
          • 2

          #5
          Yes, there is much more checking (against users in the database and such) but I didn't include it so the code would be shorter, clearer, what have you.

          And yes, the issue does seem to be with caching and cookies. I've talked to the IT department here about it, and they've given me some tips, but I thank you all for your time anyway :)

          Comment

          • TheMadMidget
            New Member
            • Oct 2006
            • 98

            #6
            I've got some info that should help. I looked through some Opera help pages and found this to basically disable the cache
            [HTML]
            <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
            <META HTTP-EQUIV="Expires" CONTENT="-1">
            [/HTML]
            This fixed page to page transitions, but it still took a refresh after logging in to actually log people in. What I did is made the redirect page from logging in to a browser detect page.
            [PHP]
            if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGEN T']))
            {
            //display Opera error and make <a> to originalLogInRe directPage
            }
            else
            {
            header( 'Location: http://originalLogInRe directPage' ) ;
            }
            [/PHP]
            Apparently the cookies don't update with only one page transition. I tried using a header( 'Location:'); alone to make another page transition, but it didn't work. I also tried to use Javascript and document.locati on, but this didn't work either.
            Combined, these methods "fixed" everything.
            Hope this helps.

            Jason
            Last edited by TheMadMidget; Nov 23 '06, 05:42 PM. Reason: changed browser check

            Comment

            Working...