Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP sizing problem!

Options
  • 21-02-2006 9:24pm
    #1
    Registered Users Posts: 1,987 ✭✭✭


    Below is the code, my problem is only the 100% is being used on the IE browser, i want the Firefox browser to be 100% and all other browsers to be 800 pixesl!????
    if (strpos($_SERVER, 'MSIE') !== FALSE)
    {
    echo'
    <table width="100%" boarder="0">
    <tr>
    <td>';
    }
    else
    {
    echo'
    <table width="800" boarder="0">
    <tr>
    <td>';
    }


Comments

  • Registered Users Posts: 35,524 ✭✭✭✭Gordon


    Change it to 'MSIE') == FALSE)

    and alter the code to suit?


  • Subscribers Posts: 9,716 ✭✭✭CuLT


    Ziycon, if "dublinnites.com" is your site, I'd really reconsider your method of user authentication. It's incredibly easy to bypass.


  • Closed Accounts Posts: 8,478 ✭✭✭GoneShootin


    Your syntax for the IF statement is wrong.
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
    

    Should be
    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') != FALSE)
    

    Note the != versus !==

    In fact theres a few errors in there that may cause problems. Here is how I would do it
    <?php if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') == TRUE){
    $width="100%";
    }
    else {
    $width="800px";
    }
    ?>
    
    <table width="<?php echo $width;?>" border="0">
    <tr>
    <td>
    &nbsp;
    </td>
    </tr>
    </table>
    


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    if your taking about the members area, thats not an important area yet, i have proper security on the chat forum, i just havent been able to get round to securing the login onto the members area! On that note! anyone know how to use the passwords and usernames from the chat forum database for a members area login??
    CuLT wrote:
    Ziycon, if "dublinnites.com" is your site, I'd really reconsider your method of user authentication. It's incredibly easy to bypass.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    The !== operator is a valid operator for what he's doing. But he has his logic mixed up. He should either be using !== TRUE or === FALSE
    In fact theres a few errors in there that may cause problems. Here is how I would do it
    <?php if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') == TRUE){
    $width="100%";
    }
    else {
    $width="800px";
    }
    ?>
    
    <table width="<?php echo $width;?>" border="0">
    <tr>
    <td>
    &nbsp;
    </td>
    </tr>
    </table>
    
    Or if you want to be *really* obtuse:
    <table width="<?php echo (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === FALSE)? "100%" : "800px" ?>" border="0">
    <tr>
    <td>
    &nbsp;
    </td>
    </tr>
    </table>
    


  • Advertisement
  • Closed Accounts Posts: 975 ✭✭✭squibs


    Ziycon - I never used that forum but Id say have a look a the table structure. At a guess there may be a user table with username and encrypted (via md5?) password. If so just md5 encrypt the password your user types in and compare login and encryped password with whats in the table.

    Cult - good catch on the security issue. Had to have a good root around before I saw it. Do you always look for that stuff?


  • Registered Users Posts: 1,987 ✭✭✭Ziycon


    Its using the 'Sha1' encryption. I knowingly coded the members area login like that because at the time the site did'nt have a DB behind it and since the DB has been available i haven't been able to get a chance to even look at coding a proper login for it due to major work in college!

    Gonna give it a look this week.


Advertisement