Jump to content

remember me login script


craigtolputt

Recommended Posts

Thanks for the ehads up, i have managed to get it integratd into my site but i am a little confused as the script read me file says that you can specify what content a user can see depending if they are logged in or not...?

 

but when i navigate to my page it automatically takes me to the login.php page and makes me login before i can view any other pages???

 

the site is at www.tktest.co.uk/selectandsave/retailer

 

the code i use to show content or not is

 

<?php
	if ( ! $_SESSION['logged_in'] ):
?>

show content here is person is not logged in

<?php
	endif;
?>

 

 

<?php
	if ( $_SESSION['logged_in'] ):
?>

show content here is person is logged in

<?php
	endif;
?>

 

 

any idea what ive done wrong?

Link to comment
Share on other sites

Are you using session_start() at the top of each page you want to use sessions?

Are you setting $_SESSION['logged_in'] when they log in?

I would also either use isset or compare it to a value as well.

Link to comment
Share on other sites

I would love to pretend to know what that means but im a newbie and dont have a clue ; )

 

but this is the code for a standard page your_store.php

 

<?php 
require_once('settings.php');
checkLogin( '1 2' );

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Make your store stand out from the crowd with Select and Save</title>
<meta name="author" content="Craig Smith"> 
<meta name="subject" content="Convenient Store">
<meta name="Description" content="Your Store is an area for retailers to download marketing material and literature to use in their Select and Save store." />
<meta name="Keywords" content="select and save, groceries, frozen foods, off licence, convenient store, shopping, shop, local shop, your store, marketing area" />
<meta name="Language" content="English"> 
<meta http-equiv="Expires" content="never"> 
<meta http-equiv="CACHE-CONTROL" content="PUBLIC"> 
<meta name="Copyright" content="Select and Save"> 
<meta name="Designer" content="Craig Smith"> 
<meta name="Publisher" content="Tolputt Keeton"> 
<meta name="distribution" content="Global"> 
<meta name="Robots" content="INDEX,FOLLOW"> 
<meta name="country" content="United Kingdom">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadimages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadimages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadimages('../images/buttons/home_over.gif','../images/buttons/marketing_over.gif','../images/buttons/promotions_over.gif','../images/buttons/development_over.gif','../images/buttons/branding_over.gif','../images/buttons/your_store_over.gif','../images/buttons/join_us_over.gif','../images/buttons/contact_us_over.gif','../images/buttons/sign_in_over.gif','../images/buttons/register_over.gif')">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="14" align="center" valign="top" background="../images/top_bg.gif"></td>
  </tr>
  <tr>
    <td height="128" align="center" valign="top" background="../images/top_bg2.gif"><a href="../index.html" target="_self"><img src="../images/retailer_logo.gif" alt="Select & Save" width="763" height="128" border="0" /></a></td>
  </tr>
  <tr>
    <td height="1" align="center" valign="top" bgcolor="#FFFFFF"></td>
  </tr>
  <tr>
    <td height="2" align="center" valign="top" bgcolor="#FFFFFF"><img src="../images/top_line.gif" /></td>
  </tr>
  <tr>
    <td height="14" align="center" valign="top" bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="10" colspan="3"></td>
        </tr>
      <tr>
        <td width="238" height="61" align="left" valign="bottom" bgcolor="c9c9c9"><img src="../images/buttons/news.gif" alt="News" width="59" height="28" /></td>
        <td width="2"></td>
        <td width="760" align="left" valign="bottom" bgcolor="c9c9c9"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="4"></td>
            <td><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','../images/buttons/home_over.gif',1)"><img src="../images/buttons/home.gif" alt="Go to the home page for Select and Save retailers" name="Home" width="65" height="28" border="0" id="Home" /></a></td>
            <td width="6"></td>
            <td><a href="marketing.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Marketing','','../images/buttons/marketing_over.gif',1)"><img src="../images/buttons/marketing.gif" alt="Go to the marketing page for Select and Save" name="Marketing" width="86" height="28" border="0" id="Marketing" /></a></td>
            <td width="6"></td>
            <td><a href="promotions.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Promotions','','../images/buttons/promotions_over.gif',1)"><img src="../images/buttons/promotions.gif" alt="See what promotions Select and Save have on offer" name="Promotions" width="94" height="28" border="0" id="Promotions" /></a></td>
            <td width="6"></td>
            <td><a href="development.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Development','','../images/buttons/development_over.gif',1)"><img src="../images/buttons/development.gif" alt="Go to the development page to fond help with your store" name="Development" width="107" height="28" border="0" id="Development" /></a></td>
            <td width="6"></td>
            <td><a href="branding.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Branding','','../images/buttons/branding_over.gif',1)"><img src="../images/buttons/branding.gif" alt="See our branding guidelines and download our logos and literature" name="Branding" width="80" height="28" border="0" id="Branding" /></a></td>
            <td width="6"></td>
            <td><a href="your_store.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Your Store','','../images/buttons/your_store_over.gif',1)"><img src="../images/buttons/your_store_over.gif" alt="Access everything you need to for your store here" name="Your Store" width="91" height="28" border="0" id="Your Store" /></a></td>
            <td width="6"></td>
            <td><a href="register.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Join Us','','../images/buttons/join_us_over.gif',1)"><img src="../images/buttons/join_us.gif" alt="Not yet a member, Click here to join us now" name="Join Us" width="71" height="28" border="0" id="Join Us" /></a></td>
            <td width="6"></td>
            <td><a href="contact_us.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Contact Us','','../images/buttons/contact_us_over.gif',1)"><img src="../images/buttons/contact_us.gif" alt="Find our contact details and get in touch with Select and Save" name="Contact Us" width="93" height="28" border="0" id="Contact Us" /></a></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="left" valign="bottom" bgcolor="#FFFFFF"></td>
        <td></td>
        <td height="3" align="left" valign="bottom" bgcolor="#FFFFFF"></td>
      </tr>
      <tr>
        <td height="61" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="7">
          <tr>
            <td><p><span class="date">12.04.09</span><br />
                  <span class="ntitle">The latest information about retail news</span><br />
                  <span class="ntext">News updates will display here which can<br />
                    be added via an admin panel by an<br />
                    administrator on a daily, weekly or monthly<br />
                    basis.</span></p>
              <p><span class="date">12.04.09</span><br />
                  <span class="ntitle">The latest information about retail news</span><br />
                  <span class="ntext">News updates will display here which can<br />
                    be added via an admin panel by an<br />
                    administrator on a daily, weekly or monthly<br />
                    basis.</span></p>
              <p><span class="date">12.04.09</span><br />
                  <span class="ntitle">The latest information about retail news</span><br />
                  <span class="ntext">News updates will display here which can<br />
                    be added via an admin panel by an<br />
                    administrator on a daily, weekly or monthly<br />
                basis.</span><br />
              </p></td>
          </tr>
        </table>        <hr />
<?php
	if ( ! $_SESSION['logged_in'] ):
?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><a href="login.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Sign In','','../images/buttons/sign_in_over.gif',1)"><img src="../images/buttons/sign_in.gif" alt="Existing members Sign In here" name="Sign In" width="87" height="61" border="0" id="Sign In" /></a></td>
    <td> </td>
    <td><a href="register.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Register','','../images/buttons/register_over.gif',1)"><img src="../images/buttons/register.gif" alt="New members can register here" name="Register" width="149" height="61" border="0" id="Register" /></a></td>
  </tr>
</table>
<?php
	endif;
?>
<table width="100%" border="0" cellpadding="7" cellspacing="0">
  <tr>
    <td align="right" valign="top"  class="details">
<?php
if ( $_SESSION['logged_in'] ):
?>

<?php echo 'Hello ' . get_username ( $_SESSION['user_id'] ) . '!<br />You are now logged in.<br /><br /><a href="update_profile.php" title="Click here to update your profile"><img src="images/update.gif" alt="Click here to update your profile" width="127" height="20" border="0" /></a><br /><br /><a href="logout.php" title="Logout of the members area"><img src="images/logout.gif" alt="Click here to Logout" border="0" /></a>'; ?>

<?php
endif;
?></td>
  </tr>
</table>
<hr />
</td>
        <td></td>
        <td align="right" valign="top"><table width="759" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="124" align="right" valign="top" background="../images/your_store_header.jpg"><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td align="right" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="27"></td>
                      </tr>
                      <tr>
                        <td align="right" valign="top"><img src="../images/titles/your_store.gif" alt="Your Store" width="160" height="34" /></td>
                      </tr>
                  </table></td>
                  <td width="5" height="124" bgcolor="e70000"></td>
                </tr>
            </table></td>
          </tr>
        </table>
        <table width="760" border="0" cellpadding="7" cellspacing="0">
            <tr>
              <td align="left" valign="top"><h1>Managing Your Store More Efficiently</h1>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td align="left" valign="top"><p>Independent retailers operate in a competitive<br />
environment. To operate efficiently and to optimise store<br />
performance in areas of sales, profitability, stock control<br />
and leakage, it is becoming more and more essential for<br />
store operators to have available to them the very best<br />
management information.<br />
<br />
<br />
<span class="style2">Select & Save Scan</span><br />
For this reason, Select & Save recommends that all our<br />
members seriously consider the implementation and<br />
operation of an EPOS scanning system if they are not<br />
doing so already.<br />
                      </p>
                      </td>
                    <td align="left" valign="top"><p>Recognising that the investment required can often be<br />
                      very substantial, we have teamed up with one of the<br />
                      very best EPOS providers in the country to produce<br />
                      Select & Save scan. The system incorporates all of the<br />
                      facilities demanded by a growing independent retailer,<br />
                      including electronic order placement and the facility to<br />
                      receive weekly product file updates. Moreover, the<br />
                      system has been produced to bring EPOS facilities within<br />
                      reach of the vast majority of retailers.<br />
                      <br />
                      <br />
                      <span class="style2">Designed for Retail</span><br />
                      Developed by retailers for retailers, Select & Save Scan is<br />
                      installed with full staff training. For ease of mind the system<br />
                      will be fully maintained under a maintenance contract.</p>
                      </td>
                  </tr>
                </table>                
                <p> </p></td>
            </tr>
          </table></td>
      </tr>
    </table>
    <p> </p></td>
  </tr>
  <tr>
    <td height="14" align="center" valign="top" background="../images/bottom_bg.gif"></td>
  </tr>
  <tr>
    <td height="14" align="center" valign="top"><table width="1000" border="0" cellspacing="0" cellpadding="6">
      <tr>
        <td align="left"><span class="style1">©2009 Select & Save | <a href="../privacy_policy.html">Privacy policy</a> | <a href="login.php">Sign In</a> | <a href="register.php">Register</a></span></td>
        <td align="right" class="style1"></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

 

and this is the code for the login.php

 

<?php
require_once ( 'settings.php' );

if ( array_key_exists ( '_submit_check', $_POST ) )
{
	if ( $_POST['username'] != '' && $_POST['password'] != '' )
	{
		$query = 'SELECT ID, Username, Active, Password FROM ' . DBPREFIX . 'users WHERE Username = ' . $db->qstr ( $_POST['username'] ) . ' AND Password = ' . $db->qstr ( md5 ( $_POST['password'] ) );

		if ( $db->RecordCount ( $query ) == 1 )
		{
			$row = $db->getRow ( $query );
			if ( $row->Active == 1 )
			{
				set_login_sessions ( $row->ID, $row->Password, ( $_POST['remember'] ) ? TRUE : FALSE );
				header ( "Location: " . REDIRECT_AFTER_LOGIN );
			}
			elseif ( $row->Active == 0 ) {
				$error = 'Your membership was not activated. Please open the email that we sent and click on the activation link.';
			}
			elseif ( $row->Active == 2 ) {
				$error = 'You are suspended!';
			}
		}
		else {		
			$error = 'Login failed!';		
		}
	}
	else {
		$error = 'Please use both your username and password to access your account';
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Select and Save</title>
<meta name="author" content="Craig Smith"> 
<meta name="subject" content="Convenient Store">
<meta name="Description" content="Your Store is an area for retailers to download marketing material and literature to use in their Select and Save store." />
<meta name="Keywords" content="select and save, groceries, frozen foods, off licence, convenient store, shopping, shop, local shop, your store, marketing area" />
<meta name="Language" content="English"> 
<meta http-equiv="Expires" content="never"> 
<meta http-equiv="CACHE-CONTROL" content="PUBLIC"> 
<meta name="Copyright" content="Select and Save"> 
<meta name="Designer" content="Craig Smith"> 
<meta name="Publisher" content="Tolputt Keeton"> 
<meta name="distribution" content="Global"> 
<meta name="Robots" content="INDEX,FOLLOW"> 
<meta name="country" content="United Kingdom">
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadimages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadimages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadimages('../images/buttons/home_over.gif','../images/buttons/marketing_over.gif','../images/buttons/promotions_over.gif','../images/buttons/development_over.gif','../images/buttons/branding_over.gif','../images/buttons/your_store_over.gif','../images/buttons/join_us_over.gif','../images/buttons/contact_us_over.gif','../images/buttons/sign_in_over.gif','../images/buttons/register_over.gif')">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="14" align="center" valign="top" background="../images/top_bg.gif"></td>
  </tr>
  <tr>
    <td height="128" align="center" valign="top" background="../images/top_bg2.gif"><a href="../index.html" target="_self"><img src="../images/retailer_logo.gif" alt="Select & Save" width="763" height="128" border="0" /></a></td>
  </tr>
  <tr>
    <td height="1" align="center" valign="top" bgcolor="#FFFFFF"></td>
  </tr>
  <tr>
    <td height="2" align="center" valign="top" bgcolor="#FFFFFF"><img src="../images/top_line.gif" /></td>
  </tr>
  <tr>
    <td height="14" align="center" valign="top" bgcolor="#FFFFFF"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="10" colspan="3"></td>
        </tr>
      <tr>
        <td width="238" height="61" align="left" valign="bottom" bgcolor="c9c9c9"><img src="../images/buttons/news.gif" alt="News" width="59" height="28" /></td>
        <td width="2"></td>
        <td width="760" align="left" valign="bottom" bgcolor="c9c9c9"><table border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="4"></td>
            <td><a href="index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Home','','../images/buttons/home_over.gif',1)"><img src="../images/buttons/home.gif" alt="Go to the home page for Select and Save retailers" name="Home" width="65" height="28" border="0" id="Home" /></a></td>
            <td width="6"></td>
            <td><a href="marketing.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Marketing','','../images/buttons/marketing_over.gif',1)"><img src="../images/buttons/marketing.gif" alt="Go to the marketing page for Select and Save" name="Marketing" width="86" height="28" border="0" id="Marketing" /></a></td>
            <td width="6"></td>
            <td><a href="promotions.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Promotions','','../images/buttons/promotions_over.gif',1)"><img src="../images/buttons/promotions.gif" alt="See what promotions Select and Save have on offer" name="Promotions" width="94" height="28" border="0" id="Promotions" /></a></td>
            <td width="6"></td>
            <td><a href="development.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Development','','../images/buttons/development_over.gif',1)"><img src="../images/buttons/development.gif" alt="Go to the development page to fond help with your store" name="Development" width="107" height="28" border="0" id="Development" /></a></td>
            <td width="6"></td>
            <td><a href="branding.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Branding','','../images/buttons/branding_over.gif',1)"><img src="../images/buttons/branding.gif" alt="See our branding guidelines and download our logos and literature" name="Branding" width="80" height="28" border="0" id="Branding" /></a></td>
            <td width="6"></td>
            <td><a href="your_store.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Your Store','','../images/buttons/your_store_over.gif',1)"><img src="../images/buttons/your_store.gif" alt="Access everything you need to for your store here" name="Your Store" width="91" height="28" border="0" id="Your Store" /></a></td>
            <td width="6"></td>
            <td><a href="register.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Join Us','','../images/buttons/join_us_over.gif',1)"><img src="../images/buttons/join_us_over.gif" alt="Not yet a member, Click here to join us now" name="Join Us" width="71" height="28" border="0" id="Join Us" /></a></td>
            <td width="6"></td>
            <td><a href="contact_us.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Contact Us','','../images/buttons/contact_us_over.gif',1)"><img src="../images/buttons/contact_us.gif" alt="Find our contact details and get in touch with Select and Save" name="Contact Us" width="93" height="28" border="0" id="Contact Us" /></a></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td align="left" valign="bottom" bgcolor="#FFFFFF"></td>
        <td></td>
        <td height="3" align="left" valign="bottom" bgcolor="#FFFFFF"></td>
      </tr>
      <tr>
        <td height="61" align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="7">
          <tr>
            <td><p><span class="date">12.04.09</span><br />
                  <span class="ntitle">The latest information about retail news</span><br />
                  <span class="ntext">News updates will display here which can<br />
                    be added via an admin panel by an<br />
                    administrator on a daily, weekly or monthly<br />
                    basis.</span></p>
              <p><span class="date">12.04.09</span><br />
                  <span class="ntitle">The latest information about retail news</span><br />
                  <span class="ntext">News updates will display here which can<br />
                    be added via an admin panel by an<br />
                    administrator on a daily, weekly or monthly<br />
                    basis.</span></p>
              <p><span class="date">12.04.09</span><br />
                  <span class="ntitle">The latest information about retail news</span><br />
                  <span class="ntext">News updates will display here which can<br />
                    be added via an admin panel by an<br />
                    administrator on a daily, weekly or monthly<br />
                basis.</span><br />
              </p></td>
          </tr>
        </table>
<?php	
	if ( ! $_SESSION['logged_in'] ):
?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><a href="login.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Sign In','','../images/buttons/sign_in_over.gif',1)"><img src="../images/buttons/sign_in.gif" alt="Existing members Sign In here" name="Sign In" width="87" height="61" border="0" id="Sign In" /></a></td>
    <td> </td>
    <td><a href="register.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Register','','../images/buttons/register_over.gif',1)"><img src="../images/buttons/register.gif" alt="New members can register here" name="Register" width="149" height="61" border="0" id="Register" /></a></td>
  </tr>
</table>
<?php
	endif;
?>
<table width="100%" border="0" cellpadding="7" cellspacing="0">
  <tr>
    <td align="right" valign="top"  class="details">
<?php
if ( $_SESSION['logged_in'] ):
?>

<?php echo 'Hello ' . get_username ( $_SESSION['user_id'] ) . '!<br />You are now logged in.<br /><br /><a href="update_profile.php" title="Click here to update your profile"><img src="images/update.gif" alt="Click here to update your profile" width="127" height="20" border="0" /></a><br /><br /><a href="logout.php" title="Logout of the members area"><img src="images/logout.gif" alt="Click here to Logout" border="0" /></a>'; ?>

<?php
endif;
?></td>
  </tr>
</table>

</td>
        <td></td>
        <td align="right" valign="top"><table width="759" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="124" align="right" valign="top" background="images/join_bg.jpg"><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td align="right" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td height="27"></td>
                      </tr>
                      <tr>
                        <td align="right" valign="top"><img src="../images/titles/sign_in.gif" alt="Sign In" width="160" height="34" /></td>
                      </tr>
                  </table></td>
                  <td width="5" height="124" bgcolor="e70000"></td>
                </tr>
            </table></td>
          </tr>
        </table>
        <table width="760" border="0" cellpadding="7" cellspacing="0">
            <tr>
              <td align="left" valign="top"><h1>Existing members sign in</h1>
                </td>
            </tr>
          </table><?php
if ( $_SESSION['logged_in'] ):
?>
          <table width="100%" border="0" cellspacing="0" cellpadding="15">
  <tr>
    <td align="left" class="date">You are already a member and logged in!</td>
  </tr>
</table>
<?php
endif;
?>
<?php
if ( ! $_SESSION['logged_in'] ):
?><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="left" valign="top"><div id="log">
<?php if ( isset( $error ) ) { echo '			<p class="error">' . $error . '</p>' . "\n";}?>
</div>
<div id="container" style="width:230px;" align="left">

	<form class="form" action="<?=$_SERVER['PHP_SELF']?>" method="post">

		<input type="hidden" name="_submit_check" value="1"/> 

		<div style="margin-top:12px; margin-bottom:10px">
			<label for="username">Username</label>
			<input class="input" type="text" name="username" id="username" size="25" maxlength="40" value="" />
		</div>
		<div style="margin-bottom:6px">
			<label for="password">Password</label>
			<input class="input" type="password" name="password" id="password" size="25" maxlength="32" />
		</div>
		<?php if ( ALLOW_REMEMBER_ME ):?>
		<div style="margin-bottom:6px">
			<input type="checkbox" name="remember" id="remember" />
			<label for="remember">Remember me</label>
		</div>
		<?php endif;?>
		<input type="image" name="Login" value="Login"  class="submit-btn" src="images/btn.gif" alt="submit" title="submit" />
		<br class="clear" />
		<a href="register.php">Register</a> / <a href="forgot_password.php">Password recovery?</a>

	</form>
        	
</div></td>
  </tr>
</table>
<?php
endif;
?>
</td>
      </tr>
    </table>
</td>
  </tr>
  <tr>
    <td height="14" align="center" valign="top" background="../images/bottom_bg.gif"></td>
  </tr>
  <tr>
    <td height="14" align="center" valign="top"><table width="1000" border="0" cellspacing="0" cellpadding="6">
      <tr>
        <td align="left"><span class="style1">©2009 Select & Save | <a href="../privacy_policy.html">Privacy policy</a> | <a href="login.php">Sign In</a> | <a href="register.php">Register</a></span></td>
        <td align="right" class="style1"></td>
      </tr>
    </table></td>
  </tr>
</table>

</body>

</html>

Link to comment
Share on other sites

Sorry for the delay my internet went down,

 

<?php
require ( 'lib/connection.php' );			// - the connection class needed to operate with mysql
require ( 'functions.php' );				// - the functions


/*
|---------------------------------------------------------------
| SYSTEM VARIABLES
|---------------------------------------------------------------
|
| System variables needed by the application
|
*/
define ( "HOSTNAME", "localhost" );			// - hostname - nedded to access the database
define ( "DATABASE", "" );				// - database name - the name of your mysql database
define ( "DBUSER", "" );				// - database user - what user should we use to access the database
define ( "DBPASS", "" );			// - database password - what password should we use to access the database
define ( "DBPREFIX", "" );				// - db prefix - would you like to use a prefix for your table?
define ( "APPLICATION_URL", "http://www.tktest.co.uk/selectandsave/retailer/" );// - app. url - the url that points to our application ( ! with trailing slash )
define ( "APPLICATION_FOLDER", "retailer" );		// - do we have a folder where we store our scripts? ( ! no slashes )
define ( "REDIRECT_TO_LOGIN", "http://www.tktest.co.uk/selectandsave/retailer/login.php" );		// - where should we redirect visitors if the access is restricted?
define ( "REDIRECT_AFTER_LOGIN", "http://www.tktest.co.uk/selectandsave/retailer/members.php" );	// - where should we redirect members after logging in?
define ( "REDIRECT_ON_LOGOUT", "http://www.tktest.co.uk/selectandsave/retailer/index.php" );		// - where should we redirect on logout?
define ( "ADMIN_EMAIL", "dave@tolputtkeeton.co.uk" );	// - what email should we use to contact our members?
define ( "KEEP_LOGGED_IN_FOR", 60*60*24*100 );		// - if they chose to be remembered, how long should the cookies remain active ( default is 100 days )
define ( "COOKIE_PATH", "/" );				// - where should the cookies be active ( '/' means the whole domain. )
define ( "DOMAIN_NAME", "Select and Save" );		// - the domain name that we use
define ( "RUN_ON_DEVELOPMENT", TRUE );			// - TRUE if you wish to see the nasty errors for debugging, FALSE to hide them
define ( "REDIRECT_AFTER_CONFIRMATION", TRUE );		// - TRUE if you want to redirect your users to the members page after they confirm their membership
define ( "ALLOW_USERNAME_CHANGE", FALSE );		// - do we let our members update their usernames as well? ( FALSE stands for no )
define ( "ALLOW_REMEMBER_ME", TRUE );			// - do we let our members use the "remember me" feature


/*
|---------------------------------------------------------------
| EMAILING VARIABLES
|---------------------------------------------------------------
|
| Emailing variables needed by phpmailer
|
*/
define ( "USE_SMTP", FALSE );				// - do you want to use SMTP to send out emails? TRUE or FALSE ( mail() will be used )
define ( "SMTP_PORT", "" );				// - what port should we use for smtp ( only needed if SMTP is set to TRUE )
define ( "SMTP_HOST", "" );		// - what host should we use for smtp ( only needed if SMTP is set to TRUE )
define ( "SMTP_USER", "" );		// - what user should we use for smtp ( only needed if SMTP is set to TRUE )
define ( "SMTP_PASS", "" );		// - what password should we use for smtp (only needed if SMTP is set to TRUE)
define ( "MAIL_IS_HTML", TRUE );			// - send emails as html or text? ( TRUE for html and FALSE for text )
############################################################# DON'T EDIT BELOW THIS LINE ########################################


/*
|---------------------------------------------------------------
| SET THE SERVER PATH
|---------------------------------------------------------------
|
| Let's attempt to determine the full-server path to the "system"
| folder in order to reduce the possibility of path problems.
|
*/
if ( function_exists ( 'realpath' ) AND @realpath ( dirname (__FILE__) ) !== FALSE )
{
define ( "BASE_PATH", str_replace ( "\\", "/", realpath ( dirname(__FILE__) ) ) . '/' );
}


//how do we handle errors
error_reporting ( ( RUN_ON_DEVELOPMENT ) ? E_ALL : E_WARNING );
if ( file_exists ( BASE_PATH . 'install.php' ) )
{
die ( "Please delete install.php from your server before continuing!" );
}


$db = new db ( DBUSER, DBPASS, DATABASE, HOSTNAME );	// - and away we go
?>

Link to comment
Share on other sites

Well I don't see session_start() anywhere on any of your pages.

 

If you have a Include or Require on every page like

require_once ( 'settings.php' );

 

Then inside of settings.php, just add session_start(); to the top of the code, just under <?php and before your first require.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.