[PHP] RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
I think the canonical way would be to have one table for your items, one table for your tags, and one table for your tag assignments. CREATE TABLE items ( item_id INT(11) AUTO-INCREMENT PRIMARY KEY, item_name VARCHAR(100) NOT NULL KEY, ... ); CREATE TABLE tags ( tag_id INT(11) AUTO-INCREMENT PRIMARY KEY, tag_name VARCHAR(100) NOT NULL KEY, ... ); CREATE TABLE item_tags ( item_id INT(11) NOT NULL KEY, tag_id INT(11) NOT NULL KEY ); This way you could do SELECT item_id, item_name FROM tags JOIN item_tags ON tags.tag_id = item_tags.tag_id JOIN items ON item_tags.item_id = items.item_id WHERE ... ; to get all of the items with a particular tag, or SELECT tag_id, tag_name FROM items JOIN item_tags ON items.item_id = item_tags.item_id JOIN tags ON item_tags.tag_id = tags.tag_id WHERE ... ; with equal ease and efficiency. Using an ever-lengthening bitmap for the tag assignments is a trap for the unwary. The path to perdition is lined with the bodies of those who believed We'll never need more than x... As for setting up a hierarchy, that's trickier. One way to handle that is to work like libraries do: 10 is fiction, 10.05 is crime novels, 10.05.07 is British authors, and so forth. Your `tags` table then looks like CREATE TABLE tags ( tag_id INT(11) AUTO-INCREMENT PRIMARY KEY, tag_name VARCHAR(100) NOT NULL KEY, tag_number VARCHAR(100) NOT NULL KEY, ... ); Then you can search for tags by tag_number LIKE ('10.%') or tag_number LIKE ('10.05%') and so forth. This scheme is infinitely extendable. To get the entire hierarchy, you simply SELECT tag_number, tag_name FROM tags ORDER BY tag_number; Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 E-mail: je...@gii.co.jp Web site: www.the-infoshop.com -Original Message- From: Dotan Cohen [mailto:dotanco...@gmail.com] Sent: Thursday, January 20, 2011 9:32 AM To: mysql.; php-general. Subject: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist I am designing an application that make heavy usage of one-to-many tags for items. That is, each item can have multiple tags, and there are tens of tags (likely to grow to hundreds). Most operation on the database are expected to be searches for the items that have a particular tag. That is, users will search per tags, not per items. These are the ways that I've thought about storing the tags, some bad and some worse. If there is a better way I'd love to know. 1) Each item will get a row in a tags table, with a column for each tag. mysql CREATE TABLE tags ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, item VARCHAR(100), tag1 bool, tag2 bool, tagN bool ); With this approach I would be adding a new column every time a new category is added. This looks to me a good way given that users will be searching per tag and a simple SELECT item FROM tags WHERE tag1=true; is an easy, inexpensive query. This table will get very large, there will likely be literally thousands of items (there will exist more items than tags). 2) Store the applicable tags one per line in a text field in the items table. mysql CREATE TABLE items ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, item VARCHAR(100), tags text, ); This looks like a bad idea, searching by tag will be a mess. 3) Store the tags in a table and add items to a text field. For instance: mysql CREATE TABLE tags ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, tagName VARCHAR(100), items text, ); This looks to be the best way from a MySQL data retrieval perspective, but I do not know how expensive it will be to then split the items in PHP. Furthermore, adding items to tags could get real expensive. Caveat: at some point in the future there may be added the ability to have a tag hierarchy. For instance, there could exist a tag restaurant that will get the subtags italian and french. I could fake this with any approach by having a table of existing tags with a parentTag field, so if I plan on having this table anyway would method 3 above be preferable? Note: this message is cross-posted to the MySQL and the PHP lists as I am really not sure where is the best place to do the logic. My apologies to those who receive the message twice. Thanks! -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=je...@gii.co.jp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
-Original Message- From: Dotan Cohen [mailto:dotanco...@gmail.com] Sent: Thursday, January 20, 2011 11:25 AM To: Jerry Schwartz Cc: mysql.; php-general. Subject: Re: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist As for setting up a hierarchy, that's trickier. One way to handle that is to work like libraries do: 10 is fiction, 10.05 is crime novels, 10.05.07 is British authors, and so forth. Your `tags` table then looks like Thanks. I prefer the parent tag field, though, I feel that it is more flexible. [JS] I disagree. The method I proposed can be extended to any depth, and any leaf or branch can be retrieved with a single query. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 E-mail: je...@gii.co.jp Web site: www.the-infoshop.com -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: Organisational question: surely someone has implemented many Boolean values (tags) and a solution exist
[JS] I disagree. The method I proposed can be extended to any depth, and any leaf or branch can be retrieved with a single query. I suppose for retrievals this structure has advantages, but unless MySQL has a ++ operator (or better yet, one that adds or subtracts 2 from an int) then it looks to be a pain to add nodes. [JS] Not at all. Somebody, somehow, has to assign a name to the tag and designate its place in the hierarchy. I don't see how you can avoid that being done by a human. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 E-mail: je...@gii.co.jp Web site: www.the-infoshop.com But I will play with the idea. Maybe after I write the code (I'm saving that for tomorrow) I'll see it differently. Thanks. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Good source for sample data?
If you need verifiable mailing addresses (actual street/city/state/zip combinations), you should look at some of the databases the USPS (usps.com) has available. They are mostly for tracking delivery statistics, and the like, but as a side effect they list streets all over the USA. The only thing you won't have are street numbers and names, but you can easily generate random combinations there. By the way, if you need real-sounding names you can get a pile of first names from http://www.socialsecurity.gov/OACT/babynames/decades/names2000s.html; I used that information as part of security screening for a registration system. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com -Original Message- From: Shawn McKenzie [mailto:nos...@mckenzies.net] Sent: Thursday, January 28, 2010 7:20 PM To: Brian Dunning Cc: php-general@lists.php.net; my...@lists.mysql.com Subject: Re: Good source for sample data? Brian Dunning wrote: Hey all - I need a few million sample contact records - name, company, address, email, web, phone, fax. ZIP codes and area codes and street addresses should be correct and properly formatted, but preferably not real people or companies or email addresses. But they'd work if you did address validation or mapping. Anyone have a suggestion? - Brian It should be easy to code a routine to generate random data. Maybe 20 - 30 lines of code. Obviously you may have a name like Dgidfgq Xcvbop and company Wsdkn, but it shouldn't matter if testing is your purpose. -- Thanks! -Shawn http://www.spidean.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=jschwa...@the- infoshop.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL auto_increment fields Server version: 5.1.32-community-log
ALTER TABLE T1 AUTO_INCREMENT=1; It's likely that you dropped every record and expected the auto_increment to reset. Jerry Wilborn jerrywilb...@gmail.com On Sun, Aug 9, 2009 at 1:17 PM, Ralph Deffke ralph_def...@yahoo.de wrote: Hi all, I'm facing the fact that it seems that auto_increment fields in a table not start at 1 like it was in earlier versions even if I install mySQL brand new creating all tables new. it seems to me that auto_increments handling has changed to older version. is somebody out there who can give me a quick background about auto_increment and how and if I can control the behavior of mySQL about them. ralph_def...@yahoo.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can php be cause a strain on a web server
You seem nice. Jerry Wilborn jerrywilb...@gmail.com On Sun, Aug 9, 2009 at 12:54 PM, Daniel Brown danbr...@php.net wrote: On Sat, Aug 8, 2009 at 11:08, Jerry Wilbornjerrywilb...@gmail.com wrote: You're going to have to be more specific. There are very few problems where this is absolutely no solution. And you're going to have to read what he said again and understand the context of the question and answer. It requires no more specifics unless it's being explained to a pre-schooler. -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Check out our great hosting and dedicated server deals at http://twitter.com/pilotpig
Re: [PHP] Server change affecting ability to send downloaded files???
http://us2.php.net/readfile Returns the number of bytes read from the file. If an error occurs, FALSE is returned and unless the function was called as @readfile(), an error message is printed. Ah. So readfile() was generating some error and outputting before the Content-Type was sent to the browser. It might not hurt to move to a fread($fh, 8096) + print() to prevent the bug in the future. Jerry Wilborn jerrywilb...@gmail.com On Sat, Aug 8, 2009 at 9:00 AM, Brian Dunning br...@briandunning.comwrote: A Rackspace guy determined that php.ini was set to use 16MB of memory, and he upped it to 32MB, and now everything works. Some of my downloads are as large as 41MB so I asked him to up it to 48MB. Maybe they upgraded the PHP version or something and wiped this setting. The 41MB files had always been downloading to customers before, without any problem -- is there some way that could have worked with php.ini set to 16MB, or does this mean for sure that the setting was changed somehow? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec not hit server
You could also try checking the SSL log. This may give hints about the problem; none of the HTTP conversation happens until after SSL has been negotiated. Jerry Wilborn jerrywilb...@gmail.com On Fri, Aug 7, 2009 at 1:16 PM, Tom Worster f...@thefsb.org wrote: On 8/6/09 2:33 PM, Ted Yu ted...@yahoo.com wrote: Hi, I use the following code to call third party web service: curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($ch, CURLOPT_SSLVERSION, 3); curl_setopt($ch, CURLOPT_SSLCERT, $loc); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $password); curl_setopt($ch, CURLOPT_HTTPHEADER, $this-_httpHeaders); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $this-_xmlData); $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $xmlResponseData = curl_exec($ch); But for a specific API, curl_exec() returns true but there was no hit on their server (as verified by contact in that company from server log) Can someone provide hint ? not me. but, if you haven't already, maybe try debugging by: print out the values of all the variables in the above code and with them (or some subset) try making the same (or similar, or simpler) requests to the same $url using curl the command line with verbosity or tracing turned on. curl might give the hint you need. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Buffered Logging?
You don't mention what database you're using, but mySQL supports memory based tables. You can use this to insert your single page loads and then have a job that periodically inserts in bulk. Memory based tables: http://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html Jerry Wilborn jerrywilb...@gmail.com On Fri, Aug 7, 2009 at 5:46 PM, Waynn Lue waynn...@gmail.com wrote: Hey PHPers, We've been doing sampled logging to the database in our application for awhile, and now I'm hoping eventually to blow that out to a larger scale. I'm worried about the performance implications of logging to our database on every single page load, though, so I was wondering if anyone's found a solution that does buffered logging. Essentially it would log to memory (memcached/apc/etc), and then periodically dump to a database in a structured format, preferrably user-defined. It's not essential that we get every signle hit, so I'd be fine if there was some data loss on a restart. I started writing my own solution, and then thought I'd ask the list to see if anyone has any experience with other tools that do this. My Google searches around buffered logging have mainly found error logging packages, like PEAR's Log package, or log4php. Those all seem to write to only one particular stream at a time, with no real support for buffering it in memory and then moving it to database. Thanks for any help! Waynn
Re: [PHP] Server change affecting ability to send downloaded files???
The 500 is the result of the missing content-type in the real header. Once you get a blank line in there, it thinks thats the content. The error log will likely say 'premature end of script headers'... Good mystery on why it's got the blank line though. Jerry Wilborn jerrywilb...@gmail.com On Fri, Aug 7, 2009 at 7:16 PM, Ben Dunlap bdun...@agentintellect.comwrote: Very interesting. Excellent debugging advice. It's giving me a 500 error, probably why the Rackspace techs told me to check my code: HTTP/1.0 500 Internal Server Error Did you get that 500 while running curl from a machine outside of Rackspace's network? If so, I'd be interested to see what you get if you run it from the server's command line (using 'localhost' in the URL you pass to curl). Have you checked your Apache error log as well, and PHP's? There will usually be more detail in those locations when the server sends a 500. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] curl_exec not hit server
Can you tell us anything about the cert on the host? Is it self signed, is it expired, etc? A hip-shot: try turning off VERIFYPEER and VERIFYHOST. Jerry Wilborn jerrywilb...@gmail.com On Thu, Aug 6, 2009 at 1:33 PM, Ted Yu ted...@yahoo.com wrote: Hi, I use the following code to call third party web service: curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($ch, CURLOPT_SSLVERSION, 3); curl_setopt($ch, CURLOPT_SSLCERT, $loc); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $password); curl_setopt($ch, CURLOPT_HTTPHEADER, $this-_httpHeaders); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $this-_xmlData); $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $xmlResponseData = curl_exec($ch); But for a specific API, curl_exec() returns true but there was no hit on their server (as verified by contact in that company from server log) Can someone provide hint ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] navigation include not functioning
I'm having trouble understanding your description of the problem. Can you tell us what you're seeing and what you expect to see? Jerry Wilborn jerrywilb...@gmail.com On Wed, Aug 5, 2009 at 12:00 PM, Allen McCabe allenmcc...@gmail.com wrote: I am trying to generate pages by importing content in includes, and using my navigation include to tell PHP to replace a $thisPage variable which all the includes use ?php include('phpincludes/' . $thisPage . '.php') ? The idea behind it (I know tons of people do it, but I'm new to this concept), is to have a 'layout' page where only a variable changes using $_GET on an href (index.php?page=services or index.php?page=about) to load the new 'pages'. PROBLEM: All my links are displaying the current page state, and links are not building around the link text (hrefs are built conditionally with if $thisPage != services then build the link, otherwise leave it as normal text). Same thing with the background image behind the link text (to indicate a page's current position). If the condition is not true, all the links (except the true current 'page') are supposed reload index.php and pass a variable to itself to place into $thisPage using href=index.php?page= (after which I have a variable which stores about or services within the if statement near the link text. If this sounds like something you are familiar with (former issues and whatnot) please let me know what I'm doing wrong. I would be happy to give you any code you want to look at (index.php or navigation.php, whatever). Thanks again for your help PHP gurus!
Re: [PHP] Time keeping in DB
You don't mention what DB you're using, but mySQL can be quite a pain when dealing with multiple time zones. Not impossible, but a hassle none the less. Be sure to set aside a place to store this (and another spot for user preferences to keep track of their TZ). Jerry Wilborn jerrywilb...@gmail.com On Wed, Aug 5, 2009 at 2:20 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Wed, 2009-08-05 at 14:18 -0500, Shawn McKenzie wrote: So, obviously not PHP related, but I'm looking for thoughts on the best way to record time sheets in a DB. A time sheet for hours worked per day, not like a time clock where you start and stop. The two possibilities that I have thought of are (these are simplistic, of course I'll be storing references to the user, the project code etc.): 1. One record for each 7 day week (year, week_num, d1, d2, d3, d4, d5, d6, d7) where the dX field holds the hours worked 2. One record for each day (date, hours) -- Thanks! -Shawn http://www.spidean.com I'd go with a record per timesheet, so you might end up with more than one timesheet per day. That way, it's just simple SQL to find out how many hours you've worked on one day, or on one job, etc. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dynamically naming PHP vars on the fly?
http://us2.php.net/manual/en/language.variables.variable.php Jerry Wilborn jerrywilb...@gmail.com On Wed, Aug 5, 2009 at 5:17 PM, Govinda govinda.webdnat...@gmail.comwrote: HI all One thing I have been working around but now would love to just do it finally (and save workaround/longer code hassle) is when: I need to be able to create a variable (name it, and assign it a value) whose name is built up from a fixed string concatenated with another string which comes from the value of another (already set) variable. Ie: I want to do this: (I am just assuming it won't work; I haven't even tried it yet) $var1='apple'; $Fruit_$var1=organic; echo $Fruit_apple; // I want this to return organic Or how are you guys dynamically naming PHP vars on the fly? John Butler (Govinda) govinda.webdnat...@gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] socket_last_error() equiv
Is there an equivalent to socket_last_error() when using a socket opened with stream_socket_client()? If it's not written yet, is there a suitable work around? I am looking to get the last status of the system connect() call. I see there is a bug opened for it (http://bugs.php.net/bug.php?id=34380), but the last movement on it is 2005. Jerry Wilborn jerrywilb...@gmail.com
Re: [PHP] Clean break.
Am I missing something? Can't this be done quickly/easily with preg_match()? if (preg_match('/\[(.*):(.*)\s/U', '[21/Jul/2009:00:00:47 -0300]', $matches)) { print date: {$matches[1]}, time: {$matches[2]}; } Jerry Wilborn jerrywilb...@gmail.com On Tue, Aug 4, 2009 at 5:36 AM, Wolf lonew...@nc.rr.com wrote: Paul Halliday wrote: Whats the cleanest (I have a really ugly) way to break this: [21/Jul/2009:00:00:47 -0300] into: date=21/jul/2009 time=00:00:47 Caveats: 1) if the day is 10 the beginning of the string will look like [space1/... 2) the -0300 will differ depending on DST or TZ. I don't need it though, it just happens to be there. This is what I have (it works unless day 10): $theParts = split([\], $theCLF); // IP and date/time $tmpParts = explode( , $theParts[0]); $theIP = $tmpParts[0]; $x = explode(:, $tmpParts[3]); $theDate = str_replace([,, $x[0]); $theTime = $x[1]:$x[2]:$x[3]; the full text for this part looks like: 10.0.0.1 - - [21/Jul/2009:00:00:47 -0300] ... more stuff here Anyway, any help would be appreciated. thanks. unset ($STRING,$pos,$pos2,$pos3,$L,$D,$T,$pos4,$NString); $STRING=10.0.0.1 - - [21/Jul/2009:00:00:47 -0300] ... more stuff here $pos=strpos($STRING,[); $pos2=strpos($STRING,]); $L=$pos2-$pos; $NString=substr($STRING,$pos,$L); $pos3=strpos($NString,:); $D=substr($NString,0,$pos3); $pos4=$pos3++; $T=substr($NString,$pos4,8); echo date=$D; echo time=$T; untested, but that should be pretty much all you need. HTH, Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple MySQL Queries
Keep in mind that you can use name=var[] value=value1, name=var[] value=value2 and php will create an array as $_REQUEST['var'] with each of your values. The keys are numbered and don't count on what order they'll come through. Jerry Wilborn jerrywilb...@gmail.com On Tue, Aug 4, 2009 at 10:47 AM, Bastien Koert phps...@gmail.com wrote: On Tue, Aug 4, 2009 at 11:40 AM, sono...@fannullone.us wrote: Is what I'm looking to do not possible in PHP? I've come close with a JavaScript version, but I'd rather not rely on everyone having JS turned on. Or am I stuck having to use JS? Thanks again, Frank I'd like to revisit this one last time. Below is the revised code I'm using, but I don't like having individual 'Add To Cart' buttons for each item. I've tried to find a way to have only one that resides outside the nested tables for all items, but without luck. It would need to send every item that has a quantity to the cart, but only those items. The URL that would be passed needs to look like this: /shop.cgi?c=viewcart.htmitemid=P74Si_P74S=80S2448Si_S2448S=100ACi_AC=26 (The above URL is sending 3 items and their quantities to the cart; 80 - P74S, 100 - S2448S and 26 - AC.) Thanks again for all your help. I'm learning a lot on this list - albeit slowly! ;) Regards, Frank ?php $cats = array('02121-19222-13349-11451' = 'Stationary Posts','04103-99222-48340-11422' = 'Solid Galvanized Shelves'); echo 'table border=1tr'; foreach ( $cats AS $cat = $title) { echo START td valign=top table border=1 trth align=center colspan=4{$title}/th/tr tr td class=text-header align=centerItem#/td td class=text-header align=centerDescriptionbr / span class=text-small(Click for more info)/span/td td class=text-header align=centerPrice/td td class=text-header align=centerQty/td /tr START; $cat = mysql_real_escape_string($cat, $db); $SQL = SELECT itemid,description,unitprice FROM catalog WHERE categories='$cat' ORDER BY itemid; if ( ($result = mysql_query($SQL, $db)) !== false ) { while ( $item = mysql_fetch_assoc($result) ) { $price = $ . number_format($item['unitprice'],2); echo ROW tr td class=text-med{$item['itemid']}/td td class=text-meda href=/shop.cgi?c=detail.htmitemid={$item['itemid']}{$item['description']}/a/td td class=text-med align=right{$price}/td td class=text-med form action=/shop.cgi method=get input type=hidden name=itemid value={$item['itemid']} / input type=text name=i_{$item['itemid']} value= size=4 / input type=hidden name=c value=viewcart.htm / input type=image src=/graphics/addtocart.png name=addToCartButton alt=Add To Cart / /form /td /tr ROW; } } else { echo No results for category #{$cat}!; } echo '/table/td'; } echo '/tr/table'; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You could do it with PHP, but you would still need to loop through all the data in the cart to find the element(s) to update. This can be done via a straight submit button where you send all the data to the server and the code walks thru the current contents -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Multiple MySQL Queries
If the form method is POST then set the 'c' variable with a hidden value within the form: input type=hidden name=c value=viewcart.htm Jerry Wilborn jerrywilb...@gmail.com On Tue, Aug 4, 2009 at 1:50 PM, sono...@fannullone.us wrote: On Aug 4, 2009, at 9:43 AM, Jerry Wilborn wrote: Keep in mind that you can use name=var[] value=value1, name=var[] value=value2 and php will create an array as $_REQUEST['var'] with each of your values. The keys are numbered and don't count on what order they'll come through. Thanks for the tip, Jerry. I'm still trying to figure this out, but in the meantime, I'm running into another problem. I have the action on the form set as /shop.cgi?c=viewcart.htm but it keeps stripping out everything after the question mark. I want c=viewcart.htm sent only once in the URL, so I can't place it in the form as it then gets sent along with every itemid in the form. How does one append a path extension after the auto-generated question mark? Thanks, Frank
Re: [PHP] Multiple MySQL Queries
I re-read your original thread, and I think *now* I may know what you're asking. Bastien is right, you're not going to be able to selectively send data to PHP with just HTML. Be careful though, as 'GET' has its limits. POST has limits as well, but for adding items to a shopping cart you're unlikely to hit those. If you want to avoid JS, you're going to have to send the whole page and then sort out what needs to be updated on the server. Jerry Wilborn jerrywilb...@gmail.com On Tue, Aug 4, 2009 at 2:03 PM, sono...@fannullone.us wrote: Sorry... I'm using GET. I have used the code you supplied below, but as I mentioned, it gets sent for every itemid in the table. I needs to be sent only once, and right after the action. That's where I'm stumped. Frank On Aug 4, 2009, at 11:56 AM, Jerry Wilborn wrote: If the form method is POST then set the 'c' variable with a hidden value within the form: input type=hidden name=c value=viewcart.htm Jerry Wilborn jerrywilb...@gmail.com On Tue, Aug 4, 2009 at 1:50 PM, sono...@fannullone.us wrote: On Aug 4, 2009, at 9:43 AM, Jerry Wilborn wrote: Keep in mind that you can use name=var[] value=value1, name=var[] value=value2 and php will create an array as $_REQUEST['var'] with each of your values. The keys are numbered and don't count on what order they'll come through. Thanks for the tip, Jerry. I'm still trying to figure this out, but in the meantime, I'm running into another problem. I have the action on the form set as /shop.cgi?c=viewcart.htm but it keeps stripping out everything after the question mark. I want c=viewcart.htm sent only once in the URL, so I can't place it in the form as it then gets sent along with every itemid in the form. How does one append a path extension after the auto-generated question mark? Thanks, Frank
[PHP] Re: php ssl connection timeout issue
On Thu, May 14, 2009 at 5:17 PM, Nathan Rixham nrix...@gmail.com wrote: Jerry Zhao wrote: On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham nrix...@gmail.com wrote: Jerry Zhao wrote: I tried different combination of ssl clients and servers, it all points to problems on the client side of my new php build. The same code worked on an older php build. checked the output of print_r( stream_get_wrappers() );? Array ( [0] = php [1] = file [2] = data [3] = http [4] = ftp [5] = compress.bzip2 [6] = https [7] = ftps [8] = compress.zlib ) so you've got ssl support, next up you visited the url in a browser to check the ssl certificate? odds are it's invalid and that an exception has been made on the old php server No, the certificates are valid.
[PHP] php ssl connection timeout issue
Hi, I am having trouble connecting to https sites using php's builtin ssl functions. I tried: file_get_contents('https://securesite') fsockopen('ssl://securesite', 443, $errno, $errstr,20) and same errors every time: SSL: connection timeout Failed to enable crypto Call to openssl_error_string() returns no error. Curl worked both within php and as standalone client. The strange thing is that the connection seemed to be dropped immediately upon contact with the server, i.e., the call to the above functions failed immediately, which I think contradicts the timeout error. Any tips on the cause of this issue or how to debug this is appreciated. Regards, Jerry.
[PHP] Re: php ssl connection timeout issue
I tried different combination of ssl clients and servers, it all points to problems on the client side of my new php build. The same code worked on an older php build. On Thu, May 14, 2009 at 4:57 PM, Nathan Rixham nrix...@gmail.com wrote: Jerry Zhao wrote: Hi, I am having trouble connecting to https sites using php's builtin ssl functions. I tried: file_get_contents('https://securesite') fsockopen('ssl://securesite', 443, $errno, $errstr,20) and same errors every time: SSL: connection timeout Failed to enable crypto Call to openssl_error_string() returns no error. Curl worked both within php and as standalone client. The strange thing is that the connection seemed to be dropped immediately upon contact with the server, i.e., the call to the above functions failed immediately, which I think contradicts the timeout error. Any tips on the cause of this issue or how to debug this is appreciated. Regards, Jerry. assuming you've checked for mod_ssl and tried connecting up to an ssl server you know works fine? then check for bad ssl certificates on the remote server.
[PHP] Re: php ssl connection timeout issue
On Thu, May 14, 2009 at 5:05 PM, Nathan Rixham nrix...@gmail.com wrote: Jerry Zhao wrote: I tried different combination of ssl clients and servers, it all points to problems on the client side of my new php build. The same code worked on an older php build. checked the output of print_r( stream_get_wrappers() );? Array ( [0] = php [1] = file [2] = data [3] = http [4] = ftp [5] = compress.bzip2 [6] = https [7] = ftps [8] = compress.zlib )
RE: [PHP] RE: non-auto increment question
-Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Thursday, February 26, 2009 11:27 AM To: Jerry Schwartz Cc: a...@ashleysheridan.co.uk; 'Gary W. Smith'; 'MySql'; php- gene...@lists.php.net Subject: Re: [PHP] RE: non-auto increment question Jerry Schwartz wrote: Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS [JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session variable or (more easily) as a hidden field on your form. Thanks, Jerry, You hit the nail on the head.:) [JS] I'm glad to hear it. To refine my problem (and reduce my ignorance),here's what is happening on the form page: There is a series of INSERTs. The first inserts all the columns of book table except for the id, which I do not specify as it if auto- insert. In subsequent tables I have to reference the book.id (for transitional tables like book_author(refers authors to book) etc. [JS] Okay. If I understand it correctly, I must retrieve (SELECT LAST_INSERT_ID()) after the first INSERT and before the following insert; and save the id as a string ($id)...e.g. $sql = SELECT LAST_INSERT_ID() AS $id [JS] You are confusing database column names with PHP variable names. You don't need an alias at all, unless you feel like it for reasons of convenience or style. Assume that $title is your book title, and that the first column is an auto-increment field. The first two queries should look like $query_insert = INSERT INTO book VALUES (NULL, '$title', ...); and $query_select_id = SELECT LAST_INSERT_ID(); Of course, you need to actually execute the two queries. The first one doesn't return anything (check for errors, of course). The second one retrieves the ID of the record you just inserted. Now retrieve the value returned by the SELECT statement and put it into a variable. You'll use something like $row_selected = mysql_query($query_select_id) or die($query_select_id failed); $last_id = mysql_fetch_array($row_selected) or die(Unable to fetch last inserted ID); and you have what you want. You can now use $last_id anywhere you want, until your script ends. This is all very simplified, but I think you can get my drift. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com I need clarification on the AS $id - should this be simply id(does this have to be turned into a value into $id or does $id contain the value? And how do I retrieve it to use the returned value for the next $sql = INSERT ... - in other words, is the id or $id available for the next directive or do I have to do something like $id = id? I'm trying to figure this out with some trials but my insert does not work from a php file - but it works from command-line... that's another post. -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: catch the error
-Original Message- From: PJ [mailto:af.gour...@videotron.ca] Sent: Thursday, February 26, 2009 12:28 PM To: php-general@lists.php.net; MySql Subject: catch the error What is wrond with this file? same identical insert works from console but not from this file :-( html head titleUntitled/title /head body ? //include (lib/db1.php);// Connect to database mysql_connect('biggie', 'user', 'password', 'test'); $sql1 = INSERT INTO example (name, age) VALUES ('Joe Blow', '69'); $result1 = mysql_query($sql1,$db); if (!$result1) { echo(PError performing 1st query: . mysql_error() . /P); exit(); } ? /body /html Seems to be good to print out the error message, but that's all. db not written. [JS] You need $db = mysql_connect('biggie', 'user', 'password', 'test'); -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=jschwa...@the- infoshop.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: non-auto increment question
Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query = INSERT INTO `another_table`(`link_id`,`value`) VALUES($autoId,'$value'); $result = mysql_query($query); No need to call another query to retrieve the last inserted id, as it is tied to the last query executed within this session. Ash www.ashleysheridan.co.uk [JS] Ashley is absolutely right, I'd forgotten about the mysql_insert_id shorthand. (I'm a one-man band, and for the last week or two I've been immersed in VB for Access forms.) Not only is she right, but her way is better. Presumably a language's internal code is maintained as the specific database changes. You can make yourself more independent of the specific database by using the PDO abstraction, although I would save that for a rainy weekend. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: non-auto increment question
Sorry, I should know better. -Original Message- From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: Thursday, February 26, 2009 1:51 PM To: Jerry Schwartz Cc: 'PJ'; 'Gary W. Smith'; 'MySql'; php-general@lists.php.net Subject: RE: [PHP] RE: non-auto increment question On Thu, 2009-02-26 at 13:44 -0500, Jerry Schwartz wrote: Here's how I mostly do it (albeit simplified): $query = INSERT INTO `sometable`(`title`,`content`) VALUES('$title','$content'); $result = mysql_query($query); $autoId = mysql_insert_id($result); $query = INSERT INTO `another_table`(`link_id`,`value`) VALUES($autoId,'$value'); $result = mysql_query($query); No need to call another query to retrieve the last inserted id, as it is tied to the last query executed within this session. Ash www.ashleysheridan.co.uk [JS] Ashley is absolutely right, I'd forgotten about the mysql_insert_id shorthand. (I'm a one-man band, and for the last week or two I've been immersed in VB for Access forms.) Not only is she right, but her way is better. Presumably a language's internal code is maintained as the specific database changes. You can make yourself more independent of the specific database by using the PDO abstraction, although I would save that for a rainy weekend. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com I just checked, and yep, I'm definitely still a he ;) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: non-auto increment question
Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS [JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session variable or (more easily) as a hidden field on your form. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=jschwa...@the- infoshop.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: non-auto increment question
Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. [JS] Being rather old to all this, I can tell you that if something is even remotely possible it will happen just before your performance review. Never depend upon this. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=jschwa...@the- infoshop.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installation of php-5.2.8-win32-installer.msi
Tried to install PHP using this installer and about 2/3 of the way through the installation I get an error message: I am trying to install the IIS ISAPI module and MySQL to the hard drive under c:\Program Files\PHP on an XP Professional SP2 machine. Any help on this problem? Jerry Foote ScopeCraft, Inc. 4175 E. Red Cliffs Dr. Kanab, UT 84741 435-899-1255 jfo...@scopecraft.com
[PHP] Re: date processing needed in form
Sue wrote: Hello - I need to create a form that allows the user to select a Month, Day and Year. I am also new to PHP and am wondering if there is a way for me to display the contents of the Select list box (for the Day) based on the Month that is selected (and Year), so that the valid number of days for the month ( year?) displays. For all of our other forms, we use CGI to handle our standard forms validation, and was hoping to handle more complex validation within PHP prior to sending the entire contents of my form to our standard CGI validation routine. I know that I could use the Checkdate function once the entire date is selected, but thought there might be an easier/more efficient way of handling this and also not sure how to reference Checkdate prior to Submitting my form to the CGI routine. I also was not sure if this was something that is handled easier using Javascript? Any help/examples, etc. would be greatly appreciated! Thanks!! Sue For what it's worth I use JavaScript for validation prior to the form being submitted. It's faster and doesn't use any network resources. If you do validity checking at the browser using JavaScript ... then when the form is submitted I'd let it go straight through to your standard forms validation program ... I wouldn't even involve PHP. -- Jerry Kita http://www.salkehatchiehuntersville.com email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP MySQL
Man-wai Chang wrote: A table with a column big5 char(2) not null primary key. $target-query(delete from canton); for ($ii=0; $ii256; $ii++) { for ($jj=0; $jj256; $jj++) { echo $ii ... $jj . \n; $query=insert into canton ( big5 ) values ( ' . mysql_real_escape_string(chr($ii).chr($jj)) . ' ); $target-query($query); } } The program died with this output: 0.92 0.93 0.94 0.95 0.96 0.97 Duplicate entry '' for key 1 The character strings shouldn't be repeated. Why did it stop at (0,97)? Here's one thought . ascii (97) is the letter a is it possible that the ascii (65) A was interpreted as lowercase thus creating a duplicate primary key? Or your DBMS doesn't make a distinction between upper or lower case. -- Jerry Kita http://www.salkehatchiehuntersville.com email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Javascript Calendar and PHP
What Javascript calendar works good with PHP? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why do I get the warning messages in this case? When I execute script from shell. If I execute script from browser, no warnings.
php time_test.php PHP Warning: Unknown(): Unable to load dynamic library './domxml.so' - ./domxml.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './imap.so' - ./imap.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './ldap.so' - ./ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './odbc.so' - ./odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './pgsql.so' - ./pgsql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './snmp.so' - ./snmp.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: Unknown(): Unable to load dynamic library './xmlrpc.so' - ./xmlrpc.so: cannot open shared object file: No such file or directory in Unknown on line 0 Content-type: text/html X-Powered-By: PHP/4.3.4 31 //Source Code ?php setlocale(LC_TIME, C); echo strftime(%d); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML HTTP
It is SOAP. I read tutorial on w3 website. Have one more question: The data that is exchange in SOAP protocol is encrypted or not? Thanks On Mon, 21 Mar 2005 17:32:59 -0800 (PST), Richard Lynch [EMAIL PROTECTED] wrote: On Fri, March 18, 2005 11:14 am, Jerry Swanson said: I create XML file, how to pass the XML file to another server through HTTP? Let's try it this way: What's the other server? Did you read their FAQ and their documentation? Here are functions that, depending on what you read on the other server, may be helpful: http://php.net/file (GET) http://php.net/fsockopen (POST) http://php.net/curl (SSL) The (WORD) indicates which function you would use, at a minimum, if you find that word in the other server's documentation. Note that in each case, you *could* use the next function down in my list, if you wanted to do it the hard way. :-) YMMV. NAIAA. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML HTTP
I need to use SOAP and I use PHP 5. Do I need to compile PHP with some option? Thanks On Fri, 18 Mar 2005 16:03:20 -0500, Jason Barnett [EMAIL PROTECTED] wrote: Chris Shiflett wrote: Jerry Swanson wrote: I generated XML file. I need to send the file to another server not through FTP but though HTTP. Yes, I gathered that, but you're not telling us how you're supposed to send it. For example, when Google first provided their web API, they didn't say, just send us an XML document. :-) There are many details you're not giving us (you can leave out the details involving the XML document itself, of course), so it's pretty much impossible to even guess an answer to your question. Chris Seriously... Chris is truly trying to help you. There are many, many ways to send an XML file. The following are HTTP methods off of the top of my head: SOAP (possibly with WSDL) Simple HTTP POST (usually through a form) Simple HTTP GET (possibly through a form, though passing XML documents through URL parameters is probably not A Good Thing.) It really depends on what the *receiving server* expects. Is there a documented API? Or perhaps can you just point us to the page (URL) that is supposed to receive the XML document? -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML HTTP
I create XML file, how to pass the XML file to another server through HTTP? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML HTTP
I generated XML file. I need to send the file to another server not through FTP but though HTTP. On Fri, 18 Mar 2005 14:17:28 -0500, Chris Shiflett [EMAIL PROTECTED] wrote: Jerry Swanson wrote: I create XML file, how to pass the XML file to another server through HTTP? This is similar to asking how to ship a package, only there are even more options. :-) What is the other server's API? How are they expecting to be sent the XML file? HTTP can practically be assumed, but this alone doesn't provide enough information. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [HAB] How to build a member area with PHP Sessions
OOzy Pal wrote: Dears Can anyone direct me to a good tutorial on how to build a member area using php sessions? Thank you OOzy Regards, OOzy What is the purpose of life? - Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term' I'm not aware of a tutorial but I do have member areas on my website. I also will display certain items on a web page depending on whether a member is actually logged in. The process is something like this: 1. Members logs into website using USERID and PASSWORD 2. Prior to every new page a session is started 3. If member is in-session then set VALIDLOGON = 'YES' 4. At that point I can display links or images or anything that are dependent on VALIDLOGON = 'YES' For example I have PHP code that looks something like: if (validlogon == 'YES') { Display stuff that only members see } I've also taken it a further step by creating a variable called 'Privileges' which gives gives certain members greater access to information. For example I might have PHP code that looks something like: if (validlogon == 'YES' and privilege = 'C') { Display stuff for members who have C privilege } The last example is the case where I don't want non-members to see a particular page. I do the check for validlogon at the beginning of the script if the user is not validated then user gets bounced back to the site HOME page. This PHP code looks like: if ($validlogon == NO) { header(Location: home.php?msg=INVALID USERID OR PASSWORD); exit; } Anyways, that's the general idea. It works for me. Others may have more complex schemes but this serves my purpose well. I'm not a professional programmer so I generally look for stuff that I can easily understand. Hope this helps. -- Jerry Kita http://www.salkehatchiehuntersville.com email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem solved!
I didn't want to give up entirely on the flexibility of writing my scripts in C, so I thought some more about how to get a CGI script to use PHP without having to spend a lot of time on PHP logic. My first attempt was to see whether I could substitute the extension .php for the usual .cgi extension. I could, but it made no difference, i.e., PHP didn't intercept the output. I did some searching in /usr/local/lib/php to no avail, but then I brought up the phpinfo page and studied it. Under the Environment heading, I found the variable SCRIPT_FILENAME and passed it a test PHP filename as a command-line argument. Voila! I got a HTTP header and the expected PHP-processed output! Now all I have to do is use popen from the C program that will become my CGI script, and I'll be able to let C handle the GET and/or POST query strings, create the MySQL queries, and pass a more manageable amount of PHP code to access the tables. Using HTTPS should also be more straightforward that way. I knew there had to be a better way! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: How to make binary strings useful?
Here's the code (with the domain name removed) that doesn't work, despite the poor documentation of the variable types: ? $dir = /home/domain_name/www/binary/; $dh = opendir ($dir); do { $file = readdir ($dh); } while (!strncmp ($file, ., 1)); $filename = sprintf (%s%s, $dir, $file); $fh = fopen ($filename, r); $cont = fread ($fh, 4); echo file:BR; echo $filename; echo BRcont:BR; printf (%02x %02x %02x %02x, $cont{0}, $cont{1}, $cont{2}, $cont{3}); fclose ($fh); closedir ($dh); ? Here's the output of od -c glance_date up to the fourth byte: 000 177 E L F All four bytes are non-zero! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to make binary strings useful?
Is there an example of the UNIX od utility written in PHP? Is such a useful task even possible?? From what I've seen of strings, they're completely opaque, so what good does it do to be able to read binary-safe strings from a file??? Even the deprecated (why) $str{$inx} notation apparently results in another string, because trying to printf it with the %02x format always comes out with 00. (Maybe that's why -- it's useless!) As an experienced C programmer, I'm finding PHP to be as counter-intuitive for low-level work as Perl is. I need to convert binary dumps of data structures into database table rows, and MySQL on my server doesn't support queries from C. I thought about writing a CGI script (in C) that would generate the hard-coded PHP output for each instance, but a URL that ends in .cgi is never intercepted by the PHP interpreter. Worse yet, the SCRIPT LANGUAGE= SRC= that works perfectly well with JavaScript is likewise ignored if the language is PHP! Finally, I'm not aware of a Content-type such as text/php. What exactly was the purpose of designing yet another inflexible language?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to make binary strings useful?
There's a FAQ section entitled PHP and Other Languages, C isn't even listed among them! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to make binary strings useful?
That should help. Thanks. Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've written complete file parsers in PHP, and the only snag I've run into is dealing Signed integers (and larger). Jerry Miller wrote: Is there an example of the UNIX od utility written in PHP? Is such a useful task even possible?? From what I've seen of strings, they're completely opaque, so what good does it do to be able to read binary-safe strings from a file??? the pack() and unpack() functions are used to remove data from and place data into binary strings. Even the deprecated (why) $str{$inx} notation apparently results in another string, because trying to printf it with the %02x format always comes out with 00. (Maybe that's why -- it's useless!) $str{$inx} does return a single character string, in order to get the numerical value, try using ord() As an experienced C programmer, I'm finding PHP to be as counter-intuitive for low-level work as Perl is. I need to convert binary dumps of data structures into database table rows, and MySQL on my server doesn't support queries from C. I thought about writing a CGI script (in C) that would generate the hard-coded PHP output for each instance, but a URL that ends in .cgi is never intercepted by the PHP interpreter. Worse yet, the SCRIPT LANGUAGE= SRC= that works perfectly well with JavaScript is likewise ignored if the language is PHP! Finally, I'm not aware of a Content-type such as text/php. What exactly was the purpose of designing yet another inflexible language?! Chris http://www.php.net/pack http://www.php.net/unpack http://www.php.net/ord http://www.php.net/chr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] replacement
I'm trying to replace a substr of the string that start from Rated blahblah; azt the end semicolon. Example: safsagfasdfsdfdsfRated by 4 people;fafafaafafaf - return safsagfasdfsdfdsffafafaafafaf $replacement =; $pattern = /Rated.+;/; $found_str = preg_replace($pattern, $replacement, $found_str); Why this above, doesn't work? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session errors when uploaded to host
Burhan Khalid wrote: Tim Burgan wrote: Hello, I've developed my site, and tested on a web host (Apache, PHP 4.3.9). Now I've uploaded to a different host (IIS, PHP 4.3.1) where I want to keep it, and I get session error messages like: Warning: session_start() [function.session-start http://www.php.net/function.session-start]: open(/tmp\sess_30f6794de4b0d80b91035c6c01aae52d, O_RDWR) failed: No such file or directory (2) in E:\W3Sites\ywamsa\www\timburgan\index.php on line 9 Warning: session_start() [function.session-start http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent by (output started at E:\W3Sites\ywamsa\www\timburgan\index.php:9) in E:\W3Sites\ywamsa\www\timburgan\index.php on line 9 The problem is that the php installation on this server is not configured correctly. It still holds the default session location (/tmp) which doesn't exist on Windows PCs. You need to ask the server administrator to verify the PHP installation and point the session location directory to a valid location on the server. You also have the option of creating your own session location directory by inserting the following at the beginning of each script. session_save_path('...public/tmp'); I happen to do this because my hosting company uses load balancing which means I can never know what server is processing my PHP script. I place my session location in a tmp folder in my public directory. Otherwise I would lose my session variables periodically. -- Jerry Kita http://www.salkehatchiehuntersville.com email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Apache 2.0 and Sessions
Stephen Craton wrote: I just updated to Apache 2.0 and have gotten PHP all with it. However, I just loaded up a script that worked fine on my old Apache 1.3 install but is now causing my errors. Here's the error: Warning: session_start(): open(C:\WINDOWS\TEMP\\sess_8c53cb2382f75076c51ed4b3edece36b, O_RDWR) failed: No such file or directory (2) in D:\htdocs\payments\index.php on line 8 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at D:\htdocs\payments\index.php:8) in D:\htdocs\payments\index.php on line 8 I don't see why it's happening, especially since I went into php.ini (I'm on Windows XP) and changed session.save_patch to this: session.save_path = C:/PHP/sessiondata Can anyone give me some input here? I think I see the problem, the whole double back slash in the file location, but I don't see how to fix that. Thanks, Stephen Craton Stephen, Not sure I can see your error either but here's a thought that might be useful. I run Apache 2.0 on my laptop with PHP 4.3.4. Sessions work fine for me. For various reasons I chose to set my session.save_path at the beginning of every script and it works fine. Here's the line of code I use: session_save_path('c:\Program Files\Apache Group\Apache2\htdocs\tmp'); Again it doesn't answer the question you're asking but it might be an approach that's easy for you to implement. I do it via an include(). -- Jerry Kita http://www.salkehatchiehuntersville.com email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Apache 2.0 and Sessions
Stephen Craton wrote: Thanks for the reply, and I apologize for being a top poster, just a habit. I would do that, and it is a good idea, just not practical since I usually upload or publish the scripts I have on here to a server or to other people. Steve My laptop is my development server but my production work is on a public server. I apologize for not giving you a complete description of what I do ... I set my session.save_path on the public server by creating a TMP directory in my Public_html folder. I've created an IF THEN ELSE that recognizes whether the code is being executed on my laptop or at the public server. The entire include() file is as follows: ?php if ($_SERVER['SERVER_NAME'] == localhost) { session_save_path('c:\Program Files\Apache Group\Apache2\htdocs\tmp'); } else { session_save_path('/...x/public_html/tmp'); } ? Works great ... and the old session files in the public_html/tmp directory get cleaned out automatically. Still might not be practical for you for other reasons but I thought I should give you a more complete answer .. Jerry What I have here will not work on their servers if I do this. I could just comment that line out, granted, but it doesn't seem practical for my situation. Thanks for the suggestion though! Thanks, Stephen Craton -Original Message- From: Jerry Kita [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 11, 2005 7:03 PM To: php-general@lists.php.net Subject: [PHP] Re: Apache 2.0 and Sessions Stephen Craton wrote: I just updated to Apache 2.0 and have gotten PHP all with it. However, I just loaded up a script that worked fine on my old Apache 1.3 install but is now causing my errors. Here's the error: Warning: session_start(): open(C:\WINDOWS\TEMP\\sess_8c53cb2382f75076c51ed4b3edece36b, O_RDWR) failed: No such file or directory (2) in D:\htdocs\payments\index.php on line 8 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at D:\htdocs\payments\index.php:8) in D:\htdocs\payments\index.php on line 8 I don't see why it's happening, especially since I went into php.ini (I'm on Windows XP) and changed session.save_patch to this: session.save_path = C:/PHP/sessiondata Can anyone give me some input here? I think I see the problem, the whole double back slash in the file location, but I don't see how to fix that. Thanks, Stephen Craton Stephen, Not sure I can see your error either but here's a thought that might be useful. I run Apache 2.0 on my laptop with PHP 4.3.4. Sessions work fine for me. For various reasons I chose to set my session.save_path at the beginning of every script and it works fine. Here's the line of code I use: session_save_path('c:\Program Files\Apache Group\Apache2\htdocs\tmp'); Again it doesn't answer the question you're asking but it might be an approach that's easy for you to implement. I do it via an include(). -- Jerry Kita http://www.salkehatchiehuntersville.com email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: making FORM dissapear when successful login
I do exactly the same thing on my website. I use PHP's Session handling to determine if a user is actually logged on. You can see that I check a variable called $validlogon which I set to either YES or NO at the beginning of the script ?php if ($validlogon == NO) { print p class=\hnavbar\Salkehatchie Members Login Here:br\n; print form action=\Salkehatchie_LoginScript.php\ method=\POST\\n; print p class=\login\smallUSER ID:/smallbr\n; print input type=\text\ name=\userid\brbr\n; print smallPASSWORD:/smallbr\n; print input type=\password\ name=\password\brbr\n; print input type=\submit\ value=\Enter\/p\n; print /form\n; } ? Near the beginning of my script I check for the existence of a valid session ?php if (isset($_SESSION[userid])) { $validlogon = YES; } else { $validlogon = NO; } ? Setting the $validlogon variable allows me to do a number of useful things. For example, there are certain parts of the webpage that I reveal to logged in users. Checking $validlogon allows me to decide dynamically what to render to the browser. In the following I display a message showing the user as being logged in and give them a link that logs them out. if ($validlogon == YES) { print table style=\width: 100%\;\n; print tbody\n; print tr\n; print td width=\50%\p class=\login\smallbYOU ARE LOGGED IN AS: $_SESSION[userid]/b/small/p/td\n; print td width=\50%\p class=\login\smallbCLICK a href=\LogoutScript.php\ here/a TO LOGOUT/b/small/p/td\n; print /tr\n; print /table\n; } Hope this is helpful Jerry Kita JHollis wrote: I had this code working the way i wanted it to (as far as correct username and password allowing successful login)...but what i want to happen now is when a user successfully logs it it will make the login form disappear and just say successfully logged in or welcome user and a link below it so they can log off and make the form re-appear. Below is the code that i have where i tried to get it to disappear on successful login, but it stays disappeared all the time. Can someone please point out what im doing wrong. I have tried everything i can think of...and nothing works. Im a PHP newbie...so im sure some of you might get a laugh out of this...if it is real easy. ---snippet !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html head link href=style.css rel=stylesheet type=text/css / /head body div id=container div id=top h1header/h1 /div div id=leftnav p ?php $username=$_POST['username']; $password=$_POST['password']; $db=user; $server=localhost; $db_username=root; $db_password=***; $connect = mysql_connect($server,$db_username,$db_password); if (!$connect) { die (could not connect to database); } $select = mysql_select_db($db,$connect); if (!$select) { die (could not select database $db); } /*username='$username';*/ $sql = SELECT * FROM passwords, user_info where id=PID and username='$username'; $result = mysql_query($sql); /*$num_rows = mysql_num_rows($result);*/ while ($user = mysql_fetch_array($result)) { $id = $user['id']; $username2 = $user['username']; $password2 = $user['password']; $firstname = $user['firstname']; $email = $user['email_address']; IF ($username==$username2 $password==$password2) { echo(\Welcome, b$firstname/b\);?br? echo (\Your email address is b$emailb\);?/tdtr a href=?$_SERVER['PHP_SELF']??username=?password=Logoff/a? break; } else { ? FORM action=?$_SERVER['PHP_SELF']? method=post INPUT type=hidden name=id table tdb*/bUsername:/td tdINPUT class=input size=8 type=text name=username value=?echo $username?/tdtr tdb*/bPassword:/td tdINPUT class=input size=8 type=password name=password/tdtr td class=xsmallb* Case Sensitive/b/td tdINPUT type=submit value=Login/tdtr tdnbsp /td /table /FORM ? break; } } //IF ($username != $username2 || $password != $password2) {// ?br ? if ($username == $password == ) { echo (Please type in a Username and Password);} if ($username != $password == ) { echo (Please type in a password);} if ($username == $password != ) { echo (Please type in a username and password);} ? /p /div ?if (($username2==$username $password2==$password) ($username2!= || $password2!=)){? div id=rightnav class=box p /p /div ?}? div id=content h2Subheading/h2 p /p p /p /div div id=footer p Today is ?php echo( date(F dS Y
[PHP] Re: Calculate No Of Days
Khuram Noman wrote: Hi Is there any function avialable in PHP to calculate the no of days by passing 2 dates like 1 argument is 1/1/2005 and the second one is 1/2/2005 then it returns the no of days or how can i do that if there is no builtin function . Regards Khuram Noman __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com Here's a piece of code that I use on my website. It calculates the number of days from today to some future date (which happens to be July 16, 2005) It's not exactly what you asked for but it might be helpful to you. No one will confuse me with being a professional programmer but this seems to work well on my site. snippet $timeuntilcamp = mktime(12,0,0,7,16,2005,-1) - time(); $daysuntilcamp = round($timeuntilcamp/86400); if ($daysuntilcamp 0) { print h4Days until start of 2005 Camp: .$daysuntilcamp./h4\n; } snippet You can see it in action by visiting: http://www.salkehatchiehuntersville.com/Salkehatchie_2005_Camp.php -- Jerry Kita http://www.salkehatchiehuntersville.com email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to enable ftp in php5?
How I can enable php in FTP 5? What I should change in PHP.INI file? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to set register_globals=off in the script?
I know that register_globals = on is not secure. But one program requires to use register_globals=on. So in php.ini register_globals is set to on. I have PHP 5.1, is it possible in the code set register_globals=off for specific scripts. So I want to keep PHP register_globals=on in php.ini, but in local files set to off? How I can do this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Pass mysql array into SESSION?
I want to pass an array from one page to excell generation page. I tried to pass through session($_SESSION['sql'] = $var). But value is not set. The array is actually $result = mysql_query($query); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP upgrade
How to upgrade PHP 4.3.2 to new version? OS is Linux(Fedora Core 2). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Script Name
What variable(parameter) in PHP stores file name? TH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Name
I meant, file that are being executed. On Fri, 26 Nov 2004 09:46:05 -0500, John Nichel [EMAIL PROTECTED] wrote: Jerry Swanson wrote: What variable(parameter) in PHP stores file name? TH Stores what filename? The name of the file being executed? $_SERVER['SCRIPT_NAME'] -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP script + read file
What is wrong with this code? Why $input_str is empty. if ($handle = opendir('/home/test2/')) { echo Directory handle: $handle\n; echo Files:\n; while (false !== ($file = readdir($handle))) { if($file != . $file != ..){ $handle1 = fopen($file, a+); $input_str = fread($handle1, filesize($file)); echo TEST.$input_str; } } } On Sun, 21 Nov 2004 05:40:07 +0800, Jason Wong [EMAIL PROTECTED] wrote: On Sunday 21 November 2004 05:11, Jerry Swanson wrote: I know how to read a file. But the problem is different, I have directory that has more than 250 files. I need to read each file and process it. But How I know what file to read? ls -l (show all files). How I can select each file without knowing name? The file will be process and than delete. To get list of files from directory: manual Directory Functions To open/read/write/delete files: manual Filesystem Functions There are plenty of examples in the manual and in the user notes of the online manual. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Do not try to solve all life's problems at once -- learn to dread each day as it comes. -- Donald Kaul */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP script + read file
I know how to read a file. But the problem is different, I have directory that has more than 250 files. I need to read each file and process it. But How I know what file to read? ls -l (show all files). How I can select each file without knowing name? The file will be process and than delete. Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HTML form online
I want to write php script that fill out HTML form online. Any ideas how to do it? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Segmentation Fault
I have index.php file. On one server it executes with no problem. On another server it gives me Segmentation Fault error. 4.3.2 - Segmentation Fault 4.3.4 - no problem What can cause such problem? This is simple login page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP file permission
What is the optimal PHP file permission? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP file permission
regular php page, some mysql queries and print html on the screen. On Sun, 14 Nov 2004 18:19:28 +0100, M. Sokolewicz [EMAIL PROTECTED] wrote: depends on what you need it for Jerry Swanson wrote: What is the optimal PHP file permission? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] header variable ?
What variable header use? If I send something in header, what GLOBAL variable header use? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why cookie is created?
So As I understand. Session also store ID on the harddrive. I don't see the big difference between session and cookies from privacy point of view. On Mon, 8 Nov 2004 17:55:03 -0500, Paul Reinheimer [EMAIL PROTECTED] wrote: -- I don't want to use cookies. I want to use session. When I use this code. It stores data on the harddrive. -- When you use Sessions, the data you put in the session is NOT stored on the users hard drive in a cookie. Only the Session ID is stored there. All of the other information you store in the session (say their userid, name, prefernces, security level, etc) is stored on the SERVER. The session ID stored in the cookie only serves as a pointer to the data stored on your server. The alternative to allowing PHP to store the users session id in a cookie is to have php re-write all of the urls on your page to include their session id. Generally this is not the preferred solution for several reasons: 1. URLs look a lot messier eg: a) without cookies http://forum.example.com/index.php?sid=a568a4c022a2f8491323c5f3ef5888d8 b) with cookies http://forum.edonkey.com/index.php 2. Users may accidentally give away their session id, and possibly open the door to session hijacking. 3. Users bookmark pages with stale session ids So, in summary. Using sessions only stores the session id on the users hard drive. The rest of the data stored in the session is saved on the server. paul -- Paul Reinheimer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why cookie is created?
Why when I specify session.cookie_lifetime = 1 // Cookies are not created. However, when I specify large lifetime, cookies are created. session.cookie_lifetime = 1500 On Tue, 9 Nov 2004 08:11:46 -0500, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I just want to give you a simple example that for diff. of session and cookie is that--- When in our gmail account we will see that one option is there to save the password for 2 weeks, so that eans when u check that bbox and submit then one cookie is created for that comp. with your details nand the expiry time would be for 2 weeks (by converting insec.). And when u r in checking of your in box just copy the contents of address bar and then closs all the windo and again paste the address bar link it will sshow you the login page because your inforation is stored in seession.So when a page starts it first of al it check the session.it will check the session id from your co. which is not set when you logged out FOR SESSION == A visitor accessing your web site is assigned an unique id, the so-called session id. The session support allows you to register arbitrary numbers of variables to be preserved across requests. When a visitor accesses your site, PHP will check automatically (if session.auto_start is set to 1) or on your request (explicitly through session_start() or implicitly through session_register()) whether a specific session id has been sent with the request. If this is the case, the prior saved environment is recreated. FOR COOKIE == Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. Ankur Dave PHP Developer INDIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why cookie is created?
I don't use cookie for my page. I use session. As I understand cookies don't create any files on user computer. I have this code below on my page. When I access this page immediately cookie is created on my computer. Any ideas why? ?php session_start(); $referral = $_SESSION['referral']; if(empty($referral)) { $referral = $_SERVER['QUERY_STRING']; $_SESSION['referral'] = $referral; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why cookie is created?
; Whether to use cookies. session.use_cookies = 0 ; This option enables administrators to make their users invulnerable to ; attacks which involve passing session ids in URLs; defaults to 0. session.use_only_cookies = 1 I changed the global variables on PHP. It still stores cookies on my harddrive. Any ideas why? PHP version 4.3.4 On Mon, 08 Nov 2004 16:01:27 -0500, John Nichel [EMAIL PROTECTED] wrote: Jerry Swanson wrote: I don't use cookie for my page. I use session. As I understand cookies don't create any files on user computer. I have this code below on my page. When I access this page immediately cookie is created on my computer. Any ideas why? As soon as you call session_start(), you are 'given' a session id. To track this id from page to page throughout you site, it is stored in a cookie by default. It's all in the manual... http://us4.php.net/session -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why cookie is created?
I don't want to use cookies. I want to use session. When I use this code. It stores data on the harddrive. session_start(); $referral = $_SESSION['referral']; if(empty($referral)) { $referral = $_SERVER['QUERY_STRING']; $_SESSION['referral'] = $referral; } On Mon, 8 Nov 2004 16:19:49 -0600, Greg Donald [EMAIL PROTECTED] wrote: On Mon, 8 Nov 2004 15:56:03 -0500, Jerry Swanson [EMAIL PROTECTED] wrote: I don't use cookie for my page. I use session. As I understand cookies don't create any files on user computer. Your understanding is incorrect. Using cookies does indeed place files on the user's computer. That's what a cookie is, a file on the user's computer, created by the web client. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] email as link
I'm sending email in text format. When I specify URL in the email http://www.mydomain.com, person that receive email can click on the link and go to the page. But when a person receive and email with email address like [EMAIL PROTECTED] the email is regular text not an email. How to make email address to be a link? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] beginnind and end of the week
Your solution works only for Monday. For Tuesday output is below start -- 20041108 end - 20041114 I have no idea why ti doesn't wotk. On Mon, 1 Nov 2004 02:45:59 +, Curt Zirzow [EMAIL PROTECTED] wrote: * Thus wrote Jerry Swanson: I need to run a query using PHP/MYSQL. The query should be for a week. So if today is tuesday, the query should be from Monday to Sunday. How in in php I can know when the beginning and end of the week? ?php // in case the date unlikley changes $t = time(); // this weeks monday $m = strtotime('this monday', $t); // next weeks monday minus 1 second $s = strtotime('next monday', $t) - 1; echo date('r', $m), \n; echo date('r', $s), \n ? Now $m and $s contain the proper timestamps. Curt -- Quoth the Raven, Nevermore. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] text email new line
I'm sending text email. How I can make new line. \n seems to be not working. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] text email new line
#1. $headers .= Content-Type: text/plain; #2. $headers .= Content-Type: text/html; charset=iso-8859-1\r\n; If I use #1 header I don't need \n\r just create extra space on the email. Why \n\r doesn't work for #2 ? TH On Tue, 2 Nov 2004 17:23:41 +0100, Sebastiano Cascione [EMAIL PROTECTED] wrote: Use \r\n Some pop server doesn't support other special characters. Sebastiano Alle 17:12, martedì 2 novembre 2004, Jerry Swanson ha scritto: I'm sending text email. How I can make new line. \n seems to be not working. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] text email new line
It is working without \r\n. Just using regular spaces/new lines in the text message. On Tue, 2 Nov 2004 18:34:00 +0100, Jordi Canals [EMAIL PROTECTED] wrote: On Tue, 2 Nov 2004 16:25:56 +, Richard Davey [EMAIL PROTECTED] wrote: Hello Jerry, JS I'm sending text email. How I can make new line. JS \n seems to be not working. \n in a text (not HTML) email will do the trick most of the time, sometimes I see \r\n, but \n works for me nicely. Are you sure it's quoted properly? instead of ''? The RFC 2822 for Internet Message Format states clearly that MUST be \r\n using only \n is not standard and you cannot expet all servers to accept it as a valid separator. Just want to take your attention to this paragraph from RFC 2822: Messages are divided into lines of characters. A line is a series of characters that is delimited with the TWO characters carriage-return and line-feed; that is, the carriage-return (CR) character (ASCII value 13) followed inmediatly by the line-feed (LF) character (ASCII value 10). Also take in consideration that a message line cannot have more that 998 characters (plus CRLF) ... The RFC 2821 says: The apperance of CR or LF characters in text has long history of causing problems in mail implementations and applications that use the mail system as a tool. SMTP client implementattions MUST NOT transmit these characters except when they are intended as line terminators and then MUST transmit them only as CRLF sequence. I hope this will help in composing mail messages and my recommendation is to *follow the standard* and send messages always by using CRLF as a line delimiter. Only doing that way, you will ensure your messages are accepted by any server. More information: RFC 2822 - http://www.faqs.org/rfcs/rfc2822.html. RFC 2821 - http://www.faqs.org/rfcs/rfc2821.html. Best regards, Jordi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] beginnind and end of the week
I need to run a query using PHP/MYSQL. The query should be for a week. So if today is tuesday, the query should be from Monday to Sunday. How in in php I can know when the beginning and end of the week? TH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] output htmkl file as text
I want to output html file on the screen like text not like html file. I want a program to read html file and output source code to the screen. Any ideas how to fake browser, so browser will print html tags on the screen? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to parse this?
I have huge html file. I want to parse the data and get everything between b class=class1 and !-- Comments -- What function is good for this purpose? TH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing
I have huge html file. I want to parse the data and get everything between b class=class1 and !-- Comments -- What function is good for this purpose? TH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: ' (Single Quotes) in user inputs
I'm not sure that stripslashes() are used for input. addslashes() - to insert data into database stripslashes() - to get data from database and print it. On 14 Oct 2004 11:19:14 +0200, Christian Jul Jensen [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] (Ben) writes: Any ideas on dealing with this would be greatly appreciated. Disable magic_quotes, and handle all escaping of characters yourself, I would absolutely prefer that. But beware of sql-injection. Leave magic_quotes on, and use stripslashes() on your input. -- Christian Jul Jensen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] For how long session exist
For what period of time a session can exist? Or session exist as soon as browser is open? TH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Validation
On what percent browsers Javascript is enabled? On Wed, 13 Oct 2004 15:48:51 -0700, Mattias Thorslund [EMAIL PROTECTED] wrote: There are several JavaScript solutions for validating forms on the client side. Search on hotscripts.com and google.com. Client-side validation (in the browser) is useful, but you shouldn't depend on it to guarantee that the data that your users submit is valid. You should also validate the data in your PHP script as you process the form. Oh, and there are several PHP-based list managers available, for instance phplist, so you may not need to program it yourself. /Mattias Huang, Ou wrote: I am currently working on a newsletter mailing list project and developed a form in php. I would like to validate before it is submitted. What would be the best way to validate a form? Write your own routines or using a form validator. I just started learning PHP, so don't have much experience on this. I am thinking using a form validator but not sure where I can get it. Any suggestions would be appreciated! Thanks. -- More views at http://www.thorslund.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] time
I want to send email every 24. What time format you recomend to use? In what format the data should be store in mysql? TH -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] please ignore
just testing maildrop please ignore :)
[PHP] Re: Session problems under heavy load???
I had a problem with session variables being lost. However it wasn't because of a heavy load. My hosting company does load balancing and user requests would be directed to different servers. However, when the session was originally defined it was placed in the /tmp file of one server. When a request came into a different server it wouldn't know about the session and hence the variables seemed lost only to reappear unexpectedly a few requests later. I fixed the problem by defining the /tmp directory to my public_html directory. This may have nothing to do with your isse but the heavy load you are experiencing may be triggering some load balancing mechanism which is directing users to another server that isn't aware of your session variables. Boot [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] My server was under a heavy load (rebuilding software raid 1 array) and my PHP+MySQL site seemed to be all messed up. From what I can makeout session variables were being lost. I would expect simply degraded performance but not the loss of variables. Is this normal? LOL the array is still rebuilding right now and the alternative problem means something happened to my code (yes I have backups :)) Thanks for any comments! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session Variables Disappear and Reappear
For those interested I was able to get to the bottom of this issue. My hosting supplier uses multiple servers to do load balancing. As such the folder in which the session variables were stored was stored in a /tmp file on each of the servers. That explained why the session variables would randomly disappear and reappear. It also explained why my single-server test system experienced no problems. The solution was to set up a /tmp folder for the session variables in my public_html folder. When I did this everything worked perfectly. I'm not a professional programmer. I started this website very recently on behalf of a project we do at our church. I'd be interested in others opinions and thoughts regarding how other hosting services handle this issue. Should I have expected to create the /tmp folder within my public_html folder or do other hosting services provide a different approach? Thanks and Happy New Year to everyone. Jerry Kita Jerry Kita [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] New to PHP and I've checked previous posts and haven't seen similar problem. Any ideas would be appreciated. Have encounted an odd problem. Using session variables to allow users to log in and out of my site. I've created a test system on my laptop. Apache 2.0.48, PHP 4.3.4, MySQL and Windows 2000. On my test system everything works perfectly. Sessions are created and maintained as long as the browser is open. I can also destroy sessions. However when I load everything up to my site via FTP the results are very sporadic. Sessions seem to drop and reappear. While a user is logged in I display a Logged in as: X message at the top of the page. I can continually refresh the page and occassionally the Logged in as X message will disappear showing the Please Login Form. If I refresh again (without logging in) the page shows the user is again Logged in. Here's the script that I use to log users in: ?php error_reporting (E_ALL ^ E_NOTICE); //check for required fields from the form if ((!$_POST[userid]) || (!$_POST[password])) { header(Location: Salkehatchie_Home.php); exit; } session_start(); //connect to server and select database $conn = mysql_connect(x.x.x.x, xx, x) or die(mysql_error()); //echo Connection is $conn br; mysql_select_db(xx_salkehatchie,$conn) or die(mysql_error()); //create and issue the query $sql = select userid, password, privs from userlist where userid = '$_POST[userid]' AND password = '$_POST[password]'; //echo USERID is $_POST[userid]br; //echo PASSWORD is $_POST[password]br; //echo SQL is $sqlbr; $result = mysql_query($sql,$conn) or die(mysql_error()); //echo Result is $resultbr; $rows = mysql_num_rows($result); //echo Number of Rows are $rowsbr; //get the number of rows in the result set; should be 1 if a match if (mysql_num_rows($result) == 1) { //if authorized, get the values set the $_SESSION Variables -- userid, password and privs $_SESSION[userid] = $_POST[userid]; $_SESSION[password] = $_POST[password]; $_SESSION[privs] = mysql_result($result, 0, 'privs'); //Direct user to members page header(Location: Salkehatchie_Members_Home.php); exit; } else { //redirect back to login form if not authorized header(Location: Salkehatchie_Home.php); exit; } ? I start off each webpage with the following script: ?php //Check for existence of Valid Login ID error_reporting (E_ALL ^ E_NOTICE); header(Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); header(Expires: . gmdate(D, d M Y H:i:s) . GMT); header(Cache-Control: no-store, no-cache, must-revalidate ); header(Cache-Control: post-check=0, pre-check=0, false); header(Pragma: no-cache); session_start(); if (isset($_SESSION[userid])) { $validlogon = YES; } else { $validlogon = NO; } echo $validlogon //test to see if user has previously logged on This all works perfectly on my test system but creates problems at my site. If anyone would like to see this for themselves go to the following site: http://www.salkehatchiehuntersville.com/Salkehatchie_Home.php and log in using test/test as userid/password. When logged in go back to the home page and then continually refresh that page. You will see that that the user moves in and out of a logged in status. This will also show up on other pages but since this site is under construction it's safest to stick to the HOME page. Other possibly helpful information. Web Hosting site is BlueDomino. Thanks for your help. Jerry Kita -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session Variables Disappear and Reappear
New to PHP and I've checked previous posts and haven't seen similar problem. Any ideas would be appreciated. Have encounted an odd problem. Using session variables to allow users to log in and out of my site. I've created a test system on my laptop. Apache 2.0.48, PHP 4.3.4, MySQL and Windows 2000. On my test system everything works perfectly. Sessions are created and maintained as long as the browser is open. I can also destroy sessions. However when I load everything up to my site via FTP the results are very sporadic. Sessions seem to drop and reappear. While a user is logged in I display a Logged in as: X message at the top of the page. I can continually refresh the page and occassionally the Logged in as X message will disappear showing the Please Login Form. If I refresh again (without logging in) the page shows the user is again Logged in. Here's the script that I use to log users in: ?php error_reporting (E_ALL ^ E_NOTICE); //check for required fields from the form if ((!$_POST[userid]) || (!$_POST[password])) { header(Location: Salkehatchie_Home.php); exit; } session_start(); //connect to server and select database $conn = mysql_connect(x.x.x.x, xx, x) or die(mysql_error()); //echo Connection is $conn br; mysql_select_db(xx_salkehatchie,$conn) or die(mysql_error()); //create and issue the query $sql = select userid, password, privs from userlist where userid = '$_POST[userid]' AND password = '$_POST[password]'; //echo USERID is $_POST[userid]br; //echo PASSWORD is $_POST[password]br; //echo SQL is $sqlbr; $result = mysql_query($sql,$conn) or die(mysql_error()); //echo Result is $resultbr; $rows = mysql_num_rows($result); //echo Number of Rows are $rowsbr; //get the number of rows in the result set; should be 1 if a match if (mysql_num_rows($result) == 1) { //if authorized, get the values set the $_SESSION Variables -- userid, password and privs $_SESSION[userid] = $_POST[userid]; $_SESSION[password] = $_POST[password]; $_SESSION[privs] = mysql_result($result, 0, 'privs'); //Direct user to members page header(Location: Salkehatchie_Members_Home.php); exit; } else { //redirect back to login form if not authorized header(Location: Salkehatchie_Home.php); exit; } ? I start off each webpage with the following script: ?php //Check for existence of Valid Login ID error_reporting (E_ALL ^ E_NOTICE); header(Last-Modified: . gmdate(D, d M Y H:i:s) . GMT); header(Expires: . gmdate(D, d M Y H:i:s) . GMT); header(Cache-Control: no-store, no-cache, must-revalidate ); header(Cache-Control: post-check=0, pre-check=0, false); header(Pragma: no-cache); session_start(); if (isset($_SESSION[userid])) { $validlogon = YES; } else { $validlogon = NO; } echo $validlogon //test to see if user has previously logged on This all works perfectly on my test system but creates problems at my site. If anyone would like to see this for themselves go to the following site: http://www.salkehatchiehuntersville.com/Salkehatchie_Home.php and log in using test/test as userid/password. When logged in go back to the home page and then continually refresh that page. You will see that that the user moves in and out of a logged in status. This will also show up on other pages but since this site is under construction it's safest to stick to the HOME page. Other possibly helpful information. Web Hosting site is BlueDomino. Thanks for your help. Jerry Kita -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Not able to execute Linux binary
On Mon, Dec 08, 2003 at 01:28:11PM +0800, Jason Wong wrote: On Monday 08 December 2003 12:56, Karam Chand wrote: I think there is some problem with the permission. Even if I execute a command like - echo ( start ); exec ( pwd ); echo ( end ); the output is - startend shouldnt be pwd showing the present working directory to me. Yes, but exec() itself does NOT output anything. If there is a beter way, someone reply but I beleave the command you are looking for is system() -- Jerry M. Howell II -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Dynamic Website Question!
Hi, I am not familiar with DHTML and how it can be used to talk to PHP to update a certain part of a page. That is all I need, is one section of the page, not the entire page, to be refreshed. The part is just text from a database. However on the page I want backgrounds, images etc but I don't want these to refresh, just the text from the database. What you have said below seems exactly what I want. But I have never used DHTML. Could you show me a example of both frames (just the source) of how one talks to another please? Jerry --- Bronislav Klucka [EMAIL PROTECTED] wrote: I want to have a PHP website that feeds information off a mysql database. But generally changes occour and instead of asking users to refresh the page to get the updates is there a way to provide the updates without them needing to refresh the page? E.G. For like shooping Carts, Chat rooms, etc... Is there a way in PHP or something to make updates show up live as they happen instead of the yucky meta refresh tag in HTML? Thanks for your time in advance. I'm sorry, I always dissapoint you, but what ever you want to send to browser must be demend by the browser. I mean you can tell browser to reload part of the page, browser has to ask for it, you can send more information to the browser and then use DHTML to provide the showing, or hiding... There is only one way how to do, what you want (but it always ask the server, only user will not see reloading). The way is to have 2 frames: 1st for showing the content and the second to refresh every 1 min. (or as you want), receive informations and using DHTML change the content of the first frame, the secomd frame could be at the bootom of the browser, 1pixel height, to be invisible Brona http://personals.yahoo.com.au - Yahoo! Personals New people, new possibilities. FREE for a limited time. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Dynamic Website Question!
Hi, Okay let me explain what I want to do. Now I have a variety of queries to do to the database and echo's to echo out and how to output on the PHP page. But I am not sure how to get my code (below) sucessfully to work in the example in the previous email. (found lower) Could someone point me in the right direction please? I need the echo's shown in the queries to be outputed on the page as it says. But I need only that part of the page to be refreshed once every 5 seconds and not the enitre page to reload.. Just the data from the database. Here is my code: ? require('header.php'); // delete user if user=admin and action=deleteuser if ($username == $adminloginname AND $action == deleteuser) { $sql = DELETE from user WHERE naam='$delname'; mysql_query($sql, $conn); //also delete his/her messages $sql = DELETE from message WHERE sender = '$delname' OR recipient = '$delname'; mysql_query($sql, $conn); } //get all users $sql = SELECT naam, lastlogin FROM user where naam '$username'; $result=mysql_query($sql, $conn); // toon lijst met users while ($myrow = mysql_fetch_array($result)) { // show name of friend echo a href=send.php?recipientname= . htmlentities(urlencode($myrow[naam])) . font color=\$linkcolor\$myrow[naam]/font/a; // count all mesages for this user $sql = SELECT count(*) as aantal FROM message where recipient = '$username' AND sender = '$myrow[naam]'; $messageresult=mysql_query($sql, $conn); // toon aantal messsages per vriend $myrow2 = mysql_fetch_array($messageresult); if ($myrow2[aantal] 0) { // kijk of er nog nieuwe messages zijn $sql = SELECT isread FROM message where recipient = '$username' AND sender = '$myrow[naam]' AND isread=0; $readmessageresult=mysql_query($sql, $conn); $myrow3 = mysql_fetch_array($readmessageresult); echo a href=\messages.php?sender= . htmlentities(urlencode($myrow[naam])) . \; if ($myrow3[isread] == null) { echo font color=\$oldmessagecolor\(. $myrow2[aantal] . )/font/a; }else{ echo font color=\$newmessagecolor\(. $myrow2[aantal] . )/font/a; } } // show online/offline status if ($timestamp - totime($myrow[lastlogin]) $isonlineseconds) { echo font color=\$offlinecolor\$langisoffline/font; }else{ echo font color=\$onlinecolor\$langisonline/font; } // give admin delete possibility if ($adminloginname == $username) { echo a href=\index.php?action=deleteuserdelname= . htmlentities(urlencode($myrow[naam])) . \font color=\$linkcolor\x/font/abr; }else{ echo br; } } ? Now maybe I need to do each query seperately to work in the example below? But how.. And remembering to output the echo's and not what the database provides. As I need it to be formated as in the echo. Unless I remove the echo's and put the results as defined in the example below. function DoOnLoad(){ ele=PSGetElementById(parent.frames[0],text); ele.innerHTML=?=date(Y-m-d H:i:s);?; ^ With myrow['whatever'] I'm not sure, new to this stuff, but thought I'd post my code, maybe someone could whack up a code that functions The code of the refreshing part is below with all pages relevant to it. (please note i emailed the person that gave me the code below and replied with my code but they have not replied as of yet of how to get it to function so that is why i posted on here also.) Jerry --- Bronislav Klucka [EMAIL PROTECTED] wrote: index.php html frameset rows=100%,* border=0 frameborder=no frame name=first src=first.php noresize frame name=second src=second.php noresize /frameset /html first.php html body div id=text/div /body /html second.php html head meta http-equiv=refresh content=10;URL=second.php script function PSBrowser(){ this.ns4 = (window.document.layers); this.ie4
Re: [PHP] RE: [PHP-DB] Dynamic Website Question!
I am using frames. As mentioned in the email(s)... If you read it it shows 3 different php files. One is the index to display 1 frame and hide the second frame. The displaying frame has the outputed information and a section defined to be refreshed by the hidden frame. The hidden frame consists of the parameters to refresh frame showing and tell frame showing to update a set area with updated information. The email(s) state that, read all emails. Jerry --- Jason Sheets [EMAIL PROTECTED] wrote: JeRRy wrote: Hi, Okay let me explain what I want to do. Now I have a variety of queries to do to the database and echo's to echo out and how to output on the PHP page. But I am not sure how to get my code (below) sucessfully to work in the example in the previous email. (found lower) Could someone point me in the right direction please? I need the echo's shown in the queries to be outputed on the page as it says. But I need only that part of the page to be refreshed once every 5 seconds and not the enitre page to reload.. Just the data from the database. Here is my code: ? require('header.php'); // delete user if user=admin and action=deleteuser if ($username == $adminloginname AND $action == deleteuser) { $sql = DELETE from user WHERE naam='$delname'; mysql_query($sql, $conn); //also delete his/her messages $sql = DELETE from message WHERE sender = '$delname' OR recipient = '$delname'; mysql_query($sql, $conn); } //get all users $sql = SELECT naam, lastlogin FROM user where naam '$username'; $result=mysql_query($sql, $conn); // toon lijst met users while ($myrow = mysql_fetch_array($result)) { // show name of friend echo a href=send.php?recipientname= . htmlentities(urlencode($myrow[naam])) . font color=\$linkcolor\$myrow[naam]/font/a; // count all mesages for this user $sql = SELECT count(*) as aantal FROM message where recipient = '$username' AND sender = '$myrow[naam]'; $messageresult=mysql_query($sql, $conn); // toon aantal messsages per vriend $myrow2 = mysql_fetch_array($messageresult); if ($myrow2[aantal] 0) { // kijk of er nog nieuwe messages zijn $sql = SELECT isread FROM message where recipient = '$username' AND sender = '$myrow[naam]' AND isread=0; $readmessageresult=mysql_query($sql, $conn); $myrow3 = mysql_fetch_array($readmessageresult); echo a href=\messages.php?sender= . htmlentities(urlencode($myrow[naam])) . \; if ($myrow3[isread] == null) { echo font color=\$oldmessagecolor\(. $myrow2[aantal] . )/font/a; }else{ echo font color=\$newmessagecolor\(. $myrow2[aantal] . )/font/a; } } // show online/offline status if ($timestamp - totime($myrow[lastlogin]) $isonlineseconds) { echo font color=\$offlinecolor\$langisoffline/font; }else{ echo font color=\$onlinecolor\$langisonline/font; } // give admin delete possibility if ($adminloginname == $username) { echo a href=\index.php?action=deleteuserdelname= . htmlentities(urlencode($myrow[naam])) . \font color=\$linkcolor\x/font/abr; }else{ echo br; } } ? Now maybe I need to do each query seperately to work in the example below? But how.. And remembering to output the echo's and not what the database provides. As I need it to be formated as in the echo. Unless I remove the echo's and put the results as defined in the example below. function DoOnLoad(){ ele=PSGetElementById(parent.frames[0],text); ele.innerHTML=?=date(Y-m-d H:i:s);?; ^ With myrow['whatever'] I'm not sure, new to this stuff, but thought I'd post my code, maybe someone could whack up a code that functions The code of the refreshing part is below with all pages
[PHP] Good php WebMail Clients thru apache
Any suggestions ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT-Re: worm on th list
On Wed, Aug 20, 2003 at 11:11:43AM -0400, andu wrote: Is this worm/virus windows specific? It appears so but considering a good percent of users are MS/Outlook users this is a bad one. Got over 100 yesterday, 100+ the day before and looking at the same today. Considering I hardly ever have seen a wild virus emailed to me, this is a bad one. -- Jerry M. Howell II -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: arguments against moving site from Linux/Apache/PHP server to Windows/IIS/PHP needed
How about you can get a the world's fastest PC, a 64bit server that handles 8gig of memory that can run cicles around any wintel based machine and still use all the *nix software without having rewrite anything for say $3k. That's with 10/100/1000 ethernet ports. It already has hugely more installed base than Linux (7 million) and can still run all your favorite MS software even Windows OS if so inclined-- as an additional application. There is no server/user license fees from the manufacturer. For bigger projects, thing like Oracle are available. It doesn't require a whole new staff of certified (READ $) staff to manage and maintain. In fact, $1k a year can buy you 30min 24/7 phone response and 4hr business hours on-site response time factory service. For $6k you can put fibre channel 1.25T of raid data. If you really need a GUI for all the *nix stuff and perhaps don't care to unload or compile from source, a Server option for $500 will give you all kinds of GUI interfaces to the settings, again- unlimited users. Jerry Artman Budget and Reimbursement [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Expensive WEB HOST NEEDED!!!!!
-Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: 24 June 2003 13:20 To: Denis 'Alpheus' Cahuk; [EMAIL PROTECTED] [snip] Like I said, I need a web host. It MUST support PHP, mySQl and sending emails, optional. It shouldn't have any ads (pop-ups, ads), but I will allow if it has watermarks (SMALL! watermarks). It should be TOTALY FREE! [/snip] You must be kidding. You probably will find one that supports one or two of these features for free but anyplace thats free will probably have banners and mabe even watermarks. Most anyone can probably send you to a cheep place as prices have droped since I started but what your asking is for someone not to make a living? Kinda unreasonable. Anyways, I try and avoid these threads as they waste mucho bandwith but here I am :) -- Jerry M. Howell II -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Warning Spammer
On Wed, Jun 11, 2003 at 10:45:15AM +1000, daniel wrote: i dont know u tell me, all i know is thats how i'm being mail bombed so do they get the emails from the archive ? ?if so password protect please !! Which one? This list is archived on numerous sites. So what your saying is that we password protect from ppl googleing up answers so one person can avoid spam? I personaly think that day will be a sad one. As of right now I see no php value to this thread so a;; rplies will be nicely sent to /dev/null . PS. Look into a good e-mail filter. -- Jerry M. Howell II -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Please point me in the right direction
Hi All, I have a CGI application written in Delphi web services and I want to port it to the Linux environment. I was going to use Kylix but I'm concerned that Borland isn't keeping up with the fast paced Linux development (ie they are still on Redhat 7.2 and Redhat is about to release version 9.0 next month). The current CGI is a little complicated and relies heavily on OOP data structures. It processes the data then sends a stream to the web server for display in the browser. It's very fast and I am happy with the performace, but I must port it over to Linux. As I am very unfamiliar with the PHP environment, can someone point in the right direction? If I use PHP for the front-end, what is the best tool to create the CGI? I was considering using Python, but would Pearl be better? Any direction to get me started and headed in the right direction would be very appreciated Thanks, Jerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Powerpoint presentations?!?
Do a search for other applications that write PPT files. I have used a number of others in the past. Perhaps they are scriptable and run in your environment. Perhaps openOffice? Example: Apple's new presentation product. I does write PPT. Their products are normally very scriptable. Also OFFICEx PowerPoint for OSX should be fairly scriptable. Apple's OSAX is very easy to understand and use. Also powerpoint plays quicktime and wm files. Might it be possible to build the file in that format and then have played back in PP? (or as alternative to PP)? Jerry Artman Budget and Reimbursement [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: iCal parser and importing iCal to database
Just drop on over to http://phpicalendar.sourceforge.net/nuke/ and I think you'll find what you are looking for. Jerry Artman Budget and Reimbursement [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php and asp
Hello all I seem to recall php being able to provide some suport for asp. How would I turn this feature on? is it a line in the php.ini or is it a compile time option? -- Jerry M. Howell II -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Humour me
if you ran locate php.ini you would find it's in /etc/php.ini :) hey it sure beats RTFM, lol On Fri, 06 Dec 2002 23:39:59 -0500 John Taylor-Johnston [EMAIL PROTECTED] wrote: Humour me. New server. I'm a little tired. Where is my php.ini on a red hat server? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Jerry M. Howell II -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: publishing php mysql website on cd-rom
Mike, What makes you think I would allow you to setup http services on my machine on the fly and potentially open it up to the outside world for attack? I consider that a bad idea. I would really need to know you very well to consider such privileges. Jerry Artman Budget and Reimbursement [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php