[PHP] function to discover if value is already in array
Here is an example array: array( array(1,2), array(2,3), array(3,1) ) now suppose I get some form inputs with the value 1 and 1. I am trying to find a way to figure out if the first coloumn is already in the table and if so just add the second coloumn to the first. I have tried various combinations of foreaches, in_array and array_search. Has anyone had a similar problem and found a soloution? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] append to array?
I have actually rtfm and can't seem to find a function to add onto the end of an array. Is there a function to do it or do i need to write my own? -- --- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyway to interface to myob
I need a way to interface php with myob, is it possible? -- --- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Best way to include multi-lingual support in an application.
I am currently planning an application. I would like to include multiple language support so that I can have a german or french version down the track if need be. What are your views on the best way to include the ability to add languages after it is complete? -- --- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: CVS In PHP
Either use exec() to run a command line script. Or investigate creating a php module or something. -- --- JJ Harrison [EMAIL PROTECTED] Trilochan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello Every body , I have written some programs in c , I want to run those programs in my PHP script. Is there any way to do that . Any suggestion is highly appreciated. Regards Trilochan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Free PHP Hosts?
Until now I haven't had the need for a free PHP host because what I have done has been commercial. However, In this case I am doing the website for my PC Gaming clan. We are one step below needing php to do alot of stuff. Does anyone know of a free php webhost? (Banners, poop-ups etc are exceptable). -- --- JJ Harrison [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Free PHP Hosts?
I did do that, and have yet to turn up a useful result. That is why I asked. David T-G [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help, Convincing upgrade of PHP
I will be generating a dynamic website for a Class in america. (Don't worry about details) The schools technican is the type that doesn't really know what they are talking about. They are running PHP 4.0.6 which is too old for me - Language differances. They say that upgrading to PHP 4.2.3 will put unnessercary load on our server. I have told about the security problem found (Which applys to 4.2.x only, but he doesn't know that). Can anyone think of other excuses. I told about safe mode for security. He said that when they buy a new server they will get the new version of PHP. TO me this suggests that he doesn't know how to compile PHP for Mac OS X server. Does anyone know of some good instructions? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: html parsing from html file through php
Hello, I am making an app that read from an html file outputted by MS word (ya its for those people that need to make webpages but don't know how o write html) anyway, using MS word is a requirement; After the user saves their .doc file as a web page (now and htm file) the php will take that html file from a dir on the server, open it, read it, and ignore anything that is from the beginning of the file up to and right after the body tag ends, then it must ignore anything at the end of the page up and including the body tags and the closing html tag. So basically after its done doing its thing I would have all the content of the page ready to be echoed inside another page that would be a sort of shell or template. I am loocking right now at regular expressions and file_open etc, but just to give you an idea and to see if anybody has any helpful pointers, this (yes, can u believe it?) is the beginning of the word2html translation that MS word does: (BAH!) (i have to get rid of this remember?) Here is an example regular expression that someone on this group gave me. It gives everything between the body tags. ?php $html_text = ' html head titleUntitled/title /head body Blah Blah Blah Blah /body /html '; preg_match(/body(.*)\/body/i,$html_text,$matches); echo $html_text; ? Here is a class that removes un-needed word 2000 HTML tags: http://www.phpclasses.org/browse.html/package/277.html If you need the styling you will need to do an extra regular expression to get out of the head and perhaps put it into a file. If you don't need styling I would recomment parsing the document itself and removing all the class= and style= attributes -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Save ability... Duplicate DB entries
i have this code snippet: if(isset($_POST['save'])){ $query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].', '.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\', '.$_POST['cat'].', \''.$_POST['text'].'\', 0)'; $result = mysql_query($query) or die(Query failed: $querybr . mysql_error()); echo 'you saved your work.'; } elseif(isset($_POST['pub'])) { $query = 'INSERT INTO article_data VALUES (\'\', '.$_SESSION['uid'].', '.time().', \''.$_POST['title'].'\', \''.$_POST['description'].'\', '.$_POST['cat'].', \''.nl2br($_POST['text']).'\', 0)'; echo 'you published your work.'; } Which has a save or a publish option. I only want to keep one copy of each article in the DB. This adds a new one each time. I know about updates in SQL but the file may or may not already be in the db. Does anyone have a good way to go about this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Save ability... Duplicate DB entries
I'll do that. When I load an article I supply the article's id. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- Please reply on the list/newsgroup unless the reply it OT. Analysis Solutions [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi JJ: On Sun, Aug 11, 2002 at 01:44:53AM +1000, JJ Harrison wrote: Which has a save or a publish option. I only want to keep one copy of each article in the DB. This adds a new one each time. I know about updates in SQL but the file may or may not already be in the db. Does anyone have a good way to go about this? Here's a quick outline of what I do. I have a form for entering in articles. If the form is opened without an ArticleID, the ArticleID (a hidden form field) becomes 0. But, if the form is opened with an ArticleID, the given ArticleID is put in the hidden field. Now, when I make my changes and hit the Save (submit) button, the script checks the ArticleID. If it's 0, do an insert. If it's non-zero, do an update. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Linux PHP editor
Thanks for all your responses... I will begin checking them out. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Jj Harrison\ [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I just switched over to Red Hat Linux from Win2k... Only to find my fav editor only works on windows systems... could someone suggest a good replacement? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help to choose hosting!
I would recommend Infinology Smart Consumers: http://smartconsumers.infinology.com/ You should look at them. I use them and I am very pleased with their service. Their servers have very fast response times and the give you plentiful features. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Mantas Kriauciunas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hey php-general, i want to buy hosting. but i can't find good one for me. maybe someone could point some links. but this is what i need! Storage up to 100MB normal transfer limit(best would be without) CGI/Perl/PHP/ASP/SSI/SSL MySQL database (can be only 1) some pop3 mailboxes free domain transfer (maybe free domain if i pay for 1 year ahead) FTP access SSH access Shell capability up to 3 background processes if anyone know combination like that i would appreaciate your help! thanks -- Best regards, Mantas Contacts: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Logging out with authentication
You could redirect to a file outside the 'realm' by using header(location: ) or just linking to it. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Ray Todd Stevens [EMAIL PROTECTED] wrote in message 3D44690D.25129.D620734@localhost">news:3D44690D.25129.D620734@localhost... I am working on a web site that is using php controled www- authenticate authentication. User ids are specific to users and different pages and different levels of information for a given page will be displayed based on the user id used. The problem is how do you log out without having to quit all browser sessions. Anyone doing this? Care to share code that makes it work? -- Ray Todd Stevens Specialists in Network and Security Consulting Senior ConsultantSoftware audit service available Stevens Services Suite 21 3754 Old State Rd 37 N Bedford, IN 47421 (812) 279-9394 [EMAIL PROTECTED] Thought for the day: Concerto (n): a fight between a piano and a pianist. For PGP public key send message with subject please send PGP key If this message refers to an attachment the attachment may arrive as a seperate mail message depending on the type of mail client and gateway software you are using. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP + Form + Session Problem. Please help
I could take a guess. I would imagine that you are not closing all of your browser windows. This means that the session cookie was being kept. First I recommend using session_destroy(); at the end of your session work. Also writting your script as if register globals was off would probably fix it. e.g. use $_SESSION['qty'] instead of $qty for session data. Using scripts ensures greater compatibilty and (hopefully) better security. For more info on Register Globals you should check out these pages: http://www.php.net/manual/en/security.registerglobals.php http://www.php.net/manual/en/language.variables.predefined.php I also suggest buying a book for PHP(if you don't have one) I would recommend PHP and MySQL Web Development by Luke Welling and Laura Thopson. It includes a working example of what you are probably trying to do. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Wee Keat [EMAIL PROTECTED] wrote in message 008601c236bc$a656e7a0$6300a8c0@wickid">news:008601c236bc$a656e7a0$6300a8c0@wickid... Hi all, I have been working on an online shopping thingy for quite a while and I have encounter a strange problem which could not be solved. Deeply needed your help. Problem: Its very hard to explain this. So, if you do not quite understand it, please tell me, I will send some screenshots to you personally... I tried send it here but it was rejected. Okay.. here goes... I have a product list, where customers can select which products to buy and enter the quantity they want... Upon clicking on Order button, the customer is brought to his shopping cartwhere there is the product, with price in Per Unit, Qty, and Total Price . In this area, value for Qty column is obtained from the $qty that is passed on from the previous page, where it is also a registered in session_register(qty). (The same goes to the Product, where prod_id is obtained from $prod_id, also a session registered variable.) It worked out fine so far... it could get the product, unit price, qty and the total price. But then, when I continued shopping second time, doing the same thing, first select the product, then enter the quantity and then dump it in the shopping cart, something starts going wrong... the Qty column do not show any value at all.. However, products are still working... which means that the $prod_id session is recorded. How come? Here is the snippet of the script: (took out the HTML font tags to make it more readable) The code I used to create the table in the product list - ?php session_start(); session_register(qty); ? all other normal thingy.. while($query_data = mysql_fetch_array($result)) { $price = $query_data[price_lq] * $rrp * $gst; $RowColor = useColor(); echo TR BGCOLOR=\$RowColor\; echo TD.$query_data[prod_brand]./TD; echo TD.$query_data[prod_code]./TD; echo TD.$query_data[prod_desc]./TD; echo TD$,number_format($price, 2, '.', ''),/TD; echo TDinput name=\qty[.$query_data[prod_id].]\ type=\text\ size=\1\/TD\n; echo TDinput type=\checkbox\ name=\choice[, $query_data[prod_id], ]\ value=\, $query_data[prod_id],\/TD\n; } all other html stuffs. --- This is the code I used for the shopping cart --- ?php session_start(); session_register(qty); ? all other normal thingy.. while (list($key,$prod_id) = each($cart)) { $result = mysql_query(SELECT * FROM products WHERE prod_id = '$prod_id' ORDER BY prod_brand ASC, $link_id); $query_data = mysql_fetch_array($result); $RowColor = useColor(); $index = $query_data[prod_id]; $quantity = $qty[$index]; $price_perunit = $query_data[price_lq] * $rrp * $gst; $total_price = $query_data[price_lq] * $rrp * $gst * $quantity; $grandtotal = $grandtotal + $total_price; echo TR BGCOLOR=\$RowColor\; echo TD.$query_data[prod_brand]./TD; echo TD.$query_data[prod_desc]./TD; echo TD$.number_format($price_perunit, 2, '.', '')./TD; echo TD.$quantity./TD; echo TD$.number_format($total_price, 2, '.', '')./strongBR/FONTnbsp;nbsp;/TD\n; echo \tTDa href=\delete.php?delete=.$query_data[prod_id].\ Onclick=\return confirm('Are you sure?');\; echo [Delete]/a/TD/TR; } other html stuffs. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Reg-Vulnerabilities in PHP
I don't know. php_info();? But why use PHP 4.0.6 ? We are up to PHP 4.2.2 now(Which was just realeased due to a security bug). -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Senthilvelavan [EMAIL PROTECTED] wrote in message 009101c236bc$61c8b410$300110ac@snpsi">news:009101c236bc$61c8b410$300110ac@snpsi... Hello Folks, I have applied patch to PHP4.0.6.Any one of you please suggest on how to test the patched version and confirm that the vulnerability is fixed. [Note :Patch is applied for the following Vulnerability. Vulnerabilities in the php_mime_split function may allow an intruder to execute arbitrary code with the privileges of the web server.] Any help is appreciated. Advance thanks and regards, Senthil. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: setcookie question
If the different applications are on the same domain/ip you should use this: (myCookie,$cookie_value,$timeToExpire); note the missing parameter at the end -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Gaylen Fraley [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I need to create a cookie that is accessible from more than 1 application, but on the same server. What would be the proper syntax? What I tried was setcookie (myCookie,$cookie_value,$timeToExpire,'/'); Right or wrong or impossible? Should I not have used the /? Thanks. -- Gaylen PHP KISGB v4.0.5 Guest Book http://www.gaylenandmargie.com/phpwebsite/ PHP KISSQ v1.0 Stock Quote http://www.gaylenandmargie.com/phpwebsite -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I show the sourse code?
research the php function htmlspecialchars(). I replaces with lt; and with gt; etc. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com I often get confused with lt; and gt; so they may be in the wrong order but I am sure you get the idea. ØYstein HåLand [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have seen on some of the script-sites around some nice ways of presenting the source code. Often in nice colors. So, the natural question is: how is that done (cause I don't think anyone has the patience to put lt; and gt; around all the ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I hate to do this - Parse error...
Sorry, I really have tried to fix this. I get a parse error on line 24(see comment in script) *Any Way* Here is the script. function view_post($tid){ $query = 'select forum_post.name, forum_post.time, forum_post.uid, forum_post.message, priv_user.username from forum_post, priv_user where forum_post.uid = priv_user.uid AND forum_post.tid = '.$tid.'; $result = mysql_query($query) or die(Query failed: $querybr . mysql_error()); $num_results = mysql_num_rows($result); for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo $row['name'].' '.date('jS-M-Y',$row['time']).' '.$row['username'].\nbr; // Parse error here - line 24 echo $row['message'].\nbr; } } I am getting really frustrated. I know I really shouldn't use the mailing list for debugging. My editors not showing anything obvious with syntax highlighting. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: I hate to do this - Parse error...
Thanks. I've never seen an error that far up from the qouted line. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Chris Earle [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I think the Parse error might actually be on the last line of your query ( the .'; ). I tested that on my page and if I put in the query, as is, it gave me a parse error. Without the ending .' it was okay though. function view_post($tid){ __ $query = 'select forum_post.name, forum_post.time, forum_post.uid, forum_post.message, priv_user.username from forum_post, priv_user where forum_post.uid = priv_user.uid AND forum_post.tid = '.$tid.'; // HERE __ $result = mysql_query($query) or die(Query failed: $querybr . mysql_error()); $num_results = mysql_num_rows($result); for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo $row['name'].' '.date('jS-M-Y',$row['time']).' '.$row['username'].\nbr; // Parse error here - line 24 echo $row['message'].\nbr; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date() Problem
Alternativly you could store the dates as UNIX timestamps. That is what I do. It is then eaiser to do certian things(ie show stuff released in the last month) -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Tony Harrison [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Yeh, ive allready looked at that before, but where and when do i use DATE_FORMAT() ? When im inserting the row or selecting it? Jome [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, im making a tab/lyric portal, and for viewing tabs i want to display the time the lyric/tab was submitted. So I retrive it from a MySQL database (as a timestamp) and format it using the date function. The problem is, that the date: 19-01-2038 04:14:07 is allways returned, even though in the `date` field the timestamp says (as an actual example) 20020723200919. Here is a shortened version of the script: ?php $submitdate = date(d-m-Y H:i:s, $values[4]); echo(Submitted on $submitdate); ? Hi Tony, the date() function in PHP does _only_ take UNIX timestamps as an argument which means that you can not run such a timestamp as the above. I recommend that you have a look at http://www.mysql.com/doc/D/a/Date_and_time_functions.html which describes the built-in functions for date-handling in MySQL. A function to look at could be DATE_FORMAT(). Regards, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] removing html...
Hi, I have search around on google/php.net to try and find a way to remove body, everything above ,/body and everything below it in a html page. eg. html head titletest/test /head body Blah Blah Blahbr /body /html would become: Blah Blah Blahbr I know how to use php to convert html to pure text etc but I don't know how to remove the unwanted header and footer HTML. I am pretty sure that someone must have done it(HTML file uploads for sites etc). Thanks in advance and good night. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: removing html...
Thanks, I had never used regular expressions before and will look into them a bit more. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Jj Harrison [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I have search around on google/php.net to try and find a way to remove body, everything above ,/body and everything below it in a html page. eg. html head titletest/test /head body Blah Blah Blahbr /body /html would become: Blah Blah Blahbr I know how to use php to convert html to pure text etc but I don't know how to remove the unwanted header and footer HTML. I am pretty sure that someone must have done it(HTML file uploads for sites etc). Thanks in advance and good night. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Installed PHP on home Win98se, now how can I get browser to see it?
If you got it installed. insert a script called php_info.php on the companies webserver. here is it's contents: ?php phpinfo(); ? That will give you lots of info about the configuration of PHP. do the same thing on your PC. if they are differant: Use windows explorer/my computer to browse to C:\WINDOWS\ then find a file in that directory called php.ini. Check the settings against the ones shown with php info. change them to the isp/companies config. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Marcus Unlimited [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I just installed the nice and easy one click PHP install to my Windows 98se machine. I just want to be able to test and practice My basic PHP /MySQL stuff without up loading. So now what do I do. I ran the php info scripts and got bunch of weird messages. How do I get the PHP to work in my browsers IE, NN just as it does when uploaded to my hosting co's servers? Thanks, -Marcus -- || Marcus Unlimited http://marcusunlimited.com Multimedia Internet Design and Education || --- Also visit: - http://www.chromaticus.com - http://ampcast.com/chromaticus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Possible to have optional values in function?
I just realised why my search returned nothing. I was searching the function list instead of the whole site :} Sorry :( -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 26 July 2002 23:33, Tech Support wrote: Don't waist everyone's time with this b.s. ...either you can help or you cannot. Jeez. How do you like your help to be given to to? By saying 'rftm' that is not helping? It's blindingly obvious from the question that the section of the manual to look up would be the chapter on functions. So to be helpful I should go and copy-paste bits of the manual in my reply? Use rtfm sparingly. Treat it as a last resort; a secret weapon. Reserve it for people who ask really dumb questions like how do I use sessions, or how do I use mysql, or something general like that, when you know damn well they have not even tried to find out anything on their own. A substantial number of questions to this list can/should be answered with 'rtfm'. Only recently someone said why read the manual when it's quicker to ask the list and have some sucker do my homework for me (or words to that effect). -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Banectomy, n.: The removal of bruises on a banana. -- Rich Hall, Sniglets */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Possible to have optional values in function?
I *did* rtfm(or searched it at least). That is why I asked the group. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 26 July 2002 17:46, JJ Harrison wrote: is it possible to have optional values in a PHP function? some of the built in ones have optional parameters. Yes, rtfm. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* O give me a home, Where the buffalo roam, Where the deer and the antelope play, Where seldom is heard A discouraging word, 'Cause what can an antelope say? */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Possible to have optional values in function?
Thank You. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com René moonen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... JJ Harrison wrote: is it possible to have optional values in a PHP function? some of the built in ones have optional parameters. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com http://www.php.net/manual/en/functions.arguments.php look at section 'Default argument values' René -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] timing header(Location: )
Is it possible to make the browser wait say, 5 seconds before redirection by outputting headers? I know you can do it with meta tags but not how by outputting headers -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multiple search
After executing the exact script I get the following (rough)error: Warning: Undefined offset: 1 in :/Inetpub/co2_busters_mk2 The script(Which is being executed about 25m away) soon cause my computer to fill up up it's memory(96mb used to about 256) That is why I couldn't give you the message(IE crashed). It is looping forever for some reason(I've never filled a client's computer that fast before!) How can I fix it? Or if you cant tell me what does the error mean? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... My question is what can I do if someone searches for php script for search? I would want to use OR in my SQL statment. The problem is how do I write the query so that it will detect the number of words sent then put enough ORs and LIKE '%$search[1]% in? The LIKE operator will cheerfully return 1 or 0, which you can add up, or in your case, weight and add up in your SELECT: $query = select 0 ; # The 0 is a kind of 'yeast' to start off our summation of matches. $words = explode(' ', $search); while (list(,$word) = $words){ $word = trim($word); if ($word){ $query .= + article_keyword.weight * article_keyword.keyword like '%$word%' ; } } $query .= as score ; $query .= from article_keyword, article_data ; $query .= where score 0 ; $query .=and article_data.aid = article_keyword.aid ; $query .= order by score desc ; echo $query, BR\n; -- 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
[PHP] Re: Redirect Question
That answers my question. Thanks, -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Tim Luoma [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... FWIW, a user note at http://www.php.net/manual/en/function.header.php says : There is this nasty bug in IE 5 for Windows prior to service pack 2, described in Microsoft knowledgebase article Q281197 which causes a problem with redirecting.. if you submit a POST form to a page that uses header() to redirect to another page after processing the form data, then IE will not display some of the images on the page, if the user has an external HTTP namespace handler (RealDownload for example) installed. It took me a very long time to figure this out; I had no idea why my ads weren't displaying on IE for windows but worked fine everywhere else. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multiple search
My question is what can I do if someone searches for php script for search? I would want to use OR in my SQL statment. The problem is how do I write the query so that it will detect the number of words sent then put enough ORs and LIKE '%$search[1]% in? Thanks. Here is the script. ? include includes/required.php; $query = SELECT count(article_keyword.weight) as score, article_keyword.aid, article_data.name, article_data.time, article_data.description FROM article_keyword,article_data WHERE article_keyword.aid = article_keyword.aid AND article_keyword.keyword LIKE '%$search%' GROUP BY article_keyword.aid ORDER BY score DESC ; $result = mysql_query($query) or die(Query failed: $querybr . mysql_error()); $num_results = mysql_num_rows($result); if($num_results == 0){ echo Your search returned no results. Try other keyword(s).; exit; } elseif($num_results 0){ for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo 'trtd'; do_hr(); echo 'a href=full_article.php?aid='.$row['aid'].''; do_h($row['name'].' - '.date('jS-M-Y',$row['time']), 3, 'n'); echo '/a'; echo '/td/trtrtd'.$row['description'].\n; echo '/td/tr'; } } ? Jj Harrison [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... To add search functionality I decieded this was the best table structure I could come up with for a keywords table. Here it is: CREATE TABLE article_keyword ( aid int(11) unsigned NOT NULL default '0', keyword char(50) NOT NULL default '', weight tinyint(2) unsigned NOT NULL default '0', PRIMARY KEY (aid), KEY keyword (keyword), KEY aid (aid), KEY weight (weight) ) TYPE=MyISAM; Using that structure could I get a decent search? I would probably add up the weight for each keyword(Where it is searched for). Then sort it by the most 'relevent' then I could use a join to get the title, time etc of the article and return the results. What I am asking is that if this is a good table structure for something like this(N00B alert!). If not could you please give me a better one? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Speed Question
if I do this: if(validate($_POST['password'], $_POST['username']) != 0) echo validate($_POST['password'], $_POST['username']); will it execute the function twice or use the same result twice? would it be (slightly) faster to do this: $uid = validate($_POST['password'], $_POST['username']) if($uid != 0) echo $uid); -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Speed Question
thx Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Thursday 18 July 2002 19:32, JJ Harrison wrote: if I do this: if(validate($_POST['password'], $_POST['username']) != 0) echo validate($_POST['password'], $_POST['username']); will it execute the function twice or use the same result twice? Function executes twice. would it be (slightly) faster to do this: $uid = validate($_POST['password'], $_POST['username']) if($uid != 0) echo $uid); Probably. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* If fifty million people say a foolish thing, it's still a foolish thing. -- Bertrand Russell */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Formmail replacement?
Does anyone know a good PHP-based Formmail Replacement(From matt's script archive)? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Good Forum...
What is a good php-based forum? I would have used vBulletin but my group a non-profit so we obviously can't afford it. Part of what I require is users to be stored in a db table using md5() or anouther function. What I would do is expand the table with more user info for use with my whole site. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How come this will echo No or nothing?
here is the portion of the script: if($row['plevel'] == '0'){ echo 'No'; } else { echo 'Yes'; } here is my table structure dump: # # Table structure for table `docs` # CREATE TABLE docs ( id int(11) unsigned NOT NULL auto_increment, name varchar(200) NOT NULL default '', note varchar(200) NOT NULL default '', author varchar(200) NOT NULL default '', path varchar(200) NOT NULL default '', plevel tinyint(3) NOT NULL default '0', type char(3) NOT NULL default '', cat tinyint(3) NOT NULL default '0', file_size int(11) unsigned NOT NULL default '0', date int(11) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM; the row plevel is either 0 or 1. why won't this script echo Yes? The reason that the plevel is set in numbers is because I may add higher ones later. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How come this will echo No or nothing?
I tried that. same result. Here is my (new) snippet: if($row['plevel'] == 0){ echo 'No'; } else { echo 'Yes'; } Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... because $row['plevel'] is NEVER == '0' It is probably == 0 though. (note the missing quotes. ) :) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:01 PM To: [EMAIL PROTECTED] Subject: [PHP] How come this will echo No or nothing? here is the portion of the script: if($row['plevel'] == '0'){ echo 'No'; } else { echo 'Yes'; } here is my table structure dump: # # Table structure for table `docs` # CREATE TABLE docs ( id int(11) unsigned NOT NULL auto_increment, name varchar(200) NOT NULL default '', note varchar(200) NOT NULL default '', author varchar(200) NOT NULL default '', path varchar(200) NOT NULL default '', plevel tinyint(3) NOT NULL default '0', type char(3) NOT NULL default '', cat tinyint(3) NOT NULL default '0', file_size int(11) unsigned NOT NULL default '0', date int(11) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM; the row plevel is either 0 or 1. why won't this script echo Yes? The reason that the plevel is set in numbers is because I may add higher ones later. -- JJ Harrison [EMAIL PROTECTED] www.tececo.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
Re: [PHP] How come this will echo No or nothing?
The value of plevel is 0 according to var_dump. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Have you done a var_dump on $row to make sure that plevel exists? =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:11 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How come this will echo No or nothing? I tried that. same result. Here is my (new) snippet: if($row['plevel'] == 0){ echo 'No'; } else { echo 'Yes'; } Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... because $row['plevel'] is NEVER == '0' It is probably == 0 though. (note the missing quotes. ) :) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:01 PM To: [EMAIL PROTECTED] Subject: [PHP] How come this will echo No or nothing? here is the portion of the script: if($row['plevel'] == '0'){ echo 'No'; } else { echo 'Yes'; } here is my table structure dump: # # Table structure for table `docs` # CREATE TABLE docs ( id int(11) unsigned NOT NULL auto_increment, name varchar(200) NOT NULL default '', note varchar(200) NOT NULL default '', author varchar(200) NOT NULL default '', path varchar(200) NOT NULL default '', plevel tinyint(3) NOT NULL default '0', type char(3) NOT NULL default '', cat tinyint(3) NOT NULL default '0', file_size int(11) unsigned NOT NULL default '0', date int(11) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM; the row plevel is either 0 or 1. why won't this script echo Yes? The reason that the plevel is set in numbers is because I may add higher ones later. -- JJ Harrison [EMAIL PROTECTED] www.tececo.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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How come this will echo No or nothing?
Still doesn't work. I'll have to think about it. I may raise all the values in the plevel colomn by one. It may work then. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... off the top of my head, I'd suggest : if(intval($row['plevel']) == 0){ Grasping at straws here but you've moved beyond a simple question into a debigging process. (Which doesn't work too well for email.) Sorry I couldn't be of more help. =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:26 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How come this will echo No or nothing? The value of plevel is 0 according to var_dump. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Have you done a var_dump on $row to make sure that plevel exists? =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:11 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How come this will echo No or nothing? I tried that. same result. Here is my (new) snippet: if($row['plevel'] == 0){ echo 'No'; } else { echo 'Yes'; } Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... because $row['plevel'] is NEVER == '0' It is probably == 0 though. (note the missing quotes. ) :) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message----- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:01 PM To: [EMAIL PROTECTED] Subject: [PHP] How come this will echo No or nothing? here is the portion of the script: if($row['plevel'] == '0'){ echo 'No'; } else { echo 'Yes'; } here is my table structure dump: # # Table structure for table `docs` # CREATE TABLE docs ( id int(11) unsigned NOT NULL auto_increment, name varchar(200) NOT NULL default '', note varchar(200) NOT NULL default '', author varchar(200) NOT NULL default '', path varchar(200) NOT NULL default '', plevel tinyint(3) NOT NULL default '0', type char(3) NOT NULL default '', cat tinyint(3) NOT NULL default '0', file_size int(11) unsigned NOT NULL default '0', date int(11) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM; the row plevel is either 0 or 1. why won't this script echo Yes? The reason that the plevel is set in numbers is because I may add higher ones later. -- JJ Harrison [EMAIL PROTECTED] www.tececo.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 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] How come this will echo No or nothing?
It *still* didn't work. I will increment all table cells using a single update query to do them all. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Jj Harrison [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Still doesn't work. I'll have to think about it. I may raise all the values in the plevel colomn by one. It may work then. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... off the top of my head, I'd suggest : if(intval($row['plevel']) == 0){ Grasping at straws here but you've moved beyond a simple question into a debigging process. (Which doesn't work too well for email.) Sorry I couldn't be of more help. =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:26 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How come this will echo No or nothing? The value of plevel is 0 according to var_dump. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Have you done a var_dump on $row to make sure that plevel exists? =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message----- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:11 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How come this will echo No or nothing? I tried that. same result. Here is my (new) snippet: if($row['plevel'] == 0){ echo 'No'; } else { echo 'Yes'; } Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... because $row['plevel'] is NEVER == '0' It is probably == 0 though. (note the missing quotes. ) :) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:01 PM To: [EMAIL PROTECTED] Subject: [PHP] How come this will echo No or nothing? here is the portion of the script: if($row['plevel'] == '0'){ echo 'No'; } else { echo 'Yes'; } here is my table structure dump: # # Table structure for table `docs` # CREATE TABLE docs ( id int(11) unsigned NOT NULL auto_increment, name varchar(200) NOT NULL default '', note varchar(200) NOT NULL default '', author varchar(200) NOT NULL default '', path varchar(200) NOT NULL default '', plevel tinyint(3) NOT NULL default '0', type char(3) NOT NULL default '', cat tinyint(3) NOT NULL default '0', file_size int(11) unsigned NOT NULL default '0', date int(11) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM; the row plevel is either 0 or 1. why won't this script echo Yes? The reason that the plevel is set in numbers is because I may add higher ones later. -- JJ Harrison [EMAIL PROTECTED] www.tececo.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 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] How come this will echo No or nothing?
I found figured it out. I am a n00b BTW. the snippet was caught inside anouther if statment so it was only displaying if the file was under a Meg in size! -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Jj Harrison [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Still doesn't work. I'll have to think about it. I may raise all the values in the plevel colomn by one. It may work then. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... off the top of my head, I'd suggest : if(intval($row['plevel']) == 0){ Grasping at straws here but you've moved beyond a simple question into a debigging process. (Which doesn't work too well for email.) Sorry I couldn't be of more help. =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:26 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How come this will echo No or nothing? The value of plevel is 0 according to var_dump. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Have you done a var_dump on $row to make sure that plevel exists? =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message----- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:11 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How come this will echo No or nothing? I tried that. same result. Here is my (new) snippet: if($row['plevel'] == 0){ echo 'No'; } else { echo 'Yes'; } Cal Evans [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... because $row['plevel'] is NEVER == '0' It is probably == 0 though. (note the missing quotes. ) :) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Friday, July 12, 2002 11:01 PM To: [EMAIL PROTECTED] Subject: [PHP] How come this will echo No or nothing? here is the portion of the script: if($row['plevel'] == '0'){ echo 'No'; } else { echo 'Yes'; } here is my table structure dump: # # Table structure for table `docs` # CREATE TABLE docs ( id int(11) unsigned NOT NULL auto_increment, name varchar(200) NOT NULL default '', note varchar(200) NOT NULL default '', author varchar(200) NOT NULL default '', path varchar(200) NOT NULL default '', plevel tinyint(3) NOT NULL default '0', type char(3) NOT NULL default '', cat tinyint(3) NOT NULL default '0', file_size int(11) unsigned NOT NULL default '0', date int(11) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM; the row plevel is either 0 or 1. why won't this script echo Yes? The reason that the plevel is set in numbers is because I may add higher ones later. -- JJ Harrison [EMAIL PROTECTED] www.tececo.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 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] Execute script then output image.
I found it. I used header(Location: http://www.yoursite.com/images/stat.gif;); -- JJ Harrison [EMAIL PROTECTED] www.tececo.com David Otton [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Thu, 11 Jul 2002 22:01:03 +1000, you wrote: You need to output the correct content-type header for the image (eg image/gif), take it's size and output it as content-length, and suppress error reporting. Then output the image data. There was a much simpler way. It just said the location of the file. I could use your method but the other one was much simpler. Is this what you meant? http://news.php.net/article.php?group=php.generalarticle=106348 http://news.php.net/article.php?group=php.generalarticle=106370 Looks like the same thing I suggested to me... $filename = your/file.gif; // output the correct content-type header header(Content-Type: image/gif); // take it's size and output it as content-length header(Content-length:.filesize($filename)); // Then output the image data readfile($filename); djo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Execute script then output image.
Sorry, I lost the email that contained the info and I can't find it in the archives. How do I output a static image through a php script? it had something to do with headers but I can't remember exactly what. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Execute script then output image.
There was a much simpler way. It just said the location of the file. I could use your method but the other one was much simpler. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com David Otton [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Thu, 11 Jul 2002 21:00:36 +1000, you wrote: How do I output a static image through a php script? it had something to do with headers but I can't remember exactly what. You need to output the correct content-type header for the image (eg image/gif), take it's size and output it as content-length, and suppress error reporting. Then output the image data. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Executing Script through image
It is a couple of seconds slow. Treating the file as an image means that the rest of the page can still load while it is doing the reverse DNS lookup and executing the script. Anyway I have got the answer now -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... When the nessicary include file is included it does a reverse-DNS lookup to find the remote host's DNS name. The problem with this is that is seems slow(at least on my test server with a DSL connection). How slow? There's, like, a couple seconds slow, which is just how slow reverse-DNS can be, and *MINUTES* slow... Minutes slow, most likely, indicates that where-ever you are trying to look up the DNS records is trying to do a reverse DNS on *YOU* (or, rather, PHP's web-server) and timing out. If you have any control over that machine where you are doing the reverse-DNS, be sure they have your IP address associated with a name. For DSL, you can use something like http://dyndns.org to give your dynamic IP address a domain name. There are dozens of competitors to http://dyndns.org, and feel free to shop around. I thought the best way to speed things up would be putting the entire script into a file and then using img src=stats.php within the page. The problem is that I don't know how to output the image with PHP. Like, I don't even understand the theory here... How would the script being in a file (and where is it now?) make the DNS lookups any faster? I'm so confused. At any rate, a sample of how to dump out an image was already posted in this thread. -- 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
[PHP] Grr SQL syntax error silghtly OT
Sorry :} I get a SQL syntax error at line two of the query: $query = select 2count(*) as tececo_stats.views, meta_data.title from meta_data, tececo_stats where meta_data.id = tececo_stats.id; I have stared at this 'till i felt dizzy. can someone tell me what I am doing wrong so that I can learn from it? Thanks in advance -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Grr SQL syntax error silghtly OT
table structure for tececo stats(Stores information about the visitors to my site.visited is either 0 or 1 depending on whether or not the stats cookie has been set): id int(11) unsigned NOT NULL auto_increment, page_id int(11) NOT NULL default '0', visited int(11) NOT NULL default '0', time int(11) NOT NULL default '0', remote_dns varchar(100) NOT NULL default '', remote_ip varchar(15) NOT NULL default '', referer varchar(200) NOT NULL default '', browser varchar(100) NOT NULL default '', system varchar(100) NOT NULL default '', PRIMARY KEY (id), KEY page_id (page_id,time) table structure for meta_data(contains information about the pages in my website): id int(11) unsigned NOT NULL auto_increment, pid int(11) unsigned NOT NULL default '0', title varchar(200) NOT NULL default '', page_name varchar(75) NOT NULL default '', description text NOT NULL, keywords text NOT NULL, PRIMARY KEY (id), KEY pid (pid) main file(required.php automaticly does a DB connect and is used elsewhere so I know is not the problem). ? include includes/required.php; do_html_header('Page Detail Statistics'); $query = select count(tececo_stats.*) as tececo_stats.views, meta_data.title from meta_data, tececo_stats where meta_data.id = tececo_stats.id order by meta_data.id group by meta_data.id; $result = mysql_query($query) or die(Query failed: $querybr . mysql_error()); $num_results = mysql_num_rows($result); ? table width=500 tr style=black_rowtd width=200Page Name/tdtdTota;Number of Sessions/td/tr ? for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo 'trtd'.$row['meta_data.title'].'/tdtd'.$row['tececo_stats.views'].' /td/tr'; } ? /table ? do_html_footer(); ? error message: Query failed: select count(tececo_stats.*) as tececo_stats.views, meta_data.title from meta_data and tececo_stats where meta_data.id = tececo_stats.id order by meta_data.id You have an error in your SQL syntax near '*) as tececo_stats.views, meta_data.title from meta_data and tececo_stats whe' at line 2 What I want to do: This is essentially a script for a stats program that I am writting that returns the number of hits for each page. Instead of looping a query I decieded to try and join the two tables to make it more efficiant. I am trying to get it to work with hits now than make it sessions later. I hope this is enough info and thank you for your help. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Joakim Andersson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I assume that 2count should really be count and 2 is just the line-number you added in this post... tececo_stats.views is (probably) the name of a column and cannot be used as an alias. Change it to something else. change count(*) to count(tececo_stats.*) (I think that's what you want) And you probably need a group by-statement at the end: GROUP BY whatever_you_need_to_group_by It's really difficult to answer your questions without the table designs, the error message and what you expect this query to do. And, it's not slightly OT. It's totally OT. :-) Regards Joakim Andersson -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 10:10 AM To: [EMAIL PROTECTED] Subject: [PHP] Grr SQL syntax error silghtly OT Sorry :} I get a SQL syntax error at line two of the query: $query = select 2count(*) as tececo_stats.views, meta_data.title from meta_data, tececo_stats where meta_data.id = tececo_stats.id; I have stared at this 'till i felt dizzy. can someone tell me what I am doing wrong so that I can learn from it? Thanks in advance -- JJ Harrison [EMAIL PROTECTED] www.tececo.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
Re: [PHP] Grr SQL syntax error silghtly OT
Thanks Joakim Andersson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I would try something like this... SELECT COUNT(tececo_stats.id) as num_hits, meta_data.title FROM tececo_stats, meta_data WHERE meta_data.id = tececo_stats.page_id GROUP BY tececo_stats.page_id ORDER BY num_hits DESC /Joakim -Original Message- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 11:07 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Grr SQL syntax error silghtly OT table structure for tececo stats(Stores information about the visitors to my site.visited is either 0 or 1 depending on whether or not the stats cookie has been set): id int(11) unsigned NOT NULL auto_increment, page_id int(11) NOT NULL default '0', visited int(11) NOT NULL default '0', time int(11) NOT NULL default '0', remote_dns varchar(100) NOT NULL default '', remote_ip varchar(15) NOT NULL default '', referer varchar(200) NOT NULL default '', browser varchar(100) NOT NULL default '', system varchar(100) NOT NULL default '', PRIMARY KEY (id), KEY page_id (page_id,time) table structure for meta_data(contains information about the pages in my website): id int(11) unsigned NOT NULL auto_increment, pid int(11) unsigned NOT NULL default '0', title varchar(200) NOT NULL default '', page_name varchar(75) NOT NULL default '', description text NOT NULL, keywords text NOT NULL, PRIMARY KEY (id), KEY pid (pid) main file(required.php automaticly does a DB connect and is used elsewhere so I know is not the problem). ? include includes/required.php; do_html_header('Page Detail Statistics'); $query = select count(tececo_stats.*) as tececo_stats.views, meta_data.title from meta_data, tececo_stats where meta_data.id = tececo_stats.id order by meta_data.id group by meta_data.id; $result = mysql_query($query) or die(Query failed: $querybr . mysql_error()); $num_results = mysql_num_rows($result); ? table width=500 tr style=black_rowtd width=200Page Name/tdtdTota;Number of Sessions/td/tr ? for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); echo 'trtd'.$row['meta_data.title'].'/tdtd'.$row['tececo_st ats.views'].' /td/tr'; } ? /table ? do_html_footer(); ? error message: Query failed: select count(tececo_stats.*) as tececo_stats.views, meta_data.title from meta_data and tececo_stats where meta_data.id = tececo_stats.id order by meta_data.id You have an error in your SQL syntax near '*) as tececo_stats.views, meta_data.title from meta_data and tececo_stats whe' at line 2 What I want to do: This is essentially a script for a stats program that I am writting that returns the number of hits for each page. Instead of looping a query I decieded to try and join the two tables to make it more efficiant. I am trying to get it to work with hits now than make it sessions later. I hope this is enough info and thank you for your help. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Joakim Andersson [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I assume that 2count should really be count and 2 is just the line-number you added in this post... tececo_stats.views is (probably) the name of a column and cannot be used as an alias. Change it to something else. change count(*) to count(tececo_stats.*) (I think that's what you want) And you probably need a group by-statement at the end: GROUP BY whatever_you_need_to_group_by It's really difficult to answer your questions without the table designs, the error message and what you expect this query to do. And, it's not slightly OT. It's totally OT. :-) Regards Joakim Andersson -Original Message----- From: JJ Harrison [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 09, 2002 10:10 AM To: [EMAIL PROTECTED] Subject: [PHP] Grr SQL syntax error silghtly OT Sorry :} I get a SQL syntax error at line two of the query: $query = select 2count(*) as tececo_stats.views, meta_data.title from meta_data, tececo_stats where meta_data.id = tececo_stats.id; I have stared at this 'till i felt dizzy. can someone tell me what I am doing wrong so that I can learn from it? Thanks in advance -- JJ Harrison [EMAIL PROTECTED] www.tececo.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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bug in SQL can you help?
Here is my SQL(used in a PHP script so this isn't ot) SELECT extract(year FROM time), extract(month FROM time), count(*) as monthly_views, time FROM tececo_stats group by extract(year FROM time), extract(month FROM time) order by monthly_views desc limit 1 the problem is that is counts the number of rows in the whole thing not the echoed row. How can I get it count the best days only? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Bug in SQL can you help?
Thanks Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Tuesday 09 July 2002 18:32, JJ Harrison wrote: Here is my SQL(used in a PHP script so this isn't ot) Aside from the fact that this has _nothing_ to do with php, you would most likely get a better response from the php-db list where, hopefully, the sql experts hangout. SELECT extract(year FROM time), extract(month FROM time), count(*) as monthly_views, time [snip] -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Philadelphia is not dull -- it just seems so because it is next to exciting Camden, New Jersey. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Executing Script through image
I am making a stats program. When the nessicary include file is included it does a reverse-DNS lookup to find the remote host's DNS name. The problem with this is that is seems slow(at least on my test server with a DSL connection). I thought the best way to speed things up would be putting the entire script into a file and then using img src=stats.php within the page. The problem is that I don't know how to output the image with PHP. The image would not be dynamic just a file on the server. I would appreciate peoples comments or other suggestions JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with SQL query
I can't figure out what is wrong with this: $query = select count(*) as monthly_views from visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1; $result = mysql_query($query); echo $query; $row = mysql_fetch_array($result); echo $row['monthly_views']; echo mysql_error(); I get this: select count(*) as monthly_views from visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1 Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\TecEco_PHP\stats_interface\summary.php on line 76 You have an error in your SQL syntax near ''year', time), extract('month', time) order by monthly_view desc limit 1' at line 1 I don't know any advanced SQL so I don't know how to debug this. I am using mySQL. The person who gave me this code appeared to be using postgreSQL if that makes any differance -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with SQL query
Thanks for giving me something to look up :) -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Alberto Serra [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ðÒÉ×ÅÔ! I forgot to add: SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1 I take it that you have a *monthly_view* column in your table that is not the *monthly_views* alias yoiu use in your query. if that's a typo and you mean to order by the numebr of visitors (that is, you want the most visited month on top of the result) your query should probably look like: SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by 3 desc limit 1 That's because most databases (and I guess MySql is no exception) will not be able to use an alias in their GROUP BY, ORDER BY clauses. But you may want to try, maybe MySql *is* an exception, after all. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with SQL query
No matter what I try I still seem to get the error message. The coloumn that contains the dates has unix timestamps. I think this is why it is not working. I will research it further. If you can be of any help please tell me. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Alberto Serra [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ðÒÉ×ÅÔ! I forgot to add: SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1 I take it that you have a *monthly_view* column in your table that is not the *monthly_views* alias yoiu use in your query. if that's a typo and you mean to order by the numebr of visitors (that is, you want the most visited month on top of the result) your query should probably look like: SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by 3 desc limit 1 That's because most databases (and I guess MySql is no exception) will not be able to use an alias in their GROUP BY, ORDER BY clauses. But you may want to try, maybe MySql *is* an exception, after all. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with SQL query
I have fixed it now don't worry! -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Alberto Serra [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... ðÒÉ×ÅÔ! I forgot to add: SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1 I take it that you have a *monthly_view* column in your table that is not the *monthly_views* alias yoiu use in your query. if that's a typo and you mean to order by the numebr of visitors (that is, you want the most visited month on top of the result) your query should probably look like: SELECT extract('year', time), extract('month', time), count(*) as monthly_views FROM visitors group by extract('year', time), extract('month', time) order by 3 desc limit 1 That's because most databases (and I guess MySql is no exception) will not be able to use an alias in their GROUP BY, ORDER BY clauses. But you may want to try, maybe MySql *is* an exception, after all. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Figuring Out the Best Day in stats program
I have been going fine in a Web Stats program until now. How can I figure out which day has had the most records(ie visitors) inserted? There is a time column which has unix timestamp of when the record was inserted. The best I can think of currently is: To use a while loop to repeatedly query the DB. then use an if statement to replace two variables(UNIX timestamp and number of visitors) if the value returned is higher. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Figuring Out the Best Day in stats program
Here is my code: ? $query = select count(*) as monthly_views from visitors group by extract('year', time), extract('month', time) order by monthly_view desc limit 1; $result = mysql_query($query); $num_results = mysql_num_rows($result); echo $num_results; echo mysql_error(); ? When I execute it I get this error: Warning: Supplied argument is not a valid MySQL result resource in C:\Inetpub\TecEco_PHP\stats_interface\summary.php on line 75 You have an error in your SQL syntax near ''year', time), extract('month', time) order by monthly_view desc limit 1' at line 1 I don't know any advanced SQL so can't really debug it. Could someone tell me what I am doing wrong please? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Richard Lynch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... I have been going fine in a Web Stats program until now. How can I figure out which day has had the most records(ie visitors) inserted? There is a time column which has unix timestamp of when the record was inserted. The best I can think of currently is: To use a while loop to repeatedly query the DB. then use an if statement to replace two variables(UNIX timestamp and number of visitors) if the value returned is higher. Almost any time you do a while loop to repeatedly query the DB, you've done something wrong. :-) Either you are missing an SQL function that will do what you want, or you just designed the db schema wrong and the application wrong in the first place. Fortunately, in this case, you're just missing an SQL function. Dig through the manual of your database (you didn't say which one) in the Date/Time functions section, and see if you can find one that will extract the year and month from a timestamp. You'll end up writing something not unlike this: select count(*) as monthly_views from visitors group by extract('year', whattime), extract('month', whattime) order by monthly_view desc limit 1 The GROUP BY part is the magic -- It will do any aggregate function (count, average, sum) broken down by whatever fields are listed. In this case, I broke it down by year month. If you wanted the most popular month over the last five years, it would be something not unlike: select count(*) as monthly_views from visitors where whattime + '@ 5 years' = now() group by extract('month', whattime) order by monthly_view desc limit 1 Disclaimers: 1. 'extract' is probably not the right function name. You'll have to look that up. 2. The whattime + '@ 5 years' works just nifty in PostgreSQL. You have to type more than that in MySQL, I think... MySQL date arithmetic always gives me a pain. Always dig for a way to do it in SQL first. -- 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] Is there an easy way to divid up HTTP_USER_AGENT?
Because! Also the audiance that will probably see the site will highly likely not have the knowledge or intention to change the user agent var. So my Q remains. To add to my original Q is there seperate vars for browser and OS? JJ Harrison [EMAIL PROTECTED] www.tececo.com Alberto Serra [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... JJ Harrison wrote: Is there an easy way to divide up $_SERVER['HTTP_USER_AGENT'] or do I have to use regular expressions(Which I have little experiance with)? Why would you want to use that? People write in their HTTP_USER_AGENT whatever they want to, and many times you'll find there a set of 4 letter words instead of the info you look for. There is a nice add-on for Mozilla to make that trick even easier. Alberto Kiev -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an easy way to divid up HTTP_USER_AGENT?
After A bit of research I wrote this(File is also attached in case e-mail programs/servers interfere with formatting): ? // Browser Detection if( eregi((opera) ([0-9]{1,2}.[0-9]{1,3}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs) || eregi((opera/)([0-9]{1,2}.[0-9]{1,3}){0,1},$_SERVER['HTTP_USER_AGENT'],$re gs)){$browser = Opera $regs[2];} elseif( eregi((konqueror)/([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$reg s) ){$browser = Konqueror $regs[2];} elseif( eregi((omniweb/)([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = OmniWeb $regs[2];} elseif( eregi((webtv/)([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ) {$browser = WebTV $regs[2];} elseif( eregi((lynx)/([0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}),$_SERVER['HTTP_USER_AGENT' ],$regs) ){$browser = Lynx $regs[2];} elseif( eregi((links) \(([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = Links $regs[2];} elseif( eregi((msie) ([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = MSIE $regs[2];} elseif( eregi((netscape6)/(6.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$bro wser = Netscape $regs[2];} elseif( eregi(mozilla/5,$_SERVER['HTTP_USER_AGENT']) ){$browser = Netscape;} elseif( eregi((mozilla)/([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = Netscape $regs[2];} elseif( eregi(w3m,$_SERVER['HTTP_USER_AGENT']) ){$browser = w3m;} else{$browser = Unknown;} // OS Detection if(eregi(linux,$_SERVER['HTTP_USER_AGENT'])){$system = Linux;} elseif(eregi(win32,$_SERVER['HTTP_USER_AGENT'])){$system = Windows;} elseif(eregi(Win 9x 4.90,$_SERVER['HTTP_USER_AGENT'])){$system = Windows Me;} elseif(eregi(windows 2000,$_SERVER['HTTP_USER_AGENT']) || eregi((windows nt)( ){0,1}(5.0),$_SERVER['HTTP_USER_AGENT']) ){$system = Windows 2000;} elseif(eregi((windows nt)( ){0,1}(5.1),$_SERVER['HTTP_USER_AGENT']) ){$system = Windows XP;} elseif( (eregi((win)([0-9]{2}),$_SERVER['HTTP_USER_AGENT'],$regs)) || (eregi((windows) ([0-9]{2}),$_SERVER['HTTP_USER_AGENT'],$regs)) ){$system = Windows $regs[2];} elseif(eregi((winnt)([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT '],$regs) ){$system = Windows NT $regs[2];} elseif(eregi((windows nt)( ){0,1}([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs) ){$system = Windows NT $regs[3];} elseif(eregi(mac,$_SERVER['HTTP_USER_AGENT'])){$system = Macintosh;} elseif(eregi((sunos) ([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs)){$system = SunOS $regs[2];} elseif(eregi((beos) r([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs)){$system = BeOS $regs[2];} elseif(eregi(freebsd,$_SERVER['HTTP_USER_AGENT'])){$system = FreeBSD;} elseif(eregi(openbsd,$_SERVER['HTTP_USER_AGENT'])){$system = OpenBSD;} elseif(eregi(irix,$_SERVER['HTTP_USER_AGENT'])){$system = IRIX;} elseif(eregi(os/2,$_SERVER['HTTP_USER_AGENT'])){$system = OS/2;} elseif(eregi(plan9,$_SERVER['HTTP_USER_AGENT'])){$system = Plan9;} elseif(eregi(unix,$_SERVER['HTTP_USER_AGENT']) || eregi(hp-ux,$_SERVER['HTTP_USER_AGENT']) || eregi(X11,$_SERVER['HTTP_USER_AGENT']) ){$system = Unix;} elseif(eregi(osf,$_SERVER['HTTP_USER_AGENT'])){$system = OSF;} else{$system = Unknown;} echo You are using $browser on a $system system; ? I seems to work quite well. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com P.S. My proxy seems to interfere with the Weberdev site. If Boaz Yahav [EMAIL PROTECTED] or someone else wants to post this to Weberdev or any other similar site as long as it remains free/open source etc. Jj Harrison [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Because! Also the audiance that will probably see the site will highly likely not have the knowledge or intention to change the user agent var. So my Q remains. To add to my original Q is there seperate vars for browser and OS? JJ Harrison [EMAIL PROTECTED] www.tececo.com Alberto Serra [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... JJ Harrison wrote: Is there an easy way to divide up $_SERVER['HTTP_USER_AGENT'] or do I have to use regular expressions(Which I have little experiance with)? Why would you want to use that? People write in their HTTP_USER_AGENT whatever they want to, and many times you'll find there a set of 4 letter words instead of the info you look for. There is a nice add-on for Mozilla to make that trick even easier. Alberto Kiev -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... begin 666 eregi.php M/#\-B\O($)R;W=S97(@15T96-T:6]N#0H):68H(5R96=I*(H;W!EF$I M(A;,TY77LQ+#)]+ELP+3E=S$L,WTIS L,7TB+1?4T525D526R=(5%10 M7U5315)?04=%3E0G72PDF5GRD@?'P@97)E9VDH(BAO5R82\I*%LP+3E= MS$L,GTN6S M.5U[,2PS?2E[,PQ?2(L)%
[PHP] I am probably dumb but why isn't this inserting stuff into my DB?
Attached is the file. It doesn't give any parse errors or anything. Just nothing is inserted into the DB. What am I doing? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: I am probably dumb but why isn't this inserting stuff into my DB?
Here it is then: ? function tececo_stat_cookie(){ setcookie ('tececo_stats', '1'); } // Browser Detection if( eregi((opera) ([0-9]{1,2}.[0-9]{1,3}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs) || eregi((opera/)([0-9]{1,2}.[0-9]{1,3}){0,1},$_SERVER['HTTP_USER_AGENT'],$re gs)){$browser = Opera $regs[2];} elseif( eregi((konqueror)/([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$reg s) ){$browser = Konqueror $regs[2];} elseif( eregi((omniweb/)([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = OmniWeb $regs[2];} elseif( eregi((webtv/)([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ) {$browser = WebTV $regs[2];} elseif( eregi((lynx)/([0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}),$_SERVER['HTTP_USER_AGENT' ],$regs) ){$browser = Lynx $regs[2];} elseif( eregi((links) \(([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = Links $regs[2];} elseif( eregi((msie) ([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = MSIE $regs[2];} elseif( eregi((netscape6)/(6.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$bro wser = Netscape $regs[2];} elseif( eregi(mozilla/5,$_SERVER['HTTP_USER_AGENT']) ){$browser = Netscape;} elseif( eregi((mozilla)/([0-9]{1,2}.[0-9]{1,3}),$_SERVER['HTTP_USER_AGENT'],$regs) ){$browser = Netscape $regs[2];} elseif( eregi(w3m,$_SERVER['HTTP_USER_AGENT']) ){$browser = w3m;} else{$browser = Unknown;} // OS Detection if(eregi(linux,$_SERVER['HTTP_USER_AGENT'])){$system = Linux;} elseif(eregi(win32,$_SERVER['HTTP_USER_AGENT'])){$system = Windows;} elseif(eregi(Win 9x 4.90,$_SERVER['HTTP_USER_AGENT'])){$system = Windows Me;} elseif(eregi(windows 2000,$_SERVER['HTTP_USER_AGENT']) || eregi((windows nt)( ){0,1}(5.0),$_SERVER['HTTP_USER_AGENT']) ){$system = Windows 2000;} elseif(eregi((windows nt)( ){0,1}(5.1),$_SERVER['HTTP_USER_AGENT']) ){$system = Windows XP;} elseif( (eregi((win)([0-9]{2}),$_SERVER['HTTP_USER_AGENT'],$regs)) || (eregi((windows) ([0-9]{2}),$_SERVER['HTTP_USER_AGENT'],$regs)) ){$system = Windows $regs[2];} elseif(eregi((winnt)([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT '],$regs) ){$system = Windows NT $regs[2];} elseif(eregi((windows nt)( ){0,1}([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs) ){$system = Windows NT $regs[3];} elseif(eregi(mac,$_SERVER['HTTP_USER_AGENT'])){$system = Macintosh;} elseif(eregi((sunos) ([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs)){$system = SunOS $regs[2];} elseif(eregi((beos) r([0-9]{1,2}.[0-9]{1,2}){0,1},$_SERVER['HTTP_USER_AGENT'],$regs)){$system = BeOS $regs[2];} elseif(eregi(freebsd,$_SERVER['HTTP_USER_AGENT'])){$system = FreeBSD;} elseif(eregi(openbsd,$_SERVER['HTTP_USER_AGENT'])){$system = OpenBSD;} elseif(eregi(irix,$_SERVER['HTTP_USER_AGENT'])){$system = IRIX;} elseif(eregi(os/2,$_SERVER['HTTP_USER_AGENT'])){$system = OS/2;} elseif(eregi(plan9,$_SERVER['HTTP_USER_AGENT'])){$system = Plan9;} elseif(eregi(unix,$_SERVER['HTTP_USER_AGENT']) || eregi(hp-ux,$_SERVER['HTTP_USER_AGENT']) || eregi(X11,$_SERVER['HTTP_USER_AGENT']) ){$system = Unix;} elseif(eregi(osf,$_SERVER['HTTP_USER_AGENT'])){$system = OSF;} else{$system = Unknown;} // Referer Detection. if(isset($_SERVER['HTTP_REFERER'])){ $referer = $_SERVER['HTTP_REFERER']; } else { $referer = $_SERVER['PHP_SELF']; } // Remote DNS name $remote_dns = gethostbyaddr($_SERVER['REMOTE_HOST']); $remote_ip = $_SERVER['REMOTE_HOST']; // Sets Current time $time = time(); // Weather it is a person's first visit within session if(isset($_COOKIE['tececo_stats'])){ $visited = '1'; } else { $visited = '0'; tececo_stat_cookie(); } $query = INSERT INTO tececo_stats values ('', $id, $visited, $time, $remote_dns, $remote_ip, $referer, $browser, $system); mysql_query($query); ? JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: I am probably dumb but why isn't this inserting stuff into my DB?
OK, I have magic_quotes on though so useless lecture thanks for the advice -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Miguel Cruz [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Sat, 6 Jul 2002, JJ Harrison wrote: $query = INSERT INTO tececo_stats values ('', $id, $visited, $time, $remote_dns, $remote_ip, $referer, $browser, $system); mysql_query($query); You should always do the following if you are having trouble: 1) print out $query and try it yourself at the mysql command line. 2) print mysql_error(). In this case I think the problem is that you've failed to quote the strings in your INSERT. Try something like INSERT INTO tececo_stats values ('', '$id', '$visited', '$time' ... Also note that as it stands, I could potentially make big trouble for you by putting clever values into HTTP_REFERER (which is totally under my control as a visitor to your site). So make sure you mysql_escape_string or addslashes those values (unless you have magic_quotes turned on, in which case you can ignore this lecture). miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Re: I am probably dumb but why isn't this inserting stuff into my DB?
I followed that part. I just have magic_quotes on so I don't need to use addslashes/stripslashes -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Julie Meloni [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... JH I have magic_quotes on though so useless lecture thanks for the advice Having magic_quotes on doesn't preclude your query from being invalid. You should still: JH Miguel Cruz [EMAIL PROTECTED] wrote in message: 1) print out $query and try it yourself at the mysql command line. 2) print mysql_error(). Any time a query fails. - Julie -- Julie Meloni -- [EMAIL PROTECTED] -- www.thickbook.com Find Sams Teach Yourself MySQL in 24 Hours at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Simple Example of Passing on a file through a PHP script
I want to show info when my docs are viewed though my stats program. I have decieded the best way would be to put the info into a DB through php file then output the PDF, Excel, Zip or Powerpoint file. Only trouble is I have no Idea how to do this -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with menu
Thx. I a bit of a n00b so don't always understand. I is a lot clearer now thank you -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Richard Lynch [EMAIL PROTECTED] wrote in message news:20020703212954.BFUU903.sccrmhc03.attbi.com@[192.168.1.103]... when I echo menu($id) I get the current page's title. How do I print it's peers and it's single parent? You will need a second query to ask for all the children of the parent: $peer_query = select id as child_id, title from meta_data where pid = $pid; $peers = mysql_query($query) or error_log(mysql_error()); while (list($child, $child_title) = mysql_fetch_row($peers)){ echo $child_title ($child)BR\n; } P.P.P.S. All pages have information provided by this script: $fn = explode(/, $_SERVER['PHP_SELF']); $num_of_s = count($fn) - 1; $fn = $fn[$num_of_s]; $query = SELECT * FROM meta_data WHERE page_name = '$fn'; $result = mysql_query($query); $num_results = mysql_num_rows($result); $row = mysql_fetch_array($result); $id = $row['id']; $pid = $row['pid']; $title = $row['title']; $description = $row['description']; $keywords = $row['keywords']; It is my metadata page and is used all over the place. so why re-query the db for it's parent? I'm saying: Don't do that. Don't use * in this first query. In *ANY* query, specify *exactly* which columns you need. You'll be a lot less confused by your data when you start forcing yourself to be more precise in your code about what you want. *CHANGE* the line above to: $query = select id, pid, title, description, keywords from meta_data where page_name = '$fn'; Then, after you have the $pid, add in the stuff I wrote above. -- 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
[PHP] Re: Simple Example of Passing on a file through a PHP script
Thx. I can output the file using readfile(). But the problem is that it appears to output the data in it's raw form. How can I get it to open in the right application? I wasn't going to put the file in the DB. I am just working on a stats program for a couple of sites. One had about 50 downloads and I want info about who is viewing them also. JJ Harrison [EMAIL PROTECTED] www.tececo.com Richard Lynch [EMAIL PROTECTED] wrote in message news:20020703213010.BFZW903.sccrmhc03.attbi.com@[192.168.1.103]... I want to show info when my docs are viewed though my stats program. I have decieded the best way would be to put the info into a DB through php file then output the PDF, Excel, Zip or Powerpoint file. Only trouble is I have no Idea how to do this Stuffing the actual data into your database doesn't really give you much added value to tracking who is viewing it... Write something like this: -- display.php -- ?php $query = update stats set count = count + 1 where filename = '$filename'; mysql_query($query) or error_log(mysql_error()); # If it's the first time this file has ever been displayed... if (mysql_affected_rows() 1){ $query = insert into stats(filename, count) values('$filename', 1); mysql_query($query) or error_log(mysql_error()); } readfile($filename); ? - You can then put your PDF files *outside* your web-tree so nobody can read them, except like: http://yourserver.com/display.php?filename=foo.pdf -- 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] Re: Simple Example of Passing on a file through a PHP script
It sort of works now. Here is my script so far: ? $file = strtolower($_GET['filename']); $file_split = explode(., $file); // The number of dots is counted in case a file has two or more dots if($file_split[1] == 'pdf'){ header(Content-type: application/pdf); } elseif($file_split[1] == 'xls') { header (Content-type: application/msexcel); } elseif($file_split[1] == 'zip') { header (Content-type: application/zip); } header (Content-Disposition: attachment; filename=$file ); readfile($file); ? The problem is that with excel files it asks me if I want to download twice. Also it opens in excel not IE. Sometimes PDFs open in IE sometimes the don't. What is wrong? Also would I be better of collecting my stats then using a header to re-direct to the right file(Rather than outputting it through a script)? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com Jason Wong [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Thursday 04 July 2002 10:46, JJ Harrison wrote: I can output the file using readfile(). But the problem is that it appears to output the data in it's raw form. How can I get it to open in the right application? You _do_ want it to output the data in it's raw form. However it is your responsibility to output the correct headers beforehand so the browser knows what to do with the file. Search archives for download would/should bring up loads of articles on what form the headers should take. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* the butane lighter causes the pincushioning */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with menu
Thanks for that info. I am still a bit new to programming/PHP to fully grasp that but I am sure I will in time. *anyway* when I echo menu($id) I get the current page's title. How do I print it's peers and it's single parent? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com P.S. I originally wanted to build a hierachy based menu like this but failed Page 3 Page 4 P4 C1 P4 C2(I am here) etc... I went fine until I have to print the parent and it's peers like shown in the example P.P.S if you had a couple of functions which would help me do this I would be grateful, but don't write anything. P.P.P.S. All pages have information provided by this script: $fn = explode(/, $_SERVER['PHP_SELF']); $num_of_s = count($fn) - 1; $fn = $fn[$num_of_s]; $query = SELECT * FROM meta_data WHERE page_name = '$fn'; $result = mysql_query($query); $num_results = mysql_num_rows($result); $row = mysql_fetch_array($result); $id = $row['id']; $pid = $row['pid']; $title = $row['title']; $description = $row['description']; $keywords = $row['keywords']; It is my metadata page and is used all over the place. so why re-query the db for it's parent? Richard Lynch [EMAIL PROTECTED] wrote in message news:20020701232031.VNMV6023.sccrmhc02.attbi.com@[192.168.1.103]... I have a table with id, pid(parent), title and page_name(url) fields. The vars provided to the script are the current page's title, id and pid(parent) You can look up the parent and in the database, so it's not horribly important that those be provided. *UNLESS* you have a heterarchy, and not a hierarchy -- In other words, *UNLESS* there are two different paths to get to 'id' through different parents. In other other words, *UNLESS* you have duplicate id's in the database... If you *DO* have a heterarchy, you'd need to track the user's path as they traveled to know which route to display. I'll assume you don't have a heterarchy, for now. When I am on the parent page I get this(Which is what I want): [ Chronological History ][ Website Chronological History ] When I am in the Child I get this: [ Website Chronological History ][ Website Chronological History ] What am I doing wrong??? You really can't get all the parents in one SQL statement. You'll need to look up the parent. Then the grand-parent. Then the great-grand-parent. And so on. Each with a different SQL query. Now, this is not ideal for performance. In fact, it's *HORRIBLE* if (A) your tree is really deep -- If you have 10 generations of depth to the g'great-grand-parents, then it's gonna take 9 queries to look it up. If you're only looking at three or four levels, it's really no big deal... Unless your site is, like, getting a zillion hits. Let's assume it's not getting a zillion hits for now, okay? I have stared at this two many times now and am probably missing the obvious function menu($id, $pid, $title) { $query = select * from meta_data WHERE pid = '$id' OR pid = '$pid' pid != 0; This will give both the current record and the parent record, but never, ever, ever, the grand-parent record... $result = mysql_query($query); $num_results = mysql_num_rows($result); if($num_results != 0){ ? table width=100% trtd align=center ? echo '[ '.$title.' ]'; for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); if($id == $row['id']){ echo '[ '.$row['title'].' ]'; } elseif($row['pid'] == $id || $row['id'] == $pid $pid != 0) { echo '[ a href='.$row['page_name'].''.$row['title'].'/a ]'; } } ? /td/tr /table ? } Try something more like this: function menu($id){ $query = select pid, title from meta_data where id = $id; $meta = mysql_query($query) or error_log(mysql_error()); # Check HTTP error_log for SQL errors! list($pid, $title) = mysql_fetch_row($meta, 0); if (isset($pid) $pid)){ # Switch the menu() and $title parts around if you want bread-crumbs in the other direction $result = menu($pid) . $title; } else{ $result = ''; } return $result; } NOTE: There *ARE* techniques for encoding the SQL in such a way that a single SQL statement can get the entire path at once, but they get kinda complicated and gnarly, and, really, as I said, if you have a shallow tree, it's just not worth the hassle... If you have a really *DEEP* tree, you'll need to do some more research. -- 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
[PHP] Problem with menu
I have a table with id, pid(parent), title and page_name(url) fields. The vars provided to the script are the current page's title, id and pid(parent) When I am on the parent page I get this(Which is what I want): [ Chronological History ][ Website Chronological History ] When I am in the Child I get this: [ Website Chronological History ][ Website Chronological History ] What am I doing wrong??? I have stared at this two many times now and am probably missing the obvious function menu($id, $pid, $title) { $query = select * from meta_data WHERE pid = '$id' OR pid = '$pid' pid != 0; $result = mysql_query($query); $num_results = mysql_num_rows($result); if($num_results != 0){ ? table width=100% trtd align=center ? echo '[ '.$title.' ]'; for ($i=0; $i $num_results; $i++) { $row = mysql_fetch_array($result); if($id == $row['id']){ echo '[ '.$row['title'].' ]'; } elseif($row['pid'] == $id || $row['id'] == $pid $pid != 0) { echo '[ a href='.$row['page_name'].''.$row['title'].'/a ]'; } } ? /td/tr /table ? } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting IP from behind proxies
I want to check to see if people have voted yet for a poll. How can I get the ip of a user from both behind a proxy and the proxies ip? is this simple? will i have trouble with firewalls etc? -- JJ Harrison [EMAIL PROTECTED] www.tececo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting IP from behind proxies
I want to check to see if people have voted yet for a poll. How can I get the ip of a user from both behind a proxy and the proxies ip? is this simple? will i have trouble with firewalls etc? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can only get it if the proxy provides you with this data. Most don't, so this is not a reliable approach. -Rasmus On Sat, 29 Jun 2002, JJ Harrison wrote: I want to check to see if people have voted yet for a poll. How can I get the ip of a user from both behind a proxy and the proxies ip? is this simple? will i have trouble with firewalls etc? -- JJ Harrison [EMAIL PROTECTED] www.tececo.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
Re: [PHP] Getting IP from behind proxies
what esle could i use? Rasmus Lerdorf [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can only get it if the proxy provides you with this data. Most don't, so this is not a reliable approach. -Rasmus On Sat, 29 Jun 2002, JJ Harrison wrote: I want to check to see if people have voted yet for a poll. How can I get the ip of a user from both behind a proxy and the proxies ip? is this simple? will i have trouble with firewalls etc? -- JJ Harrison [EMAIL PROTECTED] www.tececo.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] Re: New Newsgroups
I am on the newsgroups. visit PHP.net look a little bit and you will find the link to the news server. Peter [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Does anyone else out there use Outlook Express to get the posts from this newsgroup? Yesterday a dialog popped up to say there were new newsgroups (php.docs.de etc), I acknowledged this but the same message came up again just now! Did this happen to anyone else or was it just me?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Incrementing a table cell
what is the best way to increment a mySQL table cell? is there a increment function or do I need to increment it in php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Incrementing a table cell
Thanks Jj Harrison [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... what is the best way to increment a mySQL table cell? is there a increment function or do I need to increment it in php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why isn't this working?
Here is my code: $query = UPDATE poll_options SET votes + 1; mysql_query($query); All where conditions have were removed to try and fix the problem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php