Re: Weird problem (groupcheck)
- From: "Bertman" <Bertman@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 23 May 2005 10:48:13 +0200
Hello,
I found what's wrong, but now I need a sollution.
In the directory 'root\login' is also where the cookie is created. The
cookie is only active for this directory. But I want the cookie to be active
for the complete website, from root to the lowest directory. But when I put
a webaddress in the setcookie function it doesn't set a cookie
For explample (form php.net)
setcookie ("TestCookie", "test",time()+3600, "/~rasmus/", ".utoronto.ca",
1);
"Bertman" <Bertman@xxxxxxxxxxxxxxxxxx> schreef in bericht
news:f6Gdnar3xYMcIhLfRVnyvQ@xxxxxxxxxxxxx
> Hello,
>
>
>
> I want to check an array, that's not the biggest problem. But now I'm
> having a real weird situation. I have a file 'checklogin.php' this file
> put all the groups where a user is member off in a array ($usergroups). I
> have a simple file to test it 'test.php'. When I put 'test.php' in the
> 'root\login' directory he will say exactly that I'm member off 2 groups
> (after I logged in). But when I put 'test.php' in the 'root', he will say
> that i'm member off 1 group. And when I put 'checklogin.php' in the root,
> he also will say that i'm member off one group. It's pretty weird, because
> the files don't have a path to other files except to 'incl\connect.php'
> (this file will make a connection to my MySQL database)
>
>
>
> Example below:
>
> root\login\test1.php
>
> - this one will say that i'm member off 2 groups
>
> root\test.php
>
> - this one will say that i'm member off 1 group
>
>
>
> (root = top of the server)
>
> root\login\checklogin.php
>
> root\login\test1.php
>
> root\test.php
>
>
> # test.php
> <?PHP
> include 'include\connect.php';
> include 'login\checklogin.php';
> echo count($usergroups);
> ?>
>
> # test1.php
> <?PHP
> include '..\include\connect.php';
> include 'checklogin.php';
> echo count($usergroups);
> ?>
>
> # checklogin.php
> <?php
> if (isset($_COOKIE["UserID"])) {
> if (isset($_COOKIE["Name"])) {
> if (isset($_COOKIE["Pass"])) {
> $userid = $_COOKIE["UserID"];
> $name = $_COOKIE["Name"];
> $pass = $_COOKIE["Pass"];
> $query = mysql_query("SELECT * FROM cd_user WHERE User_loginname='$name'
> AND User_password='$pass' AND User_id='$userid'") or die (mysql_error());
> if (mysql_num_rows($query)=='0') {
> $usergroup='0'; // 0 zijn public groepen
> $usergroups='0';
> $name='';
> } else { # mysql_num_rows($query)=='0'
> $usergroups='';
> $count='0';
> while($result = mysql_fetch_array($query)){
> $userid = $result["User_id"];
> $query1 = mysql_query("SELECT * FROM cd_user_and_group WHERE
> User_id='$userid'") or die (mysql_error());
> while($result1 = mysql_fetch_array($query1)){
> $usergroups[$count] = $result1["Group_id"]; //Maak een array aan met
> alle group nummers
> $count = $count + 1;
> }
> }
> } # mysql_num_rows($query)=='0'
> }else{
> //Pass not set.
> $usergroup='0'; // 0 zijn public groepen
> $usergroups='0';
> $name='';
> }
> }else{
> //name not set.
> $usergroup='0'; // 0 zijn public groepen
> $usergroups='0';
> $name='';
> }
> }else{
> //userid not set.
> $usergroup='0'; // 0 zijn public groepen
> $usergroups='0';
> $name='';
> }
> ?>
>
.
- Follow-Ups:
- Re: Weird problem (groupcheck)
- From: Bertman
- Re: Weird problem (groupcheck)
- References:
- Weird problem (groupcheck)
- From: Bertman
- Weird problem (groupcheck)
- Prev by Date: Weird problem (groupcheck)
- Next by Date: Re: Weird problem (groupcheck)
- Previous by thread: Weird problem (groupcheck)
- Next by thread: Re: Weird problem (groupcheck)
- Index(es):
Relevant Pages
|