php pages are slow on loading....
Posted: Tue May 09, 2006 7:32 am
feyd | Please use
Here is how I am processing session (sessionInfo.php)
Thanks,
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
My website is in plain HTML and few of the pages are in PHP. I have then converted all the HTML pages into PHP. What I did is I just changed the webpage file extensions from .html to .php and added a SESSION check code in every php page. So, that I can track the user.
And, there is no other php code inside these pages but my pages are loading very slow. I'm not sure if I have to modify any configurations to speed this up. Or is there any caching issue? If you can help me I'll be very thankful to you. I am not that much familiar with PHP.
Here is the code that I'm using in my php files in the start(and all other code is only HTML).Code: Select all
<?php
require_once('common/sessionInfo.php');
ProcessSession();
?>Code: Select all
<?php
function ProcessSession()
{
global $source;
$pos = -1;
session_start(); // neccessary to read session information...
// if session is already started.....
if (isset($_SESSION['source_location']))
return;
// if this is the first request....
$source = $_SERVER['HTTP_REFERER'];
if( $source != "")
{
$pos = strpos($source, "/", 7);
if ($pos != false)
{
$source = substr($source, 0, $pos);
}
if (!isset($_SESSION['source_location']))
{
SaveInSession();
}
}
}
//################################################################################################################
function SaveInSession()
{
global $source;
session_start();
// destroy previous session
session_unset();
session_destroy();
// set session expire time = 30 mintues
//session_cache_expire(SESSION_EXPIRATION_TIME) ;
session_start();
$_SESSION['source_location'] = $source;
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]1.[/b] Select the correct board for your query. Take some time to read the guidelines in the sticky topic.[/quote]