[PHP] Re: weird fopen problem
Jon Farmer wrote: > I am getting a the follwing error: > > Warning: fopen("/home/jon/pgpfiles/sgsdgsdg","w") - Permission denied in > /home/ethiorg/public_html/test.php on line 2 > the directory /home/jon/pgpfiles has mode 777 and is owned by nobody and > group is nobody. Apache runs under user nobody. Sure, but if /home/jon/pgpfiles/sgsdgsdg exists, it may have other permission which does not allow nobody to write to it. -- PHP General Mailing List (http://www.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: Redeclaring functions
Arve Bersvendsen wrote: > As a small, personal, "enjoy-myself"-project I'd like to run a > perpetual-running socket server. Problem is; I also want it to be > self-modifying so I can insert, remove and change functions as the > server is running. > > The problem is; under normal circumstances, PHP won't let the script > redeclare functions. Is there any way to circumvent this. I dont know what a perpetual-running socket server is, but to have a main PHP script execute different functions with the same name I guess you could play with "include/require" directives or create classes with the same function-names you then pass to you main program (kind like poor-mans polymorphism :-) -- PHP General Mailing List (http://www.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: Parsing SAR output with PHP.
Austin Gonyou wrote: > The real question I suppose is how could I parse this type > of output into something I could use to make a graph. > > Example: > 12:20:00 PM CPU %user %nice %system %idle > 12:30:00 PM all 2.17 0.79 0.77 96.27 > Problem is I'm not sure how to go about breaking up the rows > to allow them to be inserted into the db. Thanks in advance for > any ideas. I guess fields are separated with tabs? Then just use split, as in: list($time,$cpu,$ser,$nice,$ststem, $idle)= split ("\t", $line); Then build your INSERT sql clause. Graph building is then a simple matter of passing the data as arrays to your php graph system. -- PHP General Mailing List (http://www.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: Specific References Incident
Ken Kinder wrote: > The $this->children attribute should be an array of (references to) objects. > I think somehow in the foreach ($this->children as $child) the objects are > being copied, as $child->validate(); seems not to effect the original objects. Someone just said you can use $a = &$b to make $a a reference to $b instead of a copy. Dunno if that solves you problem though, but it may be a step on the way. -- PHP General Mailing List (http://www.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 executing system commands..
Louie Miranda wrote: > Hi, can php execute system commands > like df, and then print it to html ? `df`; shell ("df"); exec ("df"); etc -- PHP General Mailing List (http://www.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 to get a function backtrace?
Stefan Rusterholz wrote: > Im not sure if "function-backtrace" is the correct word for what I need, so I'll >explain: > If I have for example What you are looking for is a "stacktrace", ie the stack of called functions. Dunno if php has any support for it, but it is normally used when debugging and error/exception handling. -- PHP General Mailing List (http://www.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: Passing variables with include()
Imar De Vries wrote: > Imar De Vries wrote: > > >>- Including remote files *is* possible. The php manual does not mention this >>does not work, and when I add the variable to the call (include >>/calculate_drivers?serie_id=3.php) the code is processed perfectly. The >>thing is, I can not pass the variable with the call, because it's value is >>determined by the form field. I could use a switch statement of course, but >>that adds a lot more text to the code. >> > > I just changed the code to (include > .../calculate_drivers?serie_id=$serie_id.php) > > ... and this worked! Weird solution... Not really. The http://.../foo.php request returns html and not php. The foo.php file is parsed and executed by the remote server and returned to you as html. By adding serie_id=xxx you actually give the remote php-script the name and value of the variable. You should think of include/require as a way to *include* any file into your script. Instead of cutting and pasting code into your file, you use include. Thats the way it works in practice. No magic is going on here :-) -- PHP General Mailing List (http://www.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: Passing variables with include()
Scott Houseman wrote: > Hi Al. > > While we are on topic, what are the key differences between include() & > require() ? "Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed." -- PHP General Mailing List (http://www.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] Content
Jimmy wrote: > Hi Daniel, > > >>variables, but as part of the Content of the HTTP request. Here is a sample: >> > >>POST >>/~rafael/sms_mail/cliente.dcs.php?NotificationProtocolVersion=1.0.0.0&ApplicationName=NPlex&ApplicationVersion=6.0.037&RequestType=NewMsg&RequestTime=01/15/2002%2014:08:23&ServerType=email&[EMAIL PROTECTED]&MessageType=email&[EMAIL PROTECTED]%3E&Subject=TST26&MessageReceivedTime=01/15/2002%2014:08:23 > >>HTTP/1.0 >> > > in your php script, try to echo the passed param directly as variable, > for example $NotificationProtocolVersion or $ApplicationName > if it show the correct value, then you're lucky. > > otherwise, you have to parse the HTTP request. > parse_str($QUERY_STRING); > // after this you will have the $NotificationProtocolVersion variable Well, I think Daniel means that he wants to use the body of the POST. I would guess that the GET variables are useful as usual. I dunno how to do that from the top of my head, but imo Daniels server is broken since POST variables are sent in the body, but that is clearly no POST request at all. In this case PHP has no way of parsing the broken request. Or am I wrong here? -- PHP General Mailing List (http://www.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: User authentacation
[EMAIL PROTECTED] wrote: > Hello, > > I need to allow a client, named: "A", to give their clients access to a remote page >on A's server. This is the problem: > 1. I need to record who has accessed this page on A's server grep stuff /var/log/httpd/access.log > 2. password protect this page Create suitable .htaccess file if you are using apache. > 3. and copy the pages contents to A's clients server. cron + shell script (using ftp client) -- PHP General Mailing List (http://www.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_insert_id?
Dl Neil wrote: > 2 because the (function argument) controlling feature is the connection, it is not >possible for another > concurrent user to 'steal' your ID or influence the ID returned to you - it's all >yours! Ok, assume you are correct, but what if you are using persistent connections (ie pconnet)? -- PHP General Mailing List (http://www.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: htmlspecialchars() alias
Jason G. wrote: > Hello General and Dev list, > > Considering the fact that it is good practice to use htmlspecialchars() > anytime you are outputting non-html content to the browser... > > After typing the 16 characters in the htmlspecialchars() function > thousands of times... > > I was wondering if it would be feasible to create an alias for this > function, say hsc() or something short. > > Even nicer, but probably not practical would be a language extension like: >being the same as Yup, sounds like a good idea. But I guess you could always wrap htmlspecialchars in your own function until php gets that feature. -- PHP General Mailing List (http://www.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] Generating a new line in a text file
Jason Murray wrote: >>: Don't know why it's got everyone else stumped. >>: >>: "\n" is the new line character. Make sure you use it in "" and >>: not in ''. >>: >>: Jason >> >>Unfortunately, that doesn't work either, it changes the \n that >>appeared at the end of the new line to a single black block. It >>does not put the next quote onto a new line. >> > > Ah, so you're opening the file in something that doesn't understand > newlines and prefers line feeds, then. > > In that case you'll want to use \r instead of \n. Na, he's posting using MS Outlook so I guess he is using Windows. In that case use "\r\n". -- PHP General Mailing List (http://www.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] pack problem
Hi I am having some problems with the 'pack' function. Some values just doesnt come out right. For instance, 0xa0 turns into x81a0. Here is some code I used for testing. It packs the value, prints it. Then unpacks the value and prints it # This is wrong, but note that unpack gives the correct value! $v = 0xa0; $x = pack ("n", $v); echo $x . "***"; # 33184 (0x0081a0) $y = unpack ("nfoo", $x); echo $y["foo"] . "**"; # 160 (0xa0) # These guys are ok $v = 0x9; $x = pack ("n", $v); echo $x . "***"; # 9 (0x0009) $y = unpack ("nfoo", $x); echo $y["foo"] . "**"; # 9 (0x0009) $v = 0x100; $x = pack ("n", $v); echo $x . "***"; # 256 (0x0100) $y = unpack ("nfoo", $x); echo $y["foo"] . "**"; # 256 (0x0100) Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: template logic problem
List Peters wrote: > > > > navigation > > > > > In the include file I have all the code i need. > > My problem is that for one page in the site I need to display a image in the > navigation bar that is referenced from a database. The database query > happens in the included file which is below the navigation in the html - > This means i cant reference the image file name because the query hasnt > happened. Well, either write the sql code twice, or could break out all your database queries into functions which you then put in a php file (say db_funs.php). Now require("db_functions.php") at the top of your file and call the get_navbar_image () when you need it. You also need to require("db_functions.php") in the "include file depending on url" file. The general philisophy is thus to put all programming logic which you use more than once in separate functions which you include. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: IF Statements
Jon Yates wrote: > People, hope you can help. The below IF statement is getting a PARSE error. > Can anyone spot why? > > if (($this->checkReferralCB($this->benefitRef, $this->benefitNo, > $this->childDOB)) > && (!$this->checkLocation($this->post, "W")) && (!empty($this->childDOB))) > || ($this->checkPregnancy($this->benefitRef, $this->benefitNo)) Geez, use your editors paren-matching capabilities. Any modern editor should notify you that you are missing the last parentheses in if clause. I recommend emacs or vi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] I'm doing something wrong....
Robert Rothe wrote: > Thanks. So the next() and prev() functions just traverse an array > some type of linked list? This is what precludes direct access to > specific elements? Yup, there is an internal position pointer in every array which are used by most array_ functions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Generate every possible combination
Evan Nemerson wrote: > I need to generate every possible combination of the the values in an array. > For example, if... > > $array = Array("A", "B", "C"); > I really have no idea where to begin. The best lead I can think of is that > there are going to be n! elements in the output array, where n is the size of > the input array. Correct, this also implies that using more than say 20 elements (20!) will take *loads* of CPU time and memory. Anyway, I did such a program once to test the performance of VB versus Java but alas I dont keep it around. It was recursive tho. A quick check on google came up with some code here: http://www.delphiforfun.org/Programs/Permutes_1.htm and som theory here: http://www.theory-of-evolution.org/Main/chap4/permutations_7.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help with arrays
Josh Edwards wrote: > This is a basic question but I'm a basic fellow. If I have an array > > $timespread = array("12am-01am"=>0); > $timespread["01am-02am"]=0; > $timespread["02am-03am"]=0; etc > > Using $time which is a number, I want to add 1 to the value of > $timespread[$time] without changing the key so if $time =1 > I want to have $timespread["01am-02am"]=1; > > Using $timespread[$time]+=1; doesn't work. Nope, you must say $timespread["01am-02am"] += 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for web based email
Jared Boelens wrote: > This is the one my company uses: > > http://nocc.sourceforge.net/ > > I found it very easy to modify, and it fully supports attachments as well as > the related RFCs. I had problem with it, since it required imap stuff and whatnot. Anyway, I ended up using squirrelmail and we have been using that for some time now. Quite happily I might add. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with strtolower()
David Orn Johannsson wrote: > I'm having a problem with StrToLower function in php > > I'm trying to convert characters like Þ and acute letters from > uppercase to lowercase, but it dosen't work. > > this is what the manual says: "Note that 'alphabetic' is determined by > the current locale. This means that in i.e. the default "C" locale, > characters such as umlaut-A (Ä) will not be converted." > dose this mean that it dosen't return acute and other letters like that > or is it a matter of configuration on the server? Well, here is the actual loop which does the lowering for you: for (i=0; ihttp://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cannot compile my extension as a shared .so library
Hi php-4.1.2 linux RH 7.2 I have created a small php extension. The extension works as expected when I compile it using $ ./configure --with-foo && make # foo is the extension It gets compiled into the php binary. All is well, but I would like to compile my extension as a loadable modules (ie to use with the dl() function). Thus $ ./configure --with-foo=shared && make The compilation completes with no errors. The php binary works (my foo ext is not included in the binary), but I end up with *no* 'foo.so' file. Instead I get this $ ls -l modules/ 51776 Apr 5 13:11 foo.a 647 Apr 5 13:11 foo.la I expected to see a 'foo.so' file. Obviously I cannot use dl() on these files. The foo extension is as simple as possible, just to illustrate the problem. It was created using these commands: 1. $ cd ~/php-4.1.2/ext 2. $ ./ext_skel --extname=foo 3. $ cd .. 4. $ vi ext/foo/config.m4 5. $ ./buildconf 6. $ ./configure --with-foo=shared 7. $ make The whole config.m4: PHP_ARG_WITH(foo, for foo support, [ --with-foo Include foo support]) if test "$PHP_FOO" != "no"; then PHP_EXTENSION(foo, $ext_shared) fi Output from make: make[3]: Entering directory `/home/wic/php-4.1.2/ext/foo' /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=compile gcc -I. -I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main -I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend -I/home/wic/php-4.1.2/ext/mysql/libmysql -I/home/wic/php-4.1.2/ext/xml/expat -I/home/wic/php-4.1.2/TSRM -g -O2 -prefer-pic -c foo.c && touch foo.slo /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=link gcc -I. -I/home/wic/php-4.1.2/ext/foo -I/home/wic/php-4.1.2/main -I/home/wic/php-4.1.2 -I/home/wic/php-4.1.2/Zend -I/home/wic/php-4.1.2/ext/mysql/libmysql -I/home/wic/php-4.1.2/ext/xml/expat -I/home/wic/php-4.1.2/TSRM -g -O2 -prefer-non-pic -static -o foo.la -avoid-version -module -rpath /home/wic/php-4.1.2/modules foo.lo /bin/sh /home/wic/php-4.1.2/libtool --silent --mode=install cp foo.la /home/wic/php-4.1.2/modules PATH="$PATH:/sbin" ldconfig -n /home/wic/php-4.1.2/modules -- Libraries have been installed in: /home/wic/php-4.1.2/modules [etc...] Note that I can manually create a so-file from the foo.a file using ld as in: $ cd modules; ar x foo.a; ld -Bshareable -o foo.so foo.o and then call dl("foo.so"), but that is not the way to go, right??? I think there is some arcance libtool switch missing in the Makefile, or I need something else in the config.m4 file Btw, my real extension is a lot more complex, but it has the same problems so I figured this foo-thing would be a bit easier to debug :-) I have searched high and low for any leads, but nothing has turned up so far. /Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php