[PHP] Re: Dual Pentium Pro 200 vs. Single Pentium II 450
For such a small userload it doesn't matter. I'm working on a day-to-day basis with a local ISP to help get everything running at tip-top shape and right now he's running his main hosting server on a single p200, his firewall on a p75 and his primary nameserver on a 486 100. No holdups in the system anywhere, and his userload at any one time on any of those systems is higher than what you expect by far. The biggest concern is to get the systems set up properly, like configuring Apache and PHP. Those two will suck of RAM if you aren't careful, not to mention CPU resources. Mike Frazer "Phil Schwarzmann" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have two PCs, one is a Dual Pentium Pro 200Mhz and the other is a > Pentium II 450Mhz (both have 64MB) > > I want to set one of them up using Linux Red Hat 7.2, Apache, MySQL, > and PHP. I only plan to have about 1-3 users accessing it at any one > time. > > Which of those CPUs do you think is better? Will Linux take full > advantage of those Dual Processors? > > Thanks for your advice! > -- 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] session problem Warning: open(/tmp\sess_..., O_RDWR) failed: m (2)
Win2k is the same as NT and does, indeed, have permissions. Very different from *nix permissions but they do exist. Mike Frazer "Nick Wilson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > > * and then Freddy blurted > > I am getting the folloing error whenever I try to open a session. > > Warning: open(/tmp\sess_0929ece4254c982def371c8f1ccd8164, O_RDWR) failed: m (2) > > It seems like a permissions issue to me but I do not know where to look for > > addressing the problem. I am using apache on win2k. > > Win2k doesn't /have/ permissions. Does it? > Check in your php.ini for (i think) the session_save_path or something > very similar. I'll bet /tmp doesn't exist on your machine and you just > need to put a path liek C:\\Windows\temp or something. > - -- > > Nick Wilson > > Tel: +45 3325 0688 > Fax: +45 3325 0677 > Web: www.explodingnet.com > > > > -BEGIN PGP SIGNATURE- > Version: GnuPG v1.0.6 (GNU/Linux) > > iD8DBQE8UG43HpvrrTa6L5oRAmTRAJ9DMZMNu54HgIuf6t7tbxZSDSS/9wCgmvRM > TiZKEvsXZvV4MvW6mAsY8rg= > =P7KG > -END PGP SIGNATURE- -- 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] Fastest way to read from an url?
How quickly can you get other data from that same remote host? Sounds to me like it's a network bottleneck someplace. If you are downloading static data from that system at the same speed its the network. Mike Frazer "Stefan Rusterholz" <[EMAIL PROTECTED]> wrote in message news:009601c1a428$5839bab0$3c01a8c0@quasimodo... > > > Nick Wilson wrote: > > * and then Stefan Rusterholz blurted > > > Yes, I *have* to use php. > > > > Hmm... Then I can't see any way to speed it up as presumably the php > > proccessing is slowing it all down. I hope someone can be of more help > > as it's an interesting thread. > > No, it's definitifly *not* the php processing which is slowing it down. > Processing 15 files of totally 25MB from the remote host takes approximatly > 2 minutes while processing exactly the same files from localhost takes > approximatly 10s. So it's definitfly the slow fetching of the data from the > remote host which slows the script down. > > What I could think of is that PHP has something built-in thought as feature: > that php automatically slows down remote connections to not "kill" the > remote server by slurping everything with max. speed (just like the > UA-Robots modul extending the libwww module for Perl). But in my case it's > more important that files are slurped fast when needed even at the price > that the remote servers resources are all used for the download. > > best regards > Stefan Rusterholz > > -- 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] Re: directory structure list
Write the whole thing as a function, and then do a check like if (is_dir("/path/to/directory")) { listDirs("/path/to/directory"); } PHP will allow you to recursively call a function from with that same function. Mike Frazer <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I need to print out a list of directories, which is a piece of cake, just do something out of the manual: > $handle = opendir('.'); > while (false != ($file = readdir($handle))) { > if ( ($file != ".") && ($file != "..") && (is_dir ($file)) ) > echo "$file\n"; > } > closedir($handle); > ?> > > The thing is, I need the sub-directories, and the sub-directories under them... ad infinitum in a list format. > i.e. > *Dir1 > *SubDir1of1 > *SubDir2of1 > *Dir2 > *SubDir1of2 > *SubSubDir1of2 > ... etc. > > There are some truly great php applications for this, such as: > http://freshmeat.net/projects/phpmyexplorer/ > But it's way ahead of what I need. > > Any crafty suggestions? > > Thanks for any input, > > Sean > > > -- 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] Re: while loop on an array
There's a rather easy way to process arrays with while loops (I saw it used loosely in some of the other replies). while ($i < sizeof($array)) { ... actions ... $i++; } Hopefully you can tailor that to suit your needs. Mike Frazer "Joe Rice" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > > Hello, > > I would like to know how i can know when i'm at the > end of an array during a while loop? > > reset($new_answers); > while (list($new_qID,$new_aID) = each ($new_answers)) { >$sql .= "qID=\"$new_qID\ ||" "; > } > $sql .= ") AND uID = \"$uID\""; > > i would like to know how to stop putting the " || " at > the end of $sql in the middle of the while loop. > > any help would be appreciated. > > thanks, > 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] Re: Writing new lines in txt- files?
Sample script for writing to a file: if ($fp = fopen("/path/to/file", "w")) { fwrite($fp, $text . "\n", strlen($text)); } else { ... code to report error opening file } You can use a loop for writing, obviously, if you have to write more than one line (as it sounds like you do). Just create a while() loop that gets a line or a certain length of text from a source and write it until you reach the end of the source. Just remember to add the "\n" and you'll get each line read from the source written to its own line on the destination file. Mike Frazer "Mëòv î?çîÎ òsyïn" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Hello folks! > > I want to write to a textfile, but I want a row for each string I write to > the file. As it is now when I write to the file it just starts writing where > the last string ends.. > > What should I do? =) > > Thanks! //M. > > > > > -- > Mårten Andersson > Loddbygatan 2 > 60218 Norrköping > > URL: http://www.vanvett.net/marten > email: [EMAIL PROTECTED] > ICQ: 86515830 > > > _ > Kom med i världens största e-posttjänst; MSN Hotmail. > http://www.hotmail.com/sv > -- 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] fsockopen questions
Although they are experimental, I find the socket() and connect() functions in PHP4 to be much easier to use and manage. May want to try them, perhaps? They seem to be a little less tempramental. Mike Frazer "Bhavin Modi" <[EMAIL PROTECTED]> wrote in message news:01d901c1a419$deea9de0$0664a8c0@bhavinm... > You can use CURL extension with PHP to use SSL, provided PHP is compiled > with CURL library functions. http://www.php.net/manual/en/ref.curl.php > > You can get more help from > http://www.phpbuilder.com/columns/matt2305.php3 > > Regards, > Bhavin > > > - Original Message - > From: "Daniel Reichenbach" <[EMAIL PROTECTED]> > To: "Php-General" <[EMAIL PROTECTED]> > Sent: Wednesday, January 23, 2002 7:14 PM > Subject: [PHP] fsockopen questions > > > > Hy, > > > > for a project I need to connect to a SSL server with PHP. Additionaly I > > have to authenticate myself with username/password with standard auth. > > Is this possible with PHP's fsockopen function? I couldn't find any > > hint on this in the manual. > > > > Greetings, > > Daniel > > > > > > -- > > 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] Re: I lost the message...
Here's a generic way to access each file sequentially and perform your specific actions: if ($dir = opendir("/path/to/directory")) { while ($file = readdir($dir)) { ... perform your condition checks here ... } closedir($dir); } else { ... code for reporting that directory could not be opened ... } Mike Frazer "Todd Cary" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am embarrassed to say that I lost the anser to my question on the > syntax to get a list of all of the files in a specified directory > matching a sertain criteria. > > Anyone willing to give me another chance? > > Todd > > -- > Todd Cary > Ariste Software > [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] Re: CGI PHP processing .shtml
Did you remove the "AddType server-parsed" entry for .shtml that is usually there by default? You may be better served asking this on an Apache newsgroup. Mike Frazer "Christian Cresante" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >i want to have php process .shtml files. i tried > appending the following to .htaccess, but to no avail: > > AddType application/x-httpd-php .shtml > > is it because php is running as a cgi program? how > would i go about getting this to work. its php 4.0.6 > running on a sparc, if that matters. thanks all. > > > > __ > Do You Yahoo!? > Great stuff seeing new owners in Yahoo! Auctions! > http://auctions.yahoo.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] Re: seems easy...
Line 4 & 5 combined: $text = substr($text, 0, $limit) . " ... your additional text here"; Mike Frazer "Justin French" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > Really simple, but can't see which funtion to use in the manual. > > I want to take a user-inputted string $text, and IF it's length is more > than $limit, trim it to the limited length, and then tack on some kind > of "... text cut (too long)" thing on the end. > > I'm only missing one bit (line4): > > 1 $limit = "5000"; > 2 if(strlen($text) > $limit) > 3{ > 4 > 5$text .= "...sorry, text was too long"; > 6} > > > Or is it hard than that? > > > Justin French -- 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] Form Problem
Here's a sidenote to the whole script: save your server a little load by removing the print statements. PHP is an embedded language; if you need to print something just break from PHP processing with a ?> tag and use standard HTML. You can embed to print individual variables. If you are using the script to print chunks of code based on a condition, use: Something to that effect, at least. You get the idea. It makes code considerably more readable, and in the off-chance that someone who isn't a PHP programmer needs to make some aesthetic changes to the document, they can skip over the PHP input and just change HTML. Dropping the print statement means the server does less work, too. Mike Frazer "Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > On Thursday 24 January 2002 10:47, Michael P. Carel wrote: > > Hi there, > > > > I have a problem here regarding the form table name variable (i.e > name=Process type text>), when i used Href tags to send the variable in the > > next script it does'nt recognized the $Process variable. I've tried the > > the submit type but but im having problem with other $variable in the table > > which is not part of the form. > > Here's the script: > > Correct me if I'm wrong, it seems like you're trying to set some values in a > form AND trying to pass values through the URL. You cannot do both at the > same time. Well actually you can if you use javascript. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > /* > Recursion is the root of computation since it trades description for time. > */ -- 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] RFE: $HTTP_POST_VARS =& $_POST;
Good practice is to never assign to predefined variables, PERIOD. If you need to alter the data, copy what you need to a new variable and operate on that one. Not only does it circumvent these problems, it also maintains the original data throughout the entire script in case you find you need it elsewhere. Mike Frazer "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I think the real answer here is to treat these as read-only arrays. ie. > never use them on the left side of the '=' and you will never run into > problems. Or if you do, be consistent and use the same array all the > time. You are writing your code with the assumption that these two arrays > are the same. Where does this assumption come from? Hopefully not the > documentation. > > -Rasmus > > On Thu, 24 Jan 2002, Robert Ames wrote: > > > This is the second time in as many weeks that we have been bitten by the > > fact that $_POST != $HTTP_POST_VARS; Attached is a real-world example of > > why it is currently bad practice to use the _POST variables. > > > > I cannot recommend that anyone use $_POST[..] in their scripts. > > $GLOBALS['HTTP_POST_VARS'][..] is a much safer, portable, and sane > > solution, unless $HTTP_POST_VARS is marked as depracated, scheduled to be > > phased out. > > > > For those new to the problem, $_GET and $HTTP_GET_VARS are two totally > > separate arrays which happen to hold the same data at the beginning of > > script execution. After script execution has begun, it is VERY DANGEROUS > > to modify the data contained in either of these arrays, because changes > > in one are not propagated to the other. > > > > The simplest example script is: > > > echo $_GET['test']; > > echo $HTTP_GET_VARS['test']; > > $_GET['test'] = 'changed.'; > > echo $_GET['test']; > > echo $HTTP_GET_VARS['test']; > > ?> > > > > ...The second set of echo statements will print two different values. > > > > The situation is worse when you are trying to integrate the usage of > > $_GET/$_POST into scripts which already make use of $HTTP_*_VARS. > > > > The following script is my real-world example of a difficult to trace > > logic bug caused by $_POST != $HTTP_POST_VARS. > > > > The situation is that we have a form with a radio button toggling between > > two input elements as follows. > > > > PRICING: > > > > ( ) Fixed: $[__] > > ( ) Negot: $[__] > > > > The radio field is named "option", and the two input fields are named > > "asking1" and "asking2" respectively. On the back end, we store whether > > the user selected "fixed" or "negotiable", and then 'push' asking1 or > > asking2 into a variable called "asking_price". We don't care which field > > they type the price into, but asking1 and asking2 must be named > > differently so that the browser will not stomp asking prices over each > > other when posting the information. > > > > Our function "gpc" stands for "Get/Post/Cookie", and is very similar to > > the new $_REQUEST array, except that it returns FALSE if nothing was > > posted, preventing us from having to do: > > if( isset($_REQUEST['blah']) ) > > $result = $_REQUEST['blah']; > > > > (because we run with E_NOTICE & E_ALL, and have register_globals turned off) > > ...instead, we can say: > >$result = gpc('blah'); > > > > ...anyway, we've been using PHP for a while now (since well before 4.1 > > ;^), and already have many many scripts and libraries which use the > > HTTP_*_VARS method of accessing things. It is unsafe to use $_GET and > > $HTTP_GET_VARS in the same environment. > > > > My proposed solutions again: > > > > 1) Temporary workaround: $HTTP_GET_VARS =& $_GET; > > 2) Throw an E_NOTICE if $HTTP_*_VARS or $_* is used as the left-hand side > > of an assignment. (ie: officially discourage changing $HTTP_*_VARS) > > 3) Propagate any changes made to $_GET over to $HTTP_GET_VARS and > > $_REQUEST. > > > > #1 works for the most part, but changes is $_GET are not propagated into > > $_REQUEST, which opens the door for more data inconsistency issues. > > > > #2 could possibly be implemented by making $HTTP_*_VARS and $_* into > > constants... forcing them to be read only. > > > > #3 sounds
Re: [PHP] Arrays as pointers?
The Zend Engine is programmed in C, if I remember correctly. Strings in C are really just pointers to character arrays, which is what you see here. Because PHP is a wrapper of sorts, it is basically covering up the fact that strings are character arrays. The good programmers were nice enough to make this an afterthought for all of us, but it looks like they still left C's functionality intact. Mike Frazer "Martin Towell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > it's treating a string as a character array - it's documented somewhere in > the manual, can't remember where though :( - not long ago someone was > saying that the new way it to use curly-brackets, but square brackets still > work for backwark compatibility. > > -Original Message- > From: v0idnull [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 25, 2002 8:57 AM > To: PHP List > Subject: [PHP] Arrays as pointers? > > > A friend of mine showed me this code recently. > > function firstLogin_string() { > mt_srand(make_seed()); > $pool = "AaBbCcDdEeFfGgHhIiJjKkLlM"; > $length = 26; > for($i=0; $i < $length; $i++) { > $key .= $pool[mt_rand(0,strlen($pool)-1)]; > } > return $key; > } > > look at the for loop. $pool is not an array but is being treated as such and > the key happens to be the position in $pool and it'll take that letter and > save it to $key. I've never seen this done before. What is this method > called and what other neat tricks can you do in respect to this? > > > -- > 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] directory structure list
Anyone who wants to see the directory and filesystem fiunctions in action together can go to http://www.invertedmind.com/baby/ (pardon the images, they're of my nephew, I originally wrote the script because directory listings are turned off on the server). If you want a copy of the script you can email me, as I don't yet have my script site up (gotta get the server over to my co-loc provider first). Mike Frazer "Erik Price" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hmm... I'm not familiar with the directory functions yet. > > But perhaps you can use `ls -F` somehow -- this prints the name of each > file in the directory with a special character to denote its type. For > directories, this is a forwardslash. I.e: > > localhost:~/Documents/Media Lab$ ls -F > (admin)index.php/filerequest.php/ > medialabproposal.txt > DBcreatefiles/ filesSQL.txt > oldcrapfromthisproject/ > DBqueryfiles/filespeopleSQL.txt > papercost.txt > Icon?mainfoot.inc > peopleSQL.txt > SQL_statements/ mainhead.inc > temp_php/ > changes(12-20) materialscalc.txtto- > do.txt > dbcrit.txt medialab_db-dump-02-01-07/ > > Maybe this can be coupled with directory functions in a creative > fashion > > Good luck, > Erik > > > On Thursday, January 24, 2002, at 03:45 PM, [EMAIL PROTECTED] > wrote: > > > Hello, > > > > I need to print out a list of directories, which is a piece of cake, > > just do something out of the manual: > > > $handle = opendir('.'); > > while (false != ($file = readdir($handle))) { > > if ( ($file != ".") && ($file != "..") && (is_dir ($file)) ) > > echo "$file\n"; > > } > > closedir($handle); > > ?> > > > > The thing is, I need the sub-directories, and the sub-directories under > > them... ad infinitum in a list format. > > i.e. > > *Dir1 > > *SubDir1of1 > > *SubDir2of1 > > *Dir2 > > *SubDir1of2 > > *SubSubDir1of2 > > ... etc. > > > > There are some truly great php applications for this, such as: > > http://freshmeat.net/projects/phpmyexplorer/ > > But it's way ahead of what I need. > > > > Any crafty suggestions? > > > > Thanks for any input, > > > > Sean > > > > > > > > > > -- > > 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] Re: getting a LAMP job in this economy
Just got a job as a PHP Programmer, actually. Kinda rare in this area, I guess it was a matter of being in the right place at the right time with the right skills. I've been hired twice in the past based at least in part on my PHP skills, as well. Mike "Vincent Stoessel" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On another list that I am on someone made this very bold > statement: > > "I've seen a lot of jobs for ColdFusion & Oracle or MS SQL server > experience combinations. Don't let anyone fool you, PHP/MySQL is not > going to land you a job [;)] " > > now, as someone that was making avery good living doing Linux based > web application development last year and now among the jobless I am beginning > to question the validity of having all of my eggs in the LAMP (linux apache mysql php) > basket. I just recently built a NT4 to do some win based development on. I still have > not installed any development enviroment cause it just feels so alien. Has anyone else > out there feeling the pressure of going to the win32 side to pay the bills. > Thoughts? > > > -- > Vincent Stoessel [EMAIL PROTECTED] > Linux and Java Application Developer > (301) 362-1750 > AIM, MSN: xaymaca2020 , Yahoo Messenger: vks_jamaica > -- 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] Re: wierd function behavior within classes.. Bug?
Remember, You *can* make certain values in a function optional. Place them on the right side of the arg list and give them a default value, like: function myFunction(arg1, arg2, arg3 = "foo", arg4 = "bar") { ... function guts ... } Hope that helps. Mike Frazer "Mike Eheler" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > PHP doesn't support that. > > Dunno if it plans to, either. > > There are workarounds.. can't remember exactly how it's done, but I > think I saw it on phpbuilder.com in a tutorial somewhere. > > Mike > > Marc Swanson wrote: > > I'm not sure if this is a known feature in php.. but the following code will > > generate this warning: Warning: Missing argument 2 for foo() in > > /raid/htdocs/test.php on line 7 > > - > > > class Foo { > > function Foo($bar) { > > // no argument constructor > > echo"One argument Constructor.\n\n"; > > } > > function Foo($bar,$baz) { > > // one argument constructor > > echo"Two argument constructor.\n\n"; > > } > > } > > > > $foo = new Foo("foobared constructor"); > > ?> > > - > > while simply swapping the functions around removes the warning > > > > - > > > class Foo { > > function Foo($bar,$baz) { > > // one argument constructor > > echo"Two argument constructor.\n\n"; > > } > > function Foo($bar) { > > // no argument constructor > > echo"One argument Constructor.\n\n"; > > } > > > > } > > $foo = new Foo("foobared constructor"); > > ?> > > -- > > > > > > This is running on php version 4.0.3pl1 > > Is it supposed to be this way for some reason or is this a bug? I believe I > > found that it happens with all functions within a class (not just > > constructors). > > > > Thanks > > > > > > > > > -- > It is Fortune, not Wisdom, that rules man's life. > -- 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] Re: Resalution Dection
Try Javascript. I dont recall offhand but there are some properties you can use in Javascript to detect this sort of thing. PHP is all done server-side and can't collect system properties from the user. Mike Frazer "Philip J. Newman" <[EMAIL PROTECTED]> wrote in message 00b201c1a549$39daf0d0$0401a8c0@philip">news:00b201c1a549$39daf0d0$0401a8c0@philip... I'm trying to display an image only if the user has a hi resolution? can anyone help? Philip J. Newman Philip's Domain - Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Phone: +64 25 6144012 -- 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] Re: getting a LAMP job in this economy
We're all in a good position right now. The economy is beginning a strong rebound, the pretenders have been weeded out, and a lot of companies are now beginning to see both the technical AND financial benefits of open-source technology. No buying licenses for server systems that provide less stability and a lot more fluff (draw your own conclusions from that :) ). Open source systems may require a little more configuration and actual effort to get off the ground, but if done right they will stay where you put them instead of crashing back down and validating Newton's law of gravity. Finding a LAMP job (or something including any of those components) will become easier as the positions become more plentiful. Come March you'll see a noticeable change. Please mark my words :) Mike Frazer "Michael Kimsal" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Vincent Stoessel wrote: > > > On another list that I am on someone made this very bold > > statement: > > > > "I've seen a lot of jobs for ColdFusion & Oracle or MS SQL server > > experience combinations. Don't let anyone fool you, PHP/MySQL is not > > going to land you a job [;)] " > > > > now, as someone that was making avery good living doing Linux based > > web application development last year and now among the jobless I am > > beginning > > to question the validity of having all of my eggs in the LAMP (linux > > apache mysql php) > > basket. I just recently built a NT4 to do some win based development > > on. I still have > > not installed any development enviroment cause it just feels so alien. > > Has anyone else > > out there feeling the pressure of going to the win32 side to pay the > > bills. > > Thoughts? > > > > > > > This really depends on how you want to work and/or approach 'jobs'. > > Do you consider a job a place to go for 40 hours a week and get a > paycheck? Or is it more than that? > > Being able to positively improve an employer's bottom line is always a > plus you can bring to any 'job' - you're there to do work and make them > money too. If you can help by furthering the use of Linux/PHP/etc due > to the licensing cost issues, so much the better. > > I will never again (bold words I know) *merely* have a job where I'm > told what to do by someone who doesn't really give a rat's ass about me. > :) (been there done that too many times). When approaching a job > now, I would be more proactive about what impact I can make in a > company, and the Linux/PHP skills/experience would be a facet of that, > no doubt. > > Sure, there are many people advertising for "ASP" developers, etc. > Perhaps they're not finding qualified people, and need to advertise? > I'd say PHP/MYSQL won't land you a job, but neither will CF, or Java, or > anything else. You need to sell YOURSELF, and if you sell your ability > to further a company's objectives (make money) many won't care what you > use, or at least won't care to the point of restricting you. There will > always be shops that are CF only, or MS only, or whatever. But there's > a (growing, I think) number of businesses out there that simply need to > have things work - be the person who helps them achieve their goals, and > you'll succeed just fine. > > Michael Kimsal > http://www.tapinternet.com/php/ > PHP Training Courses > 734-480-9961 > -- 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] Re: get image from blob in mysql
The code below doesn't show the test you mentioned. By all means testing if a variable = "" should work, but you may want to try something like if (!$resultado['Imagem_data']) { ... } Sometimes testing a value against "" can cause problems because of non-appearing whitespace that may exist in the variable. SOMETIMES, not all the time, and I really couldn't tell you EXACTLY how PHP reacts to some of these conditions, because I believe it to be system-dependent if memory serves me (kind of like the differences between "\n" on Unix/Linux and Windows). Just play around with things, but I'd like to see the code you are using for this condition. Mike Frazer "Rodrigo Peres" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > List, > > I'm using the following code to retrieve image from Mysql. My problem is how > can I output another image if the given ID doesn't have an image on it??? I > had already inserted a blank gif in the database in order to use it, but > I've tried to check if ($resultado['Imagem_data'] == "") or null and > outputs the blank gif, but didn't work. > > > $conexao = new conexao(); > $query = new Query($conexao); > $sql = "SELECT Imagem_data,Imagem_type FROM imagens WHERE > CelebID='$celebID'"; > $query->executa($sql); > $resultado = $query->dados(); > $imagem_banco = $resultado['Imagem_data']; > $type = $resultado['Imagem_type']; > if($imagem_banco != "") { > HEADER("Content-type: $type"); > echo($imagem_banco); > } > > Thank's > > Rodrigo > -- > > -- 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] Re: PHP in the University and Corporation [was RE: [PHP] Computer Science and PHP]
In order to make a living as a programmer, unless you can seriously wow your potential employers with raw ability, it's difficult to make any real money unless you have a little piece of paper that says "Look what I can do!" I've been programming in PHP, Perl, ASP, Java, Visual Basic, C and C++ to some extent for the last seven years, but aside from a 1-year certification in VB that has since expired I simply haven't been able to afford a certification course. The also only offer your standard Computer and Information Science degree here at the University of Delaware, nothing in Web. Here's something to do, though: most of the major universities I've looked into do *not* offer a Web Development degree. Lobby to have it added, but in the meantime look to your local community college or technical college. They more often than not WILL offer courses and ultimately an associate's or bachelor's degree in Web Development. More and more are offering courses in open source solutions because the world appears to be getting over it's fear of free products ("if they aren't charging for it, it can't be that good" mentality). Certifications/degrees are not only just the difference between getting and not getting certain jobs, but for the ones you can get it's also the difference between $25,000/yr and $75,000/yr unless you really *are* God's gift to programming. Take care, Mike Frazer "Chris Lott" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Computer science is considered an engineering discipline in most > institutions. And I think that's good... we need people out there to develop > OS's, create database servers, etc. PHP can be effectively used in this > curriculum, but C seems a lot more to the point. > > The place where PHP could (and should) make inroads is in the web > development curriculum that is generally split off from the formal computer > science programs. I think that split is a good thing even if it is made for > the wrong reasons... and while one can quibble about "real programmers" and > such, these programs that encompass web design, web mastering, systems admin > and networking are the real ground for advancing PHP. > > Many institutions, like the one I teach for, are entrenched in ASP and Java > because that is understood by administrators as "a good thing to do" and > because it is often easier to find instructors with these skills (or at > least the certifications). But there are inroads being made. I have > typically taught web design, internet and networking. Now I finally am > getting a chance to teach a PHP/MySQL class as part of the web development > curriculum (finally as in we finally found good instructors to take the > other courses so that I would have time). > > Also, these programs are typically staffed by a cadre of aduncts. If you > have PHP skills and teaching skills and you can basically donate your time > for the peanuts that are offered (and the fun of it), there is a place for > YOU to help promote PHP. > > Someone else remarked that certifications would advance PHP. There is > something to that, particularly in the corporate marketplace to USE it. More > often, in my experience, PHP is slow to be adopted in the corporate > environment because MS is so entrenched, and because MS' firm establishment > on the desktop means hiring MS people, who naturally promote and hire other > MS people, and administrators often equate using other technologies with > abandoning their desktops. > > Certification has an equally negative aspect, though, unless stringently and > particularly administered and granted, which would defeat the marketing > ends. > > c > -- > Chris Lott > http://www.chrislott.org/ -- 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] Re: upload permission denied!
Try changing the permissions of the parent directory. I've had that problem in the past and that was the only thing that seemed to fix it. Mike "Sundogcurt" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm not sure if this is a problem I can overcome with PHP or if I have > to go directly to the Linux box to fix (I hope not). > > I have moved my development from a win32/apache/mysql box to a > Mandrake/apache/mysqly box and have only one problem (that I know of) to > overcome. > > When I try to upload an image (with scripts that worked just fine on the > win32 system) I get a permission denied error. The dir that I am trying > to write to has permissions for everybody to do anything! (777 or 0777 > how ever you want to format it). The scripts are located in my user dir > under public_html etc etc. I can create directories in there but I can't > seem to convince the darn thing to copy an image. It seems to upload (no > errors) but that is where it ends. I don't know what other information > you need from me or if this is even the proper list to be submitting to. > > Again I say I am able to create directories but not copy an image. ??? > > Thanks and I'm sorry that my question has anything to do with uploading > stuff eheheh > > ~Curtis~ > -- 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 vs asp
If ASP is as slow with MySQL as it is with native Microsoft DBs (Access, SQL Server), then you may be in trouble. I did some work for a friend who owns a hosting company on a site done in ASP and the worst part of the whole thing was testing because the database was so slow. He's got some high-end servers, too, so it wasn't the system slowing it down. I have my personal site with him and it seems to load stuff from MySQL about 2-5 times as fast as the ASP-based sites load from SQL Server. My two cents. Mike Frazer "Jon Farmer" <[EMAIL PROTECTED]> wrote in message 025001c1a810$587b6730$[EMAIL PROTECTED]">news:025001c1a810$587b6730$[EMAIL PROTECTED]... > > sorry i should have explained myself abit better.i am a huge fan of > php > > hence why i subscribe to this mailing list. its just that i need to settle > > an argument. my understanding is that php works better with mysql however > a > > friend of mine is adament that asp will work just as well. i am not > > sure > > > Hmm I have to say it would depend on the quality of the ODBC driver you > would be using. > > For instance: would you be able to get the insert id with ASP as easily as > PHP? > > Look at all the MySQL functions in PHP and ask your friend hwo they would > accomplish this in ASP. > > I would be interested to hear what your friend has to say to this, I would > appreciate if you would drop me his/her reaction.. > > Regards > > Jon > > > -- > Jon Farmer > Systems Programmer, Entanet www.enta.net > Tel 01952 428969 > PGP Key available, send email with subject: Send PGP Key > -- 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] Re: How do I use a confirm box to confirm before deletion from a database
Use Javascript on the links. I've done this for all delete links I've done with database-driven sites. Place the following code in the section of the pages: var goTo; function verifyClick(goTo) { var choice; choice = confirm("Are you sure you want to delete this entry?"); if (choice) { window.location = goTo; } } Then just have it print something like the following for the links: Delete of course you'll need to set up the link however your scripts require, but the basic idea here is that if the user clicks OK then the link passed to the javascript function verifyClick() is executed. Hope that helps. Mike Frazer "Ivan Carey" <[EMAIL PROTECTED]> wrote in message 006301c1a7f4$a195ea60$0201a8c0@icarey">news:006301c1a7f4$a195ea60$0201a8c0@icarey... Hello, Thankyou for your reply. When a user clicks upon a delete link that deletes a record from a database, I would like to be able to give them the option to OK or Cancel this action. I have tried coding the browsers built in confirm box (I can bring up this) but am unable to combine it with php or a combination of php and a javascript funtion Thanks, Ivan -- 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] Re: broken imap client?
I also think there are a few bugs with IMAP. I have 4.0.1 (time to update, I know...see below) and have experienced a few problems with the imap_*() functions: 1 - Enabled pop3d on system; set protocol to pop3; unable to retrieve mailbox listings. Pop3d working properly under manual connections (telnet to localhost port 110) 2 - Swtiched to imapd; connections work perfectly; when listing mailboxes I instead get a list of *every single file* on my system. Mind you I've not used these functions in the past; however, I don't see how this could be expected behavior. Tried to upgrade yesterday but it seemed as if there was a problem with the archive. Recieved unexpected EOF in archive file. I didn't get a chance to re-download it, I'll do that today and report if there are any problems still. Mike Frazer "Cary Mathews" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've been trying to compile php_4.1.1 with imap support for the last > couple of days (seems like weeks!). I have the OpenBSD 2.9 ports version > of the c-client2000 libraries, along with the source of pine4.44, which > uses the same libraries, I think. I can ./configure --with-imap={lib dir} > and it configures and builds just fine. But when I attempt to install it > as a DSO in Apache, and do an apachectl configtest I get the following: > /usr/libexec/ld.so: Undefined symbol "_mail_string" in > httpd:/usr/local/apache/libexec/libphp4.so > > So I try to install it as a static module in Apache, and Apache bombs on > the build with: > /usr/libexec/ld.so: Undefined symbol "_mm_dlog" in > gen_test_char:{lib dir}/libc-client.so.2.1 > *** Error code 1 > > In short, I think the c-client libraries are broken, at least as far as > php is concerned, but the php documentation says that the c-client libs > are required for IMAP support. Can someone help me understand what I am > doing wrong? > > Thanks in advance, > Cary > > -- 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] Re: Cobalt RAQ4 apache config index.php
RaQ4 systems still use what is *basically* a standard config (the only real difference is some really stupid Perl code for SSL that can screw the whole system up). I don't recall where in the Web-based admin area you change these values, but the httpd.conf still has the DirectoryIndex line. Just open it in a text editor and do a search for DirectoryIndex. NOTE: Remember that changing these files manually will void your Cobalt warranty! Mike Frazer "Beeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am using a Cobalt RAQ4 server and need to edit my config file to allow > index.php as the directory index. the config file appears non standard, ad > it has the pearl for the web based server administration.. What and where do > I need to add the DirectoryIndex? also how do I disable the directory > listing. > > -- 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] Re: Cobalt RAQ4 apache config index.php
I don't remember if the DirectoryIndex directive is usable inside VHosts, it might just be global. But yes, to use it add the following line: DirectoryIndex filename1 filename2 filename3 Add as many as you want, and use any names you want. Recommended order would be something along the lines of DirectoryIndex index.htm index.html index.shtml index.php index.php3 index.cgi Mike Frazer "Beeman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > The config file currently doesn't have any occurance of DirectoryIndex, can > I just add it within the virtual host for the site that I want to modify. it > currently will default to index.html or index.htm and then the directory > listing if neither index is found. Is the DIrectoryIndex param similiar to > IIS where you can enter multiple values, and it searches for the index in > the order they are in the list?? > "Mike Frazer" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > RaQ4 systems still use what is *basically* a standard config (the only > real > > difference is some really stupid Perl code for SSL that can screw the > whole > > system up). I don't recall where in the Web-based admin area you change > > these values, but the httpd.conf still has the DirectoryIndex line. Just > > open it in a text editor and do a search for DirectoryIndex. > > > > NOTE: Remember that changing these files manually will void your Cobalt > > warranty! > > > > Mike Frazer > > > > > > "Beeman" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > I am using a Cobalt RAQ4 server and need to edit my config file to allow > > > index.php as the directory index. the config file appears non standard, > ad > > > it has the pearl for the web based server administration.. What and > where > > do > > > I need to add the DirectoryIndex? also how do I disable the directory > > > listing. > > > > > > > > > > > > -- 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] Re: Array() Limit
Obviously RAM will come into play in this but there is a system-dependent limit. I forget which type it uses (int, double, long, etc) to determine this limit, but math in computers is always finite, as there will always be a maximum limit, depending on how many bits your system is capable of handling. Mike Frazer "Zach Curtis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there a limit to the number of key=value pairs that can be stored in an > array? Or is this more a function of RAM limits? > > Thanks. > > > Zach Curtis > POPULUS > -- 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] Write an array to a file
More than one way to skin a cat :) The question obviously is whether or not you need to read this data back or if it will be static, unread data. You can use several forms here, including the one below. However, you can use for, while and foreach loops to handle it: /* for (...) method */ $fp = fopen("/path/to/file", "w"); // open file for writing for ($i = 0; $i < sizeof($array); $i++) { $status = fwrite($fp, $array[$i]); // Change the part with $array to whatever you need to write } $status = fclose($fp); /* foreach (...) method */ $fp = fopen("/path/to/file", "w"); // open file for writing foreach ($array as $item) { $status = fwrite($fp, $item); // Change the part with $item to whatever you need to write } $status = fclose($fp); /* while(...) method */ $fp = fopen("/path/to/file", "w"); // open file for writing while (list($key, $val) = each($array)) { $status = fwrite($fp, $val); // Change the part with $val to whatever you need to write } $status = fclose($fp); There are other ways, as there always are with PHP. However, these should get you by in just about any circumstance. Mike Frazer "Greg Schnippel" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Scott - You can just write it as a pipe-delimited file, write it to the file, and then read it back in. Use implode and explode: $company = array("Item 1", "Item 2", "Item 3", "Item 4"); #- # # Output array # $output_string = implode("|", $company); << write $output_string to a file >> # # Read array from file # if (!$file=fopen("file.txt", "r")) { echo "Error opening file"; } else { $input_string = fread($file,2048); } $company = explode("|", $input_string); #- -schnippy > -Original Message- > From: Scott Saraniero [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 29, 2002 12:34 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Write an array to a file > > > Hi, > > How do I write an array to a file? For example, I need to > write just this in > a file: > 4", "Item 5",); > ?> > > I've been hung up for 2 days on this. Any help would be appreciated. > > 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] Re: sockets
Are you referring to PHP sockets or C sockets? PHP sockets are an implementation of C sockets (which is why most of the actiones needed are the same in PHP but are somewhat simplified). If you mean PHP sockets, you can try taking a look at WhoisPro, a Whois/NICNAME script I wrote to understand how to implement sockets in PHP. If you mean C sockets, well, I'm currently learning them myself. Let me know which you need and I can try to get you some resources for them. Mike Frazer "Kunal Jhunjhunwala" <[EMAIL PROTECTED]> wrote in message 03dd01c1a8f9$eb909a10$0301a8c0@CONFUSED">news:03dd01c1a8f9$eb909a10$0301a8c0@CONFUSED... > hey.. > does anyone know of any good resources for using sockets? which will also > explain using sockets to connect to various protocols? like ftp, httpd, > mysql etc? Also, somewhere one can read on writing a connection deamon... > Thanks! > Regards, > Kunal Jhunjhunwala > -- 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] Re: Using $PATH_INFO as variables (inspired by www.DevShed.com)
What server are you running on? In Apache, if you add any filename to the DirectoryIndex line, it will display that page from any directory without specifying the filename. It comes default with pages like index.htm, index.html and index.shtml. If you add, for instance, index.php (some distros have this by default, as well), then you can have it load that page by default with no file listed on the address/location bar in our browser. Mike "Dr.Bob" <[EMAIL PROTECTED]> wrote in message 014501c1a98a$1f0cad30$9a3b40c3@drbob">news:014501c1a98a$1f0cad30$9a3b40c3@drbob... Hi, I'm trying to figure out how www.devshed.com does what I want to achieve also, this is my point: my main URL (for example) is www.mycompany.com I want the central page about our projects to be found under www.mycompany.com/projects and project LovePeaceAndBananas under www.mycompany.com/projects/LovePeaceAndBananas I already know that this can be achieved by using the $PATH_INFO as variables, to be used in de main file in the root of the site. So far I have my Apache webserver accept files with no extention (index, in stead of index.php) to be parsed as PHP. But if I look at the site of DevShed, I don't see them using a file at all! I can't get it to work on my local test system to make an URL like www.mycompany.com/projects/LovePeaceAndBananas without the existens of a file called 'projects'. Can anyone tell me their 'trick'? (unfortunately, they don't show their page source anymore like they used to do ...) Also, when I try to extract the variabeles from the $PATH_INFO I get some errors depending whether or not I end with a slash, and I do want to make this fool prove, so that when a site visitor deletes the slash at the end, it doesn't result in an error. This is the code I made: --- "; } ?> --- And when I call this file (localhost/index) like this: http://localhost/index/one/two/three/ This is my output: --- variable 0 = variable 1 = one variable 2 = two variable 3 = three variable 4 = --- Ofcourse I don't need the variable 0 and 4, can someone tell me where they come from? And, as said above, I get an Undefined Ofset-warning when I don't have a closing slash at the end, how can I protect this? Phew -- a lotta lotta questions here, hope someone can help me to climb this PHP-mountain:-) Thanx in advance! Dr.Bob -- 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] Re: Problem
First, I recommend installing PHP4. There's a host of new features. Second, it sounds like your problem may be that you compiled PHP without mysql support. The command for PHP4 is, I believe, "--with-mysql" when you call the configure script. Get PHP 4.1.1 from the site (I downloaded it from the default site and got a busted file, so I recommend downloading it from a mirror). Look through the Installation part of the manual for a complete list of config commands so you can install everything you may need. Mike Frazer "Uma Shankari T." <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > I have installed mysql and php successfully.While connecting with mysql it > is giving error like this > > ss.php: No mySQL support on line 11 >$link=mysql_connect("$hostname","$username","$password"); > > Manually i can connect mysql by giving like this > > mysql -uusername -ppassword > > It is connecting.If there any function to find out wheather php supporting > mysql. > > If there is any problem with mysql means manually i can't connect know... > > I have tried this one also > > phpinfo(); > > It is giving all the details about php line doc root,hostname.port address > etc... > > Then where is the problem > > Tell me as soon as possible > > with Thanks & Regards, > Uma > > -- 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] Re: get the clicked submit image
I *think* you can get the values with $HTTP_GET_VARS['image1.x'] (and the same for image1.y). If your method is set to POST, use the $HTTP_POST_VARS array instead. Obviously to tell which one the user clicked you can use if (isset($HTTP_GET_VARS['image1.x])) { ... code here ... } If the value has been set, that image was clicked. The x and y values correspond to the precise pixel that was clicked which allows these to be used as pseudo-imagemaps which you can code for. Mike Frazer "Ergin Aytac" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a form-page with several image-submit buttons. how can I know which > image is clicked? It's not allowed to use java-script or any client-side > "make the life easy"-scripts. > > > > > > > I get two vars per image with the clicked point values on the image like > image1.x, image1.y and so on. How can I get the values of these variables? I > tried $image1.x, ${"image1.x"}, $image1["x"], but they didnt work. I could > not find out the correct syntax. > > if I get the value of these vars or use the isset function, I can get out > which image is clicked because the "non-clicked" image has no values for the > clicked-point on itself. > > the vars are available in $QUERY_STRING so I could parse it, but I think > there is a simple way to get these vars. > > thanx (also for any links to manuals). > > Ergin Aytac > > -- 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] session data vs cookie data
HTTP_REFERRER is another good way to check. This allows users to access the page ONLY from a specific set of referring pages. However, if you have a gigantic site this can be cumbersome and can create a rather large array of referring pages, so you may want to put the value through a reg-ex that checks for the hosts on your domain (like www.domain.com, subdomain.domain.com, etc). That locks out all other domains, at least. Don't use this as your sole method of verification, but you can certainly include it. Mike Frazer "Jerry Verhoef" <[EMAIL PROTECTED]> wrote in message 1CDA86C6527BD311B91F0008C784121003D55205@ugbiex1">news:1CDA86C6527BD311B91F0008C784121003D55205@ugbiex1... > > > > -Original Message- > > From: Erik Price [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, January 30, 2002 3:30 PM > > To: PHP > > Subject: [PHP] session data vs cookie data > > > > > > I have read elsewhere that depending on Cookie data for site > > authentication is false economy, because Cookie data can be spoofed. > > > > True > > > > > I'm designing a login that auto-fills a person's name into a > > field for > > authentication (based on their $user_id, which is stored in > > the cookie), > > then they enter a password below that name and the fields are checked > > against data stored in MySQL. Standard authentication > > system. But from > > that point onward, I'd like to use a session variable that > > establishes > > the user's legitimacy as having logged in, using the cookie > > to store the > > SESSID. > > > > Barring the user spoofing the SESSID in the cookie, could > > someone easily > > fake legitimacy? I would think not, since the session data > > ("$logged_in = 1" or something similar) is not stored in the > > cookie but > > rather on the server. But I just want to confirm. > > > > It is possible to "steal" a session because a session_id is usually based on > a cookie. So I always store the IP, HTTP_X_FORWARD and USER_AGENT in the > session. And check them every page. > > kind regards, > Jerry > > > > > I should mention that I have register_globals = off in > > php.ini (4.1.0 on > > Linux). > > > > > > Thanks, > > Erik > > > > > > -- > > 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] > > > > > The information contained in this email is confidential and > may be legally privileged. It is intended solely for the > addressee. Access to this email by anyone else is > unauthorized. If you are not the intended recipient, any > form of disclosure, production, distribution or any action > taken or refrained from in reliance on it, is prohibited and > may be unlawful. Please notify the sender immediately. > > The content of the email is not legally binding unless > confirmed by letter bearing two authorized signatures. -- 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] Re: Using $PATH_INFO as variables (inspired by www.DevShed.com)
Looks to me like you're dealing with Apache rewrite rules, which goes beyond the scope of PHP. Mike Frazer "Dr.Bob" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have Apache on WinXP. > That sounds great what you write here, but does this also work when, for > example, I have that file index.php in www.mycompany.com and when I access > the URL with www.mycompany.com/projects that he sees it as > www.mycompany.com/index.php?var=projects ? > Or does it only work when you go to the root of the site or subdir? > > Dr.Bob > > > "Mike Frazer" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > What server are you running on? In Apache, if you add any filename to the > > DirectoryIndex line, it will display that page from any directory without > > specifying the filename. It comes default with pages like index.htm, > > index.html and index.shtml. If you add, for instance, index.php (some > > distros have this by default, as well), then you can have it load that > page > > by default with no file listed on the address/location bar in our browser. > > > > Mike > > > > > > > > "Dr.Bob" <[EMAIL PROTECTED]> wrote in message > > 014501c1a98a$1f0cad30$9a3b40c3@drbob">news:014501c1a98a$1f0cad30$9a3b40c3@drbob... > > Hi, > > I'm trying to figure out how www.devshed.com does what I want to achieve > > also, this is my point: > > > > my main URL (for example) is www.mycompany.com > > I want the central page about our projects to be found under > > www.mycompany.com/projects > > and project LovePeaceAndBananas under > > www.mycompany.com/projects/LovePeaceAndBananas > > > > I already know that this can be achieved by using the $PATH_INFO as > > variables, to be used in de main file in the root of the site. > > So far I have my Apache webserver accept files with no extention (index, > in > > stead of index.php) to be parsed as PHP. But if I look at the site of > > DevShed, I don't see them using a file at all! I can't get it to work on > my > > local test system to make an URL like > > www.mycompany.com/projects/LovePeaceAndBananas without the existens of a > > file called 'projects'. > > Can anyone tell me their 'trick'? (unfortunately, they don't show their > page > > source anymore like they used to do ...) > > > > Also, when I try to extract the variabeles from the $PATH_INFO I get some > > errors depending whether or not I end with a slash, and I do want to make > > this fool prove, so that when a site visitor deletes the slash at the end, > > it doesn't result in an error. > > > > This is the code I made: > > -- > -- > > --- > > > $var_array = explode("/",$PATH_INFO); > > $words = array_unique ($var_array); > > $total = count($words); > > for ($i = 0; $i <= $total; $i++) { > > echo "variable " . $i . " = " . $var_array[$i].""; > > } > > ?> > > -- > -- > > --- > > > > > > And when I call this file (localhost/index) like this: > > http://localhost/index/one/two/three/ > > > > This is my output: > > -- > -- > > --- > > variable 0 = > > variable 1 = one > > variable 2 = two > > variable 3 = three > > variable 4 = > > -- > -- > > --- > > > > Ofcourse I don't need the variable 0 and 4, can someone tell me where they > > come from? > > And, as said above, I get an Undefined Ofset-warning when I don't have a > > closing slash at the end, how can I protect this? > > > > Phew -- a lotta lotta questions here, hope someone can help me to climb > this > > PHP-mountain:-) > > Thanx in advance! > > Dr.Bob > > > > > > > > > > > > > > > > -- 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] Re: Page Not Found - on IE
Page not found (error 404) or Page cannot be displayed (a DNS error, as stated at the bottom of the screen)? I've seen the latter of the two countless times, only in IE. Mike Frazer "Bryan Gintz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Sometimes with certain PHP scripts, when a form is posted to another PHP > script, IE says the page cannot be found. It seems to happen randomly, > and if you refresh a couple times, you can then load the page. > > Any ideas on why, and how to fix it? > > 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]
Re: [PHP] Re: Page Not Found - on IE
I have no idea what may work as a permanent fix. It's just one of those annoying Windows errors. I have, however, found that most often there's an error in your code that isn't a compile-time error. Mike "Bryan Gintz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Sorry, > > "The page cannot be displayed" > DNS Error > > Mike Frazer wrote: > > >Page not found (error 404) or Page cannot be displayed (a DNS error, as > >stated at the bottom of the screen)? I've seen the latter of the two > >countless times, only in IE. > > > >Mike Frazer > > > > > >"Bryan Gintz" <[EMAIL PROTECTED]> wrote in message > >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > >>Sometimes with certain PHP scripts, when a form is posted to another PHP > >>script, IE says the page cannot be found. It seems to happen randomly, > >>and if you refresh a couple times, you can then load the page. > >> > >>Any ideas on why, and how to fix it? > >> > >>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] Re: preg_replace() 'space' the final frontier
PHP gave us strpos() and strrpos(), which find the first and last occurrance of something within a string. What they forgot was rather important: finding the "n"th occurrance. I wrote some code you can add to your script (or put it in a separate file and require() it) that provides just such a function: function strnpos($string, $search, $nth) { $count = 0; for ($i = 0; $i < strlen($string); $i++) { if ($string[$i] == $search) { $count++; if ($count == $nth) { return $i; } } } if ($count != $nth) { return FALSE; } } Remember, PHP was created in C, and C strings are just arrays of characters. That functionality partially carries over to PHP (I say partially because "sizeof($string)" will return 1, not the length of the string). You can access individual characters just as you would access an individual element of an array. That's what the above code does. The function returns the LOCATION of the nth occurrance, it doesn't do the replacing for you. You can use it with substr_replace() like so: $string = substr_replace($string, "", strnpos($string, " ", 19), 1); or in a less compact way: $offset = strnpos($string, " ", 19); $string = substr_replace($string, "", $offset, 1); Hope that helps. Mike Frazer "Hugh Danaher" <[EMAIL PROTECTED]> wrote in message 000801c1a9c5$26007460$017f@localhost">news:000801c1a9c5$26007460$017f@localhost... What I am trying to do is have a line of text break at a "space" after reading 19 words. Having read the various methods of finding and replacing one character with another, I settled on preg_replace as my best choice, but this function doesn't accept a space in the regular expression slot. What can I do to get around this, or is there a better function than the one I selected? $statement=preg_replace(" ","",$original,19); Warning: Empty regular expression in /home/www/host/document.php on line 71 -- 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] Re: preg_replace() 'space' the final frontier
NOTE: That was done very quickly and only works on single character searches! I'm working on one that will find multi-character strings. Gimme a few mins and email me off-list if you want it. Mike "Mike Frazer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > PHP gave us strpos() and strrpos(), which find the first and last occurrance > of something within a string. What they forgot was rather important: > finding the "n"th occurrance. I wrote some code you can add to your script > (or put it in a separate file and require() it) that provides just such a > function: > > function strnpos($string, $search, $nth) { > $count = 0; > for ($i = 0; $i < strlen($string); $i++) { > if ($string[$i] == $search) { >$count++; >if ($count == $nth) { return $i; } > } > } > if ($count != $nth) { return FALSE; } > } > > Remember, PHP was created in C, and C strings are just arrays of characters. > That functionality partially carries over to PHP (I say partially because > "sizeof($string)" will return 1, not the length of the string). You can > access individual characters just as you would access an individual element > of an array. That's what the above code does. > > The function returns the LOCATION of the nth occurrance, it doesn't do the > replacing for you. You can use it with substr_replace() like so: > > $string = substr_replace($string, "", strnpos($string, " ", 19), 1); > > or in a less compact way: > > $offset = strnpos($string, " ", 19); > $string = substr_replace($string, "", $offset, 1); > > Hope that helps. > > Mike Frazer > > > > "Hugh Danaher" <[EMAIL PROTECTED]> wrote in message > 000801c1a9c5$26007460$017f@localhost">news:000801c1a9c5$26007460$017f@localhost... > > What I am trying to do is have a line of text break at a "space" after > reading 19 words. Having read the various methods of finding and replacing > one character with another, I settled on preg_replace as my best choice, but > this function doesn't accept a space in the regular expression slot. What > can I do to get around this, or is there a better function than the one I > selected? > > $statement=preg_replace(" ","",$original,19); > > Warning: Empty regular expression in /home/www/host/document.php on line > 71 > > > > -- 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] Re: preg_replace() 'space' the final frontier
Okay that was quicker than I thought. Here's the code to find the nth occurrance of a string within a string: function strnpos($string, $search, $nth) { $count = 0; $len = strlen($string); $slen = strlen($search); for ($i = 0; $i < $len; $i++) { if (($i + $slen) > $len) { return FALSE; } if (substr($string, $i, $slen) == $search) { $count++; if ($count == $nth) { return $i; } } } if ($count != $nth) { return FALSE; } } It returns the STARTING POINT of the nth occurrance of the string. If you are looking for the first occurrance of the word "test" and "test" covers positions 10-13, the function returns 10, just like the built-in functions strpos() and strrpos(). $string is the string to be searched; $search is what you are searcing for; $nth is the number of the occurrance you are looking for. Hope you all can make use of this! Mike Frazer -- 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-PHP-RAQ4 dilemma!
Have you ever connected to MySQL from the local machine? Sounds like a permissions problem, because it appears to be successfully creating the socket. Your user may not be set up to access it from localhost, perhaps just the remote machine. Log in to MySQL as admin/root and execute the following query: GRANT ALL PRIVILEGES ON 'database' TO 'username@localhost' IDENTIFIED BY 'password'; Obviously, substitute database, username and password with your specific values. That query will allow the particular user/pass combo to access MySQL from the local machine. Mike Frazer "Greg Conway" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi Steve, > > Thanks. I have tried this (the line was not there), but still I have my > original problem. I am now suspecting it is more than a PHP problem, as I > have the same problem with Zope (where I have PHP installed :) but I don't > think the MySQL connector is reliant on it!), namely: > > Error > MySQL said: > > MySQL Connection Failed: Can't connect to local MySQL server through socket > '/tmp/mysql.sock' (111) > > So I think it's something wrong with the MySQL somewhere... despite the fact > that MySQL is running okay! I have Db Tools querying the Db okay from > outside the machine!! > > Anyway, thanks for the tip. > > Regards, > > Greg. > > > -Original Message- > > From: Steve Werby [mailto:[EMAIL PROTECTED]] > > Sent: 30 January 2002 22:41 > > To: Greg Conway; Php-General > > Subject: Re: [PHP] MySQL-PHP-RAQ4 dilemma! > > > > > > "Greg Conway" <[EMAIL PROTECTED]> wrote: > > > I'm trying to add MySQL to my RaQ4. It came > > > by default with PHP4 but no MySQL. > > > > I'd have to check a clean RaQ4 to be sure, but I thought MySQL > > was installed > > by default, but it was setup as a loadable module in PHP and was commented > > out by default. Please check for the file mysql.so on your > > server. If it's > > there, you're PHP has MySQL support compiled, it just needs to be > > turned on. > > Try checking for /usr/lib/apache/php/mysql.so or in case it's in > > a different > > location try "locate mysql.so". If you find it, try this. > > > > 1. Edit /etc/httpd/php.ini and add the following at the bottom: > > > > extension=mysql.so > > > > If it's there, but has a ";" in front, remove the ";" as that's a comment > > character. > > > > 2. Restart Apache. > > > > /etc/rc.d/init.d/httpd restart > > > > -- > > Steve Werby > > President, Befriend Internet Services LLC > > http://www.befriend.com/ > > > > *** > This is a confidential communication between sender and addressee. If you are not the intended recipient of this message, please notify the sender and do not read, copy, use or disclose this communication to others. Any opinions or views expressed are those of the individual, and unless otherwise stated, are not those of the company. All attachments and intellectual rights remain the property of GML (NT) Limited. > *** -- 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 4.1.1 Dynamic Module Install
Okay, I finally decided to upgrade to 4.1.1. I did a double compile, one for the binary and one for the dynamic module (seen this done a few times). I followed the steps in the INSTALL file *exactly*, restarted Apache, but the version is still reporting as 4.0.1, not 4.1.1. I checked the date on libphp4.so and it is today's date. I checked the httpd.conf and it's referencing that file. I copied the new php.ini-dist to /etc/php.ini which is where Redhat apparently puts its php.ini file. phpinfo() shows that as being the location. Everything is there in the right place but I still am showing the wrong version. I copied the binary to where the old binary was and checked the version, and it's showing up correctly as 4.1.1. Any ideas? Mike Frazer -- 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] Re: PHP 4.1.1 Dynamic Module Install
Just a thought...does Redhat 7 install httpd initially with the static module? Mike "Mike Frazer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Okay, I finally decided to upgrade to 4.1.1. I did a double compile, one > for the binary and one for the dynamic module (seen this done a few times). > I followed the steps in the INSTALL file *exactly*, restarted Apache, but > the version is still reporting as 4.0.1, not 4.1.1. I checked the date on > libphp4.so and it is today's date. I checked the httpd.conf and it's > referencing that file. I copied the new php.ini-dist to /etc/php.ini which > is where Redhat apparently puts its php.ini file. phpinfo() shows that as > being the location. Everything is there in the right place but I still am > showing the wrong version. > > I copied the binary to where the old binary was and checked the version, and > it's showing up correctly as 4.1.1. > > Any ideas? > > Mike Frazer > > -- 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] Re: PHP 4.1.1 Dynamic Module Install
Okay figured it out. I'm an idiot, that was the problem. I did "/usr/sbin/httpd stop" "/usr/sbin/httpd start" I should have done "/etc/rc.d/init.d/httpd stop" "/etc/rc.d/init.d/httpd start" Realized my error when it worked after a reboot. Mike "Mike Frazer" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Okay, I finally decided to upgrade to 4.1.1. I did a double compile, one > for the binary and one for the dynamic module (seen this done a few times). > I followed the steps in the INSTALL file *exactly*, restarted Apache, but > the version is still reporting as 4.0.1, not 4.1.1. I checked the date on > libphp4.so and it is today's date. I checked the httpd.conf and it's > referencing that file. I copied the new php.ini-dist to /etc/php.ini which > is where Redhat apparently puts its php.ini file. phpinfo() shows that as > being the location. Everything is there in the right place but I still am > showing the wrong version. > > I copied the binary to where the old binary was and checked the version, and > it's showing up correctly as 4.1.1. > > Any ideas? > > Mike Frazer > > -- 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] libmcrypt v2.4.x
Just a quick question: the v2.4.x function declaration for several mcrypt functions requires a path to the library (at least thats what I have gathered), whereas previous versions didn't require this. Are they looking for a specific file path, or a general path to the library files? Mike Frazer -- 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] Date format
$today = date("d/m/Y"); That will get the current date and dump it in the format you asked for (DD/MM/, complete with leading zeros). Mike Frazer "Rick Emery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... list($y,$m,$d) = explode(",",$phpdate); $newdate = "$d/$m/$y"; -Original Message- From: Jose [mailto:[EMAIL PROTECTED]] Sent: Friday, February 01, 2002 9:36 AM To: [EMAIL PROTECTED] Subject: [PHP] Date format Hi all. How can I write the date in this format (dd/mm/) if php gives me (,mm,dd)?? Thanks --Jose Fco. ( [EMAIL PROTECTED] ). OLINET, S.L. Teléfono: 952207135 - Fax: 952207600 Avda. Juan Sebastián Elcano, 39-41. 29017 Málaga. Spain -- -- 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] Re: Mysql & php
Give us the exact error message, that probably will hold the answer. Mike Frazer "Uma Shankari T." <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Hello, > > I am trying to connect php and mysql with the following syntax > > mysql_connect("localhost","username","password"); > > But it is giving error NoMysql support. > > Also i have stored the files in another webserver and trying to connect > the mysql and php in the localhost it is working properly.but it is not > working if i have tried to connect in the localhost itself > > > Then where is the problem... > > > -Uma > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file validation
A slightly less cumbersome method than the while() loop below would be a foreach() loop: function check_file($filename) { if (!$lines = file($filename)) { return false; } foreach ($lines as $line) { $num_pipes = substr_count($line, '|'); if ($num_pipes < 2 || $num_pipes > 4) { return false; } } return true; } Same result, probably absolutely no measurable (and we're talking fractions of microseconds here) difference in speed, but much easier to read. Mike Frazer "Lars Torben Wilson" <[EMAIL PROTECTED]> wrote in message 1012602758.3230.127.camel@ali">news:1012602758.3230.127.camel@ali... > On Fri, 2002-02-01 at 14:02, toni baker wrote: > > I would like to prevent users from uploading a file > > that contains more than 4 pipes or less than 2 pipes. > > The code below prevents users from uploading a file > > containing more than 4 pipes, but not less than 2 > > pipes. Should I use awk, ereg, or sed? Thanks > > Unless you *have* to spawn processes to do this for you > for some reason, you can keep things a lot simpler by > doing it in PHP, something like this: > > error_reporting(E_ALL); > > function check_file($filename) { > if (!$upload_file = file($filename)) { > return false; > } > while (list(, $line) = each($upload_file)) { > $num_pipes = substr_count($line, '|'); > if ($num_pipes < 2 || $num_pipes > 4) { > return false; > } > } > return true; > } > > $userfile = 'testpipes.txt'; > if (check_file($userfile)) { > echo "File passed.\n"; > } else { > echo "File failed.\n"; > } > > ?> > > > Hope this helps, > > Torben > > > system ("/bin/cat $userfile|/bin/sed -n > > 's/.*|.*|.*|.*|.*|/&/p'> pipes.txt; > > $fd =fopen("pipes.txt", 'r'); > > $pipes5=fgets($fd,50); > > echo ($pipes5); > > fclose($fd); > > > > if ($pipes5) { > > print "wrong number of pipes"; > > } > > > > The uploaded file below should not pass but it does: > > > > a|b|c|d|e > > a|b|c| > > a|b|c|d > > a|b > > a|b|c|d|e > > -- > Torben Wilson <[EMAIL PROTECTED]> > http://www.thebuttlesschaps.com > http://www.hybrid17.com > http://www.inflatableeye.com > +1.604.709.0506 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file validation
Your reply piqued my curiosity so I whipped together a script that times the execution of a foreach(), a while() and a for() loop executing the same commands. The results were rather surprising in some ways but not really overall. The while() loop is, as you stated, is quicker than a foreach() loop. However, the for() loop is the fastest of all three. Below are the results of three tests: Timed foreach() loop: 0.00766 sec. Timed while() loop: 0.00689 sec. Timed for() loop: 0.00676 sec. Timed foreach() loop: 0.00768 sec. Timed while() loop: 0.00688 sec. Timed for() loop: 0.00677 sec. Timed foreach() loop: 0.00770 sec. Timed while() loop: 0.00689 sec. Timed for() loop: 0.00674 sec. The loops were parsing the text in a text file. Again, we're talking about going down to 13/100,000th-second as an average speed gain with a for() loop over a while() loop. The average difference between foreach() and while() is considerably larger, approximately 79/100,000th. But again, you'd have to run through the complete execution of the loop (53 lines of text in the file) 1,266 times to lose a single second between foreach() and while(). A minimal gain in speed; I was just mentioning it because it's easier to read a foreach() loop. But in all fairness, because the for() loop was quickest, here is the code converted to for(): function check_file($filename) { if (!$lines = file($filename)) { return false; } for ($i = 0; $ < sizeof($lines); $i++) { $num_pipes = substr_count($lines[$i], '|'); if ($num_pipes < 2 || $num_pipes > 4) { return false; } } return true; } I performed the test purely out of curiosity, not pride :) Thanks for the idea though, it was interesting to see the results. Mike Frazer PS - If you'd like the code for my Timer class, email me off-list and I'll send it to you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg_replace help
nl2br() would serve that purpose as well. See the Strings section of the Functions Reference in the manual. Mike Frazer "Martin Towell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > $lines = file("filename_here.blah"); // read in file as an array > $content = implode("\n", $lines); // join it all back together > $new_cont = ereg_replace("from", "to", $content); > fopen(...); fputs(..., $new_content); fclose(...); > > > if your intent is to replace all new lines with 's then use this instead > ... > > $lines = file("filename_here.blah"); // read in file as an array > $content = implode("", $lines); // join it all back together > fopen(...); fputs(..., $content); fclose(...); > > > hope this helps > > -Original Message- > From: John P. Donaldson [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 04, 2002 3:39 PM > To: php > Subject: [PHP] ereg_replace help > > > I have a file open and can successfully write to it, > but I was to be able to search for a certain string of > text and replace it with a string of text. I can't > figure out how to construct a proper ereg_replace > statement to search through this file and do the > replacing. Examples I've seen are in the manner of: > > $text = "line1\nline2\n"; > fputs(ereg_replace("\n", "", $text)); > > But how do I set the value of $text to be the entire > contents of the text file I've got open so it can > search through the entire file to find matches and > replace those matches? Any help is greatly > appreciated. > > Thanks, > John > > __ > Do You Yahoo!? > Great stuff seeking new owners in Yahoo! Auctions! > http://auctions.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help - config setting directives in Apache config files not working
The flexibility of the dynamic module is great. I recommend it. I haven't discovered an major advantages of the static modul myself, although I know they've got to exist (either that or it's just a remnant of previous versions, there for those who are afraid of change :) ). Compile Apache alone and then do the dynamic module, there are also fewer steps in doing so. Mike Frazer "Ed Lazor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I found this on a web site... > > >When using PHP as an Apache module, you can also change the configuration > settings >using directives in Apache configuration files and .htaccess files. > > What do you do if you compile apache and php together - ie. not a > module? I compiled using the static method and now the php_value commands > in my httpd.conf don't work. Do I have to compile as a dynamic module to > get them to work again? > > -Ed > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sockets
I've found fsockopen to be very reliable. I've done a few socket scripts with PHP (WhoisPro, et al). I believe the easiest way to check for a remotely closed socket is to do an fgets() and check for EOF: while (!feof($connection)) { $buffer .= fgets($connection, 4096); // 4096 is the chunk size, you can adjust it } I *think* EOF on a socket deonotes a remote socket close but I could be horribly wrong. Mike Frazer "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am aware of cURL, but I want to just use the standard PHP stuff if I can > because I plan on releasing this when I'm done, and want to KISS for other > people. > > I know people have to compile PHP with sockets, but they will anyways for > this project- I'm going to need socket_listen and socket_create_listen too. > > This is for a proxy server which will work kinda like multiproxy, but should > be more powerful. It will support direct connections or going through another > proxy server. It seperates anonymous from non-anonymous proxy servers, then > sorts them by speed. Data is stored in tab seperated value text files (I'm > even avoiding mySQL!!!) > > I just signed up for a page @ sourceforge. If anyone is interesting in > helping out e-mail me. > > Thanks for the idea, though. I think right now my fall-back is fsockopen. I > would really love to get sockets working for this... > > > > > > On Sunday 03 February 2002 23:32, you wrote: > > A quick note... > > > > If you are not aware of cURL (curl.haxx.se), then you may want to look into > > it. > > > > If you are, then please disregard this post. > > > > -Jason Garber > > > > At 11:06 PM 2/3/2002 -0800, Evan Nemerson wrote: > > >Anyone know if there is a way yet to see if a socket is still connected to > > > a host? I want to use a socket to send "GET / HTTP/1.0\r\n\r\n" over a > > > socket, and retrieve everything the server sends. That part works great, > > > but I can't figure out when the remote host disconnects. > > > > > >I have the CVS version of php. > > > > > >Here is the function so far. The problem is at the end. > > > > > > > > > > > >function getdata ($host, $port, $data) > > >{ > > > /* well, the below comment would be true if i could get it > > > working! */ > > > > > > /* This function sends $data to $host:$port, then returns the > > > response > > > * until connection is severed. Great for HTTP, but won't usually > > > work * too well in protocols where data needs to be analyzed, and replied > > > * to appropriatly, such as POP v3 */ > > > > > > // Create a socket > > > $so = socket_create (AF_INET, SOCK_STREAM, > > > getprotobyname("TCP")); if ( !$so ) > > > { > > > exit("Could not create socket.\n"); > > > } > > > > > > // Connect... > > > $ec = socket_connect ($so, $host, $port); > > > if ( $ec < 0 ) > > > { > > > exit ("ERROR $ec: ".socket_strerror($ec)); > > > } > > > > > > /* Write $data to socket. The manual doesn't say what it returns, > > > but I'll > > > * assume (even though it makes an ass out of you and me) that it > > > is the same > > > * as socket_connect() because it wouldn't be logical to return a > > >descriptor. */ > > > $ec = socket_write ( $so, $data, ( strlen($data) )); > > > if ( $ec < 0 ) > > > { > > > exit ("ERROR $ec: ".socket_strerror($ec)); > > > } > > > else > > > { > > > /* PROBLEM IS HERE- what do I put instead of while ( $x > > > == 0 )??? */ > > > $x = 0; > > > while ( $x == 0 ) > > > { > > > $buffer = socket_read ( $so, 1, PHP_BINARY_READ); > > > $string .= $buffer; > > > } > > > } > > > > > > // And (hopefully) return $string, for your viewing pleasure. > > > return $string; > > >} > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sockets
As I said, you're probably better off with fsockopen() anyway. Remember, the oure socket functions are experimental (or at least were last time I checked that part of the manual) and you never really know with experimental things. As well, they may change at any time, rendering your scripts useless on later versions of PHP. The Network functions, as classified in the manual, are very solid and widely supported. If it works the way you want it to with one method, why recreate your own wheel? Mike Frazer "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > That's the first thing I tried- doesn't work with the lower-level sockets. > (the socket_* functions) > > Right now I have an fsockopen version, and I'm commenting out the socket > version- hopefully I'll be able to get it to work later. > > Thanks, but do you have any other ideas??? > > > -Evan > > > > > > > On Monday 04 February 2002 14:53, you wrote: > > I've found fsockopen to be very reliable. I've done a few socket scripts > > with PHP (WhoisPro, et al). > > > > I believe the easiest way to check for a remotely closed socket is to do an > > fgets() and check for EOF: > > > >while (!feof($connection)) { > > $buffer .= fgets($connection, 4096); // 4096 is the chunk size, you > > can adjust it > >} > > > > I *think* EOF on a socket deonotes a remote socket close but I could be > > horribly wrong. > > > > Mike Frazer > > > > > > > > "Evan Nemerson" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > I am aware of cURL, but I want to just use the standard PHP stuff if I > > > can because I plan on releasing this when I'm done, and want to KISS for > > > other people. > > > > > > I know people have to compile PHP with sockets, but they will anyways for > > > this project- I'm going to need socket_listen and socket_create_listen > > > > too. > > > > > This is for a proxy server which will work kinda like multiproxy, but > > > > should > > > > > be more powerful. It will support direct connections or going through > > > > another > > > > > proxy server. It seperates anonymous from non-anonymous proxy servers, > > > > then > > > > > sorts them by speed. Data is stored in tab seperated value text files > > > (I'm even avoiding mySQL!!!) > > > > > > I just signed up for a page @ sourceforge. If anyone is interesting in > > > helping out e-mail me. > > > > > > Thanks for the idea, though. I think right now my fall-back is fsockopen. > > > > I > > > > > would really love to get sockets working for this... > > > > > > On Sunday 03 February 2002 23:32, you wrote: > > > > A quick note... > > > > > > > > If you are not aware of cURL (curl.haxx.se), then you may want to look > > > > into > > > > > > it. > > > > > > > > If you are, then please disregard this post. > > > > > > > > -Jason Garber > > > > > > > > At 11:06 PM 2/3/2002 -0800, Evan Nemerson wrote: > > > > >Anyone know if there is a way yet to see if a socket is still > > > > > connected > > > > to > > > > > > > a host? I want to use a socket to send "GET / HTTP/1.0\r\n\r\n" over > > > > > a socket, and retrieve everything the server sends. That part works > > > > great, > > > > > > > but I can't figure out when the remote host disconnects. > > > > > > > > > >I have the CVS version of php. > > > > > > > > > >Here is the function so far. The problem is at the end. > > > > > > > > > > > > > > > > > > > >function getdata ($host, $port, $data) > > > > >{ > > > > > /* well, the below comment would be true if i could get it > > > > > working! */ > > > > > > > > > > /* This function sends $data to $host:$port, then returns the > > > > > response > > > > > * until connection is severed. Great for HTTP, but won't > > > > usually > > > > > > > work * too well in protocols where data needs to be analyzed, and > > > > replied &
[PHP] Re: Links to other pages
You're server will only parse PHP files that come from your server's doot cirectory or one of the virtualhost root directories, and then only when called through the right protocol. If you call a file directly from a drive (in this case, F), you aren't accessing it through the server, and therefore are not parsing the file because the server never sees it. The reason standard HTML works that way is because HTML is browser parsed. The browser makes the decision. PHP is server-parsed, and then sends across the correct headers to force the browser into printing the output as HTML or XML or whatever is being sent. Try changing your $CFG->dirroot to a values based on your server root or a vhost root (for whichever site the script below is for). Mike Frazer "Morten Nielsen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I have a link on my page that looks like this: > > $CFG->dirroot= "f:/Inetpub/wwwroot/mymarket2"; > Login > > The link is displayed right on my page, but when I press it a dialog box is > saying that I am downloading the php file and wether I want to open or save > it. > Can anybody tell me what is wrong? > > Thanks, > Morten > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Check if var is a domain name
Your reg-ex wouldn't quite work. Remember, .info, .name, .coop and other new TLDs are out or are coming out soon. A limit of {2,3} would rule them all out as invalid. It's only really possible if you have a list of all available TLDs and compare in part to that. There are like 130 TLDs too, so it's not the most practical thig in the world. Mike Frazer "Jeff Sheltren" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, I would use a regular expression to check it. This is a pretty general > one, but I think it should do the trick. It searches for 1 or more upper > or lowercase letters, followed by a literal dot, followed by 2 or 3 > lowercase letters. Of course there are valid domains that would not match > this (foobar.co.uk) for example, but it should work with the values you > specified. > > if (ereg("^[a-zA-Z]+\\.[a-z]{2,3}$", $var)) { > // valid domain > } > else{ > // not valid > } > > Jeff > > At 07:59 AM 2/5/2002 -0800, Brandon Orther wrote: > >Hello, > > > >Does anyone know a function or how I could make a function to check a > >variable for being a valid domain name without the "www. <http://www./> > >" In fron of it? > > > >Ex. $var = "mynewdomain.com" that would be TRUE > > > >Ex2. $var = "www.mynewdomain.com" that would be FALSE > > > >Ex3. $var = "My Great Domain" that would be FALSE > > > >And so on. > > > >Does anyone have a function that makes sure there are no illegal > >characters and there is a period in the middle of the text? > > > > > > > >Brandon Orther > >WebIntellects Design/Development Manager > >[EMAIL PROTECTED] > >800-994-6364 > >www.webintellects.com > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] socket - e-mailaddress validation
If the remote system has the finger service activated, that would work. However, most servers have stopped running this and also the user generally has a say in whether they want to be listed. Out of curiosity, why do you want to do this? Mike Frazer "Bvr" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Yes, this is possible. > > However you would need to connect to the users mailserver instead of just the domain. > > Use getmxrr() to retrieve the mail exchanger associated with the domain. > > To check if the user is accepted on that server you can issue a RCPT TO: command > on it and see what happens. > > Also you can use a local SMTP server that supports the VRFY (verify) command to check > if the address is accepted. > > Google for 'RFC SMTP' for more details on the SMTP protocol. > > bvr. > > > On Wed, 6 Feb 2002 11:05:31 +0100, B. Verbeek wrote: > > >Question: > > > >Is it possible to validate an e-mailaddress by opening a socket-connection > >to the specified domein (@domain.com) and then search for username > >([EMAIL PROTECTED]) to validate an e-mailaddress? > > > >I know how to set up a socket-connection, but how do I search for the user > >in the given domain? > > > >Regards, > >bart > > > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: validating form data...
To verify the existence of both a name and message, try a test similar to the following: if ((email_is_valid($email)) && (strlen($name) > 0) && (strlen($name) > 0)) { ... } I've found that using "" in a conditional block tends to be a bit buggy. strlen() seems to be pretty solid for verifying the existence of text in a variable. Mike Frazer "Toke Herkild" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I've made a script which ought to validate if there is data in the fields or > not... but it doesn't seem to work... > > the validation is following: > if ((email_is_valid($Email)) and ($Name != "") and ($Message != "")){ > do stuff ... > } > > But even if I submit an empty form it executes "do stuf..." > I have tried to put an empty space into the $Name and $Message test but that > doesn't seem to do any difference either... > > -- 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: MessageBox in PHP?
Or shorten your code: put the Javascript into a separate file, then use if ($err) { include("/javascript/file/path/here"); } Use it over and over again via this method. "Fatih Ustundag" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > But you can write javascript code with php > like this: > > if ($err) > { > echo "" > echo "\n"; > echo "alert('ERRORR');\n"; > echo "\n"; > echo "\n"; > exit(); > } > > -Original Message- > From: _lallous [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 22, 2001 3:20 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: MessageBox in PHP? > > > you can use JavaScript to do that... > > alert('your message goes here'); > > > embed this in your HTML source code. > > it is not possible to do so in PHP since it is server side. > > "Silvia Mahiques" <[EMAIL PROTECTED]> wrote in message > 005101c15aec$9ccac280$1a9cd29b@tscpc6">news:005101c15aec$9ccac280$1a9cd29b@tscpc6... > Hi!, > How can I make a messagebox in PHP to print errors or warning (such as in VB > or VC++)?. Is it possible? > > Silvia Mahiques > > > > > -- > 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] Re: Logic/method question...
You could try using a separate file for configuration that uses arrays for each catgeory: $merchandise = new Array( 1, 2, 6, 23, ... ); Then have it run a foreach loop: foreach ($merchandise as $tempVar) { $queryConditions .= "AND code = '$tempvar'"; } You need to obviously work with it a little more, but this would be a very helpful method to use. It would allow you to add a new code to the config file without having to go digging really deep through your script. Just use include() to get the config into your script. Mike "Jeff Lewis" <[EMAIL PROTECTED]> wrote in message 004301c15b1d$b9f7ab80$76a1a8c0@LEWISJCIT">news:004301c15b1d$b9f7ab80$76a1a8c0@LEWISJCIT... It's not really, but kind of, a PHP question. I mean it is being written in PHP :) I am putting together a search feature for our classified ads and there are about 4000 each day. Now I am bulding a query to search by newspaper, date, and keywords. One last thing is categories. Curious how others would handle this...on the search screen (and on the site) we have broken down the classified codes into about 8-10 main groups (stuff like Merchandise, Transportation, Services etc). Now the problem is this: in the database, each ad goes in with it's class code which matches up with the actual category. So instead of just Merchandise we have sub categories like Christmas Trees. There are close to 1500 class codeas and when I build this I need to allow the user to select just one of the 8-10 codes and have the program return everything. Will I need to do something like: if $selection="Merchandise" then { select all ads where code="2" AND code="5" AND code="123" AND code="567" etc etc } Jeff -- 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] Re: c++ help
You're better off using Perl or something else for this if possible. Learning a new language for one thing is like taking three years of Spanish to order a taco and some refried beans. Besides, C/C++ aren't the easiest languages to learn and get good at quick. Mike Frazer "Nicolas Costes" <[EMAIL PROTECTED]> wrote in message 031101c15bc6$6ad9dec0$3dfcfea9@p2333">news:031101c15bc6$6ad9dec0$3dfcfea9@p2333... > Hello, this is out of topic but I need some URLs of good C/C++ > tutorials/exemples sites ... > I really think some of you are former C programmers :) > If it is , well, I'm lokking for a good manner to get the IPs of my machine, > particularly the one used to get on the internet !!! (something like " # > ifconfig | grep inet | cut -d":" -f2| cut -d" " -f1 " ...) > thanx ... > > [when I've finished with my C program, I get back to PHP :-)] > > > (°-Nayco. > //\[EMAIL PROTECTED] > v_/_http://nayco.free.fr > -- 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] Re: Root Certificate
I believe it's an automatic thing, just like when the secure cert is expired it will tell you that, although the site is secure, its cert is dead. Mike "Adam Whitehead" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi All- > > I recently went to a website which popped up with a dialog in Internet > Explorer > asking if I wanted to install their root certificate into IE's list of > trusted root certificates. > > I now need to do this with a website I am developing but for the life of me > cannot > find the code (either server-side or client side..) which will pop this > window up and ask > the user if they want to install the root certificate. Can it be done with > PHP? > > I believe this site did it using client-side VBScript (which would be fine > given that > all visitors to this site WILL be using IE) but I don't have the code for > this, and I'd like > a better solution. > > I'd prefer not to go the route of having a link to the certificate, asking > them to save it, > right click it. install it etc. > > Cheers. > > -Adam > -- 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] Re: Redirecting to a new php file
Use the header() function in conjunction with the Location HTTP header: header("Location: http://host.domain.tld/path/to/file.php";); This MUST be sent to the browser before ANY other output. You can execute as many commands as you like but this must come before any output (and before the tag in your file). Mike Frazer "Sridhar Moparthy" <[EMAIL PROTECTED]> wrote in message news:001301c15cbc$f38018b0$[EMAIL PROTECTED]... > Hi All, > > Is there any command in PHP that redirects to a php file from another php > file? > If not does any one know how to implement this functionality? > > Thank you, > Sridhar Moparthy > > > -- 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] Can PHP do what this javascript does...
Javascript can be embedded in PHP files anyway. I do a lot of database management interfaces in PHP and one thing I want to do is protect items from being accidentally deleted. I use Javascript to verify that they intended to click on the link to delete the information. Remember, PHP files are enhanced HTML files, which means the browser will parse them exactly the same as a standard HTML file. Mike Frazer "Richard S. Crawford" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Unfortunately, since PHP lives on the server and JavaScript lives on the browser, there really is no way to get PHP to do what you want. Stick with JavaScript. There's really no reason not to when you're doing client-side programming. At 11:14 AM 10/24/2001, [EMAIL PROTECTED] wrote: >To print: >Click here or Select File >and then Print from your browser's menu. > >Is there an equivelant bit of code to do this printer shortcut with php? > >-- >Chip Wiegand >Computer Services >www.simradusa.com >[EMAIL PROTECTED] >Simrad, Inc >Lynnwood, WA >425-712-1138 > >"There is no reason anyone would want a computer in their home." > --Ken Olson, president, chairman and founder of Digital Equipment Corp., >1977 > (-- Then why do I have nine? Somebody help me!) > > >-- >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] Sliante, Richard S. Crawford http://www.mossroot.com mailto:[EMAIL PROTECTED] AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- 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 give optional arguments to functions??
Don't forget: if a function has multiple arguments the optional ones must be to the RIGHT of the required ones: function testing123($one, $two="2", $three="3")// Good function testing123($one="1", $two, $three="3")// Bad function testing123($one="1", $two="2", $three)// Bad Mike Frazer "Chris Bailey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > It could be, but then you would have two spaces in between the 2nd and 3rd > "blah", instead of just the one space. But, depending on your actual > application, this may work out. > > -Original Message- > From: DL Neil [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, October 24, 2001 10:41 AM > To: Arpad Tamas; Richard S. Crawford; sunny AT wde; php > Subject: Re: [PHP] how do i give optional arguments to functions?? > > > > On Wednesday 24 October 2001 19:14, Richard S. Crawford wrote: > > > > The default value for $image parameter was missing: > > > > > function top ($image="defaultvalue") { > > > if ($image=="defaultvalue") echo "blah blah blah"; > > > else echo "blah blah $image blah"; > > > } > > If the default value can be set to an empty string can the if statement then > be removed? > >function top ($image="") >{ > echo "blah blah $image blah"; >} > > - watch those spaces (if they're present in live data)! > =dn > > > > -- > 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] Making a string from an Array
A small addition: the code below would make a string, but it would be a single word (no spaces or other word boundaries). Use this instead: $ignored .= " " . $words[$i]; That inserts a space before each additional word. Unfortunately it also adds a space at the beginning but you can get rid of that after the processing is done. Mike "Stewart Taylor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > $ignored = ""; > $include = ""; > > > { > $ignored.= $words[$i]; > } > else > { > $included.= $words[$i]; > > -Stewart > -Original Message- > From: Sam [mailto:[EMAIL PROTECTED]] > Sent: 25 October 2001 16:18 > To: 'php' > Subject: [PHP] Making a string from an Array > > > Hi all, > this may be an easy question, but I'm stuck... > > how can this, > > $words = explode(" ", $keywordText); > > for ( $i = 0; $i < count( $words ); $i++ ) > { > if ($words[$i]=="on" OR $words[$i]=="the" OR $words[$i]=="in" > OR$words[$i]=="at" OR $words[$i]=="is" OR $words[$i]=="it") > { > $ignored[] = $words[$i]; > } > else > { > $included[] = $words[$i]; > } > } > > How can I make $included and $ignored a string instead of an array. > > Thanks > Sam Rose > > p.s. Also I'm only on the digest, so if you could reply directly to me as > well, that would be a bonus. -- 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] Re: Truncating Lines
Try the following: $body = join('', file("somefile.html")); That one line of code will help you avoid the idea of a buffer; it reads clear through to the newline and splits it there, dumping each line into an element of an array. join() just puts it all into one single variable for output. Mike Frazer "Bt News" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I have the following code, which reads in an html file > > $fd = fopen("somefile.html", "r"); > while (!feof($fd)) { > $buffer = fgets($fd, 4096); > $body .= $buffer; > } > fclose($fd); > > I am then mailing this: > > if (mail($username." <".$email.">", $mailsubject, $body, "From: > ".$Fromname." <".$Fromaddress.">\nContent-Type: text/html; > charset=iso-8859-1 > ")) > > All works fine, except when a particular line in the html file is unusually > long. Where this is the case, the mail gets sent but the long line truncates > (the last character on the line being ! (exclamation mark)) followed by the > remainder of the line on a new line. This obviously causes problems when > trying to display the HTML. > > Strangely though, if the recipient of the mail is a local user (i.e. a user > residing on this box), the line does not truncate and the HTML source > remains intact. Equally, if I write out the contents of $body to the screen, > the HTML source is intact. > > I suspect Sendmail may be the culprit, but I'm not sure. > > I realise I could keep my HTML source lines to a certain length, however > these are often created dynamically so it's not that straight forward. > > > > -- 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] Re: function names
Actually your problem is with the function itself. In order for it to work you need to use the "this" keyword: class A { var $xxx; function print() { echo $this->xxx; } } You may also run into problems with calling the function print(), I don't know for sure. But the problem is that you were telling PHP to print a variable that was, technically, not even initialized. Mike Frazer "Olexandr Vynnychenko" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello php-general, > > I have such code: > > class A > { > var $xxx; > > function print() > { > echo $xxx; > } > } > > And that's what I get: > "Parse error: parse error, expecting `T_STRING' in xxx.php on line nn" > > Php doesn't let any function or class member have a name which is > already "used" by another function (or only function from library), > am I right? Or maybe "print" has special status. Maybe that's > because print() is actually not a function? Can anyone tell me > something about that, please? > > -- > Best regards, > Olexandr Vynnychenko mailto:[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] Re: URL variables
> If the link is > > Then in yourpage.php ... > > echo($yourvar); > > the only way you may go wrong with this is with scoping, $yourvar isn't > available in a function inside yourpage.php. It can be, though. You just need to tell the function to look for the global variable $yourvar: function yourFunction() { global $yourvar; ... } Mike Frazer -- 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] Re: Best [non-PHP] way to redirect a browser
Two ways: #1 - If you have server admin access, just add to the default page list "index.php" in your server config. #2 - Use a meta refresh: http://www.yourdomain.tld/path/to/your/script.php";> Mike Frazer "René fournier" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > This is really I guess a non-PHP question, so please excuse... > > What is the most reliable, browser-safe way to redirect the browser from a > default index.html to, say, index.php? The I'm doing it now is with the > following javascript: > > > document.location="index.php" > > > And it works, but I wanted to know if any of you are using a better [more > compatible] way of redirecting the browser (say, if it doesn't have > JavaScript (!?)). > > ...Rene > > --- > Rene Fournier > [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 the difference between mail() in PHP and sendmail?
It can also use procmail, or any other SMTP-capable application you have installed. It is called from the php.ini file. Mike Frazer "Nathan Cassano" <[EMAIL PROTECTED]> wrote in message 392201c15e37$535ab3f0$2925ae3f@amos">news:392201c15e37$535ab3f0$2925ae3f@amos... > > Not a whole lot. The PHP mail function is just a nice fuzzy function > wrapper to popen("sendmail"). > > The gory details can be found at > http://cvs.php.net/co.php/php4/ext/standard/mail.c?r=1.44. > > -Original Message- > From: Web user [mailto:[EMAIL PROTECTED]] > Sent: Friday, October 26, 2001 8:43 AM > To: [EMAIL PROTECTED] > Subject: [PHP] What's the difference between mail() in PHP and sendmail? > > > > What's the difference between mail() in PHP and sendmail? Thanks! Mike > -- 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] Re: Excel to MySQL
Dump the Excel DB to a text file and use the string parsing functions. Working with two large databases will suck up most of your system resources; working with a large text file one line at a time and one database one record of a time may be a little slower but it is going to be a million times easier on your system. Mike Frazer "Daniel Harik" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello guys > > Thank You very much for your previous replies, could u help me with 1 > more thing? > > You see i have huge(for me) 100 000 record access table, i wanted to > convert it to mysql, i thought of making php convertor that uses odbc > and mysql, but maybe there is faster way? > > And other thought was also read in RAW format excel file with perl, > and take advantage of DBI? > > Anyways how would u do it? > > Thank You very much > -- 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] Re: Absolute #$#$ silliness
Exactly. Java borrows from C/C++ a great deal, and they tend to look similar overall, but they are totally different languages. PHP and Perl are much easier to learn if you already knew the other one fairly well, but the differences are vast. After learning at least the basics of seven languages, I'm ready to suggest we make one universal one :) Mike Frazer "Cc Zona" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Jtjohnston) wrote: > > > > RTM <http://www.php.net/manual/en/language.variables.php>: > > > > > > "Variable names follow the same rules as other labels in PHP. A valid > > > variable name starts with a letter or underscore, followed by any number of > > > letters, numbers, or underscores." > > > > So $_1a is legal?! Confusing given $_ in Perl. > > PHP isn't Perl, Perl isn't PHP. Approaching one language with the > expectation that it will follow the conventions of another will only give > you a headache. > > -- > 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] Re: Using php to verify fields in form...
I believe he was asking how to actually verify them, but I could be wrong... There are two ways to do it that are quick and painless. One involves matching with a regular expression (and since my regular expression knowledge is no longer up to snuff I won't even attempt to explain it in depth). The other is with the String functions. There are about 900 ways to do it with string functions. Here is a for-instance: To verify that there is a @ in an email address: $test = strpos($email, "@");// Test >= 0 if true, FALSE if false You can also tokenize the string using the strtok() function and then compare both the user ID and the domain/host information to your desired conditions. All in all. the best way is with a regular expression. However, you'll need to get help from someone else on that as I've forgotten most of the stuff about regex's. Spent too much time progrmaming other things :) Mike Frazer "Richard Hollis" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > form passes to your php file > > your php file checks the variables with the same name of that of the form > fields. > > you can then test htey have all been set accordingly > > e.g. > > $FieldName etc. > > > "Jason" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I am new to php and I have been using a book to learn a bit about it and > > well I could not find a chapter on how to use php to verify a form is > filled > > out properly, for instance I have a form with 3 fields... name, email and > > words. once the user clicks the submit button i want it to verify those 3 > > fields before running the php script to pass the info to a database. I > have > > used java-script for this function in the past but would like to use php. > > Anyone know how i can accomplish this? Thanks in advance, 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]
Re: [PHP] \n's
Remember, those functions have return values. Gotta assign the return to a variable! $variable = [replacement_function]($args ... ); They don't change the value of the variable in the argument list, they take that value and put a new value in a new memory space. Unfortunately, they don't throw an error when you don't assign the return to a variable so it can often be hard to catch. Mike "Speedboy" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > quick problem... I don't seem to be able to strip \n's out of a string > > of text: > > str_replace("\n", "", $line); > > -- 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] Re: Mail Handling Question
Create a template file with the letter text in it and something like %%variable%% where the variable text would go. After you've done that, set up your preview page like: If you set the HIDDEN tags to individual variables as opposed to $contents, remember that you still need to do the following code again to send the message: $contents = join("", file("letter.txt")); $contents = str_replace("%%variable%%", $variable, $contents); Hope that helps. Mike Frazer "Reggie White" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi. I'm new to PHP, and forgive me if I sound ridiculous but I have to ask. > I'll be as clear as possible. > > I'm trying to do mail handling in php. I know already about the mail( ) > function, but what it does isn't exactly what I need. > I have an html form that posts the contents of it's field to a php document. > The php document is an html template of a formal letter where the contents > of the form are passed into the letter as variables where appropriate. The > user is able to preview the letter when they are done modifying it. > > Now here's where I'm stuck. When the user is finished previewing the html > letter, I want two things to happen: When the user submits, I want the page > itself (with the variable in it) to be emailed to a specified recipient. I > also want a blind copy of specific information from the form to be email to > me for reporting purposes. > > Is this possible? and how? > > Thanks everyone, > Reginald White > > > -- 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] Re: sharing data stored in mysql with another site
If the other site is on the same server, you can use the same method to log in (same username and password). If it's on a separate computer you need to either create a new user or change the existing user to have remote access. To create a user with remote access: GRANT [privileges] ON [database.table[, database.table, ... ]] TO user@host IDENTIFIED BY password; Example: GRANT ALL PRIVILEGES ON mydatabase.* TO [EMAIL PROTECTED] IDENTIFIED BY mypassword; Remember that you need admin access to set this up. Mike "Matthew Delmarter" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have developed a site using PHP and MySQL. > > My question: > How do I share the data stored in the database with another site? > > Regards, > > 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] Re: php & mysql prob...
I may be a little backward here but wasn't mysql_db_*() deprecated? Keep in mind it was a long day at work and I'm tired. I could be on fire right now and probably just want to open a window to cool off. :) Mike "Sc" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi; > > i keep getting an error of: Warning: Supplied argument is not a valid MySQL > result resource in /datascripts/insertdata.php on line 17... > > Line 17 is: $row = mysql_fetch_assoc($test); > > and here is the rest of it (not all of it though): > > for ($p = 1; $p <= 24; $p++) { > $test = mysql_db_query("melbourne", "SELECT * FROM 'Port$p' WHERE > 'Port$p'.date='$yesterday'"); > $row = mysql_fetch_assoc ($test); > $yindata = $row['switchin']; > $youtdata = $row['switchout']; > $dinPort = '$inPort$p' - $yindata; > $doutPort = '$outPort$p' - $youtdata; > > Can anyone help me overcome this prob? i've prob missed something without > thinking but i cant seem to get it... > > Thx. > > sc > -- 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: php & mysql prob...
So I'm NOT stupid...just dumb! :) After two years of PHP/MySQL programming you'd think I would have been more sure about that... Mike "David Robley" <[EMAIL PROTECTED]> wrote in message 01103114530808.28397@www">news:01103114530808.28397@www... > On Wed, 31 Oct 2001 15:40, Mike Frazer wrote: > > I may be a little backward here but wasn't mysql_db_*() deprecated? > > > > Keep in mind it was a long day at work and I'm tired. I could be on > > fire right now and probably just want to open a window to cool off. :) > > > > Mike > > Since 4.06, according to the docs. > > -- > David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc > CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA > >Keyboard Not Found - Press [F1] to Continue -- 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] Re: I rest my case
PHP is a server-parsed language. You need to add the right directives to your httpd.conf file in the global config section. They should be something *like* the following: AddType application/x-httpd-php .php4 .php3 .phtml .php AddType application/x-httpd-php-source .phps You may also need to add them to the individual VHost. Depends on your setup (for instance, Cobalt systems are backward and require them in the VHost, not the global config). If you don't add this as a server-parsed type, it will process it as just text - like it us doing for you now. Mike "J W W L Berg" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all > > Sorry about what is probably a total dickhead about to enter your midst, > but I've never installed php or seen it much at all before but am trying to > do it now. > > Using RH 7.1 and Apache 1.3.19 > > Want to install php4 and mysql combo and totally ignorant. > > Installed php rpm. > > Restarted apache in case that was needed. > > made hello.php and pointed browser at it. > > Got the text, rather than executing it. > > Can I surmise that apache isn't set up properly, and if so, could someone > please point me towards relevant assistance. Got really confused with the > "manual", etc. Not that bright I suppose ;-) > > Thanks in advance > Warwick > > > > > -- 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] Re: Array of classes
Try something like this (you'll need to populate it afterward): $this->array = array(); Then populate it with the data. Mike Frazer "Andrzej Roszkowski" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi! > > I have to create array of classes. > > When I do it this way: > > f add($sth) > $this->array[] = $sth; > > it doesn't work :( when i'm trying to get class from there it says that this is not an object. > > How to do it rigth way? > > > > Code reviews are like sex, just anyone can do it, but skill and training > can make you a lot better at it." - LJ > Thomas > -- 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: I rest my case
Apache has a high learning curve. PHP isn't terribly hard to pick up on if you already know the basics of programming. Also, you may want to check out the newsgroup comp.infosystems.www.servers.unix for help with Apache if you continue to have problems. It appears from all the info you gave us that the problem is Apache and not PHP. Mike "J W W L Berg" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > OK, there goes any pretense of intelligence that I may have been able to > muster ;-) > > The AddType tag was found inside another as follows: > > > > Is there some way I can check if this module is present, otherwise what > you're saying is that the AddType isn't being executed if the is > false, yes? > > What a pillock. I can see this is going to be some learning curve. > Warwick > > > > Jason Brooke wrote: > > > John, Jason didn't literally mean for you to search for the exact string > > '' - he was telling you to look through the various types of > > tags found in your httpd.conf file, such as > > , etc etc > > > > > >> There is no element in the httpd.conf. Is that where I should be > >> looking? > >> Warwick > >> > >> > >> Jason Murray wrote: > >> > >> >> Hey thanks guys for the help, but it's still not happening. > >> >> Apache had already the AddType lines mentioned by y'all. > >> > > >> > It's possible the AddType lines are inside a container that > >> > will ensure they're not executed. Backtrack to the > >> > element that the AddType lines are in, and see what it does. > >> > > >> > 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] Re: setting member variables out of class
I believe you would be getting a number echoed to the screen or dumpfile, but you want the values, correct? $telefono is declared as an array. Calling an echo statement on an array won't give you the values of the array elements. In order to have them all printed to screen, try: foreach ($telefono as $tele) { // $tele is just a tempo variable, name it what you want print "$telefono\n"; // for screen formatting, \n for source formatting } Mike "Silvia Mahiques" <[EMAIL PROTECTED]> wrote in message 004401c16219$b50eb930$1a9cd29b@tscpc6">news:004401c16219$b50eb930$1a9cd29b@tscpc6... Hello, I want to set member variables out of their class. The code class is: I access to this class from another php file and want to set this member variable: $c = new translator(); echo $c->telefono; /* this member isn't set but in constructor method has been set*/ I have written too: echo $c->$telefon; echo "{$c->telefon}"; but is not correct. Can anybody help me? Thanks Silvia Mahiques -- 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: Re[3]: [PHP] split array in 2 halfs
Don't forget that you should clear out that memory space, especially if it's an array of arrays or an array of objects or something along those lines: unset($bigarray); Just good programming practice, that's all. I doubt it would ever be a problem on today's servers, but it's still a good idea. Mike "Mark" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... $smallarray1=array_slice($bigarray,0,3); $smallarray2=array_slice($bigarray,3,3); On Wed, 31 Oct 2001 23:25:55 -0800, Daniel Harik wrote: >Want to split it in half > >1 Big array: > >1 >2 >3 >4 >5 >6 > >Want to make > > >1 Small array: > >1 >2 >3 > >2 Small array: >4 >5 >6 > >Thank You > > -- Mark, [EMAIL PROTECTED] on 10/31/2001 -- 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] Re: include("remote host") under w2k problem
Probably a permissions problem. Can't open a file if you don't have permission to do so. Mike "Marek Wysmulek" <[EMAIL PROTECTED]> wrote in message 03b201c16308$6b6d54e0$0201a8c0@dom">news:03b201c16308$6b6d54e0$0201a8c0@dom... > Hi all. > > I have searched almost everything on the net regarding php and windows > focusing on one thing. > How to include to php script started on apache on w2k external sript placed > on some URL. > Source of test script (http://mylocalhost/marek.php) > include("http://hermes.com.pl/test.php";); > ?> > > and answer viewed in browser > > "Warning: Failed opening 'http://hermes.com.pl/test.php' for inclusion > (include_path='') in c:\www\hermes\windykacja\marek.php on line 2" > > I know that parser sayes that include_path is not correctly set but, when > I'm trying do the same under Linux - works perfectly. So (I'm sure -because > Include_path has other adaptation) it is not the reason. > > Will be wery glad for answer. Even "Leave it !" - but with explanation ;-))) > > Marek. > > -- 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 Highlighting Text Editors
Try checking the PHP section of www.wdvl.com. There should be a list of software. Mike "Chris Bailey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Also, Visual SlickEdit works on Windows (in addition to Linux as mentioned), > and FreeBSD, OS/390, and a slew of others. > > There is a list of editors out there somewhere, I know someone has posted a > link before. There are many editors that do this. > > -Original Message- > From: TD - Sales International Holland B.V. [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 02, 2001 10:32 AM > To: [EMAIL PROTECTED] > Subject: [PHP] PHP Highlighting Text Editors > > > Hey there, > > these are the editors given by you guys, thanks for the replies. If somebody > could put this online on php.net it would be great. If you have anything to > add please feel free to email me. > > Windows > > UltraEdit > ActiveState Komodo > EditPlus > HTML-Kit > Homesite > > > > > Linux/Unix > > Nedit > (x)emacs > Visual SlickEdit > vim/gvim > ActiveState Komodo > Beaver > Cooledit > KWrite (included with KDE, PHP highlighting since KDE 2.2.1 maybe 2.2.0 also > haven't used that version 2.1.2 doesn't support PHP) > > -- > 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] simple array tutorial wanted
PHP is probably the best language around for "in-house" documentation. The online manual reads less like a technical manual and more like a tutorial. Learned PHP 2 years ago. The only resource I've ever used was the manual. Mike "Jack Dempsey" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > http://www.php.net/manual/en/language.types.array.php > > start with that > > -Original Message- > From: Justin French [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 02, 2001 12:33 AM > To: php > Subject: [PHP] simple array tutorial wanted > > > Hi all, > > I really want to get me head around arrays, becuase > I KNOW there's a better way to do some of the stuff > i'm doing right now. > > I could mess with stuff for a few hours and probably > get it, but i'd rather have a decent tutorial if > anyone knows of one... > > > Thanks, > > Justin French > > -- > 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] Re: Cookies won't stick
I believe it's just the opposite, for the sake of safety. Besides, good coding practices in ANY language generally means you include all possible information, required or not (it's like HTML; you don't have to use quotes around attributes but to be forward compatible it's recommended). Mike Frazer http://www.spyproductions.com/ "Jennyw" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > For some reason, when I tried using setcookie(), cookies wouldn't stick > around. When I added an expiration time, cookies started sticking around, > but ... I thought that if you didn't provide an expiration they were > supposed to stick around indefinitely? > > Thanks! > > Jen > > > > -- 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]