Re: [PHP-DB] Retricting Access to Menu Items
Miguel, Take this tips: Before load your html main tags put: . ? session_start(); $person = array (); $person['firstname']=Jhon; $person['lastname']=Doe; $_SESSION['person'] = $person; ? html /html . Then try get the person array from another php page, using the same schema for that. Regards, Luis Morales On Mon, 2006-03-06 at 21:32 -0800, MIGUEL ANTONIO GUIRAO AGUILAR wrote: Now that you mention it!! I tried to use sessions but without success, i did: session_start(); session_register(var); but after log in as a different user, it keeps taking the data of the previous user. If I close the browser window and reload the page and log in, then it takes de current user Maybe I'm not killing the previous session! session_unset(); Do I need to propagate the Session ID on every page that use session_start()?? Can I use session_id();? Best Regards, Miguel Guirao - Mensaje original - De: Jeffrey [EMAIL PROTECTED] Fecha: Lunes, Marzo 6, 2006 7:37 ombr Asunto: Re: [PHP-DB] Retricting Access to Menu Items I've done this kind of thing with a number of web apps. What I usually do is create a user table in MySQL with a user-name, password and access level, which has an integer value. When a user logs in successfully, a session is created (see session_start() in php documentation), the access level is pulled from the user table and saved as a session variable. Then it is a simple matter of using bits of code like... if ($_SESSION['access_level'] 7){ echo some stuff; } In your example, you will also want to check the user's access level on each restricted page - it is not enough to hide menu options. Users could simply type the URL in. I hope that's clear. Good luck, Jeffrey Jeff Broomall wrote: Good morning everyone. I'm building a very simple content management site that tracks tasks. The options available are: 1. Add Task 2. Edit Task 3. View Task 4. Print Task I need to restrict some users to only View and Print and I'm trying to find a way to tell the page not to load the menu options (the text) for those not having access to the Add and Edit functions. IOW, they would only see View and Print. I have three basic users: 1. System Admin 2. Subject Matter Expert (SME) 3. Viewers Obviously the System Admin and SME will have full access so it's the Viewers that are to have access to only View and Print. I have a users table but haven't set it up for the distinction. What I was thinking was creating a field labeled users_group and assign a numeric value for each user using the numbering system above. I have my page load the menu options: Homebr / View Tasksbr / Edit Taskbr / Add Taskbr / into here... BODY table width=90% border=1 cellspacing=10 cellpadding=0 align=center trtd colspan=2h1 id=mainheadICAO Tasks #8212; WAFS/h1/td/tr tr td align= center valign=top nowrap=nowrap width=10% Menubr / ?php include ('./includes/menu.html'); ? --The menu above inserted here. /td td valign=top class=content How can I tell the system not to load the last two lines unless they are a System Admin or SME? I read a chapter on Cookies/Sessions...but it wasn't that helpful for this case. Can I setcookie('user_group', '3') and use that somehow??? Am I in the ballpark with this solution? Thanks. Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the
RE: [PHP-DB] Help needed creating a social network
Thanks for the reply. However, that only gives me a single degree. I'm looking for the way to traverse a 'tree' to see who is in your extended networks, so I can do things like: You are 4 degrees away from Sam: You know bob who knows john who knows carrol who knows Sam. Sam - carrol - john - bob - you Etc. -Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 10:28 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Help needed creating a social network CREATE TABLE `users` (userID int(11) not null auto_increment, primary key(userID), name tinytext not null, email tinytext not null); CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), key(friendID)); ?php $friends = mysql_query(select users.name, users.userID from users left join links on links.friendID = users.userID where links.userID = {$_GET['userID']}); echo h1You have friends!!/h1; while ($f = mysql_fetch_assoc($friends)) { echo a href='socialnetwork.php?userID={$f['userID']}'{$f['name']}/a br\n; } publish(); profit($greatly); do (!$use) { coldfusion('Cause it sucks'); } ? (har har) On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: Anyone have some pointers at a HowTo on creating a social network? Basically I need to show people in your immediate network, and also friends of your friends, etc... Like the whole 'six degrees of separation' thing. Ala: myspace, friendster, etc. ad nauseum. I prefer mySQL and PHP, but I could port from most any code. I guess I'm mostly interested in the theory of this an how do I set up the tables properly and what is the magic incantation (JOIN) to get this chain of people. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Retricting Access to Menu Items
session_register is old method...$_SESSION['var'] is the better way. You will still need session_start(); at the top of the page bastien From: MIGUEL ANTONIO GUIRAO AGUILAR [EMAIL PROTECTED] To: Jeffrey [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: Re: [PHP-DB] Retricting Access to Menu Items Date: Mon, 06 Mar 2006 21:32:59 -0800 Now that you mention it!! I tried to use sessions but without success, i did: session_start(); session_register(var); but after log in as a different user, it keeps taking the data of the previous user. If I close the browser window and reload the page and log in, then it takes de current user Maybe I'm not killing the previous session! session_unset(); Do I need to propagate the Session ID on every page that use session_start()?? Can I use session_id();? Best Regards, Miguel Guirao - Mensaje original - De: Jeffrey [EMAIL PROTECTED] Fecha: Lunes, Marzo 6, 2006 7:37 ombr Asunto: Re: [PHP-DB] Retricting Access to Menu Items I've done this kind of thing with a number of web apps. What I usually do is create a user table in MySQL with a user-name, password and access level, which has an integer value. When a user logs in successfully, a session is created (see session_start() in php documentation), the access level is pulled from the user table and saved as a session variable. Then it is a simple matter of using bits of code like... if ($_SESSION['access_level'] 7){ echo some stuff; } In your example, you will also want to check the user's access level on each restricted page - it is not enough to hide menu options. Users could simply type the URL in. I hope that's clear. Good luck, Jeffrey Jeff Broomall wrote: Good morning everyone. I'm building a very simple content management site that tracks tasks. The options available are: 1. Add Task 2. Edit Task 3. View Task 4. Print Task I need to restrict some users to only View and Print and I'm trying to find a way to tell the page not to load the menu options (the text) for those not having access to the Add and Edit functions. IOW, they would only see View and Print. I have three basic users: 1. System Admin 2. Subject Matter Expert (SME) 3. Viewers Obviously the System Admin and SME will have full access so it's the Viewers that are to have access to only View and Print. I have a users table but haven't set it up for the distinction. What I was thinking was creating a field labeled users_group and assign a numeric value for each user using the numbering system above. I have my page load the menu options: Homebr / View Tasksbr / Edit Taskbr / Add Taskbr / into here... BODY table width=90% border=1 cellspacing=10 cellpadding=0 align=center trtd colspan=2h1 id=mainheadICAO Tasks WAFS/h1/td/tr tr td align= center valign=top nowrap=nowrap width=10% Menubr / ?php include ('./includes/menu.html'); ? --The menu above inserted here. /td td valign=top class=content How can I tell the system not to load the last two lines unless they are a System Admin or SME? I read a chapter on Cookies/Sessions...but it wasn't that helpful for this case. Can I setcookie('user_group', '3') and use that somehow??? Am I in the ballpark with this solution? Thanks. Jeff -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Este mensaje es exclusivamente para el uso de la persona o entidad a quien esta dirigido; contiene informacion estrictamente confidencial y legalmente protegida, cuya divulgacion es sancionada por la ley. Si el lector de este mensaje no es a quien esta dirigido, ni se trata del empleado o agente responsable de esta informacion, se le notifica por medio del presente, que su reproduccion y distribucion, esta estrictamente prohibida. Si Usted recibio este comunicado por error, favor de notificarlo inmediatamente al remitente y destruir el mensaje. Todas las opiniones contenidas en este mail son propias del autor del mensaje y no necesariamente coinciden con las de Radiomovil Dipsa, S.A. de C.V. o alguna de sus empresas controladas, controladoras, afiliadas y subsidiarias. Este mensaje intencionalmente no contiene acentos. This message is for the sole use of the person or entity to whom it is being sent. Therefore, it contains strictly confidential and legally protected material whose disclosure is subject to penalty by law. If the person reading this message is not the one to whom it is being sent and/or is not an employee or the responsible agent for this information, this person is herein notified that any unauthorized dissemination, distribution or copying of the materials included in this facsimile is strictly prohibited. If you received this document by mistake please notify immediately to the subscriber and destroy the message. Any opinions contained in this
RE: [PHP-DB] Help needed creating a social network
My first thought was recursion - repeat the call for each element of the result set, numbering each so you can find each level, until nothing is returned. That would probably work, but oh, what a mess. That triggered something ... off to consult Joe Celko's SQL for Smarties. He has a whole chapter on Trees, and guess what: they're not easily done in relational databases. To try and condense it here would be, shall we say, impractical. Check with a library, or try googling for trees -- hey, look what turned up: http://www.dbmsmag.com/9603d06.html by JC himself. Have fun - Miles Thompson At 03:19 PM 3/7/2006, Daevid Vincent wrote: Thanks for the reply. However, that only gives me a single degree. I'm looking for the way to traverse a 'tree' to see who is in your extended networks, so I can do things like: You are 4 degrees away from Sam: You know bob who knows john who knows carrol who knows Sam. Sam - carrol - john - bob - you Etc. -Original Message- From: Micah Stevens [mailto:[EMAIL PROTECTED] Sent: Monday, March 06, 2006 10:28 PM To: php-db@lists.php.net Subject: Re: [PHP-DB] Help needed creating a social network CREATE TABLE `users` (userID int(11) not null auto_increment, primary key(userID), name tinytext not null, email tinytext not null); CREATE TABLE `links` (userID int(11), key (userID), friendID int(11), key(friendID)); ?php $friends = mysql_query(select users.name, users.userID from users left join links on links.friendID = users.userID where links.userID = {$_GET['userID']}); echo h1You have friends!!/h1; while ($f = mysql_fetch_assoc($friends)) { echo a href='socialnetwork.php?userID={$f['userID']}'{$f['name']}/a br\n; } publish(); profit($greatly); do (!$use) { coldfusion('Cause it sucks'); } ? (har har) On Monday 06 March 2006 9:47 pm, Daevid Vincent wrote: Anyone have some pointers at a HowTo on creating a social network? Basically I need to show people in your immediate network, and also friends of your friends, etc... Like the whole 'six degrees of separation' thing. Ala: myspace, friendster, etc. ad nauseum. I prefer mySQL and PHP, but I could port from most any code. I guess I'm mostly interested in the theory of this an how do I set up the tables properly and what is the magic incantation (JOIN) to get this chain of people. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 268.2.0/275 - Release Date: 3/6/2006 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] new comer
beginner from China BeiJing test if my outlook maillist can work -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] test
new comer from China test -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php