PHP4 Sessions And Arrays
I'm currently working on a PHP4/MySQL generic shopping cart project, but I am having problems with the cart section. At present, my 'add one item to cart' function works using sessions and arrays, something like: PHP Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Sessions Without Cookes In Php4
I need to use php sessions without cookies, my session registers works perfect, but I really don't know how to use an expiration time as it is used with cookies. Do you know what can I do to use an expiration time of 15 minutes??. I've tried using mysql to save the session ID's and check there if the sessoin is already registered and how long it has been inactive to see if it's an accepted time, but it really uses a lot of resources just to check. And if you have a lot of visitors at your page your machine almost die. Other thing is that the session Id's keeps saved in my /tmp and are never deleted if you don't do a logout where I use the destroy code.
View Replies !
Sessions Not Returning Anything? - NT - Php4
I use php4 on PWS NT workstation. I use the basic session example in the php docs, the e-commerce tut on devshed and the origional example from devshed(couch sessions) and no luck. I get a page, yet when I view source - nothing after the body tag? Is there a module I have to uncomment in php.ini or something I have to download? I have tried viewing from another machine and multiple browsers.
View Replies !
PHP4+Win98 And Sessions
I've tried PHP4build4, RC1, RC2 and 4.0.0 with Win98 but sessions doesn't work: I've got 2 pages: first_page.php3 <? session_start(); $myvar="test"; session_register("myvar");?> second_page.php3 <? session_start(); echo $myvar; ?> I've launched first_page.php3, then I've launched second_page.php3: the browser doesn't display anything (it should display the world "test").
View Replies !
Php4+apache1.3+xp With Sessions Not Working...
I seem to have a major problem with sessions on my setup. No simple example seems to work. Example below: page1.php: <?php // page1.php session_start(); echo 'Welcome to page #1' $_SESSION['favcolor'] = 'green' $_SESSION['animal'] = 'cat' $_SESSION['time'] = time(); // Works if session cookie was accepted echo '<br /><a href="page2.php">page 2</a>' // Or maybe pass along the session id, if needed echo '<br /><a href="page2.php?' . SID . '">page 2</a>' ?> Page2.php: <?php // page2.php session_start(); echo 'Welcome to page #2<br />' echo $_SESSION['favcolor']; // green echo $_SESSION['animal']; // cat echo date('Y m d H:i:s', $_SESSION['time']); // You may want to use SID here, like we did in page1.php echo '<br /><a href="page1.php">page 1</a>' ?> Output after pressing page2 link: Welcome to page #2 1970 01 01 00:00:00 page 1
View Replies !
Possible For Sessions To Work Under PHP5 And Not Under PHP4.
I'm writing an web application with PHP/MySQL. I used PHP5 but believed to use code that would work also under PHP4. However when I tried my application under PHP4 I got the warning that the headers are already sent and my session did not work. I do understand that I have to send the headers before anything else. But does anyone know what kind of difference between PHP4 and PHP5 makes it possible for sessions to work under PHP5 and not under PHP4.
View Replies !
SESSIONs And Arrays
How can I store newly entered variables to a SESSION, but when the same process is repeated, e.g. a shopping cart, the variables are stored to the same SESSION array, but in a new index. I have assumed so far that I used a SESSION similar to a page view count SESSION and use that as an index reference, e.g. $_SESSION['products']['$id'] = $variablename;
View Replies !
Arrays In Sessions
I have a button at the bottom of the page for clearing the lightbox using this code (sessionDbTest4 is the current file): PHP Code: echo "<form action='sessionDbTest4.php' method='get'> Â Â Â Â Â Â <input type='hidden' name='clear' value='true'> Â Â Â Â Â Â <input type='submit' value='Clear Cart'> Â Â Â Â Â Â </form>";.
View Replies !
Sessions & Multi Arrays
I have this problem and its driving me around the bend. I cant work out at all whats going on. function session_create_guest() { $_SESSION['userinfo']['email_address'] = "guest"; $_SESSION['userinfo']['userlevel'] = "0"; $_SESSION['userinfo']['ip'] = "{$_SERVER['REMOTE_ADDR']}"; $_SESSION['userinfo']['session_time_start'] = time(); $_SESSION['userinfo']['session_time_lastactive'] = time(); } I have this function above which i am using to store basic info for a user when logged in. here is the problem:- i notice that if i use the varible $userinfo anywhere in my coding it automatically inserts the value into the session array?
View Replies !
Creating User Sessions W/out Using Sessions
I'm working on a user management system where I can use the benefits of PHP sessions w/out messing with them. Basically, my idea is to have an entry created into a "sessions table" when the user logs in. The table contains such info as the user's id number and the date/time they logged in. When the user logs out, the entry is deleted. In each page/script, it checks to see if the user is logged in by checking the sessions table for an entry w/their IP address and the date, to make sure it is fairly current (unless anyone can think of a better way to check). Now my delema....obviously, I don't want people that don't properly log out to have a session that could last weeks (depending on when they visit again). I am thinking a script that cleans up entries that are old would do the trick, but obviously I want this script to run say, at least once an hour. Obviously, I am not going to be able to sit at my computer and run this script every hour of every day. I was thinking of using the script and doing a cron job, but I think my host only allows one cron job per day...and only at night. Any thoughts??
View Replies !
How Do Different Sessions Work? Multiple Sessions
I use a messageboard which uses sessions. I have a login script which uses sessions. I have a charting app which uses sessions. How does PHP handle this? Does it create three different sessions or is everything handled by the one session file? In other words, is it working like magic and I don't need to worry about it. What I'm confused with is that at the start of the login script there is a start_session() and other session related stuff. On logout, the session is destroyed. Now does this affect the start_session() of the other scripts?
View Replies !
Arrays Within Arrays, How To Split
I have been stumped on this one and it is probably easier than I think it is, especially since my brain is fried. This is what my array looks like: array(7) { ["injuredPerson"]=> string(0) "" ["dates"]=> string(0) "" ["describe"]=> string(0) "" ["location"]=> string(0) "" ["type"]=> array(3) { [0]=> string(8) "abrasion" [1]=> string(10) "amputation" [2]=> string(12) "asphyxiation" } ["part"]=> string(0) "" ["times"]=> string(0) "" } This is actually an array of information from a form check. I have the error handling check the form and depending on if there is an error or not, the array gets populated with "" or an actual value(s). I am testing a checkbox area of the form (the name is type, so type can hold an array of values, thats why it currently contains abrasion, amputation, and asphyxiation). I have had no problem going through the array until I get to the area with an array within the array. Let me give you some code so you can see how I am doing this:
View Replies !
Searching Arrays With Arrays
ive looked through alot of the array search functions and i dont think any of them support arrays as the "needle" to search for. so say i had a numeric array, $array1 with say 5 elements, 0-4, each element is a single word, lowercase. say i had another numeric array structured the same way called $array2 with say about 5 elements, 0-4. Is there a function which i could use or does anyone know of an easy way to search every element in $array1 and compair it through each of the elements of $array2? and if a duplicate is found in $array2 have that element be removed or unset? im sure this can be done probably easy with some kind of loop function, but thats my weak point right now in php and im working on it.
View Replies !
Unset Arrays In Arrays.
Am trying to create a simplified - prototype shopping cart. There are three pages - first two are forms that get sent to the self page. You can read the description in the beginning comments ....
View Replies !
Php4
I'm wanting to work with php4 and want to know which version of mysql to download that works great with php4 api version 3.23.x?
View Replies !
PHP4 Ignored With IIS
I am attempting to get PHP4 working with IIS but the php script is ignored. I installed Apache and it works with the Apache server so it is obviously a configuration error on my part but I can't find it. I have a test.php file that I run with each configuration.
View Replies !
Re Php4.3.4
Re previous problem Thanks to Alvaro, I solved the original problem on php version 4.3.4 However, I now have another one. I have an admin panel which requires a password to access it from a previous page. With the site live on an ISP server, everything is OK. On my local server running Apache and php 4.3.4, when the correct p/w is entered on the previous page, instead of going to the correct page (which consists of 2 frames, it simply reproduces the previous page in both frames. The script being used is: #-----REDIRECT AUTH USER---------- if($HTTP_SESSION_VARS['sessadmin']){ Header('Location:admin.index.php'); } #------AUTHENTICATE PASSWORD------- if($HTTP_POST_VARS['pass']){ if(crypt($HTTP_POST_VARS['pass'], $HTTP_POST_VARS['pass'])=='wiOgiun64DE9.'){ session_register('sessadmin'); $sessadmin='set' $done=1; } Because it works OK on an ISP, I assume it must be a setting in my local apache/php set up.
View Replies !
PHP4 XML DOM
Currently my web server supports only php4. I want to know how to parse the xml and get the element value using dom. I thought they have similar function for getting element by id or tag name, so far i haven't find anyting like that except fro PHP5 with Domdocument. $dom = domxml_open_file ('data.xml'); $e_data = $dom->document_element(); <?xml version="1.0"?> <book> <title>hhelo</title> </book>
View Replies !
GD2 And PHP4.4
It should be possible (as far as I know) to use createimagefromjpg('<urltoimage>'); In PHP4.3.11 it worked just fine, but now I use PHP4.4 and it is not working anymore! I only can do: createimagefromjpeg('blafoo.jpg') (=same dir) or createimagefromjpeg('d:/inetpub/vhosts/......../blafoo.jpg); This function is also used in a plugin (LightBox) for Nuclues and with Nucleus is isn't working also. Anybody a solution? (I *need* to load from url!).
View Replies !
PHP4 And XML
How can I pase this xml file using php. I am currently using xml_parse($xml_parser,file_get_contents($file)); but this get the php code and not the out putted xml. I can't get my head around how to parse the outputted xml using php Code:
View Replies !
XML In Php4
XML for data transfer between 2 servers. It's all working nicely - getting my "interface" object populated works like a charm - however, now that I wanted to test the application on the production server (PHP 4.4.4 - development server is 5.1), I of course, ran into a ton of issues due to php4's lack of XML support (compared to v5). After having tried multiple classes and trying to shimmy something together myself.
View Replies !
PHP4 Vs. PHP 5
I know PHP 5 is the newer (and presumably) better version, but I don't have any experience programming OOP. And I don't want to stumble learning PHP simply because I am struggling with OOP concepts. Yet at the same time, I'd rather learn a newer (more applicable) version, and I do hope to learn OOP programming some day soon.
View Replies !
PHP3 And PHP4 Together
I'm a little new to the PHP thing. I want to try to setup my server to handle PHP3 and PHP4 requests easily. e.g. I have some scripts that are PHP3 and want to start learning PHP4. Instead of doing the simple (like anything I do is simple URL ) thing, I am attempting to set up apache to support MySQL, PHP3, PHP4, SSL, ColdFusion, SteelBlue, and maybe even Frontpage. Tell me I'm insane. Now I have read the "Soothingly Seamless" setup from the website, and had it mostly working, until some unforseen circumstances caused me to have to start over. I can set up Apache to use PHP4, MySQL, and SSL, but for those PHP3 scripts, I am a bit lost. Finally, my question. Is there a simple way (using the Sootingly Seamless page as a reference) to add PHP3 into the mix. Any help on this would be great!
View Replies !
PHP3 Or PHP4
I am starting to write some scripts. Now should I wait until PHP4 documentation and tutorials arise and write in PHP4, or should I just do everything in PHP3? I have a book on PHP3 and I want to know if the language has changed enough to make this book invalid. Thanks. Any clear input is appreciated.
View Replies !
MSSQL With PHP4
I am using win98 and SQL7.0,, the problem is when i try to connect to the database using the next query : <?php $username = "bla"; $password = "bla"; $database = "bla"; $conn = mssql_connect($server, $user, $pass); $select = mssql_select_db($database, $conn); $sql = "SELECT * FROM "; $result = mssql_query($sql, $conn); ?> it gives me the next error message : Fatal error: Call to undefined function: mssql_connect() in C:Inetpubwwwrootphptestmain2.php on line 6
View Replies !
PHP4 And SSL And Raven
1) - Has anyone had intermittent "Page Not Found" or "Page Cannot Be Displayed" errors when using PHP4 over a secure connection. It's not our programming because we get the error when using phpmyadmin over SSL. Phpmyadmin is an open source utility which was programmed by someone else. We are using a RaQ4 Cobalt box running Linux, hosted with Aspre (aspre.net). Our ISP says some other customers have complained about a similar problem but they have no solutions. 2)- We talked with another dedicated server provider (Adgrafix, adgrafix.com) and they said that we would have to install "Raven" to make PHP work over SSL. Has anyone heard of Raven? Is it necessary?
View Replies !
Session In Php4
I have tested a couple functions, they work fine, but when I try the session_start() function, it just hang the browser for a long time and at the end, return me a message saying that the page is not found. Is there some configuration I have to make before I can use session-related function? or what else I should do?
View Replies !
Setting Up PHP4
I have set up PWS and PHP4 on my Windows98 computer but I am still unable to see php coding in .php files in IE. Yes I have put them in the right dir. I think the problem was that I was unable to put the file msvcrt.dll in my C:WINDOWSSYSTEM folder. When ever I try to copy that file into C:WINDOWSSYSTEM I get an error message that says "Cannot creat or replace msvcrt: The specified file is being used by Windows." Whats going on here?
View Replies !
PHP4 Beta
i installed PHP4b2 for NT4/IIS but the PHPpages just won't show - HTTP error 500. how do i troubleshoot this? I have installed the php isapi filter and also *.php is associated with the above filter as per the installation notes. The normal htm pages are OK.
View Replies !
Install Php4
I have installed php4 on my linux server,and all the process is so smooth,but when I write a php file only content a single sentence of <? phpinfo ?>,the system tells me the version of the php is 3.0.15,why?At the same time the php cann't connect ot mysql.
View Replies !
Reddhat 7.1 & Php4
Problem: the file phpinfo.php always showed the script line <? phpinfo(); ?> in redhat 7.1. But: 1. php works in window 2000 2. it also works in win98 3. it also works in a modified redhat 7.1 where I installed apache+mysql+php myself.
View Replies !
PHP LIB Works With PHP4?
I want to install phplib but found "PHP 4 is still in beta. We do not support deployment of this library with beta software." in phplib installation manual. Does it mean that I have to go back to php3? Have anyone have positive experience installing phplib on php4? After I notice this problem. I tried to look up the answer in the web, and found only one negitive answer: - - - - I did and mailed it to php4-beta. If I install a build of PHP4 and the php.ini-dist distributed with PHP4, I get the core as soon as I either define a doc_root or an auto_prepend_file, no matter what I do. Kristian - - - - But it is in php4 beta though. So, I don't dare to go any further because I'm really new to php.
View Replies !
Connecting To MS-SQL Using PHP4!
I am trying to connect to our NT based MS-SQL server from my remote linux box, i have a RH linux 6.2 plat, with PHP4.0.3, using sybase ase libs, i compiled it like the faq says, configured it, set up the interface files, but i get the following error: Fatal error: Call to undefined function: mssql_connect()in /usr/local/apache/htdocs/mssql.php on line 4 So i havent got to actually be able to connect to anything being, its saying function isnt supported.
View Replies !
PHP4.0 On Unix
Can anybody see why the following code wouldn't work on a Unix /Apache platform when it works fine in IIS5.0 on windows? Is there a problem with reading the querystring and passing it to the HTTP variable? <? session_start(); $strPage = $HTTP_GET_VARS["page"]; if (isset($logged) == true && $logged == 1){ header("Location : ".$strPage.".php");} else{ header("Location : passwordcheck.php?page=".$strPage);}?>
View Replies !
PHP4 And This Function
function query($query, $return = false) { $fetch = mysql_query($query, $this->connection) or die2(mysql_error($this->connection)); if($return) return $fetch; } mysql_error(): supplied argument is not a valid MySQL-Link resource the line that begins with $fetch is my problem. This was originally a PHP5 script that I am retrofitting. The $query is used all over, and it is really gumming things up.
View Replies !
Php4 And Linux
I'm running Red Hat linux 5.2 on my server. I'm able to run php3 fine on it. I was told that i couldn't run php4 on red hat linux 5.2. I dont think this is true, but would like to know. I don't think the person knew what i was talking about, but i wanted to make sure since i want to upgrade to php4.
View Replies !
Php4.3.1-installer
im not sure what my SMTP server would be, i think i would something like this www.geocities.com/user-name but im still not sure.
View Replies !
Parsing XML In Php4
I did the parsing XML and it works on my computer (PHP5), but as usual it doesn't on the clients server (PHP4): <?php error_reporting(E_ALL); $doc = DOMDocument::loadHTML("playlist.xml"); var_dump($doc); $aSongID = array(); $aSongName = array(); $aSongPath = array(); $songs = $doc->getElementsByTagName("Song"); foreach($songs as $song){ array_push($aSongID, $song->getAttribute("ID")); array_push($aSongName, $song->$song->nodeValue); array_push($aSongPath, $song->getAttribute("URL")); } var_dump($aSongID); ?> It just displays the blank page with no errors, so i can't figure out what is it.
View Replies !
PHP4 Installation
I have installed PHP4 many times with no problems, but this time im stuck. The system is Windows XP Pro SP1, it was just installed fresh. Web server software is Visnetic WebSite Pro, Latest build. PHP v4.3.2. Everything installs fine as far as i can tell and I setup all the needed settings in the web server. When ever I try to use PHP files on my server all I get is internet explorer saying the page cannot be displayed. I dont understand what I have done wrong, its the same setup I always use, same for the settings.
View Replies !
Use PHP4 Dom XML In PHP5?
Is it just me... Or is PHP5 XML very limited? Or am I missing something very obvious? Any way to use PHP4 Dom XML in PHP5? Does anyone know why support for it was dropped? I have following code I need to have replaced: PHP4 $eir_dom = domxml_open_mem($eir_padfile_content); $eir_root_node = $eir_dom->document_element(); // = root element PHP5 $eir_dom = new DOMDocument; $eir_dom->loadXml($eir_padfile_content); // how do I set $eir_root_node ? PHP4 .... $nodes = $cur_root_node->child_nodes(); .... if ($test_node->node_name() == $next_node_name_to_find) { PHP5 // child_nodes(); node_name() PHP4 .... if ($node_child->node_type() == XML_TEXT_NODE) { $node_child->set_content($new_content); break; } PHP5 // set_content, node_type()
View Replies !
Php4 The Future
I am studing perl at the moment for fun and will be done in a month or two but i want to now is PHP4 easy if you now perl???? I want to leard something new, the best in web development where should i go?
View Replies !
.php Or .php3 Or .php4
With the advent of php4, which extension should we use. A lot of php3 pages use the .php3 extension, but by deafault the extension in the apache httpd.conf is .php. Should we just adapt .php4 or use .php to make sure future upgrades don't cause any issues with already existing code. I would welcome any thoughts.
View Replies !
Debugging PHP4 With Dbg, Gdb, And Ddd
I want to create a debugging environment for PHP. I running Debian Woody and installed PHP4 from Debian's packaging system. I downloaded precompiled DBG from the webside and placed dbg.so in the same directory as mysql.so, Since MySQL works under PHP, I'm assuming I've got the right directory. I've updated php.ini per the DBG website. phpinfo() reports: 1. --disable-debug was part of the ./configure command. 2. ZEND_DEBUG=disabled, but the report does indicate that dbg is part of the Zend engine setup. 3. In the section on dbg, it reports dbg version 2.11.23, linked as a shared library; profiler compiled,enabled; debugger.enabled=on; etc. If I want to debug with dbg and gdb, do I have any options other than to recompile PHP omitting the "--disable-debug" switch? Once I do (or don't do) that, how does one hook gdb into dbg? How do most PHP developers who don't own a commercial IDE debug their programs?
View Replies !
PHP4->PH5 Tutorial
Seen that support for PHP4 will be dropped at the end of the year I was thinking that maybe now might be a good time to start moving things. Is there a tutorial as to what I need to look out for? And, Could I run both version on my test server? Or do I need to have to Apache servers running?
View Replies !
PHP4 For Unix ?
I need to run PHP4 on an Unix Server (with IBM AIX). Do I need a special version or special binaries ? Or can I use the files from URL ? ARE there actually any other versions (for other OSs) available (especially for IBM AIX) ? Or has anybody ever installed PHP4 on IBM AIX ?
View Replies !
Installing PHP4 On PWS?
Is it possible to use the PHP4 DLLs with the MS Personal Web Server, or is IIS absolutely necessary? I ask because ASP pages can be served with PWS (using an ASP.dll file), so it seems the same should be possible with PHP. Unfortunately, I have seen no info to support or deny this hypothesis...
View Replies !
|