Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Code

General discussions related to php

Moderators: macek, egami, gesf

Code

Postby hinkeltje » Mon Mar 11, 2013 7:37 am

We (the company I work for) seem to have a website that fully functions in IE9, but refuses to show the login part of the screen in Google Chrome.
I've been browsing through the code, but can't find the problem.
Can anyone of the guys and girls here tell me what is wrong?
Any help would be gladly appreciated.
The url by the way is http://www.itasc-dev.com/mijnmissiev2

mijnmissie ie9.png
mijnmissie ie9.png (25.44 KiB) Viewed 291 times


mijnmissie chrome.png
mijnmissie chrome.png (25.08 KiB) Viewed 291 times



Code: Select all
<?php
session_start();
// Settings
$document_title = null;
$statusbar = null;
$content_head = null;
$message = null;
$dynamic_content = null;
$content  = null;
$backward = null;
$forward = null;

$error_msg = null;
$success_msg = null;

$validbrowser = false;

$browser = explode(";", $_SERVER['HTTP_USER_AGENT']);
$domain = 'http://www.itasc-dev.com/mijnmissiev2/';
$template = './html/template_default.html';

switch ( $browser[1] ) {
case " MSIE 5.5":
die("This web application does not support IE ".$browser[1]."");
break;
case " MSIE 6.0":
die("This web application does not support IE ".$browser[1]."");
break;
default:
$validbrowser = true;
}

//Important required documents
require_once './php/inc/connecting.php';
require_once './php/lib/functions.php';

// If the browser is supported
if($validbrowser)
{
//Require the correct page
if(isset($_GET['p']))
{
$page = mysql_real_escape_string(htmlspecialchars($_GET['p']));

$select_page = mysql_query
("
SELECT
*
FROM
`pages`
WHERE
`page_filename` = '" . $page . "'
LIMIT
1
;");
       
//if page exists inside database
if(mysql_num_rows($select_page) == 1)
{
$fetch_page = mysql_fetch_object($select_page);

if(isset($_SESSION['user_id']) && isset($_SESSION['user_username']))
{
require_once './php/user_panel.php';
}
           
//if the sessions have not been set
if(!isset($_SESSION['user_id']) && !isset($_SESSION['user_username']))
{
//if the page is secured, show error
if($fetch_page -> page_secured == true)
{
$error_msg = '<p class="error">Je moet eerst inloggen om deze pagina te kunnen zien.</p>';
$message .= $error_msg;

$page = 'home';
header('location: index.php?p=' . $page);
}
require_once './php/login.php';
}

//user signed on or page does not require the user to be logged in
if(isset($_SESSION['user_id']) && isset($_SESSION['user_username']) || $fetch_page -> page_secured != true)
{
$document_title = $fetch_page -> page_title;
$content_head = $fetch_page -> page_head;

//if page has content stored inside the database
if(!empty($fetch_page -> page_content))
{
$content .= $fetch_page -> page_content;
}
//if the backward navigation button is set
if(!empty($fetch_page -> page_backward))
{
$backward .= '<input type="button" class="float_left" id="page_backward" dataurl="index.php?p=' . $fetch_page -> page_backward . '" name="page_backward" value="vorige" />';
}
//if the forward navigation button is set
if(!empty($fetch_page -> page_forward))
{
$forward .= '<input type="button" class="float_right" id="page_forward" dataurl="index.php?p=' . $fetch_page -> page_forward . '" name="page_forward" value="volgende" />';
}
//if the page is an existing file
if($fetch_page -> page_filetype == 'document')
{
//If it exists, load it
if(file_exists('./php/' . $page . '.php'))
{
require './php/' . $page . '.php';
}
else
{
$page = '404';
header('location: index.php?p=' . $page);
}
}
}
}
//opgevraagde pagina bestaat niet.
else
{
$page = '404';
header('location: index.php?p=' . $page);
}
}
//default
else
{
//when page is index.php, header home
$page = 'home';
header('location: index.php?p=' . $page);
}
}
else
{
echo "Deze browser wordt helaas niet ondersteund.";
}

//if user sessions have not been set
if(!isset($_SESSION['user_id']) && !isset($_SESSION['user_username']))
{
    //$message .= "sessie 'activated': " . isset($_SESSION['activated']);
   
    //if activated has been set and equals FALSE
    if(isset($_SESSION['activated']) && $_SESSION['activated'] == true)
    {
        $success_msg = '<p class="success">Je account is met succes geactiveerd. Je ** nu inloggen om aan de slag te gaan.</p>';
        $message .= $success_msg;
    }
    //if activated has been set and equals FALSE
    if(isset($_SESSION['activated']) && $_SESSION['activated'] == false)
    {
        $error_msg = '<p class="error">Je account is al geactiveerd. Je ** nu inloggen om aan de slag te gaan.</p>';
        $message .= $error_msg;
    }
}

//open read and close the template file.
$handle = fopen($template, 'r');
$file = fread($handle, filesize($template));
fclose($handle);

$place_holder = array
(
    '%document_title%',
    '%message%',
'%statusbar%',
    '%content_head%',
'%content%',
'%backward%',
'%forward%'
);
$place_filler = array
(
    $document_title,
$message,
$statusbar,
    $content_head,
    $content,
$backward,
$forward
);
//replace place_holders with place_fillers in file.
echo str_replace($place_holder,$place_filler,$file);
User avatar
hinkeltje
New php-forum User
New php-forum User
 
Posts: 15
Joined: Thu Aug 25, 2011 10:51 pm

Re: Code

Postby viper94x » Tue Mar 12, 2013 1:55 am

It works for me no problem.
Check if your chrome browser is up to date.

Sam
Attachments
Chrome.JPG
Login working in chrome
Chrome.JPG (149.62 KiB) Viewed 263 times
viper94x
New php-forum User
New php-forum User
 
Posts: 15
Joined: Mon Apr 16, 2012 2:15 am
Location: Netherlands


Return to PHP General

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.