Reply to Re: Handmade Shopping Cart

Your name:

Reply:


Posted by Joseph Melnick on 06/15/05 19:20

Hello Paul,

I have a couple of servers at 1and1 and am very happy with them.

I checked out your website and enjoyed the photos.

Sessions are pretty easy to understand.

<?php
session_start(); // At the top of your script starts a session.

function check_login() {
// Assuming that you are getting your login info from a login form
$username = (array_key_exists('username',$_POST))?$_POST['username']:"";
$password = (array_key_exists('password',$_POST))?$_POST['password']:"";
switch($username){
case "joe": if($password == "joespassword") { $_SESSION['mytoken']
=="somevalue"; $check_result=1; break; }
case "paul": if($password == "paulsspassword") { $_SESSION['mytoken']
=="somevalue"; $check_result=1; break; }
default: $check_result = 0;
}
return $check_result;
}
function show_login() {
// show login form content here;
}
function show_content() {
// show admin page and menu here
}
//
// $_SESSION["mytoken"] = "somevalue"; // adds a variable into your session.
//
// to manage session set token when user logs in with a valid userid and
password
// there is obviously more involved to build an inventory management system
but
// this will get you started.
//
// check if login

check_login();

if( array_key_exists("mytoken",$_SESSION) and $_SESSION["mytoken"] ==
"somevalue") {
// show admin menu and content;
show_content();
} else {
// show login screen;
show_login();
}
?>

Hope this helps.

Joseph Melnick
JM Web Consultants
http://www.jphp.com/


"paul" <paul@not.net> wrote in message
news:LcidnVnXvrQhzTrfRVn-vA@speakeasy.net...
> paul wrote:
>>
>> I've done some php & html & would like to maintain this & add features
>> over time but I've not done SQL, only MS Access.
>
> PS I've also not tried managing sessions with login, etc. Here's the
> extent of my php experience: http://www.edgehill.net/1/ a photo gallery
> which has several pages of code mostly developed over a few months from a
> couple of community college programming classes. I've done a bit of fairly
> amateur AutoLISP scripts for CAD drafting over the years.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация