Re: [PHP] sessions and trans-sid problem/question
Ernest E Vogelsinger wrote: > if ($_COOKIE[$_SESSION['cookie_name']] == $_SESSION['cookie_token']) { Ok, please forgive my ignorance, but in PHP isn't $_COOKIES the same as $_SESSION?. I thought it was if the user had cookies turned off (and even if the user had cookies turned on come to think of it) ... If not I'm in trouble. I was always under the impression that $_SESSION vars were passed as cookies ... Hc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions and trans-sid problem/question
Michael Sims wrote: I 'm not where I can test this right now, but if a session is older than session.gc_maxlifetime, isn't it invalid anyway? I.E. if I bookmark a page on your site and then come back 3 hours later passing an old SID, shouldn't that session have expired on the server by that time, in which case the session vars would be empty and you could kick me back to your login page? If my understanding of sessions is correct, no. session.gc_maxlifetime does set the lifetime of a session, but a session will not be cleaned by PHP until session.gc_probability has been hit. Again, if my understanding is correct, PHP doesn't automatically check to see if a session has expired before accessing it. It pre-supposes that any session file lying around is till active. And those session file will stay there until session.gc_probability has been hit. I might be wrong though ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions and trans-sid problem/question
Michael Sims wrote: Then I suppose it's just an added feature of the session handler I am using. Maybe the OP should give it a shot, as I use it and I definitely don't have a problem with expired sessions I'll think about writing my own session handler as it can be quite useful. However I need to evaluate the amount of extra disk read/writes it would add. Using a DB vs the file system does add some overhead ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Creating mySql search feature.....
Cookra wrote: Any help would be ideal Some code would be nice. Youdidn't post any code so we have no idea what your problem might be ... do you get an error message, or no results, or the wrong results? We don't even what what SQL query you are using ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions and trans-sid problem/question
Ernest E Vogelsinger wrote: No, that's a misunderstanding. Session var's are never passed to and from the client, only the session _name_ is passed, either via a cookie (PHPSESSIONID) or via trans-sid href encoding. Thanks for clearing that up! I hadn't realized that only the session name was passed around. I thought all the session data was too. This now hands me a dilemma ... I was building my site conservatively, i.e. assuming the user would have cookies turned off. And so I am making heavy use of session variables. *But* I had thought that if the user had cookies enabled then the variables would be saved as cookie information, hence saving my server a lot of disk reads and writes. Now you have shown me the err of my ways ... I have to consider rewriting my scripts so that if cookies *are* enabled the session information is sent has cookie data. Hum ... I hate re-writes Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions and trans-sid problem/question
Justin French wrote: What sort of stuff are you storing in the session that your are worried about with too many writes? Oh, this site is just your regular, run-of-the-mill, amazon.com copy. For each open session I store up to 20 variables. It's not a lot, but each access to a script means a disk read/write so they will eventually add up if there are enough users. Of course this problem goes away if you throw enough money at the hardware ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Huffman encoding
Hatem Ben wrote: I'm looking to implement the huffman encoding in PHP, but i would like to ask if it isn't already done ? (why reinventing the wheel) You have highjacked someone else's thread. Not very nice of you Please repost and start your own message thread ... highjacked threads rarely get any responses ... Jc PS the reason you highjacked the thread is that you used the "reply" button while reading a post and simply deleted the subject. That is not good. To post a new question use the "new message" or "compose" button of your newsgroup reader. That is good. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cybercash/Verisign and PHP possible?
My company wants to set up online credit card functionality and we are thinking of going with a company called Veritrans (I believe they are the japanese branch or cybercash for Verisign in Japan). However they do not support PHP. They only offer kits for Perl and Java. Unfortunately for me they do not have any english documentation either :( I was wondering two things: #1- Assuming that this service is the "new" cybercash as offered by Verisign does anyone know if I can use the service directly through PHP. Or do I really really need to use their kit ... #2- If I can use this service directly from within PHP can anyone point me to some online resources with examples, etc ... so I can figure out how to use this beast ;) Thanks for any advice! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Count lines from php files
Antti wrote: How can I count how many code lines I have written? I have many php files in one directory. I'm using linux.Do you know any non-php way to count the lines. from a directory one level above where all your files lie do this: (assuming all you files are in a directory called php) #ls -R php | wc -l this will give you the total number of files and directories If you want to find out how many lines in a file do # cat myfile.php | wc -l If you want to count the lines of all files in a directory ending with .php do # cat *.php | wc -l Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cybercash/Verisign and PHP possible?
Matty Rozen wrote: by using the 'curl' module, you can use any calls needed to any type of scripts. you can use curl to "talk" with the cgi. Ok, I'll look into CURL. If I understand their system, it is meant to be called from a form so CURL might be applicable. > let me know if you need more help. I'm sure I will! I've never used CURL. And before that I need to figure out what their script expects. And worse, I don't want to set up my machine to have perl run as cgi, which is what there script is ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Securing areas of a web site with PHP
On my web site there are some areas that I want to make accessible only after a user has logged in (for example when placing an order, etc ...) I have been able to achieve this however I have the following problem: 1- user logs in 2- user goes to restricted area 3- user views pages, orders an item, changes his account settings, etc ... 4- user logs out 5- user is sent to log out page 6- user hits back button ... And here my problems start ... even though the user has logged out, all the "restricted" pages he saw are still cached by his browser and accessible ... I have tried using a script that checks a session variable that indicates if a user is logged in or not and take appropriate action at the start of all "restricted" pages, but that doesn't work since when the user hits the back button, the PHP script is not re-executed, the page is simply loaded from the browser cache. What are some PHP techniques I could use so that a user can no longer access/use pages once he has logged out? Basically I would like to have sort of state machine so I that I can simply check where a user is coming from and his login "state" to decide if a certain page should be presented or not (i.e. you can't get here form there or you can't view that page with your current login status). But it seemed that creating a state machine is not the right way to go about it since hitting the back button pretty much allows a user to circumvent this ... Eventually the web site I will build will actually have many "areas", each needing a separate/different login, (and you can be logged in to multiple "areas" at once) so I would like to be able to generalize this problem and understand how I can use PHP to implement the needed functionality. Just as a simple example, once a user has placed an order, he should not be able to go back to the "order placing/processing" pages ... Any tips, hints, or pointers to tutorials are appreciated! Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Securing areas of a web site with PHP
Tularis wrote: I adives to make sure the browser doesn't cache it *at all*. This can be done using (one, or more) of the following headers: // HTTP 1.1 compliant: header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); // HTTP 1.0 compliant: header("Pragma: no-cache"); I'll try this out and see what I get. Though I have read that not all browsers follow cache-control directives ... This would cause the load on my web server to increase for those pages though ... might there be another way? If not then it will have to do ... Thanks for the advice! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Securing areas of a web site with PHP
Justin French wrote: I know it sounds simple, but try to analyse what other big sites are doing in this situation: That's exactly what I did, but I don't understand *how* they do it hence my question. I surfed some of the big sites and saw that they do not break when a user hits the back button in the middle of a "transaction" or when the user is viewing a "secure" part of a web site. > If there's a big issue with people clicking back, I'd suggest that > there *may* be a problem with the logic of your site. Afterall, > clicking "back" is what the web is about!! If the big sites can cope > with it, I'm sure you can. Exactly. It can be done, but how. What are the techniques that I can use? On amazon for example they didn't rely on javascript and it didn't seem like they had turned caching off or force and refreshes. From what I could tell, you could use the back button without any problems. *But* if you went back to a page and *then* clicked on something (a link, a button) then some kind of logic kicked and figured out that you where doing the same thing twice, or where doing something in an area you were not logged in to and acted accordingly. So I agree with you that it definitely boils down to a "logic of your site" thing. But what does that mean? How do I implement "logic" in my site? What are the ways to do this in PHP? What techniques do most PHP powered sites employ, what "patterns"? Sorry if these are "newbie" questions ... I'm programmer, and understand the PHP "language" but when it comes to site design/logic with PHP I don't really know where to start. Any help or pointers again very much appreciated! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Securing areas of a web site with PHP
Jason Wong wrote: The cache-control directives are only supposed to be followed if the page was to be _explicitly_ reloaded or refreshed. The BACK button (as specified in the standards rfc something or another) is NOT supposed to reload or refresh a page -- it is supposed to redisplay the page from the cache. Buggy browsers like NN, IE & Mozilla etc reloads the page. Well behaved browsers like Opera redisplays from cache and hence your problem. Ah ... so using cache control is *not* the way to solve my problem ... As Justin pointed it out I should be looking into solving this within my site "logic" then I guess ... Does anyone know of any good online references or even books where I could read up on on to build "logic" into my site. All the PHP books and references I have are great from a programming point of view but they hardly mention anything about site navigation/logic and how to implement it in PHP ... Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: undefined constant?
Markus JäNtti wrote: You forgot the double quotes ... Should be: if($_GET["test"] ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: populate a list menu
Bruce Levick wrote: I am looking to populate a list menu with the current date and then the 30days after that current date. Is there a small snippet of code that achieves this?? Hvae a look at date(), mktime() in the manual. Here something that should help you get started, it is untested. function day_dropdown() { ?> Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] populate a list menu
Bruce Levick wrote: That's sweet. Can you just satisfy my curiosity and explain the 86400?? I am thinking this might be minutes?? It the number of seconds in a day. But that solution doesn't take into account Daylight Savings Time. The one I posted does, I think ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to detect a PHP script time-out?
How can I detect if my PHP script is about to time-out? I would like to be able to detect a time-out and display a page with an appropriate error message "i.e. the server is busy now, please try again later". Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Timothy Hitchens ) wrote: Set up output buffering on your page then if the page times out the buffer should be sent to the browser and that is loaded with your message. Ok. Is there another solution? The reason I ask is that in order to use your solution I would need to redesign my pages (quite a few of them). I was hoping to be able to do something like this: if (timeout()) include("try_again.html"); Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Greg Beaver wrote: http://www.php.net/manual/en/features.connection-handling.php Nice! So if I understand correctly I need to: 1- register a shutdown function 2- have this function check if it was called b/c of a conection_timeout() 3- And if so have the function print out my timeout error message So in my script I could put something like this: function timeout_message() { if ( connection_timeout() ) { echo "server busy, try again later"; } } register_shutdown_function('timeout_message'); [rest of my script goes here ...] ?> If the script timesout then my error function is called. Is that about right? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Timothy Hitchens ) wrote: Issue... as I said before the register shutdown won't work because: - output from the shutdown is not visible nor do you have access to some variables You are right. From the manual: http://www.php.net/manual/en/function.register-shutdown-function.php " The registered shutdown functions are called after the request has been completed (including sending any output buffers), so it is not possible to send output to the browser using echo() or print(), or retrieve the contents of any output buffers using ob_get_contents()." That's no good ... There definitely should be a function that gets called (or can be registered) when a script times out ... A time-out indicates an error on my end (the server) and I would like to be able to detect it and take action ... If the is no way to do this then PHP is lacking. I'd definitely ask for this to be implemented ;) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ~E_NOTICE, why not ?
Pupeno wrote: $oer = error_reporting(E_ALL & ~E_NOTICE); $tpl->display("index.html"); error_reporting($oer); but it still reports notices, any idea ? Should be error_reporting (E_ALL ^ E_NOTICE); See: http://www.php.net/manual/en/function.error-reporting.php Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Timothy Hitchens ) wrote: There is one last option ... register an output buffer as I suggested before suggested but this time do the reverse and you don't have to rewrite your scripts: Ok I think I understand what you are proposing. I just have one question about your example code. Where does the string "Maximum execution" come from? Is this output automatically by PHP when a script times out? Would it be possible to use: if (connection_status == 2) {} Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Timothy Hitchens ) wrote: No you can't.. the issue with this is that you need to have error reporting turned on.. so you will need to have more error collecting or removing. [..] This isn't the best for a production env but this is the best I can see considering you don't want to rewrite!! Ouch. Having error reproting on is definitely not a good thing. But the again it can be set on a page by page basis so I could turn it off in the php.ini file, and turn it on only in those pages where I need to check for a time out. And it's not that I won't do a re-write it's just that I was hoping for something easy to implement. If a re-write is the only answer then I'll do it of course. I also posted a feature request asking for a shutdown() type function that can be used to send output back to the browser in the case of a timeout. Hope they'll implement it ;) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] EOF: how to generate one in a string
I am trying to use a command line program in Linux using this form: $result = `/path/prog $arg`; But this doesn't work as the program is expecting and EOF that never comes. If I use the program on the command line when I am finished entering all the data I need to hit return and then CTRL-D to give an EOF. How can I simulate this using the backticks? Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EOF: how to generate one in a string
Marek Kilimajer wrote: $result = `echo | /path/prog $arg`; should work That didn' work ... don't know why. Isn't there a way to say echo "EOF"? There must be a way to specify the ascii or hex value for EOF in an echo statement no? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: EOF: how to generate one in a string
I also tried tried with popen with no success. $fp = popen('/usr/src/bsfmdk/CCCallServer 2>&1', 'r'); fwrite($fp, $query); $result = fread($fp, 8096); echo "result is "; echo "$result "; I get back and empty result string ... Any more hints? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EOF: how to generate one in a string
Marek Kilimajer wrote: What prog is it anyway. It is a credit card processing program. It is interactive. You can it, type values in hit return, then ctrl-D and it spits out a status code. If I put all the values in a file I can get the prog to work by doing: #./prog < filename It does not take any command line arguments. So I cannot just do "exec prog $args" since the "args" have to be typed in, one value per line (i.e hit return between values) and then on the last line ctrl-D ... Can anyone think of a way I can get PHP to do this short of writing to a file and the doing "exec 'prog < file_I_wrote'"?? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: EOF: how to generate one in a string
I'm at wits end ... I've tried everything from system(), shell_exec(), bacticks, popen() and still no go ... I even tried writing the data to file first and then doing a system("./prog 2>&1 < ./datafile") and that didn't work either. I know that it shoudl work b/c if from the command line I issue the same command (using the file created by PHP) it works fine. Can anyone offer advice on why I can't get PHP to execute this external program? Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: EOF: how to generate one in a string
Ok, found the problem. The external program I was trying to run is only happy is it is called from the same directory as the one it resides in. I guess it needs to access files in it's directory and by calling from php somehow it gets confused as to where to files are. Thanks to everyone for their patience and help! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Tamas Arpad wrote: That's not right now. The manual is outdated. See this bug report http://bugs.php.net/bug.php?id=15209. This behavior was changed from 4.06 to 4.1. In newer versions of php the registered functions will run before the connection is closed so ouptput can be done from there as well. > > So Jean you can make it as it is suggested on this page: > http://www.php.net/manual/en/features.connection-handling.php Cool! I just tested it out and it works. At lest under PHP 4.3.0 and Apache 1.3.26. But according to the bug report this functionality may change in the future and a new function apache_register_shutdown() might replace the current one ... The current functionality is *not* what is documented, but is it was is *intended*. I.e. will the current functionality be change to be what the docs say or will it continue and the docs will be changed? I will be using this functionality and need to know if it will change in future releases ... Thanks for this info. It was a great help! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: EOF: how to generate one in a string
Matt Vos wrote: What is the ASCII value of an EOF? Find that and use For the benefit of those reading this in the future the value is 4, so use chr(4); Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Robert Fisher wrote: If you are willing to do a rewrite, then have your main script start a fork, or child process. According to Arpi (see below) I can use register_shutdown(), as the docs are wrong and it *will* send output to the browser *before* the connection is closed. Jc >Tamas Arpad wrote: > That's not right now. The manual is outdated. See this bug report > http://bugs.php.net/bug.php?id=15209. > This behavior was changed from 4.06 to 4.1. In newer versions of php the > registered functions will run before the connection is closed so ouptput can > be done from there as well. > So Jean you can make it as it is suggested on this page: > http://www.php.net/manual/en/features.connection-handling.php > > Arpi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to strip extra characters off of a string
[EMAIL PROTECTED] wrote: I need to be able to just extract the number that is right Under blocks in this example it is the number 57070. This was generated by the quota -g groupname command. Disk quotas for group site53 (gid 165): Filesystem blocks quota limit grace files quota limit grace /dev/hda4 57070 307201 3072001146 0 0 I have tried using some of the string functions like I used $test=strstr ($test, "hda"); $test= substr("$test",7); Have a look at explode(). You could do something like this: $test=strstr ($test, "hda"); $test= substr("$test",7); $aValues = explode(" ", $test); list($fs, $blocks, $quota, $limit, $rest_of_string) = each ($aValues, 4); Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with location???
Ysrael guzmán wrote: This is correct?
location.href="page.php?=SID?>&cliente=$cli";
You have one small mistake here:
[PHP] Re: Databases vs. File Access
Erich Kolb wrote: I am going to be dealing with a ton of data shortly and my goal is to make it accessible via the web. I am curious about the performance differences between using a database or leaving the data in the individual files they originated in. Can anyone offer any recommendations? Depends on what you mean by "a ton of data" and what kind of work you will do with the data. If all you will do is display the file as is on the web, then leave in file format. If the data needs to be searched, parsed, or indexed, the use a DB. My 2 cents, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] proc_open() problems
I've written a script that uses proc_open() to call and external program and capture it's output. My script works fine as long as I call/use it in the directory where it resides. But if I try to include() it in a script that resides in another folder proc_open() return an exit value of 255. I can't access the external program. What am I missing? Some file perms? I did a "chown -R apache *" from the top directory but that didn't help ... I'm using the php.ini-recommended file. Is there some setting in there I should change? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] string prints out as number (E+10...), why?
I'm passing a var into a function which is a 16 digit number, but when I try to print it out I get 1.111E+15 instead of the expected 11. Why? How can I change this behaviour? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: output of calling grep lr
If this is for output to a web browser you can use nl2br to changed all the line-breaks to 's ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string prints out as number (E+10...), why?
- Edwin wrote: I guess it's because the number is converted automatically to an exponential notation if it goes over a certain number of digits--makes it easier to read... I figured as much. But why? I found a solution by changing the precision of floats in the php.ini file. But I still find it strange that PHP will, internally, happily treat my variable as a string but when it comes time to print it out, it decides that it's a number and formats it without my asking it to. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] string prints out as number (E+10...), why?
- Edwin wrote: [...] As you can see, PHP didn't "touch" the string version... True. My var is being passed in as a POST var so maybe that has something to do with it ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to make server response to emails
I'm not sure how it's done exactly but I think the basic concept is to have a daemon running, or have your program run by cron, and have the program collect it's mail. On Linux I think you can get your mail simply by fetching and parsing the file /var/spool/mail/"username", where username is the name of the account unsubscribe requests are mailed to. But you want a mailing list, use major domo or some other ML spftware instead of writing your own. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to detect a PHP script time-out?
Tamas Arpad wrote: There was a discussion about this topic on the dev list, and because of many reasons the current functionality of register_shutdown_function() will remain the same in future releases too. Joseph Tate is working on a new function (apache_register_shutdown_function) to make it possible on apache to use the old behavior (Thanks Joseph! :)). Great! Love you guys! This "buggy" function is coming in quite handy :) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: money
Wilbert Enserink wrote: I wanrt to display amounts like "2 products a ? 6,25 = ? 12,50" Whatever I try I can't get the comma there (it's showing a point "." and it doesn't display the second number behind the comma i.e. "12.5" Show us some code and maybe we can help. If you don't give any code we have no idea what you are doing wrong. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to make server response to emails
See Kok Boon wrote: Sorry, I am abit dumb. Where is the archive that you refer to in your email? The PHP archives. Go to the PHP web site and follow the links to the mailing lists page. There you will find links to the archives. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PostgreSQL/PHP: transactions: how-to abstract out?
Hi. I thought I had abstracted out the SQL querying part of my code out, just to find out today that it doesn't work when it comes to transactions. I had come up with this code: function sql_query($sql) { $conn = pg_connect("dbname=JC user=postgres"); $res = pg_exec($conn, $sql); if (!$res) { echo "CONNECTION: could not execute query ($sql)"; die; } else return $res; } I had transactions in my code implemented like this: $sql = "BEGIN"; sql_query($sql); [some sql that should be in a transaction ...] $sql = "COMMIT"; sql_query($sql); This doesn't work. Now that I look at my code I clearly see why. All sql queries are executed using a new Postgres connection, hence the use of BEGIN/COMMIT as I was using them have no effect. Can someone recommend a way to abstract out my DB layer while still being able to use transactions? I was thinking of using the same function but if the incoming query contained the word BEGIN, saving that and all future queries in a session var and when the COMMIT comes in executing all the saved queries as one (i.e. "BEGIN;[];COMMIT"). One drawback is that all queries will be written out to disk (as session vars) and that will slow things down. Another drawback is that I have to abort if not COMMIT comes in. And a few more drawbacks ... I was also thinking about maybe the $sql a GLOBAL or first building up my query as as long string ("BEGIN;[];COMMIT") and *then* sending it to my sql_query() function. The last two seem easier to implement, safer, and more efficient but they don't seem "elegant" because I haven't abstracted out the fact that I want a transaction. Whenever I write an SQL query I have to think "does this need to be in a transaction" and then use a different coding technique depending on the answer. And if the future something that didn't need to be in a transaction now needs to be in a transaction I have to revisit my code and change the code. I'm sure someone out there must have thought about this and come up with an elegant solution and way of abstracting out the DB layer from PHP. Can anyone share their solution with me or give me some pointers to reference material? Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PostgreSQL/PHP: transactions: how-to abstract out?
Jason Sheets wrote: Manual Excerpt: " If a second call is made to pg_connect() with the same connection_string, no new connection will be established, but instead, the connection resource of the already opened connection will be returned. You can have multiple connections to the same database if you use different connection string." You're right! I did some more testing and the problem is with my testing code. I don't know why but the following code times out *but*, PHP throws an error saying the code has timed out *but* calling connection_status() says the code did *not* time out! Any idea why connection_status() returns 0 when it should return 2?? My code: set_time_limit(2); echo "set execution limit to 2 seconds "; register_shutdown_function("timed_out"); require_once("db_functions/sql_query.inc"); $sql = "BEGIN;"; $res = sql_query($sql); $sql = "insert into test(test) values('testing 4');"; $res = sql_query($sql); //This will cause the script to time out $i = 0; while(true) {$i++;} $sql = "COMMIT;"; $res = sql_query($sql); function timed_out() { $status = connection_status(); if ($status == 2) { echo "the script timed out "; } else echo "no time out. Connection status is $status "; } The OUPUT: set execution limit to 2 seconds Fatal error: Maximum execution time of 2 seconds exceeded in /www/htdocs/jc/shut.php on line 16 no time out. Connection status is 0 Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PostgreSQL/PHP: transactions: how-to abstract out?
To all who replied to my initial question ... I actually did *not* have problems with transactions in the way I first implemented my abstraction layer. In the case of PHP "If a second call is made to pg_connect() with the same connection_string, no new connection will be established, but instead, the connection resource of the already opened connection will be returned." The bug was in my transaction testing code. I was forcing PHP to time out to check weather the transaction went through or not. In the script I was catching the time-out but it so happens that there is a bug in PHP when it comes to catching connection time outs using the connection_status() function ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] calculate the traffic size with php(like the apache
I'm not sure what you are trying to do exactly (i haven't been following this thread) but if you want to analyze apache web logs try analog. It can do everything and is *blazzingly* fast. I use on log file that are 10 Gb or greater ... http://www.analog.cx Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: version switch problem
You high jacked someone else's thread, probably because you hit the "reply-to" button and just changed the subject line instead of posting a "new" message. Try posting again, creating a new message this time. You'll start your own thread and will definitely get more answers ... Jc Christian Stalberg wrote: redhat linux 7.3 apache 1.3.27 mysql 3.23.49 php 4.0.4pl1 (static install) mod_ssl-2.8.12 the box had php 4.2.3 installed on it originally. we had a mysql application that would only run with php version 4.0.4pl1 so we installed that version of php and everything worked. later we ran autorpm with the 'interactive' setting (just downloading and not auto installing) and the php-dependent application broke. when we run debug_phpinfo it says version 4.2.3. we have reinstalled php version 4.0.4pl1 and debug_phpinfo still says version 4.2.3 and the app. remains broken. yes we copied the php.ini file after the reinstall of the old version we checked the new php binary and its definitely version 4.0.4pl1. we're pulling our hair out. what are we doing wrong/do we have yet to do? thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: upgrading from 4.0.6 to 4.3.0
Gamin wrote: I have currently working a Red Hat 7.2 system that installs PHP 4.0.6 from the CD and it works fine. I want to upgrade to ver 4.3.0 what would be the simplest way to do this without breaking any of the old modules etc. I wont mind making changes to my scripts in case of changes between versions. If your old PHP was automatically installed by RH then just do an "rpm -e php" (maybe rpm-r php-4.0.6. To find out the write string to use to rpm -qa | grep php) Do i need to remove the old PHP installation before building the new one ? No, if you don't you need to take extra steps. And I can't see why you want to keep the old version around anyway. Would using the configure command that shows in the currently (with 4.0.6) work with the ver 4.3.0 ? Most probably. SO I suggest downloading the 4.3.0 source files and doing a ./configure with the options you can from phpinfo() and then compiling :) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Trapping PHP errors
Michael Sims wrote: My site has a custom error handler (implemented via set_error_handler) which sends a nicely formatted email including all of the error details, a variable dump, the contents of the output buffer before the error occured, and the contents of a call to debug_backtrace, in addition to logging the error to a file. If it's not asking too much would you be willing to share that custome error handler you wrote? I'm in the process of writing one but wouldn't want to re-invent the wheel if I didn't have too :) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Advanced Search
[EMAIL PROTECTED] wrote: I don't want to have to write 50 different ifelse statements unless I have to. You can add all the boolean fileds in the query and not worry about doing if's to check them, the DB will automatically find the fields that match for boolean fields (just make sure to initialize all your booleans variables first). So SELECT p.* FROM properties p WHERE beds >= $beds AND pool='$pool' AND waterfront='$waterfront' AND [other booleans ...] ORDER by price asc; Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.ini: how to load different ini file depending on host?
On my web server (Apache) I have two sites and I would like each site to use a different php.ini. What is the correct way for me to have each site use it's own php.ini file? I figure it's a setting in the apache conf file but I can't figure out which ... Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini: how to load different ini file depending on host?
Timothy Hitchens ) wrote: Inside each of the Virtual Host defs you can put most of the php_flag etc settings just like: Oops .. I forgot to mention that these two website do *not* have different IP addresses. Actually these are two testing website on my local LAN. What I have is to have a different php.ini loaded depending on wether the user goes to: http://192.168.254.1/test1 or http://192.168.254.1/test2 I had read up on the Virtual Host directives put it didn't seem to be applicable ... Could I do the same thing you suggested using the apache directive? Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php.ini: how to load different ini file depending on host?
Thanks to everyone for the suggestions. I finally got what I wanted by doing it a directive in the httpd.conf file. Thanks again! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why PHP doesn't work with Apache2?
I don't want to start a flame-war here, just asking for specifics on a question I have :) I know that PHP and Apache 2 (on Linux anyway) have some problems working together. I was just wondering, for my own education, why is that? Is it a problem in Apache 2 or in PHP? (Not that I want to lay blame, just wondering). Can someone point me to some ressource explaining the main points of why PHP won't work with Apache 2 just yet? Thanks. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP doesn't work with Apache2?
Henry wrote: Apache2 now work with php in aspx (PHP is as a module) Really!? I was sure there were still some issues ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP doesn't work with Apache2?
Henry wrote: what issues for example? I do know I can successful install php in module with apache2.0.43 without error messages, also execution was successful can you tell me what issues did you see? A successful install means nothing. My question is basically, does Apache2 work with PHP 100% or is it still recommend to use Apache 1.3.27? If it is still not recommended to use Apache2, why? If you think Apache2 and PHP work perfectly well together can you point me to some info that says so? I can't see anywhere on the PHP web site that recommends using Apache2. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP doesn't work with Apache2?
Yasin Inat wrote: it depends on you & your aim Ok, to put it more simply, Are there cases where something would work in Apache 1.3.27 + PHP that would break in Apache2 + PHP?? A simple yes or no will suffice. If the answer is no, I am curious as to why not ... Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP doesn't work with Apache2?
Rasmus Lerdorf wrote: Because the server doesn't work very well yet. There are issues in the filter api and you can't really uses a threaded mpm as many of the 3rd-party libraries that are commonly linked into PHP are simply not threadsafe. Thank you! That's the kind of answer I was looking for. If I understand correctly PHP will not work correctly because some parts of it are not thread-safe. Is the PHP team working on getting PHP to be thread-safe? Does it look promising? Might version 5 be thread-safe? Thanks again, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why PHP doesn't work with Apache2?
Rasmus Lerdorf wrote: No, you didn't understand correctly. I specifically said the thread safety issues were in 3rd party libraries and not in PHP. Sorry, I thought by 3rd party libraries you meant libraries that PHP is dependent upon. Do you mean libraries used by PHP or Apache. And if these are libraries used by PHP, do you mean library that as in the multi-byte library (i.e. libraries that add functionality to PHP), or do you mean C libraries used when compiling PHP. Why exactly are you asking? Is there some feature in Apache2 that you need that is not available in Apache-1.3? I don't want to move from Apache 1-3 to Apache. I just keep hearing that PHP is not ready for Apache2 yet and I wanted to educate myself as to why. I don't like just being told something and not understanding the reason behind the answer. So this boils down to Apache2 using threads and PHP not being thread-safe? And the reason that PHP is not thread-safe is that some 3rd party libraries PHP used are not thread-safe. Now the only two questions I have left are : #1 what those libraries are used for. I.e. are they part of PHP or libraries that are used to compile PHP? If they are libraries used to compile PHP, I would assume that Apache2 must have faced similar issues when going from a forking model to a threaded model? #2 Is there progress being made towards having PHP work with Apache2. And who is working on this (if not the PHP team). Thanks again for the clarifications! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: query caching & caching in general
Justin French wrote: anyone got any links to decent tutorials on sql caching, and caching in general? A few questions: At what level do you want the caching? Are you talking about stored procedures? Do you mean storing functions in the DB? (some DB's, like PostgreSQL can compile functions once and reuse the compiled function). Let me know where you want the caching to be and maybe I have a link or two. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installation problem
I've installed PHP and Apache countless times but it seems I have forgotten something somehow because I can't for the life of me get apache to install PHP as a static module. Argh ...! I'm trying to get PHP 4.3.0, Apache 1.3.27, openssl-0.9.7, mod_ssl-2.8.12-1.3.27 all working together but to no avail. The best I can get is a mod_ssl aware apache server, but no PHP. These are the steps I am following. Can anyone spot my error? # cd openssl-0.9.7 # ./config -no-thread # cd .. # cd mod_ssl-2.8.12-1.3.27/ # ./configure --with-apache=../apache_1.3.27/ # cd ../apache_1.3.27/ # ./configure # cd ../php-4.3.0/ # ./configure --with-pgsql=/usr/local/psql/ --without-mysql --with-apache=../apache_1.3.27/ --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex # make && make install # cd ../apache_1.3.27/ # SSL_BASE=../openssl-0.9.7 ./configure --with-pgsql=/usr/local/pgsql/ --without-mysql --prefix=/www --activate-module=src/modules/php4/libphp4.a --enable=module=ssl # make # make install I add the following line to httpd.conf and start apache: AddType application/x-httpd-php .php But when I try and load a .php page I get a "Save File" dialog ... What step did I miss or where did I do something wrong? Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Last error: how to get?
Is there a simple way for me to programmatically know if an error has occurred during my script? (besides from writing a custom error handler?) I want to be able to know at the end of my script if any errors where thrown and then show a simple message. I know that if the error is fatal my script won't run to completion but that is ok as a fatal error in this case should be fatal. Is there some function like get_last_error()? Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Accessing $php_errmsg give an error ...
I am trying to access the last error message using the superglobal $php_errmsg. But trying to acess that var gives a "not defined" error ... Running this script gives me: ini_set("track_errors", true); error_reporting (E_ALL); $a = $php_errmsg; die; ?> Notice: Undefined variable: php_errmsg in err.php on line 5 What am I doing wrong? Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Accessing $php_errmsg give an error ...
My mistake, spelling sold be php_error,sg. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Last error: how to get?
Found it, if track_errors is set then the last error is in $php_errormsg. However be careful as the variable is initially not set and doing a if ($php_errormsg != "") will resultin an error. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mcrypt installation problems
Can anyone point to information on how to install mcrypt support for PHP. I tried the PHP mcrypt pages but they are quite lacking in details. I downloaded libmcrypt and got that installed fine. I also downloaded mcrypt (do I really need it?) but that wouldn't configure. It complains that: checking for libmcrypt - version >= 2.5.0... no *** Could not run libmcrypt test program, checking why... *** The test program compiled, but did not run. This usually means *** that the run-time linker is not finding LIBMCRYPT or finding the wrong ... I tried compiling PHP with --with-mcrypt=/usr/src/mcrypt-2.6.3/ (the locate of the mcrypt source files) but that gave me an error when I did make: cc1: warning: changing search order for system directory "/usr/local/include" cc1: warning: as it has already been specified as a non-system directory /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:229:1: warning: "MCRYPT_FAILED" redefined In file included from /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:34: [...] Questions: 1- Do I need both libmcrypt AND mcrypt? 2- What is the installation procedure? I tried the obvious "./configure && make" combination but to no avail ... Thanks! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Execute at a defined time
Do a "man crontab" to get info. Or Google for turotials on how to use cron. Also make sure that PHP is available from the command line. Do a simple test, on the command line type: php --version If you get version iformation as output the PHP is installed for command line useage and will work with cron. Miguel BráS wrote: Hi, I was looking on PHP manual but didn't find anything about it. How can I execute a script all days at the same time? I kno i must have access to the CRON of the system, but don't know what function should I use to make this happen (run the script). Miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt installation problems
Adam Voigt wrote: Download MCRYPT SRC. tar -zxf mcrypt.tar.gz cd mcrypt ./configure --prefix=/usr/local/mcrypt From the commands you give you imply that libmcrypt is not needed. Are you sure? The configure command you give does not work. Here's the complete error: [root@host110 mcrypt-2.6.3]# ./configure --prefix=/usr/local/mcrypt [delete configure messages ...] checking for libmcrypt - version >= 2.5.0... no *** Could not run libmcrypt test program, checking why... *** The test program compiled, but did not run. This usually means *** that the run-time linker is not finding LIBMCRYPT or finding the wrong *** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point *** to the installed location Also, make sure you have run ldconfig if that *** is required on your system *** *** If you have an old version installed, it is best to remove it, although *** you may also be able to get things to work by modifying LD_LIBRARY_PATH *** configure: error: *** libmcrypt was not found -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt installation problems
Tom Rogers wrote: I did it this way untar libmcrypt and mcrypt into /usr/src then in libmcrypt ./configure --prefix=/usr (could be /usr/local if you want make make install ldconfig cd ../mcrypt-2.6.3 Up to here fine. ./configure --prefix=/usr configure: error: "You need at least libmhash 0.8.15 to compile this program. http://mhash.sf.net/"; Hum ... the PHP manual nor the mcrypt web site mentionned the need for mhash Do I really need it? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mcrypt installation problems
Jason Sheets wrote: You need only libmcrypt, mcrypt is a command line program that is intended to replace the Unix crypt program. To build the mcrypt binary you need mhash and libmcrypt, for PHP unless you want mhash you need only libmcrypt. Ok, so to build mcrypt support into PHP I only need libmcrypt ... that's it? I can compile and install that with no errors. But when I try and compile PHP I get this big long error error ... Any hints?? gcc -Iext/mcrypt/ -I/usr/src/php-4.3.0/ext/mcrypt/ -DPHP_ATOM_INC -I/usr/src/php-4.3.0/include -I/usr/src/php-4.3.0/main -I/usr/src/php-4.3.0 -I/usr/src/php-4.3.0/Zend -I/usr/local/psql//include -I/usr/src/php-4.3.0/ext/xml/expat -I/usr/src/php-4.3.0/TSRM -g -O2 -c /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c -o ext/mcrypt/mcrypt.o && echo > ext/mcrypt/mcrypt.lo /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:229:1: warning: "MCRYPT_FAILED" redefined In file included from /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:34: /usr/local/include/mcrypt.h:31:1: warning: this is the location of the previous definition /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c: In function `zm_startup_mcrypt': /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:279: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:280: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:281: `MCRYPT_BLOWFISH_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:281: (Each undeclared identifier is reported only once /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:281: for each function it appears in.) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:282: `MCRYPT_BLOWFISH_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:283: `MCRYPT_BLOWFISH_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:284: `MCRYPT_BLOWFISH_448' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:285: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:286: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:287: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:288: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:289: `MCRYPT_IDEA' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:290: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:291: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:292: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:293: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:294: `MCRYPT_RC2_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:295: `MCRYPT_RC2_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:296: `MCRYPT_RC2_1024' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:297: `MCRYPT_RC4' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:298: `MCRYPT_RC6_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:299: `MCRYPT_RC6_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:300: `MCRYPT_RC6_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:301: `MCRYPT_SAFER_64' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:302: `MCRYPT_SAFER_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:303: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:304: `MCRYPT_SERPENT_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:305: `MCRYPT_SERPENT_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:306: `MCRYPT_SERPENT_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:307: `MCRYPT_TWOFISH_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:308: `MCRYPT_TWOFISH_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:309: `MCRYPT_TWOFISH_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.
Re: [PHP] mcrypt installation problems
Tom Rogers wrote: Looks that way :) I also have that in /usr/src and in php as --with-mhash=/usr/src/mhash-0.8.17 Still no go. Did you compile into php 4.3.0? I finally got libmcrypt, mhash and mcrypt to make and install, but can't get PHP to work with --with-mcrypt OR --with-mcrypt=/usr/local OR --with-mcrypt=../mcrypt-2.6.3/ I get this big compile error: gcc -Iext/mcrypt/ -I/usr/src/php-4.3.0/ext/mcrypt/ -DPHP_ATOM_INC -I/usr/src/php-4.3.0/include -I/usr/src/php-4.3.0/main -I/usr/src/php-4.3.0 -I/usr/src/php-4.3.0/Zend -I/usr/local/psql//include -I/usr/src/php-4.3.0/ext/xml/expat -I/usr/src/php-4.3.0/TSRM -g -O2 -c /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c -o ext/mcrypt/mcrypt.o && echo > ext/mcrypt/mcrypt.lo /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:229:1: warning: "MCRYPT_FAILED" redefined In file included from /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:34: /usr/local/include/mcrypt.h:31:1: warning: this is the location of the previous definition /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c: In function `zm_startup_mcrypt': /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:279: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:280: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:281: `MCRYPT_BLOWFISH_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:281: (Each undeclared identifier is reported only once /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:281: for each function it appears in.) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:282: `MCRYPT_BLOWFISH_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:283: `MCRYPT_BLOWFISH_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:284: `MCRYPT_BLOWFISH_448' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:285: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:286: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:287: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:288: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:289: `MCRYPT_IDEA' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:290: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:291: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:292: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:293: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:294: `MCRYPT_RC2_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:295: `MCRYPT_RC2_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:296: `MCRYPT_RC2_1024' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:297: `MCRYPT_RC4' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:298: `MCRYPT_RC6_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:299: `MCRYPT_RC6_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:300: `MCRYPT_RC6_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:301: `MCRYPT_SAFER_64' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:302: `MCRYPT_SAFER_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:303: warning: passing arg 3 of `zend_register_long_constant' makes integer from pointer without a cast /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:304: `MCRYPT_SERPENT_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:305: `MCRYPT_SERPENT_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:306: `MCRYPT_SERPENT_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:307: `MCRYPT_TWOFISH_128' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:308: `MCRYPT_TWOFISH_192' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:309: `MCRYPT_TWOFISH_256' undeclared (first use in this function) /usr/src/php-4.3.0/ext/mcrypt/mcrypt.c:310: warning: passing arg 3 of `zend_register_long_constant' makes integer from po
[PHP] Re: mcrypt installation problems
I fixed my problem. For archive purposes (as of PHP 4.3.0), to install mcrypt support you only need to install libmcrypt. No need for mcrypt, or mhash ... forget anything else you might read. The installation problem I had was indeed a bug in PHP which I am happy to say is fixed in the latest CVS STABLE snapshot. Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need To Find A php Person
I might be able to help you with support/customization of your application depending on what kind of PHP application it is. I have a great deal of experience programming with PHP and developing large application. Could you let me know what kind of application you have? Jc Michael McGlaughlin wrote: Hello, I am looking for someone well versed and established who understands the php language and who can support a product that I have that I cannot receive support from by the original developer. What would be the best way for me to go about finding someone? We paid the developer by making a donation to him for his script, then paid him for some further customizations, which he completed, but now he does not appear interested in additional cusomization work on our system and I am left in a bit of a lurch. Any help you can give would be greatly appreciated. Sincerely, Michael _ Get your FREE email address http://www.hootingowl.com "The Wise Way To Search" _ Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] BBS software in PHP?
Can anyone recommend a simple (and free) BBS module/software written in PHP. preferably something that writes to a DB and preferably PoserSQL. I would like to add some bulletin board functionality to my web pages but don't feel like reinventing the wheel :) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-I18N] addslashes(): Is it multi-byte safe?
Moriyoshi Koizumi wrote: Partially yes. Strings encoded in GB2312(CP936), big5, Shift_JIS are known to be clobbered by addslashes(). Sh*t ... and I just added a whole bunch of addslashes() to my code to prevent SQL attacks. And of course my web pages are for Japanese ... and most of them will be using SJIS. If I have internal_encoding set to EUC-JP does that mean that all POST or GET vars passed in will be translated to EUC-Jp and hence my addslahes will be fine? I sure hope so ... Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] addslashes(): Is it multi-byte safe?
Is addslashes() multi-byte safe? I will bu sing it to escape multi-byte input and wouldn't want it to mangle anything... Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-I18N] addslashes(): Is it multi-byte safe?
From an email. Reposting to to list for thos who might have the same question later on :) Moriyoshi Koizumi wrote: > > Oops, I should have said mbstring.encoding_translation=on actually :) Ok. Turning that on. >>In which case I am safe :) But then again anyone who would want to try >>an SQL injection attack might try and send some SJIS ... better safe >>than sorry :) > > > It took some minutes to sort out what you're saying here.. By the word > "clients" I meant browsers and there I was trying to mention a case that > some browsers that have certain settings try to send GET queries in UTF-8 > while such queries are basically supposed to be encoded in the same > encoding as that the page is written in. Sorry if my intentions were not clear but I am trying to protect myself from SQL injection attacks by using addslashes() to user provided information. I cannot assume anything about the incoming data (not even the encoding) since anyone trying to hack my machine by using such a technique could pretty much send whatever they wanted using a telnet session or what not ... > Anyway, Shift_JIS is not a great choice for PHP scripting. Tell me about it. I have the hardest time getting the people who actually make the HTML page to use EUC instead of SJIS. Of course they all use MS platforms to create the HTML content so they can't understand why SJIS causes me pain when I try and edit it in *NIX box or parse it in PHP ... Thanks for the info! Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-I18N] addslashes(): Is it multi-byte safe?
Moriyoshi Koizumi wrote: You can avoid this issue by configuring a PHP build with --enable-zend-multibyte option and set mbstring.script_encoding to SJIS. Or better yet, make sure that all pages are in EUC-JP and use that for internal encoding too, right :) And also translate all user input to internal encoding by setting encoding_translation = On. Doing those two things should let me use the regular PHP addslashes(). Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security Q (persistent in-memory var possib;e?)
I have a PHP application that connects to a DB an retrieves encrypted data from it. The PHP application uses the decryption key to decode the data to so some work with it. Right now the key is hard-coded into the PHP script. I am worried that if someone hacks into my server they will have access to the the encryption key and can then use it to decode the encrypted data that is on my DB. Is there any way for me to remove the decryption key from the script itself and make it as inaccessible as possible? One solution that I was joping would be possible would be to a (super)global variable that is put into RAM once the web server is started. That way the key is not lying around anywhere. Is there anyway for me to either make a either $_SERVER var for apache (say in the httpd.conf file which I could delete after starting the server or in the source code?) or of creating my own superglobal for PHP (and then I delete the source code)? Any suggestions are welcomed! Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: registration
Diksha Neel wrote: $connection=mysql_connect("localhost","root","")or die("Could not connect"); print "Connected successfully"; mysql_select_db("bdoi_change")or die("could not select database"); echo " $login " The line above you give you an error ... echo" Login ID * "; ?> There's a syntx error in your code as pointed out. The is inside the tags but not quoted ... maybe you made a cut-and-paste error? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] http->https->http redirection causes browser to show alert dialog
I have a login page with a form where users enter there login and password. The form's action is "https://mysite.com/login.php";. login.php authenticates the user and if the authentication is successful it ends with a: header("Location: http://mysite.com/welcome.html?a=b&c=etc...";); The problem I am facing is that the flow of event is: http -> https -> http and this causes IE and Netscape to put up an alert box telling users that they are leaving a secured site. The IE messages is: "You are about to be redirected to a connection that is not secure. The information you are sending to the current site might be retransmitted to a non-secure site. Do you wish to continue?" I only want to use HTTPS for the parts of my web site that actually need it and nothing else. The way I have things set up now I receive the data through HTTPS, use it, and then put the user back on a "regular" HTTP connection since I don't need https anymore. But I get browsers throwing up these warnings Is there a way around this? The messages are annoying at best and probably scary to users ... Thanks, Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http->https->http redirection causes browser to show alertdialog
Cpt John W. Holmes wrote: You'll have to output a message on the HTTPS page, like "Thank you, click here to continue", otherwise there's no way around the message. It's a client side issue, other browsers may or may not do it. Yuck. I see that Hotmail does something similar, You login though HTTPS and are sent to a blanks page that redirects you to another. I guess they use some kind of META redirect tag? Thanks, Jc PS Love you columns (and all of) php|a. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http->https->http redirection causes browser to show alertdialog
[EMAIL PROTECTED] wrote: Why don't you just leave them in https? Is this a performance issue? Performance and also the fact that (if I remember correctly) session variables are not passed from http to https nor vice versa. And more importantly any relative links in page will turn to https links when they should be http links Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stupidity check: (to disable transparent session id)
Jason K Larson wrote: (B> I'm almost perfectly certain this *should* work ... can anybody shed (B> some light on why it doesn't? (B> (B> $retval1 = ini_set ('session.use_trans_sid',false); (B (BJust a quick guess but isn't that one of the settings you *can't* change (Bon the fly since it has already been read from the php.ini file and used (Bby PHP before it even gets to your script? (B (BJean-Christian Imbeault (B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
[PHP] caching question
I am using Apache 1.3.27 and PHP 4.3.3.RC1 and someone has told me that my web page cannot be cached but I cannot figure out why. My friend tells me my pages all keep sending this in their headers: Cache-Control: post-check=0, must-revalidate, no-store, no-cache, pre-check=0 But I can't figure out why the headers are set like this. I am not setting any headers so I am wondering if it is a setting in my web server, php.ini file or some other php scripts I have running in the background. Also print_r($HTTP_SERVER_VARS) gives one server variable to be: [HTTP_CACHE_CONTROL] => max-age=0 What does this variable mean and where was it set? Any and all help appreciated! Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: classes v. functions
I am sure someone will call this heresy, but if you really want OO don't (Bdo it in PHP. If you are new to OO and start with PHP you will do (Byourself a grat disfavour. OO programming in PHP is still not ready. If (Byou try and program in OO in PHP you have to learn all of it's (Bshortcomings and many "tricks" to get around them. And I promise that (Bmore than once you will scratch your head and wonder why your object (Bseems to have lost it's state or some variable never seems to get set (Bproperly. (B (BJean-Christian Imbeault (B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: caching question
Found somewhat of an answer here http://www.mnot.net/cache_docs/: (B (B"By default, objects processed by PHP are not assigned validators, and (Bare therefore uncacheable" (B (BJean-Christian Imbeault (B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CLI php: how to use different php.ini file
I am running some cronjob scripts that are written in PHP. However things are not working as expected because my php.ini file auto-prepends a file. This auto-prepending is meant for my PHP web pages and I don't want it loaded when I run PHP from the command line. Is there a way from me to either use a different php.ini file for my CLI PHP calls or to tell PHP *not* to auto-prepend the file? Thanks, Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Apache 2.x and PHP
Miguel Angelo wrote: (B> (B> Is PHP capable of running on Apache 2.x and if so what version ? (B> And is it stable ? (B (B (BPHP will run on Apache 2 but ... (B (B#1 Apache 2 is multi-threaded whereas PHP is not. You need to turn (BApache 2's multi-threading off. (B (B#2 Turning Apache 2's multi-threading off pretty much loses any (Bperformance gains Apache 2 has over Apache 1.2.X (B (B#3 I'm not 100% sure that even with multi-threading off PHP is 100% stable. (B (BConclusion: (B (BIf you want to use PHP on a production server don't use Apache 2. (B (BMy 2 cents, (B (BJean-Christian Imbeault (B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CLI php: how to use different php.ini file
Jacob Vennervald Madsen wrote: (B> (B> php -c (B (BThanks! (B (BI hate to say it but this was actually in the manual :( I just didn't (Bknow where to look ... (B (Bhttp://php.net/manual/en/features.commandline.php (B (BJean-Christian Imbeault (B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Apache 2.x and PHP
Ivo Fokkema wrote: (B> (B> May I add this little note from the PHP installation txt file : (B> (B> (B> ATTENTION: Apache 2 Users (B> (B>At this time, support for Apache 2 is experimental. It's (B>highly recommended you use PHP with Apache 1.3.x and not (B>Apache 2. (B> (...) (B> (B (BHum ... I think that pretty much sums it all up ;) (B (BJean-Christian Imbeault (B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: FTP Synching
Jwulff wrote: (B> How would I download any new files on a remote machine to my local one (in a (B> specific folder) via ftp? (B (BAnd how does this relate to PHP? I can't see a PHP question in there ... (Bif there is one please make it clear :) (B (BJean-Christian Imbeault (B (B (B-- (BPHP General Mailing List (http://www.php.net/) (BTo unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OO function overloading?
Greg Beaver wrote: > This statement isn't entirely correct, overloading is possible with the > overload extension. True. Nice work. But still a hack in my mind :) (though a *very* clean hack). Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.3.3RC download mirror sites?
I am trying to download php-4.3.3RC2 from the PHP site but my connection keeps timing out even before the download starts. I'm guessing the main server is too busy? Does anyone know of any mirror sites? Thanks, Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to use array_map() with a class callback function?
I'd like to use array map with the callback function being a static function in a class. How can I do that? I have tried: class Maker { function sGetNameId($a) { return 1; } } array_map("Maker::sGetNameId", array("1") ) But I get this error: array_map(): The first argument, 'Maker::sGetNameId', should be either NULL or a valid callback Is it possible to use class functions as callback functions? Thanks, Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to use array_map() with a class callback function?
Peter James wrote: > array_map(array('Maker', 'sGetNameId'), array("1") ) > > Have a look at the callback type, here: > http://www.php.net/manual/en/language.pseudo-types.php Thanks! That did it. Now if only PHP could treat class functions first-class citizens instead of having making us jump through hoops ;) Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OO function overloading?
Is it possible to overload a function is a class. I would like to have the same function defined differently depending on the number of arguments passed in. For example: function foo() {} function foo($a) {} function foo($a, $b) () I know I could do it with: function foo($a = "", $b = "") {} But that is such an ugly hack ... Thanks, Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php