[PHP] syntax question
I'm looking through some existing code for a project I'm working on, but I keep running into this syntax that I really don't understand. Here's an example: $a=strpos($a,'-')?explode('-',$a,2):array($a); What do the ? and the : do here? I'm seeing this sort of thing all over and just have no idea what ? : do. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reading header information
What I'd like to do is get some of the information found when you do a telent on port 80 like this below.. telnet www.hostname.com 80 Trying www.hostname.com... Connected to.www.hostname.com Escape character is '^]'. HEAD / HTTP/1.0 HTTP/1.1 200 OK Date: Thu, 29 Aug 2002 17:00:09 GMT Server: Apache/1.3.26 (Darwin) PHP/4.2.2 Connection: close Content-Type: text/html Really what I'm trying to find is the server message (404, 200, etc.) on a remote server from this line... HTTP/1.1 200 OK Is there anyway to access this through php? thanks, jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Supplied argument is not a valid PostgreSQL result resource
Hi James, > I've been getting the following error: > Warning: Supplied argument is not a valid PostgreSQL > result resource in dbasefunctions.php on line 87 that's because your SQL query return nothing, but you try to fetch a row. -- Jimmy Live for Love, for without Love you don't live. -- PHP General Mailing List (http://www.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 Curdate problem
Hi Andras, > $aresult=mysql_query("select * from orders WHERE (a3 >= CURDATE()-$datec)" > ,$db); what's the value of $datec? integer 7 or 14? if so then try to change it to this: "interval 7 days" -- Jimmy Love deeply and passionately. You might get hurt but it's the only way to live life completely. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to read/write form/into certain place in a text file
Hi Leon, > For example,read form letter 5 to 10 in line 4 ,and after some procedure > ,write into the same place. if the file is not too big, you can use file() function which will return an array containing the content of the file per line. combine this with substr() to read from specific column. to write use substr_replace(). if the file is big, then doing file() is not advised, you should read the file as stream. read the following functions: fopen(), fclose(), fseek(), fread(), fwrite(). > Another question is that if a user has opened the file to read and write , > what will happen if another one will open and write the same file? php doesnt handle file locking automatically, so i think it would depend on the OS. if you want to handle file locking, read about flock(). -- Jimmy God is greater than your greatest problem -- PHP General Mailing List (http://www.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] no reply-to header?
Hi All, I just realize there's no reply-to header in this mailing list. No wonder I never receive my own email when I reply to any mail here. Does it purposely set this way? Or is this a glitch? -- Jimmy Mistakes show us what we need to learn. -- PHP General Mailing List (http://www.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] no reply-to header?
Hi Martin, > I thought that if there's no "reply-to", then email clients will use the > "from" as the reply to ?? yes, correct, but the "from" is the address of the original sender, so when someone hit reply, the email will goes to the original sender only, not to this mailing list. -- Jimmy Be engaged at least six months before you get married -- PHP General Mailing List (http://www.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] strip from
Hi WB, > Hi i need to strip out the up to the tag. > preg_replace( "/" , " " , $body ); try this: preg_replace( "/[^]*]*>/" , " " , $body ); -- Jimmy Your mind is like parachute. It works best when it is open. -- PHP General Mailing List (http://www.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] HOWTO USE : htmlspecialchars
Hi louie, > "> htmlspecialchars() do not change the passed variable. it will _return_ the result. so you have to do like this: $info = htmlspecialchars($info); please read the manual before asking to the list. it's clearly stated there, and there's even an example on how to use this function. -- Jimmy Leave loved ones with loving words, it may be the last time you see them -- PHP General Mailing List (http://www.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] take links from url
Hi Alawi, > I want to take string between tags in put it > in variable preg_match ("|([^]*)|i", $str, $match); $match[1] will contain the string between -- Jimmy Fate shuffles the cards and we play with them -- PHP General Mailing List (http://www.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] Running php in background?
Hi James, > Ideally, I would like to run the job in the background anyway. Can > that be done? read this: http://www.php.net/manual/en/function.exec.php and search for 'background' keyword. -- Jimmy Brigands will demand your money or your life, but a woman will demand both. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Supplied argument is not a valid MySQL result resource
Hi Dan, > $parent_sql = "SELECT * FROM categories ORDER BY sort_order ASC"; > $parent_result = mysql_query($parent_sql); change the line to this one and run it again to see the error: $parent_result = mysql_query($parent_sql) or die(mysql_error()); -- Jimmy Brain off-line, please wait. -- PHP General Mailing List (http://www.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] inserting a file into MSSQL
Hi Peter, > Does anyone have a link to a good reference on how to insert a binary file > (zip file) into MSSQL? why do you want to store binary file in DB? It's more efficient to store the file in filesystem, and in DB only store the path of the file. Unless you really have a good reason and left with no option other than store the file in DB. -- Jimmy Brigands will demand your money or your life, but a woman will demand both. -- PHP General Mailing List (http://www.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] Interesting Problem
Hi Yoed, > mysql_query("SELECT Id, Dep_Date, Return_DateFROM X,Y WHERE Dep_Date LIKE > '%$SelectDate%' OR Return_Date LIKE '%$SelectDate%' ORDER BY Dep_Date"); > Will give you a ton of errors, and I'm not very fimilar with JOIN and SQL > and how that works. My idea was to create two querys, but the results in from your table definition i didn't see any relation between those two tables, so most probably it doesnt make sense to make a "join" operation. just do it in 2 query, one for each table. -- Jimmy When you have a hammer, you tend to treat everything as if it were a nail. -- PHP General Mailing List (http://www.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] weird fopen problem
Hi Jon, > 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. looks like you try to open a file outside the allowed direcory tree. check your "open_basedir" setting in php.ini config file. -- Jimmy Politics SUCKS !! -- PHP General Mailing List (http://www.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] Test if picture exists then load.
>> Would that be fopen()? or something else? I'm still new to PHP so any >> feedback would be very appreciated. > Use file_exists() to check whether a file exists. file_exists() function is quite slow. in your case, better do fopen() to check if the file exist, because you gonna do fopen() anyway if the file exist. if fopen() return error, then you can assume the file does not exist. dont forget to add "@" in front of the function name, to surpress err msg. if ($f = @fopen($image)) { // file exist, read the content, then echo to browser } else { // file does not exist, open default image } -- Jimmy Bigamy is having one spouse too many. Monogamy is the same. -- PHP General Mailing List (http://www.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] Object Copying
Hi Ken, > As we all know, this copies an object in PHP: > $obj2 = $obj1 > Preferable a way to fix PHP not to copy the object, but the reference. this will do want you want: $obj2 = &$obj1; -- Jimmy Always keep a cool head and a warm heart -- PHP General Mailing List (http://www.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] ereg
Hi Kunal, > ereg("(.*)", $lineofhtml, $output); ereg("([^]*)", $lineofhtml, $output); -- Jimmy It's not what you have in your life that counts, but who you have in your life -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] eregi and alfa numeric characters.
Hi Sait, > no characters except for the followings will not be allowed. > 0-9 a-z A-Z ~ @ # $ % ( ) _ - + = [ ] { } < ? > if ( ereg("[^0-9a-zA-Z\_\-]", $user_input) ) { //invalid char detected } else { //input contain only allowed char } just add all your valid char in the pattern, and dont forget to escape the char which has special meaning in regex. -- Jimmy Money is what you make it - a servant or a master -- PHP General Mailing List (http://www.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] preg_replace help
Hi Gaylen, > Please visit my web site at href=http://www.mysite.com>www.mysite.com. You will be glad you did! assumming all link start with www and all word which start with www must be a link: $repLink = preg_replace("/ (www[^ ]*) /i", "\\1", $myLink); -- Jimmy People are like clouds, all unique. -- PHP General Mailing List (http://www.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] Piping data into a select box
Hi Dean, > Does anyone know how to give a select pulldown box a default value > from a PHP variable? "January","02"=>"February",...); // $option_list=generate_option_list($key_value,"02"); // //$option_list now contain text January // // February // // NOTE: This will only create the tag, without the tag // while ( list($key,$value) = each($key_value) ) { if ($key==$set) {$var.="$value";} else {$var.="$value";} } return $var; } ?> -- Jimmy Leave loved ones with loving words, it may be the last time you see them -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help using ereg_replace()
Hi Erik, > "$phone" is a 10-digit string. > I would like the output to be > $phone = "(555) 555-"; you don't need regex to do that. just insert add "(" to the beginning of $phone, add ") " to the 4th position, and "-" to the 4th position from behind, using substr_replace() function. anyway if you insist on using regex: preg_replace("/(\d{3})(\d{3})(\d{4})/", "(\\1) \\2-\\3", $arr); -- Jimmy Everything loses its value when overly used, including love. -- PHP General Mailing List (http://www.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] unable to copy and chmod
Hi Edgard, > I'm trying to copy a file and chmod it to make it writable, but after I copy > it using PHP I can't even chmod in ftp ! since you upload it using PHP, most likely the owner of the file is nobody.nobody, that's why you can't chmod thru ftp. (unless you login to ftp as nobody ;)) > I can't change the file owner too. only root can chown You need root access to fix your problem...or re-upload your file using ftp, not php. -- Jimmy A diplomat is man who always remembers a woman's birthday but never her age. -- PHP General Mailing List (http://www.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
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 -- Jimmy A woman is like your shadow; follow her, she flies; fly from her, she follows. -- PHP General Mailing List (http://www.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
Hi Martin, > 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? nope. in POST request, all the variable will be in the body/content part, so it is correct. -- Jimmy To Jazz or not to jazz. That's the question. -William Saxpeare- -- PHP General Mailing List (http://www.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] Including a REMOTE FILE using include (php function)
Hi louie, > Im trying this little example of mine, Im trying to include > a file from a remote webserver but could not possibly get > it to work.. could be because the url fopen wrapper is disabled. check the value of this setting in your php.ini file: allow_url_fopen -- Jimmy Love your country, but never trust its government. -- PHP General Mailing List (http://www.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] Lazy evaluation?
Hi Alexander, > Does PHP support lazy evaluation? Meaning that if: Yes, it does. -- Jimmy Got a dictionary? I want to know the meaning of life. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] StripSlashes() & quotes in text boxes
Hi Robert, > administrator to edit the item description. When displayed in a text box the > description just shows 17. > The only solution I can find is to swap the quote marks for " > when storing the item initially you can use htmlspecialchars() function to convet all the html chars. The issue is, when do you convert it, either when you want to display them on browser, or when user INSERT/UPDATE. I think it's better to convert it only when displaying to the browser. so in the DB, the data is still stored as it is, because you might want to display the data somewhere else other than browser, for example email or printing. -- Jimmy All work and no pay makes a housewife. -- PHP General Mailing List (http://www.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] Time calculation after UNIX
Hi Olav, > I have a database that is supposed to last more than 30 years > Could someone advice me how to calculate (add and subtract) time in a maner > that willl be correct after 2030 when Unix Time stop working? if you are using MySQL, then use datetime or date column type. they can support date range from '1000-01-01' to '-12-31'. and for calculation, you can use MySQL function: ADDDATE() or SUBDATE() -- Jimmy Bigamy is having one spouse too many. Monogamy is the same. -- PHP General Mailing List (http://www.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] Lazy evaluation?
>> For "or" statements it does, but not && or xor. Are you sure only "or" which do lazy evaluation? as far as i remember, the last time I use "&&" operator it do lazy evaluation. And if you look at the online manual, some users also confirmed that PHP implement lazy evaluation for logical operator. http://www.php.net/manual/en/language.operators.logical.php >> I don't know about you, but I wouldn't want lazy evaluation on >> a conditional statement involving "and". Would you share the reason with us why you dont want lazy evaluation in "AND"? > if i have a statement like > if (($a == 'a') && ($b == 'b')) blahblahblah(); > and, $a != 'a'. > why should php even look at the value for $b while evaluating this line? i believe PHP implement lazy evaluation, so it won't evaluate $b=='b' -- Jimmy Success only comes before work in the dictionary. -- PHP General Mailing List (http://www.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?
Hi Martin, >> 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 > Ok, assume you are correct, but what if you are using persistent > connections (ie pconnet)? don't worry, persistent connection is per-child-process basis, so concurrent users will use different connection to DB. the only problem i can think of might occur with pconnect is, last_insert_id() will return you the last inserted ID from previous 'session', not current 'session'. to prevent this, you should call last_insert_id() only when your INSERT query executed succesfully. -- Jimmy Right thinking leads to right living -- PHP General Mailing List (http://www.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] WDDX...
Hi Tony, > I'm doing a website which I want to be easily updated so I made it using > wddx, now I wonder how fast or slow it is? > How many people can connect to my website without seeing any slowdowns? > Anyone knows? I use WDDX in my project to exchange data between application (which is what WDDX mainly for). In average, in all my script there will be one call to wddx_serialize_vars() function, and everything seems to be ok to me...there's no significant slow down. though, still we can not conclude that WDDX is fast/slow, since my app is not so WDDX-intensive. btw, it's interesting that you can use WDDX to help you update your website easily. would you mind sharing with us how? Thanks -- Jimmy The past is present in the future -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Help !! Mail Function Problem (Newbie)
Hi Simos, > mail([EMAIL PROTECTED], "Subject", "Line 1\nLine 2\nLine 3"); > thewall sendmail[4513]: g0H10I604513: from=apache, size=0, class=0, > nrcpts=0, relay=apache@localhost I am not sendmail expert, so i am just guessing. the nrcpts=0 in your log message might be stands for "number of recipients", and it is showing 0. So maybe you should pass the email address in proper string (enclose it inside quote), like this: mail("[EMAIL PROTECTED]", "Subject", "Line 1\nLine 2\nLine 3"); -- Jimmy The past is present in the future -- PHP General Mailing List (http://www.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?
Hi DL, >> the only problem i can think of might occur with pconnect is, >> last_insert_id() will return you the last inserted ID from >> previous 'session', not current 'session'. >> to prevent this, you should call last_insert_id() only when >> your INSERT query executed succesfully. > =Of course a "right-living" boy like me, cannot conceive of why one would > look up LAST_INSERT other than immediately after the INSERT/UPDATE command... calling last_insert_id() after INSERT is the number one rule of course :) What i mean was, what if the INSERT query fail, but the script still execute the last_insert_id() function? Most probably the returned value would be wrong, because it will return the last_insert_id of previous INSERT query (from previous 'session') > =What I have noted is that the PHP manual > (http://www.php.net/manual/en/function.mysql-insert-id.php) works > slightly differently (and possibly more simply), as well as > emphasising the "immediately after" relationship between this call > and the preceding INSERT. I might be wrong, but i think PHP's mysql_insert_id() must be using MySQL's API function call. Meaning, it will return whatever value MySQL return. Or in other word, mysql_insert_id() and last_insert_id() will return the same result. I have look thru the manual link above, and i think the phrase "immediately after" in the manual is more to advise the user to do mysql_insert_id() immediately after the INSERT query, because last_insert_id value might get overwritten by the newest one. the "immediately after" phares in the manual doesn't mean that PHP's mysql_insert_id() function is somehow tied to the previous/last INSERT query, so that if the INSERT fails then mysql_insert_id() will intelegently return the correct value. just my 1 cent -- Jimmy The average woman would rather have beauty than brains, because the average man can see better than he can think. -- PHP General Mailing List (http://www.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?
Hi mike, >>>> last_insert_id() will return you the last inserted ID from >>>> previous 'session', not current 'session'. >>>> to prevent this, you should call last_insert_id() only when >>>> your INSERT query executed succesfully. >> Most probably the returned value would be wrong, because it will >> return the last_insert_id of previous INSERT query (from previous >> 'session') > but of course, you'd have checked that the result id returned a valid result > and not an error in this case and never looked for the last_insert_id, Exactly. That's why in the first posting (read the first paragraph above), I told him to exec last_insert_id() or mysql_insert_id() ONLY when the insert query is SUCCESSFUL. -- Jimmy When you lose, don't lose the lesson. -- PHP General Mailing List (http://www.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?
Hi DL, > ="session" is not the correct word/its use is potentially confusing > (perhaps that's why it's in quotes?) - persistence refers to the > continuing connection between PHP and MySQL. yup, you're right. session is not the correct word, but i can't find the correct/easy word to subtitute session, so i just use session but put it inside quotes :) > However it is also possible that in order to save time the LAST_ID > information is built into the resultset coming back from the INSERT - > thus when mysql_insert_id() is called PHP would not need to go back > to MySQL/last_insert_id(). yes, what you said could be true also. Well, there's only one way to be sure how mysql_insert_id() works...read the source code of PHP :) but unfortunately I dont have the source code, and even if I do, I won't read it, because I am lousy at reading someone's code...:) nice discussion, Neil :) -- Jimmy Buy Land. They've stopped making 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]
Re: [PHP] Error notification and pretty error page
Hi Dan, > How can i include error notification, like if an MySQL error occurs, > to notify me of the offending page and what the error was, while > having the page die quietly or nicely, like an message saying that > the webmaster will be notified please continue? you can make a generic function to be called when such error occured. the fucntion will print a nice/default error msg to user and you can log detail information regarding the error into logfile or DB, or even send out a notification email to you. function fatal_error($msg, $file, $line) { //$msg : the to be logged //$file: name of file which trigger the error //$line: line number which trigger the error } the usage: include(''); @mysql_query or fatal_error (mysql_error(), __FILE__, __LINE__); __FILE__ and __LINE__ are php predefined constant to indicate current file and line number which is being parsed/executed. you always have to pass this __FILE__ and __LINE__ because PHP dont have the ability to "backtrack" from which file/line a function is called :( and dont forget to add "@" sign in front of the PHP's function, to surpress the error msg generated by PHP. -- Jimmy There is no greater waste as a waste of time -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Best way to get the remote IP address?
> either $HTTP_SERVER_VARS['REMOTE_ADDR'] or simply $REMOTE_ADDR (if you use > $REMOTE_ADDR in functions make sure you do a global on it first) - I > personally use $REMOTE_ADDR, but you should read the docs for details... using $REMOTE_ADDR directly is fine as long as the "register_global" setting is off. otherwise, it's wiser to use getenv('REMOTE_ADDR') instead of $REMOTE_ADDR directly. -- Jimmy Failure doesn't mean you'll never make it. It just means it may take longer. -- PHP General Mailing List (http://www.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] strange behaviour of mysql_pconnect()
Hi list, I do a small test on mysql_connect() and mysql_pconnect(), and discover a strange behaviour. the output if using mysql_connect(): Resource id #1 Resource id #1 (both resource id are the same, as expected) the output if using mysql_pconnect(): Resource id #1 Resource id #2 (both resource id are different) at first I though pconnect() will create 2 different connection because the printed resource id is different. But after doing some test (by looking at the mysql processlist) i can conclude that those two link_identifier are actually the same (only one link, but with two different id) the question is, why pconnect() print different resource id, whereas connect() print the same one? -- Jimmy You can't quicken the growing of a plant by pulling the leaves -- PHP General Mailing List (http://www.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] strange behaviour of mysql_pconnect()
Hi Shane, > Actually, I'd be interested to know why the same connection is used for two > connections to the same database? > I'm guessing people could fall over this trying to do, say, unbuffered > queries through one to fetch a huge result set, and normal queries through > another to make changes nope... as i've said before, this is only a testing script, not a real one. I come across this testing when discussing about how many same persistent connection can be opened to mysql. I believe there will always be exactly only one same connection (same connection = same host and same username), regardless of using connect() or pconnect(). but then someone make a small testing, by doing 2 same pconnect() and printing the returned link_identifier, which surprisingly return 2 different id. -- Jimmy There is no greater waste as a waste of time -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] php printer functions...
I'm running PHP 4.1.1 on a Win2K box. If I understand the manual correctly, the printer functions have been integrated into PHP as of v4.0.4. However, when I try to call any of the printer functions, nothing works. Any ideas or suggestions? TIA -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ODBC & MSSQL...
Anyone have any experience resetting the result cursor when using ODBC to access MSSQL (2000)? TIA -josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for security annoucements
Hi, I'm running a PHP/mySQL site which has been hacked twice this week :-((( I'm not so bad at security but I don't know any active resource to be aware of hole in PHP and/or MySQL, which forum/newsgroup/list wouldbe advice? Nice day to all, by the way.. Jimmy Carpe diem...today is another - good - day :))) -- PHP General Mailing List (http://www.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] Looking for security annoucements
I'm running phpBB not phpNuke and I'm subcribed to Buftraq, hope the otehrs are more helpful for me... Jimmy -- PHP General Mailing List (http://www.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] Looking for security annoucements
1.4.0 was hacked, but just for fun on tuesday, on wednesday I upgraded to 1.4.2 and it was hacked by another hacker in the night!!! I looked at the 1.4.2 for my customization, and this morning at the 1.4.4 and saw that even basic security holes are not fixed. The project team is working on the 2.0 so I think the release is not serious. I spent all the day to recover the defaced topics and texts, now I gonna backup and think to another solution... Thanks for the reply anyway, Jimmy -Message d'origine- De : Mark Roedel [mailto:[EMAIL PROTECTED]] Envoyé : vendredi 9 novembre 2001 15:22 À : Jimmy; [EMAIL PROTECTED] Objet : RE: [PHP] Looking for security annoucements > -Original Message- > From: Jimmy [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 09, 2001 2:41 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Looking for security annoucements > > > I'm running phpBB not phpNuke and I'm subcribed to Buftraq, > hope the others are more helpful for me... What version of phpBB? I know there were a number of security fixes in the last few releases (current looks to be 1.4.4)... --- Mark Roedel | "Blessed is he who has learned to laugh Systems Programmer | at himself, for he shall never cease LeTourneau University | to be entertained." Longview, Texas, USA | -- John Powell -- PHP General Mailing List (http://www.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] E-Commerce
Hi all. Is PHP a suitable language for building an online shop? Where would I go to find out more info on this? Thanks in advance! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] E-Commerce II
Wow, thanks for the help guys. Appreciate it. Here's 2 other Q that popped into my head while researching... 1. I looked at Yahoo! and bCentral, they both charge monthly fees for using their E-Commerce Tools. Why? I thought it should be a one time thing? Or are they not providing code, just letting us use the code via Explorer and Frontpage? 2. If I were to look for a website hoster, any recommendations? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with arrays
Hi, I have 2 arrays: Array ( [0] => Array ( [0] => 28 [1] => Music ) [1] => Array ( [0] => 5 [1] => Books ) ) and Array ( [0] => aaa [1] => bbb ) I want to join this two array and the result must be loke this: Array ( [0] => Array ( [0] => 28 [1] => Music [2] => aaa ) [1] => Array ( [0] => 5 [1] => Books [2] => bbb ) ) Thanks in advance for your help -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] update query based on array
not real sure of the setup of the form but if you have mutiple groups of items to be updated then you should make the rank an array -- rank[pid#] you should make all the items -- that are related part of the same group -- by using [] On Mon, 2002-12-09 at 15:06, Jason Dulberg wrote: > I am displaying a list of data (from an sql query) and some of the fields in > that list are editable through a form. If the user chooses to edit one or > more of the rows of data, they must click on a checkbox to add that row to > an "update array". The problem is that when I read that array to pass to an > UPDATE sql statement, it only passes the last entry of the array. > > Here's an example of the data being passed: > 13 - 4 - UPDATE ranking SET category='Prep School', rank='30' WHERE pid=4 > 14 - 169 - UPDATE ranking SET category='Prep School', rank='30' WHERE > pid=169 > 15 - 166 - UPDATE ranking SET category='Prep School', rank='30' WHERE > pid=166 > > The above is created based on the following html code: > //the last row > > > > > So as you can see, its only reading the last row and assigning its values to > the data above as well. > > Here's what I'm using for the sql query: > > while(list($key,$val)=each($rankid)) { >$upd=mysql_query("UPDATE ranking SET category='$category', rank='$rank' > WHERE pid=$val"); > } > > If anyone has any suggestions for fixing this problem, please let me know :) > THanks > > > __ > Jason Dulberg > Extreme MTB > http://extreme.nas.net -- Jimmy Brake <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] a good imap library?
Hi! I am looking for a good imap library .. That will let me: login logout list folders list contents of a folder retrieve email retrieve just headers retrieve the attachement of an email get the number of messages in a mailbox set server side filters etc I have been digging around squirrel mail but I am not to happy with what I am seeing -- looks very mature but I would prefer something that is OO. Thanks in advance, Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Flow diagrams.
to my knowledge there is nothing in php that does that good luck On Thu, 2002-12-26 at 11:17, Sridhar Moparthy wrote: > Hi Every one, > > Do you know how to prepare and display process flow diagrams dynamically > based on some data from database. I have information about some processes in > the database that tells different process dependencies. I need to display > that information as a process flow diagram. > > I am using PHP 4.xx and IIS on Win NT platform. Please help me if you know > how to do. > > > Thank You, > Sridhar Moparthy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading + downloading Large files ...
Hi! My users need to upload and download large files (100 + megs). Right now I only allow 100k to be uploaded. Will I need to do anything to php/apache to make sure things continue to be reliable? My google search only found threads with bad endings and they had much smaller files. Should i just make em use ftp or scp? The problem with using one of those protocols is that it makes it difficult for the users to link the files to the proper account/relation/incident and anything that is a problem for users is usually a problem for me. Thanks! Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Flow diagrams.-- Resending
can you give us some examples of the data ... the example I would like to see is: based on this information this is what should be displayed On Fri, 2002-12-27 at 11:48, Sridhar Moparthy wrote: > Hi Every one, > > I have information about some processes in the database that tells different > process dependencies. I need to display that information as a process flow > diagram. Do you know how to prepare and display process flow diagrams > dynamically. Do you know anything like JPGraph or Java script or java applet > that can do this? If so Please help me. > > I am using PHP 4.xx and IIS on Win NT platform. Please help me if you know > how to do. > > Thank You, > Sridhar Moparthy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] monster form and compression?
IE has some bugs when you have big forms when using [] test with mozilla or netscape if thats the case -- then errr well umm use what works On Fri, 2002-12-27 at 12:50, Jeff D. Hamann wrote: > I have a monster form (really a funky grid - hey the client is always right) > that does not display entirely each time the form is displayed. Some times, > quite repeatably, the bottom half of the form's select boxes will be blank > (not good). Is there a way to compress the web page before it gets sent, or > any method to ensure the page will display correctly? > > Jeff. > > -- > Jeff D. Hamann > Hamann, Donald & Associates, Inc. > PO Box 1421 > Corvallis, Oregon USA 97339-1421 > Bus. 541-753-7333 > Cell. 541-740-5988 > [EMAIL PROTECTED] > www.hamanndonald.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Flow diagrams.-- Resending
On Mon, 2002-12-30 at 06:59, Sridhar Moparthy wrote: > Hi Jimmy, > > Thank You for the your reply. Here is the example. > > If > 1. Jobs 'B' and 'C' starts immediately after Completion of job'A' > 2. Job 'D' starts after completion of both Jobs 'B' and 'C'. > 3. Job 'E' starts after completion of job 'C' > 4. ... > job = object What makes the jobs different -- should the images for different jobs be different images? Do the connecting lines need to represent objects bouncing around inside a computer, a network or the real world? Do the objects transition between the real world - inside a computer and through networks? I just need to get a grasp. Do the connecting lines always connect to the same place or are they places on an object can connecting lines have bends? If they bend can they cross other lines or pass through objects they are not related to? (lots of other questions like this) Can you show me data from your db(change the names if security is an issue). Also some general descriptions or what each job is would be great. Such as is it a function or an object or class or is this data bouncing between servers and respective processes. And things that you are looking for in the image. H if the layout is always the same then the graphic class can be quite simple but if the layout changes it could make things much more complex. > The I would like to see the following image. > > > [image] > > > If you can not see the image, Please see the attached file. > > Thank you. > Sridhar. > > > > > > -Original Message- > From: Jimmy Brake [mailto:[EMAIL PROTECTED]] > Sent: Friday, December 27, 2002 4:23 PM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Flow diagrams.-- Resending > > > can you give us some examples of the data .. > > the example I would like to see is: based on this information this is > what should be displayed > > > > On Fri, 2002-12-27 at 11:48, Sridhar Moparthy wrote: > > Hi Every one, > > > > I have information about some processes in the database that tells > different > > process dependencies. I need to display that information as a > process flow > > diagram. Do you know how to prepare and display process flow > diagrams > > dynamically. Do you know anything like JPGraph or Java script or > java applet > > that can do this? If so Please help me. > > > > I am using PHP 4.xx and IIS on Win NT platform. Please help me if > you know > > how to do. > > > > Thank You, > > Sridhar Moparthy > > -- Jimmy Brake <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mac os 9 - file upload problems
Hi, I have a file upload page that accepts file uploads from pretty much every browser and os EXCEPT any browser on mac os 9. I have no idea why, any of you ever have problems with file uploads on mac os 9? How did you solve the issue. -- Jimmy Brake <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I have a problem with MsSQL
Hi. My problem is the characters in spanish: example: Construcción (Data of MsSQL Server) Result in web with PHP: Construcci¢n Thanks you. Prompyme a su servicio - Prompyme a su servicio. "El Estado su mejor cliente, visite la página de información de Compras del Estado" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] vni -> unicode
Hi! I was wondering if anyone has vni -> unicode conversion script. Thanks Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] crontab
i think one of us misunderstood your posting ... my suggestion was simply to put a php script in your crontab to be run whenever you set it to go .. if you are writing a php script to update crontab for you as Liam understood your message it is not a good idea ( actually it's a really bad idea :) ) but running a php script versus a bash or perl or whatever script/program is no more a concern than those ( always have security in mind ) On Tue, 2003-03-04 at 13:07, John Taylor-Johnston wrote: > Cal, Liam, Jimmy, > Thanks. If this is a serious security hazard, could you show me some code that is > more secure? I am the "root". Mind you I've never worked with crontab before. I want > to run /var/www/backup_mysql.php I suppose I should start by putting it somewhere > not publicly accessible? > > Thanks, > John > > Liam Gibbs wrote: > > > > Can I run a php script in crontab? > > > Do I echo or print? > > > Anyone doing it? > > > > This is a serious security hazard. However, what you could do is have a PHP > > page set cron settings (such as name of file, location, frequency, and > > importance), then have another cron job (running at a decent frequency) do > > the organization. However, this is still a security flaw, as hackers can > > just take a look at your cron jobs and get in and run their own in place of > > yours. Probably no more a flaw than normal, though, as if a hacker can get > > in to replace your cron job, they can get in and run any number of things > > anyway. Make sure to hard code your cron jobs, as having a downloadable page > > is a bigger security hazard. You don't want the PHP page to do this itself, > > because it will have to run as root. > > > > I did this one time, and if I'm allowed some time to get my page up, I can > > e-mail you some instructions. What you'll need is a PHP page, a txt file > > (for the settings) and a cron job that will read the file and do the > > necessary steps to arrange the cron jobs itself. -- Jimmy Brake <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen and file dump to a databace...
hi mark! i import data all the dang time and this is what i use (more or less) Insert($query); // i use a class for my mysql connections } function csv_parse($data, $separator) { $quote = '"'; $values = array(); $toggle = 0; $len = strlen($data); $count = 1; for ($i = 0; $i < $len; $i++) { $tmp = substr ($data, $i, 1); if (strcmp($tmp, $quote) == 0) { $toggle = $toggle ^ 1; } $value = $value . $tmp; if (strcmp($tmp, $separator) == 0) { if (! $toggle) { # End of word $value = ereg_replace(",$", "", $value); $value = ereg_replace("^\"", "", $value); $value = ereg_replace("\"$", "", $value); $value = ereg_replace("\"+", "\"", $value); $num_of_elems = count($values); $values[$num_of_elems] = $value; $value = ""; } } } $value = ereg_replace("^\"", "", $value); $value = ereg_replace("\"$", "", $value); $value = ereg_replace("\"+", "\"", $value); $num_of_elems = count($values); $values[$num_of_elems] = $value; return ($values); } function make_safe($text) { $text = preg_replace("/(\cM)/", " ", $text); $text = preg_replace("/(\c])/", " ", $text); $text = str_replace("\r\n", " ", $text); $text = str_replace("\x0B", " ", $text); $text = str_replace('"', " ", $text); $text = explode("\n", $text); $text = implode(" ", $text); $text = addslashes(trim($text)); return($text); } On Sun, 2003-03-09 at 18:02, Mark Tehara wrote: > HI, I'm looking to take the data from a CSV file, then upload it into a > mysql databace. > > I figure i will need the following. > > To count the number of lines ... and cut up each line in its veriables then > entering it into the databace. > > I have: > > $file = fopen("pricelist-snippet.csv","r"); > $buffer = fread($file,1); > echo $buffer; > > This dumps the data to the screen ... > > where would i start to making cutting this data up by the line? > > / Mark > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird slowdown using complex functions in a loop
where are you storing the information that you are cleaning once it is cleaned? are you appending it to a variable in the script? On Wed, 2003-03-12 at 00:26, pgcd wrote: > Hi, > I'm trying to write a script to do some basic XML validation - nothing > fancy, basically I just close open tags and check the arguments. > The script runs fine, except that, when I use it in a loop (I need to > validate roughly 200.000 posts), it gets progressively slower - like, the > first ten calls to the function need around 0.01 seconds, next ten take > 0.03, then it's 0.1 and so on. > I've tried disabling parts of the code, I've tried profiling with dbg, I've > tried manually optimizing: nothing. I managed to reduce the slowdown a bit, > but it's still there, and very evident (as soon as I reach around a hundred > posts, a single function call takes as long as 10 seconds). > > It may be interesting to note that I had to recode it from scratch: I wrote > a class to do the same processing, and *that* ate memory like crazy, ending > up with nearly 2 GB of used memory (according to XP taskman). > > If anybody has come across a similar problem, I'd love to know what did they > do to solve it, but a suggestion on how to pinpoint the cause of the > slowdown would be great as well. > > Uh, yes: I'm using PHP 4.2.2 and Apache 1.3.24 on an XP machine (but I've > tried using PHP 4.3.0 and Apache 2, with the same results). > > pgcd > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 2 databases
yes -- i connect to oracle and mysql simultaneously .. On Wed, 2003-03-19 at 15:21, Iwan van Kanten wrote: > Is it possible to connect to 2 different databases?? > 2 different dtabase typs I mean > postgresql and Mysql > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cookies with internet explorer on macs
Hi! The cookies i set for people using Internet Explorer on mac (OS X or mac os 8-9) are not staying alive as long as I would like(12hours) they only last for a few hours or sometimes even a few minutes, the time on the end users computers are set correctly. IE on windows is fine and Mozilla and other browsers on linux are fine. This is what I use to set the cookie. $rand = md5(uniqid(rand())); setcookie("sessid", $rand, time()+43200, "/"); Any ideas? Thanks! Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies with internet explorer on macs
thanks ... lots of my customers use entourage ... On Mon, 2003-03-31 at 20:53, Lowell Allen wrote: > > From: Jimmy Brake <[EMAIL PROTECTED]> > > > > The cookies i set for people using Internet Explorer on mac (OS X or mac > > os 8-9) are not staying alive as long as I would like(12hours) they only > > last for a few hours or sometimes even a few minutes, the time on the > > end users computers are set correctly. IE on windows is fine and Mozilla > > and other browsers on linux are fine. > > > > This is what I use to set the cookie. > > > > $rand = md5(uniqid(rand())); > > setcookie("sessid", $rand, time()+43200, "/"); > > > > Any ideas? > > A designer I work with was having problems with his sessions sometimes > expiring after a few minutes. He uses OS X/Internet Explorer/Entourage. He > determined that whenever he checks his email with Entourage, his session > cookie is no longer recognized. He got Microsoft support to duplicate and > acknowledge the problem. I use Mac OS 9/Internet Explorer/Outlook Express -- > no problem. > > -- > Lowell Allen -- Jimmy Brake <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] native vs. phplib sessions
homegrown make a rand value for the cookie -- stick that rand value in a db with the actual user account info ... then we pull the real account info using the random value from their cookie -- simple, efficient and pretty dang secure -- also the system is load balance friendly On Fri, 2003-04-04 at 12:26, Dennis Gearon wrote: > How many people are using native vs. phplib sessions, vs. their own/homegrown > sessions? > > The archives show a LOT of problems with native sessions. -- Jimmy Brake <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP vs. jsp, advice please
hi! i run some really big apps (crms/email/shopping carts/directories/forums/etc) that make use of persistance type data but NEARLY all of it is just put in and removed from the DB - just all kinds of little/big functions that need to maintain some data or state(s) of some data - my system averages 20 queries per second - thousands and thousands and thousands of simple queries - the only persistance is with mysql connections just my two cents On Tue, 2003-06-10 at 17:51, Jean-Christian Imbeault wrote: > Cpt John W. Holmes wrote: > > Agree 100%. Don't assume that just because you use JSP, or any other > > language, your program is going to instantly "scale well" and be easy to > > maintain. You can write crappy, inefficient code in any language. You can > > also write good programs in most any language if you put the proper planning > > into it before hand. > > Ok, I've got answers concerning the learning curve and maintainability > and some pros and cons that I have found very useful. > > Now the one last point that I would like to really find out about is > persistence. I keep hearing that you can get *true* persistence with > jsp/servlets/beans/whatever. I'm still trying to find out more details > on this as I can't see how you can get that since HTML is stateless and > whatever the backend is it all eventually turns into an HTML connection ... > > Sessions in PHP are nice but as everyone knows they don't allow for true > persistence. And if you want to have your objects persist over a > session, that's even more work (and in my short programming career I > have not yet found a case where persisting a PHP object across a session > was worth the trouble/overhead). > > Can anyone offer an opinion on this? Is persistence with jsp that much > easier compared to PHP? And if true persistence is possible is it all > it's cracked up to be? > > I've often dreamed of being able to have true persistence but if I had > it maybe I wouldn't find it all that useful once I'd had a go with it. > > Thanks, > > Jean-Christian Imbeault -- Jimmy Brake <[EMAIL PROTECTED]> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What causes this?
Hi, I am getting this error randomly, just stops and starts. Error: Unable to select database: crm :Commands out of sync; You can't run this command now './configure' '--with-oracle=/opt/oracle/product/8.1.6/' '--with-oci8=/opt/oracle/product/8.1.6/' '--enable-sigchild' '--enable-track-vars' '--enable-wddx' '--with-mysql' '--with-jpeg-dir=../jpeg-6b/' '--with-t1lib=../t1lib-1.3.1' '--enable-wddx' '--with-apache=../apache_1.3.27' '--with-mysql=/usr/local/mysql/' The site ran fine till the upgrade any ideas how I can get rid of this or should I just rollback the update? Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cleaning pasted Word text
for file maker pro (windows/mac) -- word (windows/mac) function make_safe($text) { $text = preg_replace("/(\cM)/", " ", $text); $text = preg_replace("/(\c])/", " ", $text); $text = str_replace("\r\n", " ", $text); $text = str_replace("\x0B", " ", $text); $text = str_replace('"', " ", $text); $text = explode("\n", $text); $text = implode(" ", $text); $text = addslashes(trim($text)); return($text); } function make_safe2($text) { $text = str_replace("\r\n", "\n", $text); $text = preg_replace("/(\cM)/", "\n", $text); $text = preg_replace("/(\c])/", "\n", $text); $text = str_replace("\x0B", "\n", $text); $text = addslashes($text); return($text); } cannot remember I why put in two functions ... but anyhow have fun you will probably not the the implode / explode either On Tue, 2002-10-29 at 16:39, Daniel Guerrier wrote: > Paste into notepad, the copy the text from notepad. > Notepad should remove the high ASCII text. > --- Brent Baisley <[EMAIL PROTECTED]> wrote: > > I think you have posted before and probably didn't > > get an answer. I'm > > not going to give you an answer (because I don't > > have one), but perhaps > > I can point you in the right direction. > > Look at http://www.w3.org/TR/REC-html40/charset.html > > and see if that > > helps you. Below is a paragraph I pulled from it. > > > > The document character set, however, does not > > suffice to allow user > > agents to correctly interpret HTML documents as they > > are typically > > exchanged -- encoded as a sequence of bytes in a > > file or during a > > network transmission. User agents must also know the > > specific character > > encoding that was used to transform the document > > character stream into a > > byte stream. > > > > > > On Tuesday, October 29, 2002, at 02:20 PM, a.h.s. > > boy wrote: > > > > > I'm working on a PHP-based CMS that allows users > > to post lengthy > > > article texts by submitting through a form. The > > short version of my > > > quandary is this: How can I create a conversion > > routine that reliably > > > substitutes HTML-acceptable output for high-ASCII > > characters pasted > > > into the form (from a variety of operating > > systems)? > > > > > -- > > Brent Baisley > > Systems Architect > > Landover Associates, Inc. > > Search & Advisory Services for Advanced Technology > > Environments > > p: 212.759.6400/800.759.0577 > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > __ > Do you Yahoo!? > HotJobs - Search new jobs daily now > http://hotjobs.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Looking for good ZIP Code / Latitude / Longitude table
how much does the service cost? or am misunderstanding the class? why do you have to enter a password? On Wed, 2002-10-30 at 11:31, Manuel Lemos wrote: > Hello, > > On 10/30/2002 04:03 PM, Michael Zornek wrote: > > I've written a nice php/mysql site that let's you search for hospitals and > > community colleges by zip code. The search is built upon some math that > > figures out distances by a zip's lat and lon cords. > > > > My problem is that my current ZIP table (bout 42,000 rows) seems to be > > flawed. There are a ton of zip codes round california that have all the same > > lat and lons. There are other dups as well. So I'm looking for some new > > data. > > > > Does anyone know a good source for this type of info? > > This class may be used to figure the coordinates of a location given the > IP address of a computer (the user computer): > > http://www.phpclasses.org/netgeoclass > > > -- > > Regards, > Manuel Lemos > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] STDIN/STDOUT in PHP
I've been looking for a way to work with stdin/stdout for a mod_rewrite's rewritemap. There's a working example in Perl, (just returning the input) #!/usr/bin/perl $| = 1; while () { print $_; } I've been trying to achieve this with fopen() read and write the php://stdin & php://stdout . #!/usr/local/bin/php -q But no success. In the apache man they say Avoid one common mistake: never do buffered I/O on stdout! This will cause a deadloop! Hence the ``$|=1'' in the above example Could sommone give some pointers how I could achieve the perl script above in php? TIA Jim. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I would like to ask about Photo Upload in mysql and reteive problem .
Dear all , I am a new bie here and I would like to know more about coding in upload photo file by client side and store in mysql database. also , how can I show the photo in the HTML CODING embeded and get the image directly from the database ? thanks . could you mind provide some code to let me reference. ?? I am doing my project. I need this information in urgent. Please friendly give me advice here . thanks Jimmy
[PHP] A problem in mysql_fetch_array
I have insert some text with space to mysql DB with varchar() When I use mysql_fetch_array function to retrieve the data from DB . I found only the first session text can be shown . It means if any space there . It will split like session by session. for example. my DB have a text "Hello World" , It can retrieve only "HELLO" by using mysql_fetch_array . could anyone help me ? thanks ..
[PHP] ^k ? -- how do I match that?
Hi! I keep getting that evil little character ... ^k from mac users (pre X) and I need to remove it. Does anyone know how to remove? This site has that character as a vertical tab. This character is what is used in MS Excel when people hit return inside a cell. If they copy and paste that into a form its ok, but when I export that data to a csv it gets ugly. http://www.robelle.com/smugbook/ascii.html Thanks in advance! Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] missing function? array_change_key_case()
Hi! When I run this command ... $foo = array_change_key_case($foo, CASE_UPPER); I get this error .. Call to undefined function: array_change_key_case() in /index.php on line 181 Yet the function (should) exist: http://www.php.net/manual/en/function.array-change-key-case.php I am running 4.x any ideas? Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] missing function? array_change_key_case()
yep thats it ... On Wed, 2002-07-17 at 18:02, John Holmes wrote: > Works fine for me on 4.2.1 > > You have to have at least 4.2.0, do you? > > ---John Holmes... > > > -Original Message- > > From: Jimmy Brake [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, July 17, 2002 8:53 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] missing function? array_change_key_case() > > > > Hi! > > > > When I run this command ... > > > > $foo = array_change_key_case($foo, CASE_UPPER); > > > > I get this error .. > > > > Call to undefined function: array_change_key_case() in /index.php on > > line 181 > > > > Yet the function (should) exist: > > > > http://www.php.net/manual/en/function.array-change-key-case.php > > > > I am running 4.x any ideas? > > > > Jimmy > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP logo question
Hi coders, I've sent several mails to [EMAIL PROTECTED] regarding the limitations / rights to use the PHP logo. But I havent recieved any reply, does anyone know who answers that email? If so please send him/her an heads up to check his/hers inbox. Now you might think that I've been sending several mails within a few days and now cries for help... Thats no the case, I sent my first mail the 18th december and a copy of that mail was resent at the 8th of january 2004. Or if someone knows if that guy has a lot on his plate just send me an mail to let me know if he usually replies within the month or two months. Cheers Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Empty Reference to an Object
At 16:14 2004-01-13, you wrote: Hello Sebastian, Tuesday, January 13, 2004, 3:09:39 PM, you wrote: SO> I cannot believe that there is no way of making an object parameter SO> optional. function ($parameter1, $parameter2 = NULL) { // etc } If passed to your function, $parameter2 will be your object (or string or whatever you wanted), if not passed in it'll be null. this might work this is an ugly solution from the top of my head, not tested: $myObject =& (ifYour object exists)? $yourObject : new stdClass; foo("blaha",&$myObject); function foo($para1,&$param2){ if(get_class($param2) =='stdClass') $param2 = NULL; // get_class might return stdclass not sure } ?> / Jimmy -- Best regards, Richardmailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_fetch_row() and mysql_fetch_array()?
Yo! I am wondering what the difference is between mysql_fetch_array and mysql_fetch_row. I tried using this code: $result = query("SELECT * FROM index1"); while ($row = mysql_fetch_row($result)) {... but $row[] does not contain any data, but when I changed it to: $row = mysql_fetch_array($result) ... it worked just fine. So what is the difference? /Jimmy
[PHP] Session problems
Yo! I'm playing a little bit with sessions for the moment and I get a really scary errormessage: Warning: open(/tmp\sess_1b7577b36d874741ed1e74b4bead0dfd, O_RDWR) failed: m (2) in h:\program\apache\htdocs/boa/sessionTest.php on line 5 Warning: open(/tmp\sess_1b7577b36d874741ed1e74b4bead0dfd, O_RDWR) failed: m (2) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 I understand that there is a folder missing somewhere (tmp) and I tried to create one in the apache directory, but it still does not work. I'm using Win2k proffesional with an apache webserver and I don't have a clue what changes I should do to php.ini. Please help! /Broder B
Re: [PHP] Session problems
Yeah I used a path name with '\' instead of '/' but it still does not work. Help! "Johannes Janson" <[EMAIL PROTECTED]> wrote in message 94kpfm$4cc$[EMAIL PROTECTED]">news:94kpfm$4cc$[EMAIL PROTECTED]... > you have to set the 'session.save_path' in your php.ini. > be careful with the slashes you use. as you can see from > the error msg by default it's '/' but windows uses '\'. > > good luck > Johannes > > > "Jimmy Bäckström" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 001201c08564$f7398660$554d59d5@broder">news:001201c08564$f7398660$554d59d5@broder... > Yo! > I'm playing a little bit with sessions for the moment and I get a really > scary errormessage: > > Warning: open(/tmp\sess_1b7577b36d874741ed1e74b4bead0dfd, O_RDWR) failed: m > (2) in h:\program\apache\htdocs/boa/sessionTest.php on line 5 > > Warning: open(/tmp\sess_1b7577b36d874741ed1e74b4bead0dfd, O_RDWR) failed: m > (2) in Unknown on line 0 > > Warning: Failed to write session data (files). Please verify that the > current setting of session.save_path is correct (/tmp) in Unknown on line 0 > > I understand that there is a folder missing somewhere (tmp) and I tried to > create one in the apache directory, but it still does not work. I'm using > Win2k proffesional with an apache webserver and I don't have a clue what > changes I should do to php.ini. > Please help! > /Broder B > > > > > -- > PHP General Mailing List (http://www.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] session.save_path
Yo! I'm sending this call for help once again, since I didn't get an answer to my problem last time. I'm working a little with sessions, but I get a message like this: Warning: open(/tmp\sess_1b7577b36d874741ed1e74b4bead0dfd, O_RDWR) failed: m (2) in h:\program\apache\htdocs/boa/sessionTest.php on line 5 Warning: open(/tmp\sess_1b7577b36d874741ed1e74b4bead0dfd, O_RDWR) failed: m (2) in Unknown on line 0 Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0 I have a tmp directory under my apache directory (i'm running win2k btw) Is it suppose to go anywhere else? Please help me!
[PHP] ImageGif: No GIF support in this PHP build
Shu! When I try to use the function ImageGif() I get the following error: Warning: ImageGif: No GIF support in this PHP build... I'm using win2k with php4 width the gd module enabled in php.ini What can I do to make this problem go away? Thanks in advance /Broder
[PHP] Please help!! how to compare an array with another
Shu! I am currently working on a site where I want to randomly show pictures. I am using sessions to save the id's of the pictures that a user has seen during his/hers visit. My first question is: Can I use an array as a session variable? like this: $arr = array(1, 2, 3, 4, 5); session_start(); session_register("arr"); This array is to be passed on as an argument to a function used to find a random id, that has not yet been seen. This array should be compared to another array with the picture id's. There is two functions to accomplish the following: Create a randomized array consisting of all the pictures id. Find one id in that randomized array that does not exist in the array of allready seen pictures. These are the functions: function show_pic($pics_voted, $cat, $sex) { srand ((double) microtime() * 100); $result = query("SELECT id FROM $cat WHERE sex='$sex'"); while ($row = mysql_fetch_row($result)) { $arr[] = $row[0]; } shuffle($arr); $picture_id = find_id($pics_voted, $arr); echo "picture_id => $picture_id"; return $picture_id; }//show_pic //Hitta id som inte finns bland $pics_voted[] function find_id($pics_voted, $random, $x = 0) { for ($i = 0; $i < count($pics_voted); $i++) { if ($random[$x] == $pics_voted[$i] AND $x >= count($random)) return "no_pics"; //If current key in $random[] is equal to current key in $pics_voted[] AND $x is greater than, or equal to the number of keys in $random[], that is if the last key in $random[] has been reached, return "no_pics" elseif ($random[$x] == $pics_voted[$i]) { find_id($pics_voted, $random, $x+1); //If current key in $random[] is equal to current key in $pics_voted[] run the function again, with $x+1 as an argument to be used in the $random[] array, that is: do the funtion again with the next key in $random[] }//elseif }//for return $random[$x]; }//find_id Does anyone know why this ain't working? I get the same id over and over again. Maybe there is an easuer way to achive what I want? Please help!!
[PHP] Function to compare an array with another array
Shu! I need some help here. I have a script where I want to compare two arrays with eachother, and return one value from that does not exists in both arrays. I have an array of pictures id number created from a database query. I use sessions to save id numbers of pictures into an array. I want the first array to be compared to the second and return the first key/value-pair that are not found in the session array... Is there a way I can do this? Thankful for any help! /Broder B
[PHP] Create a Bulletin Board
Yo! I'm thinking of writing a bulletin board and I wonder about threads. I want the board to be built on threads but I don't know how to do it. I want it to look something like this: subject 1 | |__ reply1 to 'subject 1' | | | |__ reply1 to 'reply1 to subject 1' | | | |__ reply2 to 'reply1 to subject 1' | |__ reply2 to 'subject 1' This is important to me so I'm thankful for any help I can get! //Broder
[PHP] ld: fatal: Symbol referencing errors.
Hi, I was wondewring if someone know the reason to the error below, I'm no Unix guru and my sysadm says he cant get ldap to work due to this, is there anyone who tell me what to tell him to get it to work? greetings Jimmy Lund Sweden //ERROR ENCLOSED BELOW. gcc -DSOLARIS2=260 -I/usr/local/src/php-4.0.0 -I/usr/local/src/php-4.0.0/Zend -I/usr/local/src/php-4.0.0/Zend -I/usr/local/src/php-4.0.0 `./apaci` -o httpd buildmark.o modules.o modules/php4/libphp4.a modules/extra/libextra.a modules/standard/libstandard.a main/libmain.a ./os/unix/libos.a ap/libap.a -R/usr/ucblib -R/usr/local/ldap-3.3/lib -R/usr/local/mysql-3.22.32/lib/mysql -L/usr/ucblib -L/usr/local/ldap-3.3/lib -L/usr/local/mysql-3.22.32/lib/mysql -Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4 -ldb -lpam -ldl -lmysqlclient -lresolv -lresolv -lm -ldl -lcrypt -lnsl -lsocket -lsocket -lsocket -lnsl -lldap -llber -lavl -lldbm -lldif -llthread -lphp4 Undefined first referenced symbol in file ldap_module modules.o ld: fatal: Symbol referencing errors. No output written to httpd collect2: ld returned 1 exit status -- PHP General Mailing List (http://www.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] Newline in a guestbook
Hey guys! I'm writing a guestbook with mysql. My probblem is that when user enter at long word like blablablablablablablablablablablabla my html-tables gets screwed up. If someone is just fooling around the whole page design can be destroyed. I want to know how I can make sure that no word is longer than x characters. If a word should be longer than that, I would like the word divided into smaller parts with a - character at the end of the first word like this: "this is a text in the guestbook. if there is a really long word like blablablablablablablabla- blablabla it is divided into smaller parts and a - char is added to the first word." I thought about reading the whole message into an array, and then loop through it and for each word check whether it is larger than x chars, and if so, change it. But couldn't that be a very memory consuming script if it should do that for every message? Anyone knows how I could do this?
[PHP] parse error is always on line 1 == error ?
Hi, I have a problem, that when I get a parse error it always says that it's on line 1 in this or that file. Where is the configuration option to set this right? I have on another server seen that it's possible to get it to state the actual error line. (it's PHP Version 3.0.15 on solaris) Please help me out on this one. Best wishes Jimmy Lantz Sweden
Re: [PHP] parse error is always on line 1 == error ?
Yes, thank you you're right this is exactly what it was, I used Dreamweaver on a mac to edit the files, but now if I encounter parse error I convert them with BBEdit. Thank you. Jimmy Lantz >I use BBEdit on the Mac, uploading PHP code to a Unix server, and I get >parse errors on line 1 unless I remember to set line breaks to Unix \n >(rather than Mac and Windows line endings, which use different >characters). You may be running into a similar problem. > >Jimmy Lantz wrote: > >> Hi, I have a problem, >> that when I get a parse error it always says that it's on line 1 in >> this or that file. >> Where is the configuration option to set this right? >> I have on another server seen that it's possible to get it to state >> the actual error line. > >John Platte > >"Truth binds the mind to what satisfies it, >but worldly thinking does not satisfy >and therefore ignites curiosity." > >-- St. Theophan the Recluse -- PHP General Mailing List (http://www.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] How do I call_user_func_array() on 4.0.1pl2 ?
Hi, I wonder if there's a way to get the same result as with call_user_func_array()on 4.0.1pl2 . I need to do the following : foreach($formArray as $arrays){ foreach($arrays as $key => $value){ call_user_func_array($key, explode (",", $value)"); //Not working since I have 4.01 $key(explode (",", $value)); //This aint working either since explode returns an array, and I need to return //a list of vars to call. (different amount of vars each time!) }} Is there another way to do this using a function or something, I cant update since it's not my own server.ThanxJimmy from Sweden _IncrediMail - Email has finally evolved - Click Here
[PHP] How do I call_user_func_array() on 4.0.1pl2 ?
Hi, I wonder if there's a way to get the same result as with call_user_func_array() on 4.0.1pl2 . I need to do the following : foreach($formArray as $arrays){ foreach($arrays as $key => $value){ call_user_func_array($key, explode (",", $value)"); //Not working since I have 4.01 $key(explode (",", $value)); //This aint working either since explode returns an array, and I need to return a list of vars to call. (different amount of vars each time!) } } Is there another way to do this using a function or something, I cant update since it's not my own server. Thanx Jimmy from Sweden -- PHP General Mailing List (http://www.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] Going crazy again ...
Hej, jag hade nog inte använt åäö i case men det är bara en vana, kanske du kan använda en dold variabel via html-formuläret istället och använda den i case satsen? Men det svarar ju inte på din fråga men lycka till. / iImmy Martin Skjöldebrand wrote: > Going grey haired again. In this code only the first case is working > (adding stuff to tables). The second and third are producing - Warning: > Supplied argument is not a valid MySQL-Link resource in > /chroot/htdocs/diarium/settings.php on line 31 (which is $query_res /ms) > error: > > I've even copied and pasted the also clause which works from sendaction to > recaction but I get the same result. Anyone sees what going on? I don't. > And my deadline is tomorrow (or thursday). > > M. > > switch ($sendaction) { > case "Lägg till": > > $query="INSERT INTO employees (login, name)"; > $query .= "VALUES('$txtSend', '')"; > $query_res =mysql_query($query, $mysql_link) or die('error: >' . > mysql_error()); > if ($also=="Rec"){ > $query="INSERT INTO contacts (id, name)"; > $query .= "VALUES('$txtSend', '')"; > $query_res =mysql_query($query, $mysql_link) or >die('error: ' . > mysql_error()); > } > break; > } > > switch ($recaction) { > case "Lägg till": > $query="INSERT INTO contacts (id, name)"; > $query .= "VALUES('$txtRec', '')"; > $query_res =mysql_query($query, $mysql_link) or die('error: >' . > mysql_error()); > break; > } > > switch ($archaction) { > case "Lägg till": > $query="INSERT INTO archive (s_name, name) VALUES('$txtArch', '')"; > $query_res =mysql_query($query, $mysql_link) or die('error: >' . > mysql_error()); > > > break; > } > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] [PHP 4.2.0] Benchmarking file uploads?
Hi, I'm looking into the new version of PHP it says in the changelog "Highly improved performance with file uploads " Has there been any benchmarking done on this? / Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [PHP 4.2.0] HTTP PUT method & $_FILES ?
Hi, I'm trying to get the PUT method working on a Apache server running PHP as module. Theese are the steps I've taken so far: - I see in my apache logs that I've got PUT requests "PUT /path/filename.html HTTP/1.1" OK - I've added Script PUT /put.php , And checked so that the requests are beeing transfered to this function. OK - I've tried to get the ENV VARS but none show more than the PATH_TRANSLATED (and it's beeing set) OK - Checked the vars $PHP_UPLOADED_FILE_NAME and $PHP_PUT_FILENAME But neither are being set to any tmpfile NOT OK! - Checked $HTTP_RAW_POST_DATA , not set either. Would'nt it be better to have the PUT valuables in the superglobal $_FILES ? Or at least in a $HTTP_PUT_FILE var. If someone could direct me to where I can fine the temporary file, I would be much obliged! Theres bugs referring to this as an "non working" function is this so? - Bug #10383 Receiving an HTTP PUT, rather than sending one - Bug #14298 PUT absent $PHP_PUT_FILENAME $PHP_UPLOADED_FILE_NAME I propose a solution like the following: $HTTP_PUT_FILE['request_uri'] Path of the proposed upload like /mytest/filename.htm $HTTP_PUT_FILE['path_translated'] The full path of the proposed upload like /usr/home/foo/bar/public_html/mytest/filename.htm $HTTP_PUT_FILE['size'] The size, in bytes, of the uploaded file. $HTTP_PUT_FILE['tmp_name'] Temp name something like /tmp/hfdhjfufd8733 My only bad is that I cant program in C otherwise I would have been there doing it already. / Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [[PHP] php problem]
"johnny1b1g" <[EMAIL PROTECTED]> wrote: ? Well I guess I could try to help you if you elaborate your question a bit further. / Jimmy Start with RTFM :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sane path? Avoiding people climbing in directory structure ../../
Hi, I'm planning on using userinput as a part of path to read (horrific I know :) So to make this userinput a bit more secure I'm thinking to use $path = escapeshellarg($path); $path = str_replace("../","",$path); I'm thinking to use a basedir in a constant something like /usr/home/userdir (this also being set in php.ini) then add the userinput and then append that to the constant and then use opendir() on it. I want to avoid people putting in nice little strings like ../../../etc/ Any other pointers? / Jim Security is a state of mind not a sales arguement! *** Secret behind flying= Throw yourself at the ground and miss :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mcrypt: Blowfish or Twofish or no fish?
Hi, started playing with Mcrypt and just wanted to ask which encryption method makes the stronger encryption? (I can supply the necesary keylength). Should I go for MCRYPT_BLOWFISH or MCRYPT_TWOFISH? Or no fish at all :) So what do I need it for? I'm going to use it encrypting files, sizes varies between some 100 k's and 4-5 mb's. / Jim Paranoia + A system w/o users = Safe system :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mcrypt: Blowfish or Twofish or no fish? Part 2
Thanx for the suggestions! Someone mentioned that I could use MD5 and then encrypt the hash, how would I ever decrypt that? Is'nt MD5 a 1-way thing only? Another question? Should I go for bigger keylength or bigger blocksize or both? What makes for the best encryption? / Jim (and before someone suggest that I read the book Applied cryptography it's already orderd and on it's way :-) ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mcrypt: Blowfish or Twofish or no fish? part 3
>I believe that twofish has been successfully broken, so use blowfish >instead. Typically, for encrypting files you will use an algorithm like >blowfish in cbc mode (as opposed to ebc mode) but I don't know if Mcrypt >supports this. Also, when creating the hash of the file, it is probably best >to use SHA-1 instead of MD5, as there appears to be some concern with MD5 >over it's compression function. >HTH >JH It helps :) I have been looking into Blowfish with cbc mode :) If I use SHA-1 it's still no way to dehash it during decryption of the file, so I fail to see the use of Hashing in fileencryption. Could someone enlighten me? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] (Unlink(file) == rm file) ? (ignore this mail):(explain diffs);
Hi, (Unlink(file) == rm file) ? (ignore this mail):(explain diffs); Does PHP unlink function handle deletion of files equally as the "rm" command on the system in my case FreeBSD. Or does it involve caching/handling files in any different way? / Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php