HighDots Forums  

keeping track of user login, con't.

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss keeping track of user login, con't. in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
melissa
 
Posts: n/a

Default keeping track of user login, con't. - 08-02-2004 , 11:01 AM






I would like to keep track of who is logging in (cookie) and what pages they
go to, what files they download would be an added bonus. (php/MySQL)

I don't understand the code for how to insert the information into a
database table.

My tracking database table (userData) has the following fields: userID,
pageVisited, filesDownloaded

the pages these people will be using already has accessLevel code on each
page:

<?php
if(!isset($HTTP_COOKIE_VARS['levelCookie'])){
header("Location: secure.php");
} else {
if($HTTP_COOKIE_VARS['levelCookie'] < 2){
header("Location: secure.php");
}
}
?>

can someone help me with an example of how the code would work for inserting
this data into a table?

thanks!!

__________________________________________________ __
Specifically, what do want to track regarding user logins - last login
date/time? number of time user has logged in? something else?

To track who has downloaded what files, create a userDownloads table and
everytime some downloads a file write a record inserting the userID and
fileID.

"melissa" <melissa (AT) maddesignusa (DOT) com> wrote

Quote:
yes, they are logged in that way, I am just not sure HOW to track them
with
that? how do i dump that info into a database? some sort of hidden input
record form?



Reply With Quote
  #2  
Old   
Joe {RoastHorse}
 
Posts: n/a

Default Re: keeping track of user login, con't. - 08-02-2004 , 11:05 AM






change your tables:

userData:
UserID

visitData:
UserID
URL
DateTime

assuming that your login script stores the userid in a cookie or session
variable, change your php (pseudo-code):

<?php
if(!isset($HTTP_COOKIE_VARS['levelCookie'])){
header("Location: secure.php");
} else {
if($HTTP_COOKIE_VARS['levelCookie'] < 2){
header("Location: secure.php");
}
}
// connect to db;
// INSERT INTO visitData (UserID,URL,DateTime) VALUES
($userid,$_SERVER["PHP_SELF"],now());
// close db connection;
?>

more help:
http://dev.mysql.com/doc/mysql/en/INSERT.html
http://us2.php.net/manual/en/ref.mysql.php

joe







melissa wrote:

Quote:
I would like to keep track of who is logging in (cookie) and what pages they
go to, what files they download would be an added bonus. (php/MySQL)

I don't understand the code for how to insert the information into a
database table.

My tracking database table (userData) has the following fields: userID,
pageVisited, filesDownloaded

the pages these people will be using already has accessLevel code on each
page:

?php
if(!isset($HTTP_COOKIE_VARS['levelCookie'])){
header("Location: secure.php");
} else {
if($HTTP_COOKIE_VARS['levelCookie'] < 2){
header("Location: secure.php");
}
}
?

can someone help me with an example of how the code would work for inserting
this data into a table?

thanks!!

__________________________________________________ __
Specifically, what do want to track regarding user logins - last login
date/time? number of time user has logged in? something else?

To track who has downloaded what files, create a userDownloads table and
everytime some downloads a file write a record inserting the userID and
fileID.

"melissa" <melissa (AT) maddesignusa (DOT) com> wrote in message
news:ce835b$j87$1 (AT) forums (DOT) macromedia.com...

yes, they are logged in that way, I am just not sure HOW to track them

with

that? how do i dump that info into a database? some sort of hidden input
record form?




Reply With Quote
  #3  
Old   
melissa
 
Posts: n/a

Default Re: keeping track of user login, con't. - 08-02-2004 , 03:22 PM



ok.....here is what i have come up with.....if i echo the $user and the
$page, they show up, but nothing is being placed into the database..

i think that i need some kind of "execute this" statement, but haven't a
clue as to where it goes.

<?php require_once('../Connections/atricure.php'); ?>
<?php {
$user = $_COOKIE['acCookie']; //gets user name
$page = $_SERVER['SCRIPT_FILENAME']; // gets current url
$sql = "INSERT INTO visitData (userID, URL, DateTime) VALUES ($user, $page,
now())";
}
?>

"Joe {RoastHorse}" <joe (AT) roast-horse (DOT) commmmm> wrote

Quote:
change your tables:

userData:
UserID

visitData:
UserID
URL
DateTime

// connect to db;
// INSERT INTO visitData (UserID,URL,DateTime) VALUES
($userid,$_SERVER["PHP_SELF"],now());
// close db connection;
?

more help:
http://dev.mysql.com/doc/mysql/en/INSERT.html
http://us2.php.net/manual/en/ref.mysql.php

joe







melissa wrote:

I would like to keep track of who is logging in (cookie) and what pages
they
go to, what files they download would be an added bonus. (php/MySQL)

I don't understand the code for how to insert the information into a
database table.

My tracking database table (userData) has the following fields: userID,
pageVisited, filesDownloaded

the pages these people will be using already has accessLevel code on
each
page:

?php
if(!isset($HTTP_COOKIE_VARS['levelCookie'])){
header("Location: secure.php");
} else {
if($HTTP_COOKIE_VARS['levelCookie'] < 2){
header("Location: secure.php");
}
}
?

can someone help me with an example of how the code would work for
inserting
this data into a table?

thanks!!

__________________________________________________ __
Specifically, what do want to track regarding user logins - last login
date/time? number of time user has logged in? something else?

To track who has downloaded what files, create a userDownloads table and
everytime some downloads a file write a record inserting the userID and
fileID.

"melissa" <melissa (AT) maddesignusa (DOT) com> wrote in message
news:ce835b$j87$1 (AT) forums (DOT) macromedia.com...

yes, they are logged in that way, I am just not sure HOW to track them

with

that? how do i dump that info into a database? some sort of hidden
input
record form?






Reply With Quote
  #4  
Old   
melissa
 
Posts: n/a

Default Re: keeping track of user login, con't. - 08-02-2004 , 04:50 PM



ok, now i have the code working to put the information into the database,
but can't get the date/time to work

<?
$user = $_COOKIE['acCookie'];
$page = $_SERVER['SCRIPT_FILENAME']; // gets current url

mysql_query ("INSERT INTO visitData (userID, URL, DateTime) VALUES
('$user','$page','now()')");

?>

any ideas?



Reply With Quote
  #5  
Old   
melissa
 
Posts: n/a

Default Re: keeping track of user login, con't. - 08-02-2004 , 05:33 PM



Nevermind...got it.

my final code is:

<?
$user = $_COOKIE['acCookie'];
$page = $_SERVER['SCRIPT_FILENAME']; // gets current url
$dateNow = date('Y-m-d H:i:s');
mysql_query ("INSERT INTO visitData (userID, URL, DateTime) VALUES
('$user','$page','$dateNow')");
?>

"melissa" <melissa (AT) maddesignusa (DOT) com> wrote

Quote:
ok, now i have the code working to put the information into the database,
but can't get the date/time to work

?
$user = $_COOKIE['acCookie'];
$page = $_SERVER['SCRIPT_FILENAME']; // gets current url

mysql_query ("INSERT INTO visitData (userID, URL, DateTime) VALUES
('$user','$page','now()')");

?

any ideas?





Reply With Quote
  #6  
Old   
Joe {RoastHorse}
 
Posts: n/a

Default Re: keeping track of user login, con't. - 08-03-2004 , 06:03 AM



now() is not a string (it's a mysql function). your query should be:

mysql_query ("INSERT INTO visitData (userID, URL, DateTime) VALUES
('$user','$page',now())");

but your solution (php date) works just as well.

joe




melissa wrote:

Quote:
ok, now i have the code working to put the information into the database,
but can't get the date/time to work

?
$user = $_COOKIE['acCookie'];
$page = $_SERVER['SCRIPT_FILENAME']; // gets current url

mysql_query ("INSERT INTO visitData (userID, URL, DateTime) VALUES
('$user','$page','now()')");

?

any ideas?



Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.