Re: [PHP] Sessions?
The way I do it is to stick all those global variables into an include file, which I usually named something like global.php. Just do that and require() the file at the top of all your scripts which need it. Keep things like page color, text color, font, etc in the global file. If you ever need to change the color before you use them, just alter the colors at the top of your scripts after the require(), but before you "do" anything with them (such as echo them to the browser). Once you have the site working like that, it's easy to add per-user customization. So in the future you just check to see if a session variable is set, and if it is you replace the global variable value with the session variable value. -- Plutarck Should be working on something... ...but forgot what it was. ""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I'm used to building pages that contain links that have variables > passed on the URL (somepage.php?var1=1&var2=2...) and I'm now looking > into building a site that will have quite a bit of these that will have > to 'live' from page to page, occasionally getting reset, or changed by > new page. I'm told sessions are the way to go (specially since this > will have several users using the site). > > And consequently, now I'm lost. Sessions..okay..how does the > variable 'live' from one to the other? What do I have to do different > when setting variables that will be used globally across the site (and > reset/changed from time to time)? I don't need to STORE any of these > (say for a future log-in), however if it's easy (easier?) to do it that > way, that's fine as well. I may eventually start making the site > customizable on a per user basis. But for right now, I need a startup > primer first. > > AMK4 > > -- > W | > | I haven't lost my mind; it's backed up on tape somewhere. > | > ~ > Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130 > SysAdmin / Websmith . 800.441.3873 x130 > Photo Craft Laboratories, Inc. .eFax 248.671.0909 > http://www.pcraft.com . 3550 Arapahoe Ave #6 > .. . . . . Boulder, CO 80303, USA > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Reading a file and changing tag values
All you need is a regular expression, provided by ereg function or preg functions. You'd have the regex look for Then just adjust the result as you want it to appear. You'll need to either search around for code that already does this, or be willing to learn regular expressions (which you should do anyway). Otherwise it will seem impossible. -- Plutarck Should be working on something... ...but forgot what it was. ""Brett"" <[EMAIL PROTECTED]> wrote in message 012701c0c4a2$cbc7f840$LocalHost@Default">news:012701c0c4a2$cbc7f840$LocalHost@Default... > I have been able to find out how to read a file and replace certain matches, > but I want to be able to take a web page stored in a string and change the > tags and add www.mysite.com?page= before the actual link value so > the new url would read www.mysite.com?page=original_url. Can I do this and > if so will someone give me an idea how? Thanks. > > Brett > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP & MySQL Search Results
In a MySQL query you can use the LIMIT keyword, like in phpmyadmin. Use limit 0,10 to get the first ten results in a query. Then do the query again but use 10,10 for the limit. The first number is the "offset", and the second one is the maximum results to return. That's the way most people do "pages". -- Plutarck Should be working on something... ...but forgot what it was. ""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message 9b8rgd$oot$[EMAIL PROTECTED]">news:9b8rgd$oot$[EMAIL PROTECTED]... > Does anyone know (or have) of a good example of how to create search results > like a Yahoo or MSN search? > > for example: > > Say I do a search for "cars" and there are 10,000 records in my table that > match "car"... I would like to show the results in blocks of (say) 25 at a > time, therefore I will need a "Next Results", "Previous Results", "Total > Records found that match my query", and perhaps, between the "Previous > Results" and "Next Results" a set of numbers like so; > > > > The numbers being "jump to" links, etc. > > Thanks. > Jason > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] A slightly amusing, though mostly dangerous, endless loop
This is a bug which was apparently fixed in v 4.0.4pl1 at least, but it still present in 4.0.3 I just found it kind of amusing and it makes a nice warning. Consider this: print_r($GLOBALS); That's it. It prints all the variables available, however part of it is an array called GLOBALS. Which then prints all available variables, including an array called GLOBALS... And it will continue until you hit the Stop button or until the script times out. But if you have ignore.user.abort on, it will continue till it times out. If you've screwed with your scripts timeout settings... ...so be wary of that, and ensure you don't try and print out the variables available in GLOBALS in older versions of PHP. It was fixed with the anti-recursion feature, which automatically breaks endless loops. -- Plutarck Should be working on something... ...but forgot what it was. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] CLASSES AND OBJECTS..
Nope, I'm afraid not. Currently PHP will support single level inheritance only. So A can extend B, but C cannot extend B. You will need to create a class of B to extend it with C. I suppose PHP may one day support it, but I am guessing that the Zend API can't currently handle it. I think it will need to be retooled. Sounds like a nice thing to shoot for for PHP5, perhaps? -- Plutarck Should be working on something... ...but forgot what it was. ""alberto"" <[EMAIL PROTECTED]> wrote in message 9b9eu7$s6n$[EMAIL PROTECTED]">news:9b9eu7$s6n$[EMAIL PROTECTED]... > Anyone know if one day PHP will support multiple inheritance? > I think it's very important... > > For example, will PHP support this code: > > class A extends B, extends C { > > } > > where B and C are classes? > > Thanks! > Alberto > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] sorting multi-dimensional arrays
The easiest way is probably to just use a for loop. For instance (no pun intended...well, maybe just a little one): $imax = sizeof($joke); for ($i = 0; $i < $imax; $i++) { if (sizeof($joke[$i]) > 1) { sort($joke[$i]); } } That will handle the sorting of any two-dimensional array. It won't effect the first dimension however, so if you want to sort that you will need to do it first. -- Plutarck Should be working on something... ...but forgot what it was. <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a question about sorting multidimensional arrays. Here is my problem: > > I have an 2-d array: > $joke[1][rating]=10; > $joke[2][rating]=20; > $joke[3][rating]=15; > > > I would like to sort the jokes into an array based on the rating from highest > to lowest. The end result would be something like this: > Joke 2 : 20 points > Joke 3: 15 points > Joke 1: 10 points > > How do I accomplish this? > > I have tried fooling around with sort(), arsort(), and array_multisort(), but > I just can't get it. Thank you very much for your time. > > Shane > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sessions?
Ahh. I reread your post and now I see what you were originally asking. Yes, sessions are the best way to handle it then. The variables "live" by sending a specially augmented header to the client. The header sort of "sticks" to the client so that their session ID is automatically sent in their requests for new pages. It's basically a cookie that isn't stored on the persons hard drive. There are instances where a person's browser is, for lack of a better word, "teflon coated" so that the header/cookie just doesn't "stick" to them. That's when PHP appends the "PHPSESSID=[long string of characters]" to all of your links. So the short answer to your question is "Yes, it's the best way to handle it". But it must be noted that when someone submits a variable through the URL it will _not_ change the value of any session variables. You must do that explicitly in your code. -- Plutarck Should be working on something... ...but forgot what it was. ""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Plutarck wrote: > > > The way I do it is to stick all those global variables into an include file, > > which I usually named something like global.php. > > Um no. These aren't static variables. They change from page to > page. For example, page one > > $foo=0, $bar=3, $baz='Closed' > > They follow a particular link that changes them to, > > $foo=1, $bar=3, $baz='Open' > > They follow yet another link, and this time only $bar changes, > > $foo=1, $bar=2, $baz='Open' > > Right now, the way I've always done that was to include it in the > URL: next_page.php?foo=0$bar=3&baz='Closed' - they follow a link, and > those variables get tacked again. If it's a form, I pass hidden input > tags. > > But, there's got to be a better, transparent way of doing this. No? > > AMK4 > > -- > H | Hi, I'm currently out of my mind. Please leave a message. BP! > | > ~ > Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130 > Director of Internet Operations / SysAdmin. 800.441.3873 x130 > Photo Craft Laboratories, Inc. .eFax 248.671.0909 > http://www.pcraft.com .3550 Arapahoe Ave, #6 > .. . . . .Boulder, CO 80303, U.S.A. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] counter reseting help!
How are you saving the current counter amount? For instance if it's in a database, add a date field. Check to see if the date is more than 24 hours old before displaying the current counter. If it is then update the database and make the counter number 0. If it's not older than 24 hours, just do your counter as normal. -- Plutarck Should be working on something... ...but forgot what it was. ""McShen"" <[EMAIL PROTECTED]> wrote in message 9b9mg0$26o$[EMAIL PROTECTED]">news:9b9mg0$26o$[EMAIL PROTECTED]... > hi > > I am writing a small counter for my site. But i am not sure how to reset the > counter every 24h. How should i do it? any suggestions would be much > appreaciated! > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Explain recordset
$result holds a "resource id". When you do anything like mysql_fetch_row it sends a request to the database. All results, until you "fetch" them, are kept in MySQL. If you want to store the results away from the DB you will need to do something like: while ($array[] = mysql_fetch_row($result)); That will store all the results into $array...hopefully. -- Plutarck Should be working on something... ...but forgot what it was. "Mike P" <[EMAIL PROTECTED]> wrote in message 9b9lvb$u57$[EMAIL PROTECTED]">news:9b9lvb$u57$[EMAIL PROTECTED]... > I'm trying to figure out the way recordsets are handled with php and > mysql.After I issue a query to the Db with $result = mysql_query ($query) > is the recordset contained in $result or is this just a pointer.I want a > persistant recordset on the client computer that can be manipulated without > going to the server.Is this possable.fetchrow seems to go to the server > each time or am i wrong? > Thanks > Mike P > [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help on something simple?
What function are you calling on $result when it returns the error? Try doing this, all in one place: $db = mysql_connect("localhost", "username"); mysql_select_db("subsurface_net", $db); $result = mysql_query("SELECT * FROM customer_genre", $db); echo mysql_num_rows($result); When you use a SELECT query the function "mysql_affected_rows" is not valid. When using an UPDATE, INSERT, or DELETE query, "mysql_num_rows" is invalid. That may be your problem, because the code you paste in seems not to have anything wrong with it. -- Plutarck Should be working on something... ...but forgot what it was. ""Andrew Durk"" <[EMAIL PROTECTED]> wrote in message 9b9n47$7ej$[EMAIL PROTECTED]">news:9b9n47$7ej$[EMAIL PROTECTED]... > I can get connected to my host's MySQL database w/o error, but I cannot seem > to do anything after that. > > I do: > $db = mysql_connect("localhost", "username"); > mysql_select_db("subsurface_net",$db); > > No problem, but if I do this: > $result = mysql_query("SELECT * FROM customer_genre",$db); > > I eventually get: > Warning: 0 is not a MySQL result index in /test.phtml on line 35 > > And customer_genre _is_ a table in my database... > > Help, anyone!? > -- > Andrew Durk > [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Selected Radio Buttons
I'm not sure I understand. In the first loop you are seing if $article_active equals y. And no where in the code do you set $article_active to anything else. Why would you think $article_active would be anything but "y" or "n"? -- Plutarck Should be working on something... ...but forgot what it was. "Jordan Elver" <[EMAIL PROTECTED]> wrote in message 01041415474000.10298@localhost">news:01041415474000.10298@localhost... > Hi, > I think I'm being stupid. Why won't this code work. The $article_active > variable is showing y when I echo it? > > > if($article_active == 'y') { > echo"Yes"; > } else { > echo"Yes"; > } > > if($article_active == 'n') { > echo"No"; > } else { > echo"No"; > } > > > Thanks, > > Jord > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP without a webserver
I've heard much about how PHP is far more than just a language for web programming, and I agree. I agree enough that I would like to actually try it. I'd like to use PHP scripting in a C/C++ program that doesn't need a webserver as an intermediary. I basically want to use PHP in a standalone/TCP-IP program rather than having to build a whole "IMF-esk" hairball myself. Are there any articles or documentation which focuses, or at least would give me useful information, on how such a task would be accomplished? I'm looking at the API documentation itself which will be helpful, but is there anything a little more "pointed" than that? I'd love to see PHP grow an arm of offline scripting. It would just be _perfect_ for compiling high-level developer-friendly scripts into a format usable for 3D real-time environment manipulation, for instance. -- Plutarck Should be working on something... ...but forgot what it was. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP without a webserver
Ah, even better. However, how would the script be passed to PHP? As a command line argument? -- Plutarck Should be working on something... ...but forgot what it was. "Jeroen Wesbeek" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > well actually you could compile php4 > on it's own so you get a php executable which > you can use as an interpreter for php4 scripts... > no webserver needed > > > dowebwedo > Jeroen Wesbeek > .programming > Nieuwekade 213 | 3511 RW Utrecht > The Netherlands > p 030 2380544 | f 020 8632045 > > > [roses are red, violets are blue, > I am schizophrenic and so am I ] > > > -Original Message- > From: Brian Clark [mailto:[EMAIL PROTECTED]] > Sent: zaterdag 14 april 2001 19:53 > To: PHP is not a drug. > Subject: Re: [PHP] PHP without a webserver > > > Hi Plutarck, > > @ 11:37:09 AM on 4/14/2001, Plutarck wrote: > > > I've heard much about how PHP is far more than just a language for > > web programming, and I agree. I agree enough that I would like to > > actually try it. I'd like to use PHP scripting in a C/C++ program > > that doesn't need a webserver as an intermediary. > > It doesn't. You don't have to have a web server installed in order to > use PHP. > > -Brian > -- > PGP is spoken here: 0xE4D0C7C8 > Please do not carbon copy me on list replies. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Supplied argument is not a valid MS SQL-Link resource
http://us.php.net/manual/en/function.mssql-select-db.php *_select_db does not return a connection id, it returns true or false. Just change your script like this: $Conn=mssql_connect('192.168.1.20','username','password'); mssql_select_db('My_Database',$Conn); $QueryString="select id, name from my_table"; $Test=mssql_query($QueryString, $Conn); That should work just fine. -- Plutarck Should be working on something... ...but forgot what it was. ""davek"" <[EMAIL PROTECTED]> wrote in message 9ba2po$jnb$[EMAIL PROTECTED]">news:9ba2po$jnb$[EMAIL PROTECTED]... > Does anybody know how to fix this error? "Supplied argument is not a valid > MS SQL-Link resource" I am running: > > NT4 > MSSQL7.0 > IIS4 > PHP 4.0.4pl1 > > I've been running php3 for some time now without any problems but want to > upgrade to 4. This error seems to be occuring at the mssql_query() > function. > > $Conn=mssql_connect('192.168.1.20','username','password'); > $ThisConnect=mssql_select_db('My_Database',$Conn); > $QueryString="select id, name from my_table"; > $Test=mssql_query($QueryString, $ThisConnect); > > Please help! Thanks. > Dave > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP without a webserver
Ahh, so it's the location of the script that get's passed. Now, if the script was coming from a program, is there a way to hand the file directly to PHP, or will a temporary file have to be used? So if a user filled in a form and clicked a button in the program, the program would toy with the form a little, then send the form to PHP. Is that possible using the CGI executible? -- Plutarck Should be working on something... ...but forgot what it was. "Brian Clark" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Plutarck, > > @ 2:11:35 PM on 4/14/2001, Plutarck wrote: > > > Ah, even better. However, how would the script be passed to PHP? As > > a command line argument? > > Install the CGI executable of PHP in c:\php > > In your autoexec.bat: > > SET PATH=c:\php;%PATH% > > Reboot. > > From the command line: > > php -q script.php > > And read about $argc and $argv. If you're familiar with C, those > shouldn't be a problem. > > -Brian > -- > PGP is spoken here: 0xE4D0C7C8 > Please, DO NOT carbon copy me on list replies. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What's XML's Purpose??
I use to be really enthusiastically pro-XML just as I was getting into PHP, but now I've basically taken a "XML shmexXML" approach. I get the initial attraction, but I would think the love would fade off a bit. The key that so many people seem to forget is the best way to do HTML is with, *gasp*, HTML! If you just want a webpage, XML is using a canon to kill a fly. It's like creating classes and objects in PHP for sending text emails. Sure you can do it...but why? XML is new. Common society doesn't do well with new. They always manage to screw it up somehow. XML started as an extensible markup language...that's it. That's all it was supposed to do! Now people are using it to query databases, and concoct entire search engines, and they are trying to use it to control access to restricted data, etc etc. It's the same thing that happened with Java. People just aren't good with "new". XML is nice, and for some things it's even great. But it's not the death of plain old HTML, just like ISDN didn't kill POTS (remember when ISDN was "the future of telecom"?). I fear that there are too many cooks in the kitchen on XML, all with a seasoning all their own that they are dead set on adding to the broth. But for me, I say let people play with their Java and XML and new fangled widgets. I'll take my PHP and plain-old HTML, and I'll create twice as much material with just as high a quality, and I won't need to spend an extra minute learning a bleeding-edge technology. Life's too short to spend it learning how to live it. Translation: Better to program than to learn yet _another_ language. -- Plutarck Should be working on something... ...but forgot what it was. ""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message 002001c0c506$c70d7f00$0d1012d1@null">news:002001c0c506$c70d7f00$0d1012d1@null... > thanks that helped > I stll think it sounds like its more geared for the MS crowd > - Original Message - > From: "Brian Clark" <[EMAIL PROTECTED]> > To: "PHP is not a drug." <[EMAIL PROTECTED]> > Sent: Saturday, April 14, 2001 3:29 PM > Subject: Re: [PHP] What's XML's Purpose?? > > > > Hi Chris, > > > > @ 12:01:45 AM on 4/14/2001, Chris Anderson wrote: > > > > > Am I missing something here? > > > > This has been discussed many times. There was an extremely long thread > > last year about XML, but I can't find it in the archives. > > > > Here's a good start: > > > > http://marc.theaimsgroup.com/?l=php-general&m=97969195010857&w=2 > > > > Use the 'next in thread' link to follow the thread. > > > > -Brian > > -- > > PGP is spoken here: 0xE4D0C7C8 > > Please, DO NOT carbon copy me on list replies. > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP without a webserver
Btw, thanks for all your answers to far ;) > I have no idea. What language? Using system() in C and Perl, I'm > sure you could concoct something. Why would you want to do that? A move recently being made by game programmers has been to move an increasing amount of work into a scripting engine. My idea is to jump ahead of the slow move, so that the program is far more abstracted. The program, written in C/C++ (or Java, or any language really), is basically turned into a dumb bot. It's a mindless intermediary. The outer layer is the Display Engine, which could be a Quake Engine or an MFC style GUI, which takes all of it's commands from the intermediary layer. The final layer is the scripting engine. In the script if a move_elevator() function is called, the script interpreter bundles up some commands and passes it over to the intermediary layer. The intermediary looks at the display engine, figures out what commands must be called to fufill the wishes of the script, and passes over the commands. This would allow the vast majority of the real "content" of a game or application to be written in a scripting language, much like web apps are now. The script would run just as well on Linux as it would on windows. The intermediary understands the universally written script, and figures out how to actually do what the script asks it to. So an entire application could be written to run using OpenGL, DirectX, and a selection of different engines. So you could switch from using a Quake engine to a Midtown Madness engine for maximum effectiveness, only by tweaking the intermediary level. Since there are only so many ways to "rotate camera", code could be reused to the point that the intermediary level comes packaged with all it needs to know. And thus the sheer amount of people who have the ability to run such applications skyrockets. The creators of the Dark Forces star wars game (correct name?) created a specific programming language for doing things like moving elevators, dialog, etc. Now adays everyone has their own script. Asheron's Call has their own little internal quest scripting, and Ever Quest made their own, Doom has one, Daggerfall has some, et al. But why go to the trouble of making a whole stinking language, reinventing the wheel, when thousands of people have spent years to develop a versitile and extensible scripting engine in PHP? Anyway, that's my idea. I'd just be happy to outsource some of my C++ work to PHP. If I use MFC, goodbye platform independence. If I don't use it, it's a huge pain in the butt to do heavy string manipulation. So I figure, why not just have PHP do it, since I already know the language? -- Plutarck Should be working on something... ...but forgot what it was. "Brian Clark" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Plutarck, > > @ 2:40:28 PM on 4/14/2001, Plutarck wrote: > > > Ahh, so it's the location of the script that get's passed. > > Yes: > > % cat test.php > > while(list($i,$arg) = each($argv)) > { > print "$i: $arg\n"; > } > > ?> > > % php -q test.php a b c d e f g > 0: test.php > 1: a > 2: b > 3: c > 4: d > 5: e > 6: f > 7: g > % > > > Now, if the script was coming from a program, is there a way to hand the > > file directly to PHP, or will a temporary file have to be used? > > I have no idea. What language? Using system() in C and Perl, I'm > sure you could concoct something. Why would you want to do that? > > > So if a user filled in a form and clicked a button in the program, the > > program would toy with the form a little, then send the form to PHP. Is that > > possible using the CGI executible? > > I have no idea what you're talking about here, but if you're wanting > to build some type of GUI based application you might as well either > use PHP-GTK (http://gtk.php.net) or just use a HTML, PHP and a web > server. > > -Brian > -- > PGP is spoken here: 0xE4D0C7C8 > Please, DO NOT carbon copy me on list replies. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What's XML's Purpose??
I agree with most of your points actually. That's why I said I thought the love would "fade off a bit". For some things I agree that XML really is quite excellant. But what I meant about people not being good with "new" on Java and XML, is that when people (including myself) get a new toy they try and do everything with it. People get a VCR, and now they want it to program itself and set it's own clock. Thus came for horrible implementation of "VCR+". Java was originally made to work in little widgets like blenders and microwaves. Then it made sense to work on computers too...it's still a very good idea. But then people instantly tried to do everything with it, and complained loudly when they couldn't. So Sun bowed to their wishes and started forcing Java to do things it wasn't yet ready to do. And now Java applets are quite secure for the user, but the ease with which they can be decompiled is gastly. And with XML it's the same way, for now. They want it to do _everything_. Now when you mix XML with a little javascript and a server-side language like PHP or *cough* ASP (or any of the others), it really is a pretty nifty widget. But here is my problem. For instance with Java, people tend to get really excited about doing something that they could of done with C/C++. But in reality, it's a feature only a mother (or programmer, as the case may be), could love. So my whole POV is when you want to open a can, use a can opener. So please put the VCR back under the TV. -- Plutarck Should be working on something... ...but forgot what it was. "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Plutarck wrote: > > > I use to be really enthusiastically pro-XML just as I was getting into PHP, > > but now I've basically taken a "XML shmexXML" approach. I get the initial > > attraction, but I would think the love would fade off a bit. > > > > The key that so many people seem to forget is the best way to do HTML is > > with, *gasp*, HTML! > > > > If you just want a webpage, XML is using a canon to kill a fly. It's like > > creating classes and objects in PHP for sending text emails. > > > > Agreed, but if you have a set of data that you'd like to be able to > "fairly easily" convert into multiple presentation systems (HTML, PDF > and WAP spring to mind), then taking a more structured data and > abstraction approach can pay off quite handsomely on larger projects. > > > > > > Sure you can do it...but why? > > > > Because what you need to do might change some in the future. Yes, > use mail() all you want, but when you start needing to send attachments, > already you need a class of some sort. - Aha - I see you qualified and said > 'text' attachments. OK... > > > > > > XML is new. Common society doesn't do well with new. They always manage to > > screw it up somehow. > > > > Depends on what you mean by 'screw it up'. The notion of a commercial > internet, to me, seems to have been adopted QUITE quickly - even my > parents have coped quite well with this 'new' stuff, and they STILL > can't set their VCR clocks. > > > > > XML started as an extensible markup language...that's it. That's all it was > > supposed to do! Now people are using it to query databases, and concoct > > entire search engines, and they are trying to use it to control access to > > restricted data, etc etc. > > > > I don't know what you're talking about here. I've not heard of anyone using > XML to 'control access' to 'restricted data'. The XML itself IS the data. > > > > > > It's the same thing that happened with Java. People just aren't good with > > "new". > > > > Don't lump Java in with other 'new' technology wholesale. Sun has made, > imo, a HUGE number of mistakes pushing Java out, so the > less-than-stellar adoption of Java has as much or more to do with Sun themselves > > rather than people's ability to adopt to 'new' things. Again, imo. > > > > > > XML is nice, and for some things it's even great. But it's not the death of > > plain old HTML, just like ISDN didn't kill POTS (remember when ISDN was "the > > future of telecom"?). > > > > I fear that there are too many cooks in the kitchen on XML, all with a > > seasoning all their own that they are dead set on adding to the broth. > > > > But for me, I say let people play with their Java and XML and new fangled > > w
Re: [PHP] next release?
Nope, it 4.0.5 hasn' been released yet. However at one point I believe there was a 4.0.6dev source code on CVS, before the Midgaard extension required another round of release candidates. So I think that's where the mentions came from. And I'm sure some people are planning their features to be in 4.0.6. Then again, there are probably people who claim their features will be in PHP5 ;) -- Plutarck Should be working on something... ...but forgot what it was. "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm seeing references to functions that 'are' in 4.0.6, but I wasn't > even > aware that 4.0.5 was released yet. I've seen references to RCs for > 4.0.5, > but nothing's on the php.net page. Did I miss something? > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sorry :(
Remember: There are no stupid questions. Only stupid people. ...*couldn't resist* ;) -- Plutarck Should be working on something... ...but forgot what it was. ""Chris Anderson"" <[EMAIL PROTECTED]> wrote in message 002b01c0c528$7ea85a60$0d1012d1@null">news:002b01c0c528$7ea85a60$0d1012d1@null... > Well thanks everyone, don't feel like I'm "leeching" from the community > anymore. Now when it comes to me and napster, thats another story > - Original Message - > From: "Brian Clark" <[EMAIL PROTECTED]> > To: "PHP is not a drug." <[EMAIL PROTECTED]> > Sent: Saturday, April 14, 2001 7:47 PM > Subject: Re: [PHP] Sorry :( > > > > Hi Chris, > > > > @ 3:51:02 PM on 4/14/2001, Chris Anderson wrote: > > > > > I realized that'll that I don't do much to help this community. I > > > rarely reply to people's questions. Mainly because I have 56.6 and > > > when I get mail people answered already. I also ask alot of > > > questions. Just saying thanks for putting up with me. Chris, The 17 > > > yr Old Php Coder > > > > As far as I'm concerned, you don't have a thing to be sorry about. > > > > There isn't a thing wrong with asking questions here. In fact, if you > > have a good book and this list to get help from, you're far more > > likely to become successful with PHP. > > > > -Brian > > -- > > PGP is spoken here: 0xE4D0C7C8 > > Please, DO NOT carbon copy me on list replies. > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] converting DATETIME to a readable date.
The I "now" get a date from MySQL (hehe) is to use UNIX_TIMESTAMP then feed it over to date. That way if I want to change the way the date is displayed, I don't have to touch my query syntax. And I personally find it easier to use PHP's date() function rather than MySQL's. -- Plutarck Should be working on something... ...but forgot what it was. "Chris Adams" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On 14 Apr 2001 17:31:02 -0700, DRN <[EMAIL PROTECTED]> wrote: > >$date = $row["date"]; > > > >$new_date = date("l, j M Y, G:i:s", strtotime($date)); > >~~ > > > >but I cannot get this to work :(, I get an "unexpected error in > >date()" > > At a guess strtotime() is choking on the format MySQL used to return the date, > which would lead date() to fail as well. > > The best way of handling this is to eliminate the need for your program to > worry about the day formats. Modify your mysql query so that instead of "SELECT > date" you have something like "SELECT UNIX_TIMESTAMP(date) AS date". Then you > can simply use date($row["date"]) directly. Alternately, you could use MySQL's > date formatting function to return the desired format directly. In either case, > you'll save a great deal of trouble by avoiding the need for PHP and MySQL to > be parsing each other's human-readable date formats. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Mailbox and PHP
Check out PHPost: http://webgadgets.com/ It doesn't use IMAP, so you can probably learn quite a bit how POP3 mail can be handled. One of these days I'm going to actually figure it out myself... -- Plutarck Should be working on something... ...but forgot what it was. ""Richard"" <[EMAIL PROTECTED]> wrote in message 9bc03m$3ad$[EMAIL PROTECTED]">news:9bc03m$3ad$[EMAIL PROTECTED]... > Greetings. > > I have no problem writing an email client in PHP, which sends emails and > such things. One thing only, can I check someones POP3, such as mine, > through PHP? If so, what should be needed to complete it..? The server I am > using is running Linux FreeBSd (I think..) with the options for the user to > change quite alot.. > > - Richard > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] SQL Query syntax error... Help?
In the future, to make things easier on yourself, when you get a query syntax error add an "echo $sql;" line right before your query. Almost every time I have a query problem, that solves it. -- Plutarck Should be working on something... ...but forgot what it was. ""Scott VanCaster"" <[EMAIL PROTECTED]> wrote in message 9bd394$ikn$[EMAIL PROTECTED]">news:9bd394$ikn$[EMAIL PROTECTED]... > I've only been trying to learn this stuff for a few days and thought I was > on a roll, but now have run into a problem I don't get at all. In my script > I have the following sql query and am receiving the following error when it > executes "You have an error in your SQL syntax near '' at line 1." > > Any idea what my problem is? I removed the WHERE id=$id and it works, but > updates every record of course :( > > I'm lost here. Thanks for any help. > > $sql ="UPDATE members SET ". > "name='$name', ". > "email='$email', ". > "icq='$icq', ". > "password='$password', ". > "loginid='$loginid', ". > "countryid='$countryid', ". > "gtlogin='$gtlogin', ". > "gtpass='$gtpass', ". > "swirvelogin='$swirvelogin', ". > "swirvepass='$swirvepass' ". > "WHERE id=$id" ; > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fwrite not writing
What is this: !filesize($filepath) Add this above your if loop: $filesize = filesize($filepath); echo $filesize; That might be causing your loop not to execute...if not, I'm not sure what's wrong. -- Plutarck Should be working on something... ...but forgot what it was. "CC Zona" <[EMAIL PROTECTED]> wrote in message 9bdv8u$2la$[EMAIL PROTECTED]">news:9bdv8u$2la$[EMAIL PROTECTED]... > This function suddenly stopped working, and I just can't seem to figure out > why. The only change made recently is that now the value of $force at > calltime is sometimes true instead of being undefined or null. > > build_file("file_content","/path/to/file.inc","w",TRUE); > > function build_file($func_name,$filepath,$mode="w",$force=FALSE) >{ >if($force or !file_exists($filepath) or !filesize($filepath)) //echo > filesize($filepath) shows '0' > { > $content=$func_name(); //echo $content shows it's all there >$fp=fopen($filepath,$mode); >fwrite($fp,$content); >rewind($fp); #temp test > $read_back=fread($fp,10); #temp test > echo "file content:\n $read_back"; #temp test, displays nothing > fclose($fp); > } >} > > I've tried putting echoes and "or die('Error on __LINE__')" on every line, > checked all the variable values, and found no answers from that. > Everything shows exactly as it should be except that the content that > echoes out so nicely *doesn't ever get written to the file*. The function > runs to the end without error and the file's modification date is even > updated. But the file remains empty. I'm probably missing something > ridiculously obvious, but would someone please be kind enough to point out > what it is? Thank you!! > > -- > CC > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Want a Good Book for Ref on PHP
Personally, I never even bought a PHP book. I learned from the web only...hehe. First, go to zend.com and check out their tutorial and article sections. Then check out their links section, which just so happens to have links to 17 books, 10 of which are non-english. Check out phpbuilder.com, devshed.com, and phpbeginner.com. weberdev is also a good one. First of course, read the PHP manual. I basically learned everything I needed to from those sites. The rest comes from just hacking out code. PHP changed alot during the books writing process, so it's really rather impossible to get a totally updated book. For instance if you started writing a book now on PHP v4.0.5, PHP would be nearing version 5 before it ever hit a bookshelf. -- Plutarck Should be working on something... ...but forgot what it was. "Manisha" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > I am just entering into PHP world. First what I did is, I signed for PHP > mailing list. > > I want to buy a good PHP book for my initial start and may be later on as a > reference. I know there are lot in the market. Can anybody suggest a good > book among them ? > > manisha > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] fwrite not writing
Ahhh, I see what's going on now. I had more time to read over the code, so now I see what you are trying to do. I'm not sure why it suddenly stopped working, but let's see if you actually need it to work. First of all, I take it that you have content which you want to write into a file. Correct? If so, why does it matter if the file you want to write it to has data anyway? If you are just going to add data into it, isn't it ok that it is a zerolength file? Or is the problem that the file is _not_ actually zerolength, but PHP says it's zerolength anyway? Just try removing the !filesize() part, and then try executing the function. But maybe I just don't understand what you are trying to write and why. Could you be a little more specific what data is being saved in the file, and what is in the file already? -- Plutarck Should be working on something... ...but forgot what it was. "CC Zona" <[EMAIL PROTECTED]> wrote in message 9bebi3$133$[EMAIL PROTECTED]">news:9bebi3$133$[EMAIL PROTECTED]... > > > This function suddenly stopped working, and I just can't seem to figure > > out > > > why. The only change made recently is that now the value of $force at > > > calltime is sometimes true instead of being undefined or null. > > > > > > build_file("file_content","/path/to/file.inc","w",TRUE); > > > > > > function build_file($func_name,$filepath,$mode="w",$force=FALSE) > > >{ > > >if($force or !file_exists($filepath) or !filesize($filepath)) //echo > > > filesize($filepath) shows '0' > > > { > > > $content=$func_name(); //echo $content shows it's all there > > >$fp=fopen($filepath,$mode); > > >fwrite($fp,$content); > > >rewind($fp); #temp test > > > $read_back=fread($fp,10); #temp test > > > echo "file content:\n $read_back"; #temp test, displays > > nothing > > > fclose($fp); > > > } > > >} > > > > > > I've tried putting echoes and "or die('Error on __LINE__')" on every line, > > > checked all the variable values, and found no answers from that. > > > Everything shows exactly as it should be except that the content that > > > echoes out so nicely *doesn't ever get written to the file*. The function > > > runs to the end without error and the file's modification date is even > > > updated. But the file remains empty. I'm probably missing something > > > ridiculously obvious, but would someone please be kind enough to point out > > > what it is? Thank you!! > > > What is this: > > > > !filesize($filepath) > > If filesize is zero (which it is ), then do the rest (which it > does--except the content it fetches never makes it into the file it writes > to. How that can be, I dunno, but that apparently is what it's doing...) > > > Add this above your if loop: > > > > $filesize = filesize($filepath); > > echo $filesize; > > Already tried echoing that and all the other values. Filesize is 0. > > > That might be causing your loop not to execute...if not, I'm not sure what's > > wrong. > > I don't get it. It should work. It did work. Suddenly it's not. > > -- > CC > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] General WebServer Question?
The first thing you need is benchmarking software. Try an internet search for "webserver performance benchmark". I did it on altavista and got some good leads. For instance this one sounds excellant: http://www.softwareqatest.com/qatweb1.html It's description is "Listing of 190 web test tools and management tools - link checking, html validation, load testing, security testing, java testing, publishing...". Never underestimate the power of the search engine :) For the second part, you want a weblog analyzer. I reccommend Analog: http://www.statslab.cam.ac.uk/~sret1/analog/ It has listing for popularity of particular files, directories, etc. Good stuff. Insanely fast. -- Plutarck Should be working on something... ...but forgot what it was. ""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message 9be700$b2d$[EMAIL PROTECTED]">news:9be700$b2d$[EMAIL PROTECTED]... > Can anyone recommend (or is there) a utility / app that I can use to hit my > webserver (say from another computer outside my subnet) -- any number of > times to get an idea of performance - based on my bandwidth and hardware? > > In other words -- I'd like to do some hard core testing of my website and > see how much my pipe and servers (simultaneously) can handle... I would like > to get page return times, etc... > > Also -- is there a good add on to IIS or Apache that I can use to monitor > not only how much traffic is hitting my site, but which pages, and from > where the users are coming (ie. which websites they came from)? > > Thanks. > Jason > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] global env variables not working in php-cgi
What version of PHP? I ask because a few test functions aren't available on older versions of PHP4. Try this piece of code: $arr = get_defined_vars(); print_r($arr); (if that doesn't work, try print_r($GLOBALS), but be sure to hit the Stop button on your browser, because it will print off an infinite list) Now, look at the results. In the main listing, does it list any of the ENV variables you are trying to access? If not, page down a bit and look in the HTTP_SERVER_VARS array. Are the ENV variables in there? My guess is that they probably are. Check phpinfo() again and see what register_globals is On. That may be your problem... If none of the variables you seek are in HTTP_SERVER_VARS, then something is wrong with the installation of PHP itself. -- Plutarck Should be working on something... ...but forgot what it was. "Franklin Hays" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I am migrating a site to a new host (westhost.com) and having some > issues. PHP was compiled as a cgi instead of a module which is what I > have always used. This wasn't really an issue until I realized a lot of > my scripts that depended on apaches environment variables ($REQUEST_URI, > $HTTP_USER_AGENT, etc.) weren't working. I can write a PERL cgi script > and get them from the command line, they also appear in phpinfo(), yet I > simply can't obtain them from any of my php scripts. Maybe the cgi issue > isn't even related but up to this point it is the only culprit I can > find. After spending three days going through the docs at apache, > phpbuilder, and php.net I have not ran across anything which offers a > solution. Thus, I am not looking in the right place or this is a unique > problem. Can anyone out there help, or provide some > directions/suggestions? And yes, they are running Apache (note above, I > can obtain the variables but just not through my php scripts). Do I need > to make an addition to my .htaccess file of some sort? > > I need these variables for my site to work properly ( css generation, > hashing URL strings, etc.) so any/all help is greatly appreciated. > > If you need more information please let me know and I will get back to you > as soon as possible. At this point I can't obtain ANY of the env > variables (SERVER_PORT, REMOTE_ADDR, REQUEST_URI, HTTP_USER_AGENT, etc.). > > Thanks, > //frank > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Protecting JavaScripts from being Donwloaded
If you mean Javascript that is in your HTML code, it is both practically and theoretically impossible to do so. HTML source is wide-open to anyone who wants to look at it, and there is little/nothing you can "really" do about it. Some sites try and hide their HTML source, but it servers only to annoy the crap out of users. If I right-click a page and don't get the right-click menu I expect, I tend to become highly irritated. JavaScript is a "scripting language", which was designed for the exact purpose of being easily read by humans. Now, if you are speaking of a JavaApplet or client-side java bean, that's a little different. But in reality you can't really stop people from downloading those to their hard-drive either. There are methods to keep people from easily decompiling them, but I'm betting you aren't talking about Java stuff anyway :) -- Plutarck Should be working on something... ...but forgot what it was. ""Steve Haemelinck"" <[EMAIL PROTECTED]> wrote in message 01c0c663$59401dd0$0200a8c0@shaemeli">news:01c0c663$59401dd0$0200a8c0@shaemeli... > Hi all is it possible to protect your javascripts from being downloaded by > visitors ? > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] global env variables not working in php-cgi
Btw, the reason you got all the output is why I said to hit the browser Stop button. Technically it will run forever. The GLOBALS array contains an a array called GLOBALS, which contains GLOBALS, endlessly. It will never ever end ;) It's fixed in 4.0.2. get_defined_vars isn't available till 4.0.4, so that's why you got the error. But from looking at your output, there is definately something screwy with their setup. In phpinfo, what are the settings for track_vars (if listed) and global_vars? "Franklin Hays" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello. > > The version is php-4.02 built on Sep 22, 2000. > > |What version of PHP? I ask because a few test functions aren't available on > |older versions of PHP4. > | > |Try this piece of code: > | > |$arr = get_defined_vars(); > | > |print_r($arr); > > This gave me an error on get_defined_var() so I tried > print_r($GLOBALS) and got a ton of output of the form: > > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] > => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => | /test.php ) [GLOBALS] => > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array (|(if that > doesn't work, try print_r($GLOBALS), but be sure to hit the Stop > [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > [HTTP_SERVER_VARS]|button on your browser, because it will print off an > infinite list) | => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array ( > [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => > Array ( )|Now, look at the results. In the main listing, does it list any > of the ENV [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) > [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > [HTTP_COOKIE_VARS]|variables you are trying to access? | => Array ( ) > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array > ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )|If not, page down a > bit and look in the HTTP_SERVER_VARS array. Are the ENV [HTTP_COOKIE_VARS] > => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) > [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS]|variables in > there? | => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] > => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => > /test.php|My guess is that they probably are. Check phpinfo() again and > see what |register_globals is On. That may be your problem... > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array > ( [PHP_SELF]| => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] > => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) > [GLOBALS] => Array (|If none of the variables you seek are in > HTTP_SERVER_VARS, then something is [PHP_SELF] => /test.php > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS]|wrong > with the installation of PHP itself. | | => Array ( [PHP_SELF] => > /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )| |-- [GLOBALS] => > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] > =>|Plutarck |Should be working on something... /test.php ) [GLOBALS] => > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array (|...but > forgot what it was. | [PHP_SELF] => /test.php ) [GLOBALS] => Array ( > [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => > Array ( ) [HTTP_SERVER_VARS]| | => Array ( [PHP_SELF] => /test.php ) > [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array > ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > [HTTP_COOKIE_VARS]|> => Array ( ) [HTTP_SERVER_VARS] =>
Re: [PHP] Want a Good Book for Ref on PHP
Woh, that book looks excellant. I think I may order it, actually. It is absolutely _hell_ to find a good advanced programming or internet technology book. If the book doesn't expect you to be a moron (how many morons are interested in the implementation of TCP/IP, anyway?), it expects you to be a complete wizard (which basically means the book is a 400 page reference manual). It's hard to find a book on computers that is for an advanced-but-not-perfect user. *orders* I'll give me review to the list once I get it :) -- Plutarck Should be working on something... ...but forgot what it was. "Ulf Wendel" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Christian Reiniger schrieb: > > > > On Monday 16 April 2001 08:23, you wrote: > > > Personally, I never even bought a PHP book. I learned from the web > > > only...hehe. > > > > Same here. > > Well, actually I *did* buy a book - "Core PHP programming". I started > > reading it, saw that it basically only covers (a) introductory > > programming in general (what is a 'while' loop?) and (b) a PHP3 function > > reference (copied from the online manual), and I immediately went back to > > the web resources. > > > > That doesn't mean you shouldn't buy any book - the cookbook for example > > certainly is very useful both as starter (giving examples) and later on > > (giving more complex examples :). > > Hmm, although Sterlings book is cool, german readers can save the money > an check the german FAQ on http://www.koehntopp.de/php. It covers most > of Sterlings book except the PHP core hacking. The advanced book I like > best is "Web application development with PHP 4.0" written by > Till&Tobel. Don't expect a PHP only book, the authors did very well not > to copy the online reference or the usual tutorials. Till&Tobel wrote a > book for those that have a solid basic programming knowledge but lack > some more advanced skills like API design or certain web development > strategies (CVS, staging server, development process, ...). > > Ulf > > -- > Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt > http://www.ulf-wendel.de/projekte/menu/tutorial.php | > http://www.phpdoc.de > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] global env variables not working in php-cgi
> The GLOBALS array contains an a array called GLOBALS, which contains > GLOBALS, endlessly. It will never ever end ;) It's fixed in 4.0.2. That was a typo. What I mean to say is that it's fixed in 4.0._4_, not _2_. -- Plutarck Should be working on something... ...but forgot what it was. ""Plutarck"" <[EMAIL PROTECTED]> wrote in message 9bf39j$j2c$[EMAIL PROTECTED]">news:9bf39j$j2c$[EMAIL PROTECTED]... > Btw, the reason you got all the output is why I said to hit the browser Stop > button. Technically it will run forever. > > The GLOBALS array contains an a array called GLOBALS, which contains > GLOBALS, endlessly. It will never ever end ;) It's fixed in 4.0.2. > > get_defined_vars isn't available till 4.0.4, so that's why you got the > error. > > > But from looking at your output, there is definately something screwy with > their setup. > > In phpinfo, what are the settings for track_vars (if listed) and > global_vars? > > > "Franklin Hays" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > Hello. > > > > The version is php-4.02 built on Sep 22, 2000. > > > > |What version of PHP? I ask because a few test functions aren't available > on > > |older versions of PHP4. > > | > > |Try this piece of code: > > | > > |$arr = get_defined_vars(); > > | > > |print_r($arr); > > > > This gave me an error on get_defined_var() so I tried > > print_r($GLOBALS) and got a ton of output of the form: > > > > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] > > => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php > > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => | /test.php ) [GLOBALS] => > > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] => Array (|(if that > > doesn't work, try print_r($GLOBALS), but be sure to hit the Stop > > [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => /test.php > > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > > [HTTP_SERVER_VARS]|button on your browser, because it will print off an > > infinite list) | => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array ( > > [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => > > Array ( )|Now, look at the results. In the main listing, does it list any > > of the ENV [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) > > [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > > [HTTP_COOKIE_VARS]|variables you are trying to access? | => Array ( ) > > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array > > ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( )|If not, page down a > > bit and look in the HTTP_SERVER_VARS array. Are the ENV [HTTP_COOKIE_VARS] > > => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) > > [GLOBALS] => Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS]|variables in > > there? | => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SERVER_VARS] > > => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array ( [PHP_SELF] => > > /test.php|My guess is that they probably are. Check phpinfo() again and > > see what |register_globals is On. That may be your problem... > > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS] => Array > > ( [PHP_SELF]| => /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] > > => Array ( ) [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) > > [GLOBALS] => Array (|If none of the variables you seek are in > > HTTP_SERVER_VARS, then something is [PHP_SELF] => /test.php > > [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php ) [GLOBALS]|wrong > > with the installation of PHP itself. | | => Array ( [PHP_SELF] => > > /test.php [HTTP_GET_VARS] => Array ( ) [HTTP_COOKIE_VARS] => Array ( ) > > [HTTP_SERVER_VARS] => Array ( [PHP_SELF] => /test.php )| |-- [GLOBALS] => > > Array ( [PHP_SELF] => /test.php [HTTP_GET_VARS] => Array ( ) > > [HTTP_COOKIE_VARS] => Array ( ) [HTTP_SER
Re: [PHP] Variables not getting passed when I post info
Check your settings for track_vars and register_globals and ensure they are both enabled. Furthermore, check for the existance of $HTTP_GET_VARS["title"]. If it isn't there either and both of your ini settings are set correctly, then you can basically ignore this advice because you are having a different problem entirely. -- Plutarck Should be working on something... ...but forgot what it was. "Brandon Orther" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I made a GD script that made an image with the name of whatever page I was > in in my web site. I would post info to it like this: > http://www.domain.com/jpeg-out.php?title=FrontPage what ever I put for > title it would make the image. After reinstalling php4 on my win2000 box > with apache it doesn't seem to get the $title variable. Does anyone know > what might be going wrong? > > Thanks, > Brandon > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] is it safe to stripslashes() on all form variables?
As long as you don't need to ever store a forward slash :) Beyond that, nope. stripslash() away. -- Plutarck Should be working on something... ...but forgot what it was. ""Noah Spitzer-Williams"" <[EMAIL PROTECTED]> wrote in message 9bf7ec$m1m$[EMAIL PROTECTED]">news:9bf7ec$m1m$[EMAIL PROTECTED]... > would there be any problems caused if i used the stripslashes() function on > all posted variables from a form to eliminate sql query errors? > > - Noah > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] var question
Add an "=" on the end of your url. Viola. -- Plutarck Should be working on something... ...but forgot what it was. ""Jeroen Geusebroek"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Guys, > > I have a question about the way PHP handles var/strings. > > Let's say i have this URL: http://foo.bar.com/?login. > And in my script i have this code: > > if($login) { echo "blab"; } or > if(isset($login)) { echo "blab"; } > > It always returns FALSE. I think that is because the string > is empty. Shouldn't PHP, even if a var is empty, put it in > his var-list? > > Is there another way to do what i want? > > Thanks, > > Jeroen Geusebroek > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How do i include ASP script into PHP...??!
Doesn't work. ASP scripts require an ASP interpreter. If you stick it in a PHP file, PHP will try to interpret the ASP code. PHP can't do that. -- Plutarck Should be working on something... ...but forgot what it was. ""Joe Truong"" <[EMAIL PROTECTED]> wrote in message 9bfd8q$gum$[EMAIL PROTECTED]">news:9bfd8q$gum$[EMAIL PROTECTED]... > How can i include ASP scripts into PHP files or is it posible? > thanxz > -Joe > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] var question
Note: Yes, I meant string instrument. Any references to YoYo Ma will be dealt with swiftly and severly. -- Plutarck Should be working on something... ...but forgot what it was. ""Plutarck"" <[EMAIL PROTECTED]> wrote in message 9bfp5e$169$[EMAIL PROTECTED]">news:9bfp5e$169$[EMAIL PROTECTED]... > Add an "=" on the end of your url. Viola. > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > ""Jeroen Geusebroek"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi Guys, > > > > I have a question about the way PHP handles var/strings. > > > > Let's say i have this URL: http://foo.bar.com/?login. > > And in my script i have this code: > > > > if($login) { echo "blab"; } or > > if(isset($login)) { echo "blab"; } > > > > It always returns FALSE. I think that is because the string > > is empty. Shouldn't PHP, even if a var is empty, put it in > > his var-list? > > > > Is there another way to do what i want? > > > > Thanks, > > > > Jeroen Geusebroek > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] baffled :<:
In the loop, try using print_r($myarray) in the loop to see if the data is in there at all. Other than that, switch the while loop to: while ($myrow = mysql_fetch_assoc($result)) { That should fix it... -- Plutarck Should be working on something... ...but forgot what it was. ""Peter Houchin"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > can any one see a problem with this loop? > >$db = include"connect.inc"; > $foo = "SELECT * FROM 6pci WHERE card='$card' ORDER BY card"; > > $result = mysql_query($foo,$db); > > > while ( ($myrow = mysql_fetch_array($result) ) ) { > > $id = $myrow["id"]; > $card = $myrow["card"]; > $serial = $myrow["serial"]; > $avail = $myrow["avail"]; > $pn = $myrow["pn"]; > $cat = $myrow["cat"]; > $box = $myrow["box"]; > $quote = $myrow["quote"]; > } > ?> > > if i call say just $card it only displays the one record (the last one), the minute i try to call $myrow["card"]; i get nothing at all... any idea's? > > I have script identical to this that works perfectly .. only difference is this one has different names for the values > > Peter Houchin > [EMAIL PROTECTED] > = > _ __ /\ > /_/_/_\/ |_/ \ >/_/_/___ __ __ __ / \ >\_/_/_\ /_/ /_/ /_/ /_/ \ _ / > ___\_\_\/ /_/_/_/ /_//\/_/\_/ \/\_/ > \_//_/_/ /_/_/_/ /_/ \/_/v > > /_/_/_/_/ /_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ >/_/_ _/_/ __ __ __ /_/ __ __ > /_/_/_/_/ /_/_/_/ /_/ /_/ /_/ /_/\_\/_//_/_/_/ > /_/ \_\ /_/ _/ /_//\/_/ /_/ /_/__\_\ /_/___ _\_\_\ > /_/\_\/_/_/_/ /_/ \/_/ /_/ /_/\_\/_/_/_//_/_/_/ > = > Telephone : (03) 9329 1455 Facsimile : (03) 9329 6755 > * We rent the dot in .COM! ** > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Reauthenticate
When using sessions, which you might want to do, PHP automatically sends header's that tell the user's browser not to bookmark the page. The reason they can click the back button and see the page is because their browser is caching the page. If they press the Refresh key they won't be able to see the page, as long as you check for their cookie on that page anyway. So it's not fool proof (nothing is), but use header to send the Pragma: No-cache setting. Note: You can't _force_ the browser not to cache the page. You can only _request_ that it not be cached. -- Plutarck Should be working on something... ...but forgot what it was. ""Marcelo Pereira"" <[EMAIL PROTECTED]> wrote in message 006701c0c742$4b843b60$0b01a8c0@hmmg">news:006701c0c742$4b843b60$0b01a8c0@hmmg... > Hi All, > > I'm in trouble to authenticate each user (using a database). > When the user sucesfully login on your area the php script send a cookie, > and every php script reads this cookie. So when the user log ou the php > script expires the cookie and then the user cannot bookmark the page and > turn back.. but, if the user clicks the 'logout' button, I expire the > cookie e show the main screen, but, by other side, if the user click at > 'back button' then he can see the page... I would like to: > > - Each page look for the cookie, even if the back button is pressed. > - If the cookie isn't there, then a 'expires page' is showed > > Which is the better way to do it ??? > > Thanks in advance, > > Marcelo Pereira > Programmer > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Persistent connection & many scripts ?
Ideally you could use pconnect, then save the connection ID into a session. Then just try and use the connection like that. That _should_ work. But you may just want to use pconnect and not bother with the rest...that might be just as good as what you are trying to do. -- Plutarck Should be working on something... ...but forgot what it was. ""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all > I use PHP to query a PostgreSQL database. > Today I know how to query the database with a PHP script, but I have to > establish a connection to the database in each script. > > Is there a way to get the following : > connect.php : a script where the user enters its login and password, and > connect to the DB by the submit button (submit button which action url is > query.php). > query.php : a script that performs a query using the connection from > connect.php > > I know that I could send the login/password to the query.php to establish > the connection ; but it is not what I would like (sometimes - often - the > connection time is bigger than the query time itself !) > Thanks for your help ! > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php equivalent for `command`
The backtick operator " ` " is used like an exec() or passthru() function. But I know what you mean. For instance, try running this in a script: $n = 1; echo "The number is: $n++"; echo "The number is: $n++"; echo "The number is: $n++"; PHP will not increment a variable inside of a string. However, now try this: $n = 1; echo "The number is: " . $n++ . ""; echo "The number is: " . $n++ . ""; echo "The number is: " . $n++ . ""; But now try this: $n = 1; echo "The number is: " . ++$n . ""; echo "The number is: " . ++$n . ""; echo "The number is: " . ++$n . ""; To do what you are wanting to do, just use the post-increment or pre-increment operators, just like in Perl. Just be aware that PHP will not do any mathematical functions on variables which are inside of a string. -- Plutarck Should be working on something... ...but forgot what it was. ""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there a php equivalent for the use of ` (I think) in Unix/Perl? So for example echo "`$x++`" would first evaluate $x++ and then print the resulting value. > > Euan Greig > Technical Consultant > BRANN DATA > [EMAIL PROTECTED] > 01285 645997 > > > > > > ** > Any opinions expressed in this email are those of the individual and > not necessarily the Company. This email and any files transmitted with > it, including replies and forwarded copies (which may contain alterations) > subsequently transmitted from the Company, are confidential and solely for > the use of the intended recipient. If you are not the intended recipient > or the person responsible for delivering to the intended recipient, be > advised that you have received this email in error and that any use is > strictly prohibited. > > ** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Is this kind of code safe?
Don't use that on such small outputs, simply for the reason that it's really hard to read and follow. It also screws up Syntax highlighting. However, it works just like you would hope it would. When you call an ending tag, PHP just outputs whatever is there without parsing it. But it doesn't forget what it was doing, and will pick up right where it left off once you call an opening tag. But it can be pretty useful so you don't have to use here-doc printing, or escape a bunch of things inside of a string. -- Plutarck Should be working on something... ...but forgot what it was. ""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thanks for that Jason (and so quick!). I agree it's ugly, but I can see it being useful occasionally. > > Euan > > -Original Message- > From: Jason Murray [mailto:[EMAIL PROTECTED]] > Sent: 17 April 2001 12:38 > To: 'Greig, Euan'; [EMAIL PROTECTED] > Subject: RE: [PHP] Is this kind of code safe? > > > > > $test="b"; > > if ($test=="a"): > > ?> > >value is a > > > else: > > ?> > >value is not a > > > endif; > > ?> > > > > It seems to work, ie it outputs different text depending on > > the value of $test. But is it safe, can I rely on this > > behaviour? > > Yes can rely on it, but I just think it's somewhat ugly. If I'm combing > through a file looking for outputs, stepping through multiple ?> and tags is very annoying. > > Jason > > > ** > Any opinions expressed in this email are those of the individual and > not necessarily the Company. This email and any files transmitted with > it, including replies and forwarded copies (which may contain alterations) > subsequently transmitted from the Company, are confidential and solely for > the use of the intended recipient. If you are not the intended recipient > or the person responsible for delivering to the intended recipient, be > advised that you have received this email in error and that any use is > strictly prohibited. > > ** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Dynamic built web pages administration
If you are storing the content in a database, your job is a ton easier. Just add an edit link on the page you want people to be able to edit. It will link over to an edit page with the value of the current page sent in the URL via get. Get the content from the database pointed to by the url, and stick it in a variable. On the edit page have a text area. Set the "value" to the content the person can edit. When someone clicks submit, just take the content they submit and stuff it into the database using UPDATE. Of course you will need to do safety features like stripslashes() or the special character functions before storing the data, just to be safe. You will also want to have the option only available for registered users, and you probably want to limit it to users you know won't be malicious. There are many little tricks like using a little piece of javascript to execute a file on the hard drive that shouldn't be executed, malicious ActiveX controls, java applets, etc, that you don't want users writing to the page. But for administration used by only trusted people, it's actually pretty simple to put together. For use by people who aren't trusted... -- Plutarck Should be working on something... ...but forgot what it was. ""Romulo Roberto Pereira"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I was wondering if anybody have developed something related to dynamic web > pages building and administration. I need to store the content of the site > in the database and later as the user navigate, mount the content using > templates. This part is easy, since PHP is very powerfull in this area. My > problem would be to let the user modify the actual page content... how? any > ideas? > > TIA, > > Rom > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Returning part of a string, ereg..
This: ereg("([0-9]{1})-([0-9])-", $f, $regs); What that means is "Capture a single occurance of 0-9, then a hyphen, then capture a single occurance of 0-9 if it is imediately folowing by a hyphen." Try this instead: ([0-9]{1})-([0-9]+)- The "+" means "one or more". So "[0-9]+" is the same as "[0-9]{1,}". For instance, "{x,y}" matches at least x amount of characters, but no more than y amount of characters. Leave y off to match "x or more of the mentioned characters". But don't forget that comma. Regex is incredibly hard until you learn it. Then it doesn't seem hard anymore :) -- Plutarck Should be working on something... ...but forgot what it was. ""Chad Day"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm horrible at regex's, maybe someone can help me out. > > What I'm trying to do is parse a string in the format: number-number-number > (ex. 1-23123-312039128) > > I need to pull that second number, regardless of length > > This code returns nothing: > > $part = ereg("([0-9]{1})-([0-9])-", $f, $regs); > > but > > $part = ereg("([0-9]{1})-([0-9]{1,10})-", $f, $regs); > > will return the number, but I don't want to take a chance and limit it to 10 > characters. I thought the first bit of code would work.. any ideas what is > wrong? > > Thanks, > Chad > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] cgi vs. module
The only reason I am aware of to use PHP as a CGI is on Windows. Both apache and the php module for windows apache is considered "beta quality", so most people don't want to install beta software on their production machine. But just on my local system I've never had a problem with PHP as CGI. I honestly thought I had PHP as a module until I re-read my phpinfo, lol. And I assumed that NuSphere would install it as a module...;) -- Plutarck Should be working on something... ...but forgot what it was. "Franklin Hays" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > RE: PHP as a CGI or Module > > This has been discussed some but I am interested to see if one is more > popular then the other. My experience has been most people run PHP as a > apache module but is there a specific benefit to run it as a cgi > program? What about very large servers such as web hosts? I am currently > wrestling with some issues (apaches global variables) that aren't working > with php -cgi and wonder if this is a common occurance with php-cgi or > just a misconfiguration on the hosts end. Does one version serve the > pages faster or provide less overhead on the server? > > I have read a few FAQ's on this but interested to see what is happening in > the real world. Is one form more popular then the other? > > //frank > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Populating HTML List boxes From DB
I had that same problem. Use the "distinct" keyword in your SQL query. -- Plutarck Should be working on something... ...but forgot what it was. ""Peter Houchin"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > One thing I've come across and forgot to mention is > > say in my db i have multiple values that are the same as well as different values... how can i restrict it to showing each value just once? > > -Original Message- > From: Alexander Skwar [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 17, 2001 10:17 AM > To: Peter Houchin > Cc: Php-General@Lists. Php. Net > Subject: Re: [PHP] Populating HTML List boxes From DB > > > So sprach Peter Houchin am Tue, Apr 17, 2001 at 10:08:36AM +1000: > > 1: is there a way to populate a list box from a db? > > Sure. > > > > > 2: if some one could point me in the right direction, with out actually giving a example, as to how to go about it as i've > >got no idea > > Uhm, no example? I'll try. ... failed *G* > >$query = "SELECT ListboxText, ListboxValue FROM Table"; > $rs = mysql_select( $query ); > while( $row = mysql_fetch_object( $rs ) ){ > echo ''; > echo htmlentities( $row->ListboxText ); > } > ?> > > Alexander Skwar > -- > How to quote: http://learn.to/quote (german) http://quote.6x.to (english) > Homepage: http://www.digitalprojects.com | http://www.iso-top.de >iso-top.de - Die günstige Art an Linux Distributionen zu kommen > Uptime: 2 hours 3 minutes > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Job in Whistler, BC
It should be noted that programming facilities are entirely outdoor. But they do provide those little hand-held vacuums to suck the snow out from between your keyboard keys. Nah, I'm just kidding. But it is in Canada, so you will be forced to type "a\'boot" hundreds of times a day ;) (a little poke at our canadian friends. Which I am perfectly willing to do, because I'm waaay down here on the gulf of mexico, and they'd have to come through Georgia, Alabama, or Mississippi to come down and disagree with me. God isn't willing to go through Georgia, Alabama, or Mississippi, so I think I'm safe ;) -- Plutarck Should be working on something... ...but forgot what it was. "Mark Maggelet" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... On Mon, 16 Apr 2001 20:00:27 -0700, Dddogbruce \(@home.com\) ([EMAIL PROTECTED]) wrote: >Whistler's cool! Yeah, and a php job at a ski resort?! Hmm, that's way too good to be true. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] RFC: Storing User Info
As others suggested, use md5 or one of the mhash functions. You can't retrieve the password, but you shouldn't need to anyway. When someone looses their password, get rid of their old one and mail them their randomly created new one. Then just allow them to change it to whatever they want. Make sure to tell them to use a valid email address or require a confirmation, otherwise when people loose their password they can never get it back. People tend to email you when they loose their password, so be sure to make it clear that "once it's gone, it's really gone, and you just have to pick a new one". I try to avoid emailing a user with their password with exception to when they loose it. Then again, there isn't really much of an alternative... -- Plutarck Should be working on something... ...but forgot what it was. ""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I'm looking for comments on this one. I'm developing a site that > will have user logins on it. What's the best way to do this? What to > store, and how? > > - Are people more inclined to use a username when they need to log > in to something, or would asking for an email (as the userID) be > better? > > - How about storing passwords? All of this info will be stored in > an MySQL DB. How do admins generally do this type of stuff? > Encrypt the password stored in the DB, and decrypt it on the fly > to compare? Store it in plain text? Or store it encrypted, > and when the user logs in, encrypt that passwd (from the form) > and compare the strings? (not sure if the latter would work) > > - What about sending people passwords through email? Like when > someone signs up the first time, they supply a passwd. How do > people feel about sending that login information to the user in > plain text via email? Or do you? > > - What about when the user forgets their login? Just fetch the > info from DB and mail it out to the (registered) email address? > Or, generate a new, generic one, mail that one out, and tell the > user to login and change it again? > > Suggestions please. > > AMK4 > > -- > W | > | I haven't lost my mind; it's backed up on tape somewhere. > | > ~ > Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130 > SysAdmin / Websmith . 800.441.3873 x130 > Photo Craft Laboratories, Inc. .eFax 248.671.0909 > http://www.pcraft.com . 3550 Arapahoe Ave #6 > .. . . . . Boulder, CO 80303, USA > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Dynamic Pages and Google ???
Getting listed in search engines really is important. But in the vein of what you were talking about, people shouldn't really "worry" about it. Note: Getting listed in directories like Yahoo is way more important than having any search engine list you. You always receive a far more targeted user with places like Yahoo, because they really do want to see what you have to say. Back on topic, the only search engines worth bothering with can handle dynamic pages just fine. There is _no_ difference in a static html page and a dynmically created one. However, be _very_ careful with sessions. Sessions can force a query string onto the end of every page on your first page, causing the spider to be unable to visit any other page in your site! Also be extremely careful about the use of and browser sniffing. So many sites do something classically stupid so that when someone sees their site in a search engine, the description is "Your browser does not support frames. Your browser must support frames to view this site."...I just want to slap the webmaster every time I see that. In short, on your index page (which is what you want bookmarked the most) do not have links with query strings in them, do not use redirects, do not use frames (period. if you want to use them everywhere else on the site that's ok, but don't do it on the main page!), do not use session_start(), and do not complain if the user has disabled javascript- if you want your site to be well listed in search engines. With all that taken into effect, I can see why the person you were talking to disliked dynamic sites. But if the webmaster knows the rules of the search engines, dynamic sites work just perfectly. -- Plutarck Should be working on something... ...but forgot what it was. "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Jon Shoberg wrote: > > > So I was having a conversation with a manager/educator in the IT Industry :) > > > > In a discussion concerning search engines he stated how he dislikes dynamic > > web pages (PHP/ASP/JSP/CFM) because search engine spiders 'choke' on dynamic > > content or gives those pages a lower ranking. I can't see this as being > > true. I epically can't see the search spider "choking" on dynamic pages > > returning well-formed/valid HTML. > > > > Any thoughts? > > Each spider is different, and they've changed over time. Often they don't > index a page that has a ? in it - they definitely won't be able to follow > form input tags and such - the possibilities for input are limitless. > > Some can follow > blah.com/index.php?alh=fff > > and links of that nature. If you've got redirects in there,tho, they'll often > choke on those. > > Apache has an advantage over IIS because you can normally > pass in parameters in the $PATH_INFO area - > http://www.blah.com/index.php/blag/222/dsfsd/dlkjsdf > calls the index.php with /blag/222/dsfsd/dlkjsdf as parameters you can grab in > your > script. IIS doesn't allow for this. :( (not natively anyway) > > Some search engines wouldn't FOLLOW a ? in a link, > but will accept one as a 'submitted page' to index if you submit it manually. > > Again, all of this information is necessarily vague. What works one year > doesn't work the next. > > This was all info and experienced gleaned while building keywordcount.com a few > years > ago - the whole landscape has changed, and getting 'indexed' by search engines > is nice, > but imo can be a big waste of time and money given that there are many factors > beyond your control entirely. SEOs will bash me upside the head for that one, > but it's been my experiences over the past couple years. :) > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTML and slashes.
Check magic_quotes_runtime in your ini. If it's on, turn it off. Use the htmlspecialchars() family of functions. They will "hide" HTML in that the browser will not attempt to parse. so "" will be displayed as "", and not make all the text turn to bold. -- Plutarck Should be working on something... ...but forgot what it was. ""Dddogbruce (@home.com)"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > there is NO way of hiding the html from the user. > > the browser can't output otherwise. You can only > > try to make it difficult to get the source. > > I want to hide the HTML from the browser. If someone adds some malicious > code, or even I don't want it to underline. > > > Where does the " 's " problem come in? More detail plz. > > Is it a part of a text? Then try htmlspecialchars() or > > htmlentities(). > > Say I right "Hiya, my name's Owen" on the submission part of the form. It'll > show up as "Hiya, my name\'s Owen" on the output (which is a .txt file.) > > HTH, > Owen > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] RE: A slightly amusing, though mostly dangerous, endless loop
It's automatically enabled, and I don't think it's available for disabling. I recall hearing something about a feature being added to PHP to help prevent infinate loops, and it apparently works with print_r. It should probably be listed more prominately and in any place where $GLOBALS is mentioned. The first time I saw it I was thinking, "Geeze, this page sure is taking a long time to load...and why are so many variables available on this site..." -- Plutarck Should be working on something... ...but forgot what it was. ""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is the anti-recursion feature you mention automatically activated or do you need to configure it to take effect? > > This error with print_r is documented in the manual, but would still be (have been) an easy trap to fall into! > > -Original Message- > From: Plutarck [mailto:[EMAIL PROTECTED]] > Sent: 14 April 2001 12:59 > To: [EMAIL PROTECTED] > Subject: A slightly amusing, though mostly dangerous, endless loop > > > This is a bug which was apparently fixed in v 4.0.4pl1 at least, but it > still present in 4.0.3 > > I just found it kind of amusing and it makes a nice warning. > > Consider this: > > print_r($GLOBALS); > > > That's it. It prints all the variables available, however part of it is an > array called GLOBALS. Which then prints all available variables, including > an array called GLOBALS... > > And it will continue until you hit the Stop button or until the script times > out. But if you have ignore.user.abort on, it will continue till it times > out. If you've screwed with your scripts timeout settings... > > ...so be wary of that, and ensure you don't try and print out the variables > available in GLOBALS in older versions of PHP. It was fixed with the > anti-recursion feature, which automatically breaks endless loops. > > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > > > > > ** > Any opinions expressed in this email are those of the individual and > not necessarily the Company. This email and any files transmitted with > it, including replies and forwarded copies (which may contain alterations) > subsequently transmitted from the Company, are confidential and solely for > the use of the intended recipient. If you are not the intended recipient > or the person responsible for delivering to the intended recipient, be > advised that you have received this email in error and that any use is > strictly prohibited. > > ** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Javascript mailing list
I know of only the one on marc.aimsgroup.com. They list quite a few mailing lists of all types. But I still don't know any newsgroups :( -- Plutarck Should be working on something... ...but forgot what it was. ""Boget, Chris"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > A bit OT, yes, but I don't want to ask an > inappropriate question here (not that this > isn't an inappropriate question :p). > Can someone recommend a good Javascript > mailing list? > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] OT - cyber squatting?
I assume you mean registering a web address of a company, just to keep them from registering it or to try and make them pay you for it? Check NetworkSolutions "domain name dispute" policies. InterNIC has a pretty good policy, actually. If someone registers a name with is copyrighted, trademarked, or is clearly only valuable because it is familiar to a registered trademark of copyright, they are in violation and the domain name can be taken away from them and awared to the rightful owner via arbitration. To avoid having a domain name taken away they must prove either that they have made a good-faith effort to build a destinctive trademark of brand which does not impede upon a pre-existing copyright, and that the name was not registered for the sole purpose of keeping someone from rightfully registering it. Is that what you meant? -- Plutarck Should be working on something... ...but forgot what it was. "Kurth Bemis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > this is totally OT - however I don't where else to ask. > > i need information on cyber squatting. as in what laws there are against > it, etc.i believe that there was a law passed making cyber squatting > illegal...but i can't find it at the library of congressany help? > > ~kurth > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] get_class()
"This function returns the name of the class of which the object obj is an instance." The name of the class is "myClass", therefore the behavior is as it should be. "thisInstance" is an object, not a class. If you are trying to do something imparticular you'll have to be more specific. As for getting the name "thisInstance", I'm not really sure why you'd need to, so I can't think of a work-around. Since "thisInstance" is the name of the object, you need some object related function. I've never had to do it, so I have no clue how, but maybe someone else will know :) -- Plutarck Should be working on something... ...but forgot what it was. ""Boget, Chris"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Given the following code: > > - > > class myClass { > function myClass() { > $classVar = get_class( $this ); > > } > } > > $thisInstance = new myClass(); > > - > > What value should $classVar contain? > > "myClass" > > or > > "thisInstance" > > ? > The documentation leads me to believe that it is the > latter value, but in practice it contains the former. > If it is supposed to have the latter value, is there any > way I can get the fomer? Any way that I can get the > name "thisInstance"? > > Chris > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Is there such an array like $array[][]?
PHP can be a tad screwy with how it handles multi-dimensional arrays, but yes PHP handles them. No real speed problems with them either. But you may just want to use an associative array like: $loc = array("y" => $y, "x" => $x); Then just use $loc["y"] and $loc["x"]. Just another option, but feel free to use multi-dimensional arrays. Just be aware that PHP supports only two dimensions (so $array[][][] will not work), and if you try and get fancy with sort() and count() you are going to give yourself a migraine. -- Plutarck Should be working on something... ...but forgot what it was. "Jack Dempsey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > yes, that's a multi-dimensional array, which is fine in php (and > everything else i can think of =P)... > > -jack > > Scott Fletcher wrote: > > > > Hi! I am wondering if there is such a php array that can take care of the x > > and y axis data. I figure that using this array type, $axis[$x][$y] would > > do the trick. Would it work? If not, then education me on what would work! > > Thanks! > > > > Scott > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Site Sessions: Online/Offline - help?
Simplest way to do it IMHO. When a user logs in (starts their session) register their username into the session (that session is "bound" to them now). On every page when a user does anything, update your database with the current time as a "last_activity" entry for that user. When showing who is currently logged in, get all the entries out and check their dates. If the last activity is older than a certain amount of acceptable time (how long it takes them to be considered "logged out". note: people rarely use a logout button), then consider that user as not being logged in. Delete the entry so your "who's online" function doesn't hugely slow down the page, and you should be good to go. The only problem is that you have to do an update every time someone visits a page, which increases your server load. But to avoid any noticable slow down you could just use a register_shutdown_function. I think that should handle your problem... -- Plutarck Should be working on something... ...but forgot what it was. ""Richard"" <[EMAIL PROTECTED]> wrote in message 9bfv6n$pds$[EMAIL PROTECTED]">news:9bfv6n$pds$[EMAIL PROTECTED]... > Greetings. > > Some of you are familiar with my latest project, a smaller community. I > have implemented almost everything I need, and I wish to thank those of you > who helped me with "which mail is new" and so forth. However, this problem > is quite worse I suppose, but I hope some of you has done something like > this before: > > Sessions. > > I wish to keep track of every visitor. Not a counter or anything, but more > of when a person signs in, the users nickname will be bound to this session > ID which will keep track of the person is online or offline. I have solved > it like so: > > Whenever a person loggs in, I add it's name to a online.dat file. When > the user signs of, I remove the nickname thus the login time from the file. > > PROBLEMS?? First one: User must click on "logout" to remove itself. Second: > It does not always remove itself. > > Therefore, I ask: How can I create a new session for every visitor (so I > know how many are online at the time), bind this ID to its nickname (so one > row in a file would be: NICKNAME|SESSION_ID|DATE), and how can I make sure > that whenever the browser is closed or whatever, or after a certain time of > inactivity (3 minutes), the user is removed from the file. > > All help is greatly appriciated and your name will be on the credits list > too. > > - Richard > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Finding Duplicate Numbers?
Hm...it's not fast, but it should work. Do a select statement to take out just the phone numbers, then do something like: while ($row = mysql_fetch_row($result)) { $array[] = $row[0]; } $amount = array_count_values($array); $imax = sizeof($amount); for ($i = 0; $i < $imax; $i++) { if ($amount[$i] > 1) { $copys[] = $amount[$i]; } } It ain't pretty, but $copys will be an array filled with the phone numbers that were entered more than once, so you can do whatever you want with it other than that. -- Plutarck Should be working on something... ...but forgot what it was. ""Devin Atencio"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I have a SQL Table that has over 1,000 records and I was wanting > to write a script that would find duplicate phone numbers and > then list the duplicate phone numbers. I have been trying to > think on how to do this but I can't think of a way. Can someone > please help me on some code I could write to do this? > > Thanks in advance. > >/'^'\ > ( o o ) > --oOOO--(_)--OOOo > Devin Atencio > ArosNet Systems Administration .oooO > EMail: [EMAIL PROTECTED] ( ) Oooo. > \ (( )- > \_)) / >(_/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Site Sessions: Online/Offline - help?
The best way I know of is to use mt_rand. Check the manual for examples, but this is usually a good way to seed it: mt_srand ((double) microtime() * 100); If you look at the size of a normal session ID, it's pretty easy to make a unique sessid. There are 32 chars in a typical sessid. The chances of someone getting the same ID as someone else, all things being equal and even though it's case-insensitive, is approximately 1 in 6.3340286662973277706162286946812e+49...actually, my windows calculator doesn't go that high. It's 32 to the 36th power, anyway. That's insanely huge. But in reality, you don't really need to worry about getting two 32 character long IDs that are the same. Note: one way to auto-logout someone is to use something like a on_unload javascript procedure, but don't bother. Not worth the hassle and it's isn't fool-proof. -- Plutarck Should be working on something... ...but forgot what it was. ""Richard"" <[EMAIL PROTECTED]> wrote in message 9bi64f$goj$[EMAIL PROTECTED]">news:9bi64f$goj$[EMAIL PROTECTED]... > Greetings. > > Thanks for your help! That about people not using logout buttons is really > true! But what can one expect? However, how can I create a unique session > ID? I don't use Databases, at least not MYSQL. > > - Richard > > ""Plutarck"" <[EMAIL PROTECTED]> wrote in message > 9bhsa8$vq8$[EMAIL PROTECTED]">news:9bhsa8$vq8$[EMAIL PROTECTED]... > > Simplest way to do it IMHO. > > > > When a user logs in (starts their session) register their username into > the > > session (that session is "bound" to them now). > > > > On every page when a user does anything, update your database with the > > current time as a "last_activity" entry for that user. > > > > When showing who is currently logged in, get all the entries out and check > > their dates. If the last activity is older than a certain amount of > > acceptable time (how long it takes them to be considered "logged out". > note: > > people rarely use a logout button), then consider that user as not being > > logged in. > > > > Delete the entry so your "who's online" function doesn't hugely slow down > > the page, and you should be good to go. > > > > > > The only problem is that you have to do an update every time someone > visits > > a page, which increases your server load. But to avoid any noticable slow > > down you could just use a register_shutdown_function. > > > > I think that should handle your problem... > > > > > > -- > > Plutarck > > Should be working on something... > > ...but forgot what it was. > > > > > > ""Richard"" <[EMAIL PROTECTED]> wrote in message > > 9bfv6n$pds$[EMAIL PROTECTED]">news:9bfv6n$pds$[EMAIL PROTECTED]... > > > Greetings. > > > > > > Some of you are familiar with my latest project, a smaller > community. > > I > > > have implemented almost everything I need, and I wish to thank those of > > you > > > who helped me with "which mail is new" and so forth. However, this > problem > > > is quite worse I suppose, but I hope some of you has done something like > > > this before: > > > > > > Sessions. > > > > > > I wish to keep track of every visitor. Not a counter or anything, but > more > > > of when a person signs in, the users nickname will be bound to this > > session > > > ID which will keep track of the person is online or offline. I have > solved > > > it like so: > > > > > > Whenever a person loggs in, I add it's name to a online.dat file. > When > > > the user signs of, I remove the nickname thus the login time from the > > file. > > > > > > PROBLEMS?? First one: User must click on "logout" to remove itself. > > Second: > > > It does not always remove itself. > > > > > > Therefore, I ask: How can I create a new session for every visitor (so I > > > know how many are online at the time), bind this ID to its nickname (so > > one > > > row in a file would be: NICKNAME|SESSION_ID|DATE), and how can I make > sure > > > that whenever the browser is closed or whatever, or after a certain time > > of > > > inactivity (3 minutes), the user is removed from the file. > > > > > > All help is greatly appriciated and your name will be on the credits > list > > > too. > > > > > > - Richard &
Re: [PHP] Is there such an array like $array[][]?
Woh, I had no idea PHP supported more than 2 dimensions...lol, was that a recent addition? I could _sware_ I originally read it on either zend.com or in the manual that 2 dimensional arrays are all that are supported...then again, this is why I don't gamble :) Live and learn, lol. Guess I should of actually _tried_ it and not have just taken their word for it. -- Plutarck Should be working on something... ...but forgot what it was. "CC Zona" <[EMAIL PROTECTED]> wrote in message 9bi3ac$9n9$[EMAIL PROTECTED]">news:9bi3ac$9n9$[EMAIL PROTECTED]... > In article <9bhrri$sn9$[EMAIL PROTECTED]>, > [EMAIL PROTECTED] ("Plutarck") wrote: > > > Just another option, but feel free to use multi-dimensional arrays. Just be > > aware that PHP supports only two dimensions (so $array[][][] will not work), > > and if you try and get fancy with sort() and count() you are going to give > > yourself a migraine. > > Odd. 3+ dimensions works fine for me. I pass two dimensional arrays in > forms all the time, then reference them from $HTTP_*_VARS which adds > another dimension. No problem there. It's true sort() and count() are > sorting or counting the elements of the first dimension, but PHP does > provide other functions which allow for effective handling of more > dimensions (ex. array_multisort()). > > -- > CC > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable variable
Your problem has little to do with the things mentioned. First of all, you are refering to a variable variable incorrectly. You must use brackets, like this: ${$id} If ID has the value "Blue", then the above is the same as: $Blue So in your examble if you had the checkbox with the value "on", and you want to see if it was checked, use this: if (${$id} == "on") { echo 'on'; } else { echo 'off'; } But that's an overly complicated way of doing it if you know the "name" of the checkbox. If the name of the checkbox is "id", then use this piece of code to access it if it was submitted via POST or GET (which works even if register_globals is turned off): $f = 'HTTP_' . $HTTP_ENV_VARS["REQUEST_METHOD"] . '_VARS'; if (${$f}["id"] == "on") { echo 'The checkbox with the name "id" has the value "on"'; } else { echo "The checkbox with the name "id" was not selected"; } But if register globals was on, all you have to use is: if ($id == "on") { echo 'The checkbox with the name "id" has the value "on"'; } else { echo "The checkbox with the name "id" was not selected"; } Tell me if that doesn't answer your questions. -- Plutarck Should be working on something... ...but forgot what it was. ""Jacky"" <[EMAIL PROTECTED]> wrote in message 011001c0c839$ebfb9b40$[EMAIL PROTECTED]">news:011001c0c839$ebfb9b40$[EMAIL PROTECTED]... Hi all I have a form with check box and name of those checkboxes is usuing variable lke this, and when I submit the form to page foo.php4, at that page, I use Variable variable to call the value of the check box to see if it checked like this $quey = "select id from table"; $result = .. ( assumeing it is done and i got value for $id for all records from table) if ($$id =="on"){ echo "on"; }else{ echo "off"; } It always returns echo "off", why is that? cheers Jack [EMAIL PROTECTED] "There is nothing more rewarding than reaching the goal you set for yourself" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What is cookies
RTFM (ReadTheFineManual ;) http://us.php.net/manual/en/function.setcookie.php As listed in the manual for an explanation on cookies: http://www.netscape.com/newsref/std/cookie_spec.html -- Plutarck Should be working on something... ...but forgot what it was. "Bertrand TACHAGO" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Can anyone tell me what is cookiesand how i can use it > > Thank > > TACHAGO > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] sessions
Rather than bothering with SID whos existance is uncertain, use the variable $PHPSESSID. It's set whenever you use session_start, to my knowledge. The simplest method, and the only one I am aware of, of accessing session variables globally is by explicitly declaring them global in your function. It's also the best way to do it, as it may take extra typing when declaring your function, but it makes it alot more readable and bug-free. -- Plutarck Should be working on something... ...but forgot what it was. ""Ben"" <[EMAIL PROTECTED]> wrote in message 9bjn4n$41c$[EMAIL PROTECTED]">news:9bjn4n$41c$[EMAIL PROTECTED]... > i'm trying to use sessions with my project, but it seems that registered > variables in a session aren't global by default. > It doesn't even seem like the session is global, because if I reference the > sessionid (which only shows up if cookies are disabled) > by using , it shows up within a function, if I reference it from > within the function. > > if anyone can help me make my variables (such as $user, and $active) > globally registered with the session, I would be very grateful. > maybe its the cookie not being global, that would explain why the sessionid > shows up only from within a function (but not in the global scope) > > thanks > ben > [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Importing Data from Text File
Use file() to read the file up into an array (we'll call it $array). Then I would personally use: foreach ($array as $val) { trim($val); $arr = explode("\t", $val); // "\t" means tab, but it will not work if it's only spaces instead of a real tab $stock_name = $arr[0]; $stock_desc = $arr[1]; $stock_length = $arr[2]; $stock_qty = $arr[3]; $stock_price = $arr[4]; // Do your insert/update SQL query right here, before the ending bracket. } There you go. Now inside that loop you have 5 variables with the values they should have, ready for you to do whatever you'd like with them. If your wondering, trim() is used to remove the newline characters and extraneous spaces from the begining and end of the string. As long as they are using an actual "tab" button between each piece of data, and only ONE tab, it works. Tell me if this works for you. If it doesn't I can rethink it :) -- Plutarck Should be working on something... ...but forgot what it was. "Chris Aitken" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Everyone, > > Ive been asked to do a task here at my work and its something ive never > done before. I was hoping you guys could point me in the right direction so > I can research some more and discover how in the hell im gonna do this :) > > Basically, I have been issued a TAB delimited text file which I need to > process and insert all the data into a table. Here is a basic example of > what I need to do.. > > Say the text file had the following lines (thousands of them, 1 record per > line) > > Screw Big 12 200 1.99 > Screw Big 10 400 1.50 > > And I wanted to import each line into a table (Mysql DB) that had 6 fields > (5 for each of the above plus an autoincremented ID field > > stock_id > stock_name > stock_desc > stock_length > stock_qty > stock_price > > > Any suggestions and direction pointing will be greatly appreciated. > > > > > -- >Chris Aitken - Webmaster/Database Designer - IDEAL Internet > email: [EMAIL PROTECTED] phone: +61 2 4628 fax: +61 2 4628 8890 > > >Unix -- because a computer's a terrible thing to waste! > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mysql error code - how to debug
Ensure your database name as listed in either mysql_select_db or mysql_db_query is valid. After that, it's probably a GRANT problem. Make sure the username/password pair is correct, first of all, and check the privileges of that user. My guess is that either the DB name is incorrect, or the user does not have access to that database. -- Plutarck Should be working on something... ...but forgot what it was. <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Greetings, > > This is a mysql question, (but I'm using php with it). > > Most everything is working correctly; however, when > I hit one button I get: > Database error: cannot use database xx > MySQL Error: 0 () > Session halted. > > What should I be looking for? Is this a user/password > problem? Is this a GRANT problem? > > Any help here would be appreciated. > > Thanks! > > > > > Max Pyziur BRAMA - Gateway Ukraine > [EMAIL PROTECTED] http://www.brama.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTTP_POST_VARS variable names?
Quick answer: HTTP_POST_VARS is an associative array. The "name" of the submitted variables are the keys, and the value of the element is the value that was submitted. -- Plutarck Should be working on something... ...but forgot what it was. ""Mat Marlow"" <[EMAIL PROTECTED]> wrote in message 9bk11q$dvq$[EMAIL PROTECTED]">news:9bk11q$dvq$[EMAIL PROTECTED]... > Hi, > Does anyone know if php stores POST variable names as well as values? I'm > using HTTP_POST_VARS for the values but I'm having to create my own array > for the names. > > cheers, > > Mat > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] global sessions
If you want to access a global variable in a function, it must be declared "GLOBAL". Otherwise PHP's local scope would be totally useless. If you want to access a variable inside of a function, you must explicitly declare it as global. There are a few exceptions such as $GLOBALS, but they should not be relied on. If nothing else, not using global in a function that requires a variable that is declared outside of that function is bad practice. Note: Try using get_defined_variables() inside of a function and see what it returns. -- Plutarck Should be working on something... ...but forgot what it was. ""Ben"" <[EMAIL PROTECTED]> wrote in message 9bjvo1$irv$[EMAIL PROTECTED]">news:9bjvo1$irv$[EMAIL PROTECTED]... > i'm trying to use sessions with my project, but it seems that registered > variables in a session aren't global by default. > It doesn't even seem like the session is global, because if I reference the > sessionid (which only shows up if cookies are disabled) > by using , it shows up within a function, if I reference it from > within the function. > > if anyone can help me make my variables (such as $user, and $active) > globally registered with the session, I would be very grateful. > maybe its the cookie not being global, that would explain why the sessionid > shows up only from within a function (but not in the global scope) > > so...i guess my question is how can i globalize a session? > > thanks > ben > [EMAIL PROTECTED] > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Connection with a Palm
"exporting data to a palm" is far too vague. PHP can produce data in a format suitable for saving on a Palm, or you can have it interpret data from a Palm. To physically save data from a webpage to a palm requires client-side scripting. -- Plutarck Should be working on something... ...but forgot what it was. ""Renzi, Sebastian"" <[EMAIL PROTECTED]> wrote in message A1581797259FD211B25E00805FCBC1FA1E4C1C@SRV_DES_01">news:A1581797259FD211B25E00805FCBC1FA1E4C1C@SRV_DES_01... I ' m trying to develop a page that exports data to a Palm ,my question is ,can i do this with PHP or with JavaScript ? .If it's possible please let me know ,thnks Sebastián Renzi Consultoría & Desarrollo de Sistemas. CODES S.A -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Connection to postgresql DB used by 2 scripts ?
I think you're misunderstanding what include actually does. Let's say we have a file called db.php, with the contents: Now, if the contents of your other script are: It is the same as having the contents: When you execute a query with pg_exec you are using the current connection, not establishing a new one. There is no reason to use the global keyword to access the value of $conn, unless you are trying to access $conn inside of the function. I believe you are looking for the persistant connection function, in that you don't have to open a new connection for every time the script is run. However, you must still make a call to pg_pconnect before you attempt to query your database. Anyway, using include while not open a new connection for each query. But it will open a new connection for each time the page is visited. -- Plutarck Should be working on something... ...but forgot what it was. ""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... include will help me to organize my scripts, but it will effectively establish the connection each time I perform the query. I would like to establish the connection one time, and then to be able to perform many queries using this connection. I've been told that i could declare $conn as global in both script : -- connect.php: global $conn; $conn = pg_connect ... -- query.php: global $conn; $res = pg_exec( $conn, ... What do you think about this way ? > -Message d'origine- > De: Johannes Janson [SMTP:[EMAIL PROTECTED]] > Date: mercredi 18 avril 2001 12:42 > À: [EMAIL PROTECTED] > Objet: Re: [PHP] Connection to postgresql DB used by 2 scripts ? > > Hi, > > put: include("connect.php"); at the beginning of query.php. > > Johannes > > ""Picard, Cyril"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I would like to query a postgresql db with the php language. > > Today I wrote a script (connectandquery.php) performing the following : > > - connect to the DB : $conn = pg_Connect("dbname = foo"); > > - execute the query : $res = pg_Exec($conn,"SELECT * from BAR"); > > > > > > But I would like to write this in two scripts : > > - connect.php : $conn = pg_Connect("dbname = foo"); > > - query.php : $res = pg_Exec($conn,"SELECT * from BAR"); > > > > but I don't know how to get the $conn variable (defined in connect.php) > in > > the script query.php. > > > > Any idea is welcome ! > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Persistent connection & many scripts ?
Nope, you don't need to save the ID. PHP/database does the work of remembering what the ID of your persistant connection is. -- Plutarck Should be working on something... ...but forgot what it was. ""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hummm... I don't know how to use pg_pconnect()... It returns a connection ID, isn't it ? And I have to use this connection ID later ? I would like to reuse this connection ID to another script... and the problem is here :( I feel that I ignore something so important that I'm stopped and so trivial that you do not think about it ! > -Message d'origine- > De: Christian Reiniger [SMTP:[EMAIL PROTECTED]] > Date: mercredi 18 avril 2001 13:40 > À: [EMAIL PROTECTED] > Objet: Re: [PHP] Persistent connection & many scripts ? > > On Tuesday 17 April 2001 16:28, you wrote: > > Yes... I'm not familiar with sessions. This should be like this ? : > > > > In connect.php : > > > session_start(); > > $connect = pg_pConnect("blablabla"); > > session_register("connect"); > > clique ici > > ?> > > Simply using pg_pconnect() (without saving the connection ID) should be > just as fast and more failproof > > -- > Christian Reiniger > LGDC Webmaster (http://sunsite.dk/lgdc/) > > A - American Association Against Acronym Abuse > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php equivalent for `command`
> In the second set of code lines, what I need to do is somehow bracket off the $test++ so it is evaluated before being echoed. You need to use the string concantenation operator (a period) to use things like $test++, else PHP get's confused. > echo "Value of test: $test++ "; To get that to work like you want it to, you need only do: echo 'Value of test: ' . $test++ . ' '; It's functionally the same, no brackets needed. If you want it to be evaluated BEFORE it's echoed, you need to use: echo 'Value of test: ' . ++$test . ' '; -- Plutarck Should be working on something... ...but forgot what it was. ""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I deliberately gave a simple example, perhaps too simple. I want to output quite long and complicated strings that may involve evaluated variables, calls to functions etc. But I also want it to as legible as possible. But even something simple along the lines I quoted gives me problems. See the following code and its output > > $test=1; > echo $test++ . ""; > echo $test++ . ""; > > $test=1; > echo "Value of test: $test++ "; > echo "Value of test: $test++ "; > ?> > > The output: > > 1 > 2 > Value of test: 1++ > Value of test: 1++ > > In the second set of code lines, what I need to do is somehow bracket off the $test++ so it is evaluated before being echoed. > > Euan > > > -Original Message- > From: Jason Brooke [mailto:[EMAIL PROTECTED]] > Sent: 18 April 2001 09:46 > To: Greig, Euan; [EMAIL PROTECTED] > Subject: Re: [PHP] php equivalent for `command` > > > echo ++$x; > > http://www.php.net/manual/en/language.operators.increment.php > > > > > > Is there a php equivalent for the use of ` (I think) in Unix/Perl? So > for example echo "`$x++`" would first evaluate $x++ and then print the > resulting value. > > > > > > Euan Greig > > > Technical Consultant > > > BRANN DATA > > > [EMAIL PROTECTED] > > > 01285 645997 > > > > > ** > Any opinions expressed in this email are those of the individual and > not necessarily the Company. This email and any files transmitted with > it, including replies and forwarded copies (which may contain alterations) > subsequently transmitted from the Company, are confidential and solely for > the use of the intended recipient. If you are not the intended recipient > or the person responsible for delivering to the intended recipient, be > advised that you have received this email in error and that any use is > strictly prohibited. > > ** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Persistent connection & many scripts ?
Well I've never actually made two calls to connect in one script, but what happens on the second one is PHP notices you already have a connection open, and instead of establishing a new one it just returns the current connection ID. On your first call to pconnect, PHP looks for any persistant connections that are available to it. If it finds one it returns the ID of it to your script, which is really fast. But if it doesn't find a connection, it creates a new one and returns that. Two connects or two pconnects in the same script will work the exact same way, but one connect and one pconnect won't do exactly what you might think it would. -- Plutarck Should be working on something... ...but forgot what it was. ""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... So : Is it what you mean ? PS : I understand that my code here is not very usefull ;-) > -Message d'origine- > De: Plutarck [SMTP:[EMAIL PROTECTED]] > Date: mercredi 18 avril 2001 15:57 > À: [EMAIL PROTECTED] > Objet: Re: [PHP] Persistent connection & many scripts ? > > Nope, you don't need to save the ID. PHP/database does the work of > remembering what the ID of your persistant connection is. > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > ""Picard, Cyril"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hummm... I don't know how to use pg_pconnect()... It returns a connection > ID, isn't it ? And I have to use this connection ID later ? > I would like to reuse this connection ID to another script... and the > problem is here :( > > I feel that I ignore something so important that I'm stopped and so > trivial > that you do not think about it ! > > > -Message d'origine- > > De: Christian Reiniger [SMTP:[EMAIL PROTECTED]] > > Date: mercredi 18 avril 2001 13:40 > > À: [EMAIL PROTECTED] > > Objet: Re: [PHP] Persistent connection & many scripts ? > > > > On Tuesday 17 April 2001 16:28, you wrote: > > > Yes... I'm not familiar with sessions. This should be like this ? : > > > > > > In connect.php : > > > > > session_start(); > > > $connect = pg_pConnect("blablabla"); > > > session_register("connect"); > > > clique ici > > > ?> > > > > Simply using pg_pconnect() (without saving the connection ID) should be > > just as fast and more failproof > > > > -- > > Christian Reiniger > > LGDC Webmaster (http://sunsite.dk/lgdc/) > > > > A - American Association Against Acronym Abuse > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Connection with a Palm
Hm...can't say I've seen many subjects about this, but you might want to look around for information on WAP/WML. Maybe someone else would know more though, because I have no experiance with non-PC browsers. -- Plutarck Should be working on something... ...but forgot what it was. ""Renzi, Sebastian"" <[EMAIL PROTECTED]> wrote in message A1581797259FD211B25E00805FCBC1FA1E4C1D@SRV_DES_01">news:A1581797259FD211B25E00805FCBC1FA1E4C1D@SRV_DES_01... Thank you ,where i can download more info about this ? > -Mensaje original- > De: Plutarck [SMTP:[EMAIL PROTECTED]] > Enviado el: miércoles 18 de abril de 2001 10:42 > Para: [EMAIL PROTECTED] > Asunto: Re: [PHP] Connection with a Palm > > "exporting data to a palm" is far too vague. > > PHP can produce data in a format suitable for saving on a Palm, or you can > have it interpret data from a Palm. To physically save data from a webpage > to a palm requires client-side scripting. > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > ""Renzi, Sebastian"" <[EMAIL PROTECTED]> wrote in message > A1581797259FD211B25E00805FCBC1FA1E4C1C@SRV_DES_01">news:A1581797259FD211B25E00805FCBC1FA1E4C1C@SRV_DES_01... > I ' m trying to develop a page that exports data to a Palm ,my question is > ,can i do this with PHP or with JavaScript ? .If it's possible please let > me > know ,thnks > > Sebastián Renzi > Consultoría & Desarrollo de Sistemas. > CODES S.A > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable variable
> The braces aren't required in this case. Yup, your right. I stand corrected. I had forgotten that multiple $s are fine, and that I simply don't use them because I have trouble reading them. The joys of learning ;\ -- Plutarck Should be working on something... ...but forgot what it was. ""Steve Werby"" <[EMAIL PROTECTED]> wrote in message 001e01c0c80e$45410400$6501a8c0@workstation7">news:001e01c0c80e$45410400$6501a8c0@workstation7... > "Plutarck" <[EMAIL PROTECTED]> wrote: > > Your problem has little to do with the things mentioned. > > > > First of all, you are refering to a variable variable incorrectly. > > Actually, he's not. > > >You must > > use brackets, like this: > > > > ${$id} > > The braces aren't required in this case. Of the four examples below, only > the 3rd won't return the expected results - because the first $ is > interpreted as a literal $. Paste the code below into a webpage and see for > yourself. > > $field = 'name'; > $name = 'Steve'; > > echo '' . $$field; > echo '' . ${$field}; > echo '' . "My name is $$field."; > echo '' . "My name is ${$field}."; > ?> > > I have a few possible explanations for the problem of the original poster > (see below). > > > if (${$id} == "on") > > { > > echo 'on'; > > } else > > { > > echo 'off'; > > } > > 1. If $id is a number I believe PHP will choke b/c I don't believe numbers > can be used as variable names. > > 2. Assume $id = 'age_bracket'. The control structure checks to see if > $age_bracket == "on". To set $id in the first place for your multiple > checkbox values, you'd have to loop through the values sent from the form. > Jack (original poster), did you do that? If your form's method = post then > you would loop through $HTTP_POST_VARS and if it was get $HTTP_GET_VARS (and > then only loop through the checkbox variables). Or you could predefine the > checkbox variables using: > > $checkbox_fields = array( 'age_bracket', 'weight', 'gender', 'occupation' ); > > And then loop through as follows: > > while( list( , $val ) = each( $checkbox_fields ) ) > { > // may have to set as $$GLOBALS[$val] if within a function or declare $val > as global first. > if ( $$val == 'on' ) > { > echo 'on'; > } > else > { > echo 'off'; > } > } > > -- > Steve Werby > President, Befriend Internet Services LLC > http://www.befriend.com/ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Password Generator?
I believe there is an article on phpbuilder.com on "pronouncable passwords", which is probably what you'll want to actually do. Using real words would just be way too resource intensive. I'd give you the direct link to the article, but it seems my internet connection only works for NNTP and ftp downloads...my HTTP has broken for the moment, and I have no idea why ;( -- Plutarck Should be working on something... ...but forgot what it was. ""Ashley M. Kirchner"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Is there an easy way to generate generic passwords based on > (combined) dictionary words? (ej: take two different words and put them > together) > > AMK4 > > -- > W | > | I haven't lost my mind; it's backed up on tape somewhere. > | > ~ > Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130 > SysAdmin / Websmith . 800.441.3873 x130 > Photo Craft Laboratories, Inc. .eFax 248.671.0909 > http://www.pcraft.com . 3550 Arapahoe Ave #6 > .. . . . . Boulder, CO 80303, USA > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] regex and mysql - looking for opinions.
I use a special function just for reforming input, but they use the following bits with PCRE: $replace_wordwhite = '/[^\w\s]/'; $replace_word = '/\W/'; $replace_num = '/\D/'; $replace_email = '/[^\w\-\.@]/'; Works pretty well and it's quite useful for killing useless input without returning errors, so the username (for instance) "B{o}b" it made into "Bob". That way it's more or less forgiving of morons and malicious users alike :) -- Plutarck Should be working on something... ...but forgot what it was. "Larry Hotchkiss" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Im working on a site utilizing apaches/mysqp and of course php. Im > working through the basic framwork creating forms to collect user input > and do various searches etc. I was curious as to what most people find > the best way keep thier mysql queries from getting messed up by user > entered data. None of my searches or database data has or needs any sort > of punctuation, so I was thinking of striping it all out from form > input. What method is everyone else using? > > > -- > Larry H. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] where to get info on developing web e-mail
Check out PHPost at webgadgets.com for some non-IMAP email tips. -- Plutarck Should be working on something... ...but forgot what it was. "Henrik Hansen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > "Szeto" <[EMAIL PROTECTED]> wrote: > > > Hello, > > > > * i wondering where to get ifo on developing web e-mail > > * what standard should i use to deveping to software > > look at the imap functions in the php manual they are what you need to > develop what you need. > > -- > Henrik Hansen > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] SESSIONS, a weird, funny yet strange error happens to wrong people...
> What to fix? Her ;) Seriously though, is it possible that she stopped browsing the site long enough for the session to expire and be cleaned up by the garbage handler, then she continued on the page with a PHPSESSID that no longer existed? In that case the error would occur only once, as a new sessid with the same number would be created right then. -- Plutarck Should be working on something... ...but forgot what it was. "Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message DC017B079D81D411998C009027B7112A015ED114@EXC-TYO-01">news:DC017B079D81D411998C009027B7112A015ED114@EXC-TYO-01... > > hello guys... > > On one of our websites, where we use sessions, a funny error have happened. > > > Warning: open(/tmp/sess_b5ad1e0878dee63fa8a780df44af3ea7, O_RDWR) failed: > File exists (17) in page.japaninc.inc on line 109 > > > The funny side of it is that no one has ever seen it except our manager > (what a luck) from his PC only. I guess, we developers, visit our art-work > much more often than our manager... > > She's seen it twice already, first time was a month-two ago and now again. I > ignored it the first time, I though - well, happens... But now I start to > think it is a bit weird (and dangerous for carrier). > > Any of you have any idea why this "rare" error keeps happening on her > browser and NEVER on any of developer's? (nor even any other employee of our > 200> company ever complained)... > > What to fix? > > Sincerely, > > Maxim Maletsky > Webmaster, J-Door.com / J@pan Inc. > LINC Media, Inc. > TEL: 03-3499-2175 x 1271 > FAX: 03-3499-3109 > > [EMAIL PROTECTED] > > www.j-door.com > www.japaninc.net > www.lincmedia.co.jp > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Cookies
rather than using time(), try using one of the GMT time functions. Check under date/time in the manual, which is the same section that time is under. -- Plutarck Should be working on something... ...but forgot what it was. ""Chi Wa Au"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I use cookie to protect my web pages: > > setcookie("cookiename", "cookievalue", time()+1800); // set the expiry > time to 30 minutes > > The time zone of my server is set to GMT+8. > The server is running on a Redhat 7, apache and PHP 4 as a apache module. > > Now some users always get cookie expired error. I found that they are from > different time zones, i.e. GMT+6, GMT+5. > The users use IE to access my web pages. > > Could anyone tell me how to set the cookie independent of the time zone? > > Thanks! > > Au Chi Wa > ERG HK > > > ERG Group -- > The contents of this email and any attachments are confidential > and may only be read by the intended recipient. > - > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] best way to include html?
Easiest way I've possibly found is to shove it inside of a function which will echo it out, but with all the variables in their proper place. When I want to display something I just use: $front_page .= 'Text goes here'; In the function outout_html() I just put $front_page wherever I want it to be displayed (in the main table). If I'd like to change the format a page is displayed in I can just adjust the function or make a new one entirely, and I can avoid making a call to string replacement functions. Seems to work pretty well. I stick the declaration in a global file that all my scripts use to keep things simple. I haven't used a tag other than , , and in weeks. -- Plutarck Should be working on something... ...but forgot what it was. ""Duke"" <[EMAIL PROTECTED]> wrote in message 002301c0c87d$9f1e3c80$[EMAIL PROTECTED]">news:002301c0c87d$9f1e3c80$[EMAIL PROTECTED]... > I'm setting up an html "shell" for my webpage that I include with my php > code so I don't have to see html crap and whatnot. > I'm wondering what the best way is to insert the html "shell" into my code? > Should I just echo the file, should I include(), require(), include_once(), > or require_once()?? > One section of the shell, which is in a separate file, is an html form - > would that change the way I include that particular section of html? > Thanks. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] array_count_values
> echo $stuff[nuts]; It should work, but it's becomg a depreciated practice and may break in future versions. Always quote a non-numeric array key. Beyond that, use print_r($array) and see if there is a "nuts" key in there at all. -- Plutarck Should be working on something... ...but forgot what it was. ""Matthew Luchak"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... can someone give a quick hint as to why this does not work: $array = split ("\n", $contents); $stuff = array_count_values ($array); echo $stuff[nuts]; or even: $array = array (split ("\n", $contents)); $stuff = array_count_values ($array); echo $stuff[nuts]; thnx... matthew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How many color can html recongize in Word.
For internet explorer: http://msdn.microsoft.com/workshop/design/color/colorname.asp Due to the near randomness with which different browsers render color names, and often some browsers support nearly no color names, to avoid headaches use one simple rule: Never user color names. Just stick to hex values unless you absolutely _have_ to use the names. If you have problems with hex, use this: http://www.visibone.com/ Great collection of tools to fine the exact color you want. -- Plutarck Should be working on something... ...but forgot what it was. "Pavel Jartsev" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > "Mark Lo (3)" wrote: > > > > Hi, > > > > I would like to know how many colors can html recongized in WORD such as > > orange.. red.. blue.. > > > > eg. Blue > > > > where can I find out the sources of how many color can html recrongized in > > word. and what wording should I use.. > > Maybe this link helps a little: > http://developer.netscape.com/docs/manuals/htmlguid/colortab.htm > > > -- > Pavel a.k.a. Papi > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php equivalent for `command`
Short answer: nope, sorry lol ;) Personally though I concatenate every string I have that needs to have a variable in it. Makes it so the variables are highlighted in my syntax editor for one thing, but it's also a bit faster to use only single quoted strings with string concatenation, rather than just stuff them all inside a double quoted string. Not that it would really effect you much unless you had a hugely long script though. -- Plutarck Should be working on something... ...but forgot what it was. ""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I was hoping to avoid concatenation to make my code more legible (less illegible?). > > I take it then that there is no equivalent for the use of ` in Unix. > > -Original Message- > From: Plutarck [mailto:[EMAIL PROTECTED]] > Sent: 18 April 2001 15:13 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] php equivalent for `command` > > > > In the second set of code lines, what I need to do is somehow bracket off > the $test++ so it is evaluated before being echoed. > > You need to use the string concantenation operator (a period) to use things > like $test++, else PHP get's confused. > > > echo "Value of test: $test++ "; > > To get that to work like you want it to, you need only do: > > echo 'Value of test: ' . $test++ . ' '; > > It's functionally the same, no brackets needed. If you want it to be > evaluated BEFORE it's echoed, you need to use: > > echo 'Value of test: ' . ++$test . ' '; > > > -- > Plutarck > Should be working on something... > ...but forgot what it was. > > > > ""Greig, Euan"" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I deliberately gave a simple example, perhaps too simple. I want to > output quite long and complicated strings that may involve evaluated > variables, calls to functions etc. But I also want it to as legible as > possible. But even something simple along the lines I quoted gives me > problems. See the following code and its output > > > > > $test=1; > > echo $test++ . ""; > > echo $test++ . ""; > > > > $test=1; > > echo "Value of test: $test++ "; > > echo "Value of test: $test++ "; > > ?> > > > > The output: > > > > 1 > > 2 > > Value of test: 1++ > > Value of test: 1++ > > > > In the second set of code lines, what I need to do is somehow bracket off > the $test++ so it is evaluated before being echoed. > > > > Euan > > > > > > -Original Message- > > From: Jason Brooke [mailto:[EMAIL PROTECTED]] > > Sent: 18 April 2001 09:46 > > To: Greig, Euan; [EMAIL PROTECTED] > > Subject: Re: [PHP] php equivalent for `command` > > > > > > echo ++$x; > > > > http://www.php.net/manual/en/language.operators.increment.php > > > > > > > > > > Is there a php equivalent for the use of ` (I think) in Unix/Perl? So > > for example echo "`$x++`" would first evaluate $x++ and then print the > > resulting value. > > > > > > > > Euan Greig > > > > Technical Consultant > > > > BRANN DATA > > > > [EMAIL PROTECTED] > > > > 01285 645997 > > > > > > > > > > ** > > Any opinions expressed in this email are those of the individual and > > not necessarily the Company. This email and any files transmitted with > > it, including replies and forwarded copies (which may contain alterations) > > subsequently transmitted from the Company, are confidential and solely for > > the use of the intended recipient. If you are not the intended recipient > > or the person responsible for delivering to the intended recipient, be > > advised that you have received this email in error and that any use is > > strictly prohibited. > > > > ** > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > > > ** > Any opinions expressed in this email are those of the individual and > not necess
Re: [PHP] Newbie Technical Question
On the last question, technically yes. The key is, how big is big? If the global file is less than 1000-2000 lines, I wouldn't worry about it. If it starts getting so large that it's 50-100k, then yes you should probably break it up. Under 40k and don't even worry about it unless you are under an utterly immense server-strain. -- Plutarck Should be working on something... ...but forgot what it was. "Nashirak Bosk" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a php file with a lot of user defined funtions and wraper > functions in the this global file. Almost all my pages then use the > funtions in this one file (and variables), this is so I can keep my > website very modulure. However I know that having php go through the > file takes a bit of processor time and was wondering if it would be wise > to break up this global file or (into global 1 and 2) or something and > then only use the global 1 when those function are needed and visa > versa. Am I correct in assuming that if that global file gets too big > PHP is going to have to chew on it longer and therefore hold up the > page? > > Thanks > > -- > --- > > Clayton Bluhm > > Computer Engineering Student > > [EMAIL PROTECTED] (School) > [EMAIL PROTECTED] (home) > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Which is better coding style...
Personally I use to use: if () { ... } But I found it utterly horrible to debug. I always missed a bracket, so I switch to: if () { ... } I find that even in multi-thousand line files I can flick my scroll mouse as fast as I can while still being able to follow brackets using that style. I just think it's easier to follow and clearer, but I understand why some people don't like them. I use to hate them...until I started using them :} -- Plutarck Should be working on something... ...but forgot what it was. ""..s.c.o.t.t.. [gts]"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > OOooo... > > it drives me nuts when i see beginning brackets > on seperate lines ;) > > i like to start brackets on the same line as the > statement and finish them on a line of their own. > > if (...) { > } > else { > } > > (it drives me nuts to see "} else {" also) > > > > -Original Message- > > From: Sander Pilon [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, April 19, 2001 4:32 PM > > To: 'Php-General' > > Subject: RE: [PHP] Which is better coding style... > > > > > > Definitely the second style :) > > > > (If we were talking about C(++) then the first would have even been > > forbidden by my companies coding standard as well as several coding > > standards of other companies I worked for.) > > > > The reason is this - a function has one entrypoint (duh) and one > > exitpoint. Jumping out of a function somewhere in the middle leads to > > unmaintainable code, and bugs when extending that function and that > > return is overlooked. But, as with the indenting and bracket placing, it > > is a matter of religion. They would have to torture me for three weeks > > to get me to place the brackets like you did in your example :) > > > > > > function blah() > > { > > $retval = ""; > > > > switch( $bob ) > > { > >case 1: > >$retval = "this"; > >break; > > > > case 2: > > $retval = "that"; > > break; > > > > default: > > $retval = "other"; > > break; > > } > > > > return $retval; > > } > > > > > -Original Message- > > > From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]] > > > Sent: 19 April 2001 21:31 > > > To: Php-General > > > Subject: RE: [PHP] Which is better coding style... > > > > > > > > > i say the first style. > > > > > > unneeded variables and other thingies just > > > obscure things and make it harder to maintain. > > > > > > > > > > -Original Message- > > > > From: Boget, Chris [mailto:[EMAIL PROTECTED]] > > > > Subject: [PHP] Which is better coding style... > > > > > > > > Which is better? > > > > > > > > function blah() { > > > > switch( $bob ) { > > > > case 1: > > > >return "this"; > > > > > > > > case 2: > > > > return "that"; > > > > > > > > default: > > > > return "other"; > > > > > > > > } > > > > } > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] To contact the list > > > administrators, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP and Ranges
One way is: $min = 0; $max = 65535; if ($var >= $min && $var <= $max) { ... } Though I haven't heard of a range comparison, it would be nice if one existed...especially if it could be something like "0-4, 6-8, 9-21", and it would return true of the value was within any of the specified ranges. But I don't know of it's specific existance. -- Plutarck Should be working on something... ...but forgot what it was. ""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message 9bnos3$flm$[EMAIL PROTECTED]">news:9bnos3$flm$[EMAIL PROTECTED]... > is there a way to compare a value to a preset range. > > for example; > > $preset_ range = [0...65535] > > $a[0] = "12"; > $a[1] = "198"; > $a[2] = "B"; > > $ac = count($a); > > for($x=0; $x < $ac; $x++) > { > if($a[$x] != $preset_range) > { > $valid = 0; > } > else > { > valid = 1; > } > > print($valid . "\n"); > } > > output should look like: > 1 > 1 > 0 > > how is this accomplished in PHP? > > thanks. > jason > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Headers sent by - need to clear screen - help me
Short answer: no. If you can't just put your error information before you write information to the screen you will need to use the ob_* family of functions. Clean the information you've printed so far, then just print out the error information to the screen. -- Plutarck Should be working on something... ...but forgot what it was. "Michael Champagne" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I don't know if I'm wording this right. > > I have a display_error function in PHP that I want to generate a screen with > some information about the error, send us email, etc. The problem is that > sometimes it's called after the headers have been sent and in the middle of a > page. Is there a way to 'clear' the screen and putup the error stuff? > > Thanks! > > Mike > > > > ** > This communication is for informational purposes only. It is not > intended as an offer or solicitation for the purchase or sale of > any financial instrument or as an official confirmation of any > transaction, unless specifically agreed otherwise. All market > prices, data and other information are not warranted as to > completeness or accuracy and are subject to change without > notice. Any comments or statements made herein do not > necessarily reflect the views or opinions of Capital Institutional > Services, Inc. Capital Institutional Services, Inc. accepts no > liability for any errors or omissions arising as a result of > transmission. Use of this communication by other than intended > recipients is prohibited. > ** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PERL vs. PHP
"Basically", yes. And I do mean "basically". The languages have the same "basic" sort of syntax and you can make a perl script look almost exactly like a PHP script and vice-versa. However that means _only_ that it is easier to learn one after learning the other. The paradox is that Perl gurus write awful PHP code. PHP gurus write awful Perl code. If you are going to write something in a certain language, you _must_ write it as a programmer of that language. PHP and Perl look a lot alike, but if you try and write them the same you will never be good at either of them. Wizard level code of either PHP or Perl really isn't even the least bit similar. Good perl code stuffs a whole ton of activity into a very small space. You can check if a string is empty, run regex on it to remove certain data, then split it and stick it into a tailor-made associative array on just a few lines. Try and write PHP code like that and you might as well eat your keyboard. PHP isn't "perl, just a little better". (people trying to write PHP like it was Java perhaps worse, though. If they use a class to check a variable for truth, they're probably a Java programmer ;) Just remember: Square Peg, Square Hole. -- Plutarck Should be working on something... ...but forgot what it was. ""Jason Caldwell"" <[EMAIL PROTECTED]> wrote in message 9bq8h0$n78$[EMAIL PROTECTED]">news:9bq8h0$n78$[EMAIL PROTECTED]... > If I know PHP will I *basically* know PERL? Looking at some PERL code... it > looks nearly identical. > > Thanks. > Jason > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sessions and header-redirect
Nope, you can use header() after starting a session. This works fine, even if a session is already started: session_start(); header("Location: http://www.fbi.gov"); Creapy, but it works. You see, when a "header" is sent, it's not actually "sent". PHP collects all headers and fills out a header table, which it sends to the webserver once the script ends or when the first piece of data is sent to the browser (whichever comes first). That's why you can make 10 calls to header and all of them will work. If you are getting the "headers already sent error" it's most likely because you unknowingly sent data to the user's browser. But you'd get one of those "headers already sent" messages. Are you getting one of those? Note: People can append a PHPSESSID onto the end of your url to make you think a session is already started. Also when you destroy a session, the browser still likes to send the session ID to you. So checking for only the existance of PHPSESSID to see if the user has logged in or at least tried to is a bad idea. You should probably check for the existance of a variable inside that session. To see if they've attempted to login (even if you do that anyway, it's a good idea not to bother with something like if (!$PHPSESSID)). -- Plutarck Should be working on something... ...but forgot what it was. "Scott" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Does anyone know of a way to use sessions and still be able to redirect with > the header function. In the code below I test for the existence of the > PHPSESSID and send the user to register if it doesn't exist. If it does > exist I start a session to retrieve the session variables then call a class > that tests for other conditions. If the test is successful then I try to > redirect which fails because (as I understand it) session_start has already > sent headers. > I really don't like putting links on pages that say "Click here to continue" > so I'm looking for a solution. Any ideas? > > if (!isset($PHPSESSID)){ > header("Location:http://www.blah.com/register.php"); > } > session_start(); > if ($action == "update"){ > include("../includes/update_class.php"); > $my=new update_listing(); > header("Location:http://www.blah.com mem_welcome.php?sid=$PHPSESSID"); > } > ?> > > JS Plauche > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] This should be simple...
RTFM ...there, feel better now? *always happy to help* :) -- Plutarck Should be working on something... ...but forgot what it was. "Joseph Koenig" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Right on. That did it. I probably should have been RTFM'ed for that one > :) I knew there was a simple solution. > > Joe > > Alexander Wagner wrote: > > > > Joseph Koenig wrote: > > > > > > Well, obviously there's a problem with that. The form field will show > > > "Here's the text " and then thinks it ends. Is there any way to get > > > around this, other than stripping out her quotes? Thanks, > > > > http://php.net/htmlentities > > > > regards > > Wagner > > > > -- > > "A conference is a gathering of important people who singly can do > > nothing, but together can decide that nothing can be done." > > Fred Allen (1894-1956) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] RE: Site Sesions: Online/off...
If you want to make it easy on yourself, convert it into a timestamp (unix preferably). Then all you have to do is: $dif = time() - $last_access_time; if ($dif > 3600) { echo "The user has been inactive for more than an hour."; } That's if you want to make it easy on yourself. If you're a masochist I suppose you could play around with mktime() :) -- Plutarck Should be working on something... ...but forgot what it was. ""Richard"" <[EMAIL PROTECTED]> wrote in message 9bpbf3$fc$[EMAIL PROTECTED]">news:9bpbf3$fc$[EMAIL PROTECTED]... > Greetings. (the thread was too far down to be read by anyone) > > I am having some problems with the code itself! I have done like so, > that whenever peopel wishes to see the "onliners", I start a function called > DelOld(). This will not decrease server speed, nor create conflicts when > writing to temporary files and so forth. > Now, I tried to gather the following into an exploded array: > > // the date output > $date_output = date("Y-m-d-H-i-A"); > > As you see, I've seperated all with a "-" so I can simply call [0], [1], > [2],... if I want something. Now, How can I compare if a user is away for > like 10 minutes, or 30 minutes? I have a function called > GetLoggDateofUser($Username) which will retreive the $date_output, but with > colons and spaces, like so: > date("Y-m-d H:i A"). > > Do you or anyone else have any suggestions? > > - Richard > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHPSESSID in session
If the user's browser does not support the session cookie like it should, PHP will automatically "rewrite" your url's and add "?PHPSESSID=". So you don't need to force PHPSESSID to be sent, but you could always just add ?PHPSESSID= onto all the urls you want. It's just really ugly that way. -- Plutarck Should be working on something... ...but forgot what it was. ""nicuc.ac.jp"" <[EMAIL PROTECTED]> wrote in message 9bp4n3$7uk$[EMAIL PROTECTED]">news:9bp4n3$7uk$[EMAIL PROTECTED]... > I use session in my Shopping cart program. > start with > > session_start() ; > > and register the value with > > session_register('uid') ; > > when I want to pass the session value to another page I use > > echo "click" ; > > > In 'somepage.php' I try to echo $uid the output that correct > My question is why my url not contain like > > http://aaa.com/somepage.php?PHPSESSID= blah... blah.. > > It's not show like above just show like below > > http://aaa.com/somepage.php > > and it's work... ? > > > Is this because session send cookies to the browser ? > How could I do if I need to force session not sent the cookies to user ? > > > Any comment would be appriciated. > > > -- > Yang > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] I don't get it ... suddenly my script doesn't work ...
Check your error report settings. When you refer to something like $id as: if ($id)... PHP will throw a warning that $id isn't set. It's a nice debugging feature, but a pain in the arse otherwise. The problem is PHP now has a higher error level for some reason, so just nock it down to normal. -- Plutarck Should be working on something... ...but forgot what it was. "Tim Thorburn" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I have a PHP script that I wrote several months ago which allows a user to > enter information into a MySQL database through a basic web form - it > worked very well. However, since then I had a system crash - luckily I > made a backup of the script days before the crash. > > My problem is, that now the script generates errors which were not present > before. I've gone over it twice, even re-coded it just now, and still I > get the same errors. > > Currently, I am using Win2k Pro, MySQL 3.23.33 and PHP4.0.4pl1 installed as > CGI. > > Interestingly, when I try to run this script on my RH7.0 Linux box with > MySQL 3.22.32 and PHP3.0.18 it does not generate these errors. I have this > system setup with older versions of MySQL and PHP as those are the versions > that my hosting service uses. > > Could someone please look over my code and tell me where I'm going wrong?? > > Thank you > > -Tim > > The errors I get are as follows: > Warning: Undefined variable: submit in index.php3 on line 17 > > Warning: Undefined variable: delete in index.php3 on line 37 > > Warning: Undefined variable: id in index.php3 on line 51 > > Warning: Undefined variable: id in > E:\WebPages\2001\AtikokanInfo\Web\www.atikokaninfo.com\htdocs\aedc\comcal\mc x\webmonkey.php3 > on line 83 > > Here is the script which I am attempting to use: > > > > > > > > > > > $db = mysql_connect("localhost", "user", "passwd"); > > mysql_select_db("edoinfo",$db); > > > > if ($submit) { > >// here if no ID then adding else we're editing > >if ($id) { > > $sql = "UPDATE comcal001 SET > eventCategory='$eventCategory',eventName='$eventName',eventLocation='$eventL ocation',eventCity='$eventCity',eventState='$eventState',eventCountry='$even tCountry',eventTime='$eventTime',eventAMPM='$eventAMPM',eventDuration='$even tDuration',eventMonth='$eventMonth',eventDay='$eventDay',eventDate='$eventDa te',eventYear='$eventYear',eventC1Fname='$eventC1Fname',eventC1Lname='$event C1Lname',eventC2Fname='$eventC2Fname',eventC2Lname='$eventC2Lname',eventACph one='$eventACphone',eventPhone='$eventPhone',eventACfax='$eventACfax',eventF ax='$eventFax',eventACcell='$eventACcell',eventCell='$eventCell',eventEmail= '$eventEmail',eventWeb='$eventWeb',eventDetails='$eventDetails',entryDate='$ entryDate' > WHERE id=$id"; > >} else { > > $sql = "INSERT INTO comcal001 > (eventCategory,eventName,eventLocation,eventCity,eventState,eventCountry,eve ntTime,eventAMPM,eventDuration,eventMonth,eventDay,eventDate,eventYear,event C1Fname,eventC1Lname,eventC2Fname,eventC2Lname,eventACphone,eventPhone,event ACfax,eventFax,eventACcell,eventCell,eventEmail,eventWeb,eventDetails,entryD ate) > VALUES > ('$eventCategory','$eventName','$eventLocation','$eventCity''$eventState','$ eventCountry','$eventTime','$eventAMPM','$eventDuration','$eventMonth','$eve ntDay','$eventDate','$eventYear','$eventC1Fname','$eventC1Lname','$eventC2Fn ame','$eventC2Lname','$eventACphone','$eventPhone','$eventACfax','$eventFax' ,'$eventACcell','$eventCell','$eventEmail','$eventWeb','$eventDetails','$ent ryDate')"; > >} > >// run SQL against the DB > >$result = mysql_query($sql); > >echo "Record updated/edited!"; > > } elseif ($delete) { > > // delete a record > > $sql = "DELETE FROM comcal001 WHERE id=$id"; > > $result = mysql_query($sql); > > echo "$sql Record deleted!"; > > } else { > >// this part happens if we don't press submit > >if (!$id) { > > // print the list if there is not editing > > $result = mysq
Re: [PHP] I'm a moron. So?
Personally I like to use mt_rand() rather than rand() as it's billed to be faster and more random than plain old rand(). Kind of makes me wonder why they haven't just replaced rand() with mt_rand()... "seed" requires srand() for rand() and mt_srand() for mt_rand(). -- Plutarck Should be working on something... ...but forgot what it was. ""Dddogbruce (@home.com)"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Alrighty. I'm baack! Anyways, I seem to be having stupid little > problems, al of which are driving me insane. I'll feel really > stupid when you tell me the problem. A friend told me something about > "seeding" for random() but I didn't find anything on that. > > This is the HTML section... > > > > Horse Race v.1 > > > Welcome to horse racing v.1. This is a simple PHP game where you can > train, race and win money for your animals. Eventually I'll make it a > whole barn with feeding and horses, and costs, age, breeding. So on. > But for now, this is just a simple game. > > Enter six names of horses. > > Name1 : > Name2 : > Name3 : > Name4 : > Name5 : > Name6 : > > > Good luck! > > > > > > This is the PHP... > > $name1 = "$n1"; > $name1 = "$n2"; > $name3 = "$n3"; > $name4 = "$n4"; > $name5 = "$n5"; > $name6 = "$n6"; > $randomHorse = rand($name1, $name6); > $randomStrides = rand(1, 10); > echo "$randomHorse won the race by $randomStrides ! Congratulations."; > ?> > > > --- > > And I feel stupid. > > -Owen > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] connection problème!
Not enough "}". Change it to: -- Plutarck Should be working on something... ...but forgot what it was. ""Francois Boucher"" <[EMAIL PROTECTED]> wrote in message 9bsk0h$r2e$[EMAIL PROTECTED]">news:9bsk0h$r2e$[EMAIL PROTECTED]... > I wrote this code but nothing append. If i look de code in the browser it's > stopping to starting! > > What is the problème? > > > > echo "starting..."; > if ( mysql_connect("localhost","php","php") ) > { echo "ok"; } > else > echo "error!"; > > ?> > > > -- > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > -= François Boucher =- > -= [EMAIL PROTECTED]=- > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > -= François Boucher =- > -= [EMAIL PROTECTED]=- > -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Output graphic or other download file to client's browser
No real completely effective way of keeping someone from downloading an image. If they _really_ want the image they can take a screenshot then slice the image out. You could always use a *shudder* java applet, but if they're very familiar with a decompiler they can probably rip such a small applet to pieces in no time. In other words, it's next to impossible to keep someone from downloading one of your pictures. The only way to restrict it is to just use the images on pages that only authorized users can see. -- Plutarck Should be working on something... ...but forgot what it was. ""Jason Lam"" <[EMAIL PROTECTED]> wrote in message 001901c0ca17$a7aa5370$05d496cd@jasonwvvec46nl">news:001901c0ca17$a7aa5370$05d496cd@jasonwvvec46nl... Hello! I am trying to develop a web site where some files and images are private, I am using session to auth. user. I would like to know how I can send some local files to the client so that others without the access to the web site will not be able to download. How would I stream the local image (jpg) files over to client? I know how to stream it the normal way, just don't know how I can stream it to some and not others. Anyone have suggestions on this one? Jason Lam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Buggy Java GUI? (just a tad OT)
I've been toying around with Java to possibly interface with PHP, but I have a question about it. Is it just me, or is the GUI in most standalone java applications remarkably (and annoyingly) buggy? I downloaded Forte for Java by Sun, and after the 45 second loading time I noticed that if you click around the menus or move your cursor too fast, a menu will become temporarily "burned" into the frame of the page. Same if you hover on one button till a message comes up, then switch over to another button, a portion of the original message will still be shown. Same goes for Limewire and other 100% java apps I've tried. I was just wondering if it's just my machine, or because I use the windows98 VM, or if everyone experiences the same thing. I'm guessing the horrendous starting load time is native to java, but at least it runs ok once you get the thing to start. -- Plutarck Should be working on something... ...but forgot what it was. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Buttons and such...
Another way of getting buttons without actually "hiring" someone is to kind of trade them work. Works especially well with people you already know, or people your friends know. You'll do a little website programming for them (like a custom form-to-email or user login system) and they'll make some graphics for you. Also check out a program called IconToy, which rips out graphics from windows programs. -- Plutarck Should be working on something... ...but forgot what it was. "Geir Eivind Mork" <[EMAIL PROTECTED]> wrote in message 01042216125503.05150@maria">news:01042216125503.05150@maria... > On Saturday 21 April 2001 20:15, Jason Caldwell wrote: > > I know this is off-topic -- please forgive me. But I figure someone here > > would know. > > I'm looking for some really nice *professional* looking (submit, logon, > > buy, help, etc) buttons for my website... I've done all kinds of > > try do it with css: > .button { > font-size: 10px; > font-family: Verdana, Arial, Helvetica, Sans-serif; > color: #ff; > font-weight: bold; > background-color: #77; > border-color: #99; > } > > and just > > and the world is for your feets :) > > > searches on MSN and Yahoo -- found a ton of sites that offer all kinds of > > .gifs and .jpegs -- but I must say 99% of them are garbage. > > or hire somebody :) > > -- > php developer / CoreTrek AS| I think I'll KILL myself by leaping out > Sandnes / Rogaland / Norway| of this 14th STORY WINDOW while reading > web: http://www.moijk.net/ | ERICA JONG'S poetry!! > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] writing to file on server
When you are using that on your site, what basically happens is that you are trying to open an FTP session with yourself. Not too efficient. So just kill off the url and use the path to your file. -- Plutarck Should be working on something... ...but forgot what it was. ""Joeri Vankelst"" <[EMAIL PROTECTED]> wrote in message 9bujcv$gtm$[EMAIL PROTECTED]">news:9bujcv$gtm$[EMAIL PROTECTED]... > Hi, > > I've just started working with PHP. I've made a guest book using PHP > (nothing spectacular) that worked just fine when I tested it op my pc, but > when I uploaded it, it stopped working. > My specific problem is that I cannot write to a file that already exists and > contains data. When I try to I get these warnings: > > Warning: File already exists > Warning: fopen("ftp:[EMAIL PROTECTED]/guestbook.txt","a") - File > exists > > Is this problem related to the FTP fopen? And is there a way to correct this > problem? > > Tnx! > Joeri Vankelst > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Buggy Java GUI? (just a tad OT)
Hm, that would probably explain it. I assumed it wasn't it because the programs are so comparitively small...then again, it's not the size that counts blah blah... Since it loads so much up at one time rather than a little bit at a time, it probably eats a huge amount of ram. Forte probably loads the majority of the JDK, the virtual machine, all it's neccessary system files and the majority of it's class files, plus any files the user opens/builds. I suppose Java's lack of programmer defined memory management is probably the cause, since in other languages the programmer explicitly says what to load and what to unload. Ah well, I suppose that's the price of simplicity. Thanks for your answer. I feel better about Java now...but now I have issues about the size of my RAM. ;) -- Plutarck Should be working on something... ...but forgot what it was. "Seung-woo Nam" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi: > If you don't have plenty of ram on your machine, forget about running > Forte. Java applications that use swing look nice but they use a lot of > systems resources. It's not a bug, per se, but whenever your systems > runs out of physical memory and start writing stuff on the virtual > memory, that's what you get. I have 224MB on my machine and Forte is > still slow. > > Seung-woo Nam > > Plutarck wrote: > > > > I've been toying around with Java to possibly interface with PHP, but I have > > a question about it. > > > > Is it just me, or is the GUI in most standalone java applications remarkably > > (and annoyingly) buggy? > > > > I downloaded Forte for Java by Sun, and after the 45 second loading time I > > noticed that if you click around the menus or move your cursor too fast, a > > menu will become temporarily "burned" into the frame of the page. Same if > > you hover on one button till a message comes up, then switch over to another > > button, a portion of the original message will still be shown. > > > > Same goes for Limewire and other 100% java apps I've tried. > > > > I was just wondering if it's just my machine, or because I use the windows98 > > VM, or if everyone experiences the same thing. > > > > I'm guessing the horrendous starting load time is native to java, but at > > least it runs ok once you get the thing to start. > > > > -- > > Plutarck > > Should be working on something... > > ...but forgot what it was. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help!! newbie
You'll want to use the LIMIT option in SQL. So on the end of your query add: "LIMIT 0,10" to get the first ten results. The first number is the "offset", and the last is the max amount to retrieve. To get links 20 through 40 you'd use: "LIMIT 19, 39" The offset is refering to an array, so offset 0 is actually the first link. -- Plutarck Should be working on something... ...but forgot what it was. ""McShen"" <[EMAIL PROTECTED]> wrote in message 9btbqt$t79$[EMAIL PROTECTED]">news:9btbqt$t79$[EMAIL PROTECTED]... > hi > > I have 30 links stored in a table(mysql) now. I wanna show them accorging to > the traffic they send. But i don't want to list all of them in just 1 page > because i will be adding 300 links soon. (I don't want my visitors to wait 3 > minutes to load the links)How should i do it? I wanna do it like this > http://mydomain.com/links?list=0 > shows only links from 0-15 > and > http://mydomain.com/links?list=15 > shows links from 15-30 > etc. > > here is my code. > -- > > $connection = mysql_connect("localhost","",""); > if ($connection==false) > { > echo mysql_errno().":".mysql_error().""; > exit; > } > $query = "SELECT * FROM refer ORDER BY hits desc "; > $result = mysql_db_query ("celebzone", $query); > > $rows = mysql_num_rows($result); > $num_of_page = floor($rows/15)+1; > > $i=$list; > > for ($i = $list; $i < $list+15; $i++) > { > > if ($i <= $rows) > { > @$id = mysql_result($result, $i, "id"); // check this later > @$title = mysql_result($result, $i, "title"); // check this later > echo "http://www.celebritieszones.com/jump.php?id=$id\">$title\n"; > > } > else > { > echo ""; > $i = 288; // this forces it to quit the loop > > } > } > echo ""; > > $check = floor($rows/$num_of_page); // this finds how many pages it should generate > if ( $check>0 ) > { > > if (($i-1)==288) > { > echo ""; > } > else > { > $num_of_page = $i; > echo "http://www.celebritieszones.com/links/index.php?list=$num_of_page\">N ext Link Page"; > } > > } > ?> > --- > It's not good though and it's kinda stupid. :( When it loads the last page of my links, it will show this > "Warning: Unable to jump to row 48 on MySQL result index 2 in /home/sites/site3/web/links/index.php on line 22 > > Warning: Unable to jump to row 48 on MySQL result index 2 in /home/sites/site3/web/links/index.php on line 23" > > You see the @? I am using it to supress the error messasges cuz i don't know how to fix this error. Please help. :) > Thank You. > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]