ok I just installed version 4.1.2 of the win32 binaries for my test machine. talk about different. I tried to copy the php.ini file like the old one but I am missing something.
I finally got sessions working because the register_globals was off. so now that it working like it should, write a session and input the correct variables.
so what the problem is you ask? well I have read something about sessions in the new version but can't remember what it was. I don't think it is reading the session like it should after it is already set. if I run though my site and submit a file it is suppose to take me back to the members page as a member, but it takes me back to the login page. seems like the session id is changeing but I don't see it changing. I thought isset() works fine and it does the first time around, but after I submit something it doesn't read it. anybody have any clues on this that I am missing?
thank I love this forum and you guys are the greatest. lol Hmm..sounds odd. You got a snippet of the code to look at?
Here's some basic session handling code that should work:<?php
session_start();
$session_var = "I like a good session in the pub";
session_register("session_var");
?>This registers the variable session_var as a session variable. As long as you call the session_start() function on all pages You should have access to that variable.<?php
session_start();
print $session_var;
?>Should display the contents of session_varand that is the way I have it. but this is what I found out.
if you try to check to see if the variable is set you normally do this.
if (isset($variable)){
}
but now that works the first time though. once the user gets redirected to the members page the isset doesn't work anymore. I had to change it to
if (isset($_SESSION['variable'])){
}
even session_is_registered() doesn't work in the new version. strange indeed as it seems php is not becoming backwards compatible.Hey look! Whaddya know? It's a known problem:
<!-- m --><a class="postlink" href="http://www.zend.com/lists/php-dev/200203/msg00065.htmlI">http://www.zend.com/lists/php-dev/200203/msg00065.htmlI</a><!-- m --> will check to see if somebody has already and then I will.
but it works fine in a *nix environment so it is only a win32 problem.Originally posted by torrent
Hey look! Whaddya know? It's a known problem:
<!-- m --><a class="postlink" href="http://www.zend.com/lists/php-dev/200203/msg00065.html">http://www.zend.com/lists/php-dev/200203/msg00065.html</a><!-- m -->
that's just it. the same code I have used in the past works on a unix machine. it just won't work on a win32 machine. I have changed it to the $_SESSION([variable]) and it won't work on a *nix machine, only a win32 environment. so there is something messedup in the works at php.
I have submitted the bug, also noticed there has been a lot of issues surrounding session problems, mostly on win2000/XP machines.
maybe you can try it out and see if it works on your too, or not. add / change what you need to but make sure it writes teh session and the variables. don't forget to add a login page. then add another page so you can go to it and get redirected back to the member page. see if it goes to the login page. no hurry just whenever you get a chance.
//if (isset($_SESSION['username'])) {
if (isset($username)){
//if (!isset($_SESSION['passw2'])){
if (!isset($passw2)){
$pass = md5($pass);
$sql = "select userid, name, pass from $usr_tbl where name =
'$username'";
$result_check = mysql_query ($sql);
$num_check = mysql_num_rows($result_check);
while ($row = mysql_fetch_array($result_check))
{
$name= $row["name"];
$userid= $row["userid"];
$passw2 = $row["pass"];
}
session_register('userid','username','passw2');
}
//start members page here
}else{
//login page here.
}Yeah, I think I'll check it as I'd be interested to see if it works on my WinXP server.
Gotta finish that array tut first though hey Torrent, and anybody else that is reading.
they told me
The bug system is not the appropriate forum for asking support questions. For a list of a range of more appropriate places to ask for help using PHP, please visit <!-- m --><a class="postlink" href="http://www.php.net/support.php">http://www.php.net/support.php</a><!-- m -->
well I showed them... he then told me to update to 4.2.0RC4
and it works like a charm. hmmmm what do you think. you can read it here.
<!-- m --><a class="postlink" href="http://bugs.php.net/bug.php?id=16625&thanks=2">http://bugs.php.net/bug.php?id=16625&thanks=2</a><!-- m -->
also the register Globals is being turned off and if you use post or get it will not recieve the variables the form sends. so I am off to redo my whole site. but it will be better than before. I saw the bug report and also saw that someone had responded saying they had the same problem with 4.2.0RC4, glad to thear that's not the case. I knoew about the GLOBALS being off as that was one of the security enhancements. It just means you need to reference those vars with the $HTTP_GET_VARS and $HTTP_POST_VARS. In truth that is the way they always should have been referenced but someo fo us took..um..short cuts.
My site is in for a total redesign this Summer (that's the cool thing about a ski site, it's seasonal). I'll make the changes then.
Want to the know the odd thing though? My host is running 4.1.2 and my site is working perfectly without any changes. Strange.
Thanks for the update.my host was the same. they updated to 4.1.2 runing FreeBSD and I didn't have any problems with my code. they also turned on upoads last night so it is ready to go when you are. I put a short one up in the php / database section of the tutorials so check it out and see if that is cool or what.
also instead of $HTTP_GET_VARS and $HTTP_POST_VARS you can use $_POST[variable] and $_GET[varaiable] for the same. also $_REQUEST[variable] will do both of them.Yep, the $_GET,POST, whatever is another way to receive the info. Probably better as well because it's shorter.
The tutorial is all done bar the Glossary and proof-reading.
You can see a preview <!-- m --><a class="postlink" href="http://www.ski-info-online.com/htmlforums/">http://www.ski-info-online.com/htmlforums/</a><!-- m -->
Btw, I get a 404 error when trying to access your tutorial.ahh thanks for spotting that. I changed it but forgot to upload it. silly me. it is all better.
very good on that tutorial.
one question
print substr(implode(', ', $csv), 0);
watch out for that. "'" should be with "'s
print substr(implode("'", $csv), 0);Hmm..don't know what you mean. All the samples in the tutorial have been tested and work as expected. The list is comma delimited and the first part of the implode() states the delimiter. In this case a , so ', ' does work.
Is this what you meant?ohhhhh crap.... I see it is ',' instead of ', ', it just looked funny. I need a vacation.......
sorry you are right...LOL np, you had me worried for a mo.
I finally got sessions working because the register_globals was off. so now that it working like it should, write a session and input the correct variables.
so what the problem is you ask? well I have read something about sessions in the new version but can't remember what it was. I don't think it is reading the session like it should after it is already set. if I run though my site and submit a file it is suppose to take me back to the members page as a member, but it takes me back to the login page. seems like the session id is changeing but I don't see it changing. I thought isset() works fine and it does the first time around, but after I submit something it doesn't read it. anybody have any clues on this that I am missing?
thank I love this forum and you guys are the greatest. lol Hmm..sounds odd. You got a snippet of the code to look at?
Here's some basic session handling code that should work:<?php
session_start();
$session_var = "I like a good session in the pub";
session_register("session_var");
?>This registers the variable session_var as a session variable. As long as you call the session_start() function on all pages You should have access to that variable.<?php
session_start();
print $session_var;
?>Should display the contents of session_varand that is the way I have it. but this is what I found out.
if you try to check to see if the variable is set you normally do this.
if (isset($variable)){
}
but now that works the first time though. once the user gets redirected to the members page the isset doesn't work anymore. I had to change it to
if (isset($_SESSION['variable'])){
}
even session_is_registered() doesn't work in the new version. strange indeed as it seems php is not becoming backwards compatible.Hey look! Whaddya know? It's a known problem:
<!-- m --><a class="postlink" href="http://www.zend.com/lists/php-dev/200203/msg00065.htmlI">http://www.zend.com/lists/php-dev/200203/msg00065.htmlI</a><!-- m --> will check to see if somebody has already and then I will.
but it works fine in a *nix environment so it is only a win32 problem.Originally posted by torrent
Hey look! Whaddya know? It's a known problem:
<!-- m --><a class="postlink" href="http://www.zend.com/lists/php-dev/200203/msg00065.html">http://www.zend.com/lists/php-dev/200203/msg00065.html</a><!-- m -->
that's just it. the same code I have used in the past works on a unix machine. it just won't work on a win32 machine. I have changed it to the $_SESSION([variable]) and it won't work on a *nix machine, only a win32 environment. so there is something messedup in the works at php.
I have submitted the bug, also noticed there has been a lot of issues surrounding session problems, mostly on win2000/XP machines.
maybe you can try it out and see if it works on your too, or not. add / change what you need to but make sure it writes teh session and the variables. don't forget to add a login page. then add another page so you can go to it and get redirected back to the member page. see if it goes to the login page. no hurry just whenever you get a chance.
//if (isset($_SESSION['username'])) {
if (isset($username)){
//if (!isset($_SESSION['passw2'])){
if (!isset($passw2)){
$pass = md5($pass);
$sql = "select userid, name, pass from $usr_tbl where name =
'$username'";
$result_check = mysql_query ($sql);
$num_check = mysql_num_rows($result_check);
while ($row = mysql_fetch_array($result_check))
{
$name= $row["name"];
$userid= $row["userid"];
$passw2 = $row["pass"];
}
session_register('userid','username','passw2');
}
//start members page here
}else{
//login page here.
}Yeah, I think I'll check it as I'd be interested to see if it works on my WinXP server.
Gotta finish that array tut first though hey Torrent, and anybody else that is reading.
they told me
The bug system is not the appropriate forum for asking support questions. For a list of a range of more appropriate places to ask for help using PHP, please visit <!-- m --><a class="postlink" href="http://www.php.net/support.php">http://www.php.net/support.php</a><!-- m -->
well I showed them... he then told me to update to 4.2.0RC4
and it works like a charm. hmmmm what do you think. you can read it here.
<!-- m --><a class="postlink" href="http://bugs.php.net/bug.php?id=16625&thanks=2">http://bugs.php.net/bug.php?id=16625&thanks=2</a><!-- m -->
also the register Globals is being turned off and if you use post or get it will not recieve the variables the form sends. so I am off to redo my whole site. but it will be better than before. I saw the bug report and also saw that someone had responded saying they had the same problem with 4.2.0RC4, glad to thear that's not the case. I knoew about the GLOBALS being off as that was one of the security enhancements. It just means you need to reference those vars with the $HTTP_GET_VARS and $HTTP_POST_VARS. In truth that is the way they always should have been referenced but someo fo us took..um..short cuts.
My site is in for a total redesign this Summer (that's the cool thing about a ski site, it's seasonal). I'll make the changes then.
Want to the know the odd thing though? My host is running 4.1.2 and my site is working perfectly without any changes. Strange.
Thanks for the update.my host was the same. they updated to 4.1.2 runing FreeBSD and I didn't have any problems with my code. they also turned on upoads last night so it is ready to go when you are. I put a short one up in the php / database section of the tutorials so check it out and see if that is cool or what.
also instead of $HTTP_GET_VARS and $HTTP_POST_VARS you can use $_POST[variable] and $_GET[varaiable] for the same. also $_REQUEST[variable] will do both of them.Yep, the $_GET,POST, whatever is another way to receive the info. Probably better as well because it's shorter.
The tutorial is all done bar the Glossary and proof-reading.
You can see a preview <!-- m --><a class="postlink" href="http://www.ski-info-online.com/htmlforums/">http://www.ski-info-online.com/htmlforums/</a><!-- m -->
Btw, I get a 404 error when trying to access your tutorial.ahh thanks for spotting that. I changed it but forgot to upload it. silly me. it is all better.
very good on that tutorial.
one question
print substr(implode(', ', $csv), 0);
watch out for that. "'" should be with "'s
print substr(implode("'", $csv), 0);Hmm..don't know what you mean. All the samples in the tutorial have been tested and work as expected. The list is comma delimited and the first part of the implode() states the delimiter. In this case a , so ', ' does work.
Is this what you meant?ohhhhh crap.... I see it is ',' instead of ', ', it just looked funny. I need a vacation.......
sorry you are right...LOL np, you had me worried for a mo.