PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old December 1st, 2002, 08:15 AM
csxpcm csxpcm is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: London, UK
Posts: 13 csxpcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
problem with 'building a member area with php'

hello all,
In series 3 of this collection of articles, its suggested that the following piece of code should be used to determine if the user should be asked to supply login details or bypass this (if already logged in) and supply a menu.

ok, so I have an index.php file which includes this code, as taken from series 3 of the 'building a member area with php'

if($dtlsSecurity->IsLoggedIn())
{
?>
Menu Items here<br>
<?php
}
else
{
?>
<form method="post" action="login.php">
username: <input type="text" name="username"><br>
password: <input type="password" name="password"><br>
<input type="submit" value="login">
</form>
<?php
}


but this re-directs me to login.php which includes:

if(!$dtlsSecurity->IsLoggedIn())
{
if($strMethod == "check_login")
ProcessLogin();
else
GetLogin();
}
else
{
if($strMethod == "logout")
ProcessLogout();
else
ShowLogOut();
}

which then causes GetLogin() to be called. Hence, the user is requested to supply the username and password credentials yet again. Im struggling on how to re-structure the code so that the user supplies the username and password in index.php and when its passed to login.php it doesn't re-request this information.

Any suggestions would be much appreciated.
Thanks in advance,

Reply With Quote
  #2  
Old December 1st, 2002, 03:14 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
on your index page, do you have any header functions?

Reply With Quote
  #3  
Old December 1st, 2002, 04:35 PM
csxpcm csxpcm is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: London, UK
Posts: 13 csxpcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Ben, thanks for the reply, this is my index.php file.
The thing is, from the way you have explained the code (or maybe its my lack of understanding) we have an 'index.php' page requesting the login info. This login section on the 'index.php' page is within a table column. I was hoping to supply the login credentials and then the menu items would appear in that column (the navigation panel).
However, the form posts the login credentials to login.php which re-requests this information, via getLogin(). I want to be able just to supply this information via the index.php.
The 'login.php' file doesn't just deal with the login processing, it also provides the login request form again.
I would have thought it best to request login info in the 'index.php' file and have the code concerned with authorisation purely seperate. Does this make sense?
Anyway, maybe i've structured the code wrong, would someone please assist.

p.s. I have an example page of my index.php at
http://www.pcm.uklinux.net/index.php

Thanks very much in advance, all help is much appreciated.



my index.php page

<?php
include('class.security.php');

$dtlsSecurity = new Security;

$dtlsSecurity->ExtraFieldNames('firstname,lastname');
$dtlsSecurity->StoreSession_TableName('session');
$dtlsSecurity->Log_TableName('log');
$dtlsSecurity->FieldNames('sessionid', 'userid', 'username', 'auth');

$IsLoggedIn = $dtlsSecurity->IsLoggedIn();
$details = $dtlsSecurity->GetData();
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2">
<div align="center"><font size="3"><b>Main Navigation panel</b></font></div>
</td>
</tr>
<tr>
<td width="165">
<p>&nbsp;</p>
<p>
<?php
if($dtlsSecurity->IsLoggedIn())
{
?>
Menu Items here<br>
<?php
}
else
{
?>
<form method="post" action="login.php">
username:
<input type="text" name="username">
<br>
password:
<input type="password" name="password">
<br>
<input type="submit" value="login">
</form>
<?php
}
?>
<p>&nbsp;</p>
</td>
<td width="485">This will be the 'index.php' page</td>
</tr>
</table>
</body>
</html>

Last edited by csxpcm : December 1st, 2002 at 04:57 PM.

Reply With Quote
  #4  
Old December 2nd, 2002, 03:24 PM
csxpcm csxpcm is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: London, UK
Posts: 13 csxpcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
anyone? Ben?
i would really appreciate some help on this one.

thanks in advance

Last edited by csxpcm : December 5th, 2002 at 05:07 PM.

Reply With Quote
  #5  
Old December 5th, 2002, 05:12 PM
csxpcm csxpcm is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: London, UK
Posts: 13 csxpcm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi Ben,
Any chance you could respond to my question. It's just that with regard to the problem I have highlighted, the 2nd and 3rd article are a little inconsistent.

kind regards

Reply With Quote
  #6  
Old December 5th, 2002, 05:59 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
sorry for not getting back to you,

I see what you mean now. ok so on the index page, when you submit your login details, it send you to the login.php page, and asks for your login details again?

its all in your form action.

<form method="post" action="login.php?strMethod=check_login">

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > problem with 'building a member area with php'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway