[PHP] Session cookies appearing where there is no session
This must sound pretty far-fetched, but as far as I can tell, my site is attempting to set a session cookie from any and all PHP pages, even when the page has no calls to session_* functions and where there were also no previous visits to pages with such calls. Where is the setting that is initializing these unneccessary sessions and sending the cookies? I looked for something in php.ini or phpinfo() to explain it, but came up empty. Below are excerpts from a phpinfo() dump. I wondered about that "session.use_trans_sid", but there's no reference to it in my php.ini file (yes, I checked that phpinfo says I'm looking at the correct one) and I also cannot find anything about it in the PHP.net online docs. What does that setting do, and where is it configured? TIA begin excerpts from phpinfo() Directive Local Value Master Value assert.active 1 1 assert.bail 0 0 assert.callback no value no value assert.quiet_eval 0 0 assert.warning 1 1 safe_mode_allowed_env_vars PHP_ PHP_ safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH session.use_trans_sid 1 1 session Session Support enabled Directive Local Value Master Value session.auto_start On On session.cache_expire 60 60 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_lifetime 0 0 session.cookie_path / / session.entropy_file no value no value session.entropy_length 0 0 session.gc_maxlifetime 1800 1800 session.gc_probability 1 1 session.name SID SID session.referer_check no value no value session.save_handler files files session.save_path /tmp /tmp session.serialize_handler php php session.use_cookies On On snip HTTP Response Headers Set-Cookie SID=0c6a1e4a46c8d9d840ac865d4a9d8e6f; path=/ Expires Thu, 19 Nov 1981 08:52:00 GMT Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma no-cache snip -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] db backup script needed
In article DC017B079D81D411998C009027B7112AA93458@EXC-TYO-01, [EMAIL PROTECTED] (Maxim Maletsky) wrote: anyway, is there any script like that (fast and dirty is ok) to run on MySQL, PHP4.0.2 ? What about putting a mysqldump call into a crontab? -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Help w/ regular expressions for banned words
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Team JUMP) wrote: $num=count($bannedwords); for($i=0;$i$num-1;$i++) { $string = eregi_replace("\b$bannedwords[$i]\b","[censored]",$string); } For whatever reason, no word in $bannedwords will match in the string. I've tested it with simple expressions like "\btest\b" and it will not match the word "test". Have you tried it with either "[:space:]$bannedwords[$i][:space:] or "\$bannedwords[$i]\" yet? Also, I think using a foreach($bannedwords as $current_word) would be a better choice here; more compact, and loops all the way to the end of the array even when the numerical index does not follow the expected sequence. (BTW, if you want to stick with the for() and you know the index numbers will always be sequentially zero to whatever, then your test should be just $i$num. Otherwise, you're skipping the final loop.) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] charactor problem
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Rick Ridgeway) wrote: I grab this line and try to make it an array like this: print "line: $thelinefromfile\n"; //Check the line $var1 = trim($thelinefromfile); $var2 = split(" ", $thelinefromfile); $count = count($var2); Are you sure $thelinefromfile is actually being set correctly? Regards, Sean Yes I print it out it says "Array" so i then do print $thelinefromfile[0]; and it prints out the whole line instead of the first field from the line... You're print()ing in the order shown above, right? Print() then trim() then split()? Because that sounds like you're attempting to do a "split()" on an array. That function is for turning a string into an array; if it's already an array, then just get rid of the split() and do your count() on $thelinefromfile. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Need key() equivalent for string variable
I'm trying to pass a string variable to a custom function, echoing its *value on one line, and its *name (that is, its key if this were an array instead of a string) on another line. I searched the manual's sections on variable functions and string functions, to no avail. I tried key(), but it just produces a warning that $var is not an array. Example: build_select_menu($display,array("Y","N")); function build_select_menu($field,$options_array) { echo 'pSELECT NAME="' . key($field) . '"' . "\n"; //need to echo name of string passed as first argument foreach($options_array as $option) { echo 'OPTION VALUE="Y"'; if($field=="$option") {echo ' SELECTED';} echo "$option/OPTION\n"; } echo "/SELECT/p\n"; } Thanks! -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Need key() equivalent for string variable
In article 069f01c084ca$1642a320$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Richard Lynch") wrote: I'm trying to pass a string variable to a custom function, echoing its *value on one line, and its *name (that is, its key if this were an array I think you are looking for "variable variables"... A variable variable results in a second variable which is named for the *value of the first. So what I need is a sort of "inverse variable variable" to extract the *name of the first variable: $foo="bar" echo $foo //"bar" echo [something] //"foo" I ended up doing a clumsy workaround by altering $foo-- $foo="bar" $foo=array("foo"=$foo) echo $foo[key($foo)]; //"bar" echo key($foo); //"foo" --but then I'm having to tell PHP the very info that I was hoping it'd dynamically tell me. Any other suggestions would be much appreciated! -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] error with REPLACE or UPDATE
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: snip $connect = mysql_connect(xx); or die ("dBase not connect.") snip $sql = "REPLACE CLIENT SET ID = \"$id\", ITEM = \"$item\", TITLE =\"$title\", AUTHOR = \"$author\", PUBLISHER = \"$publisher\", DELIVERY = \"$delivery\", QTY = qty\", PRICE = \"$price\", TOTAL_PRICE = \"$total_price\", DATE = \"$date\", RECORD\"$record\" WHERE RECORD = \"$record\""; Check the manual at mysql.com for the "REPLACE" syntax. It's used like "INSERT", not "UPDATE". -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem with a regex!
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Zack Ham) wrote: What I'm trying to do is run through it and replace {title} with an appropriate value. I have tried running ereg_replace("{$var}",$value,$string) and ereg_replace("\{$var\}",$value,$string). Neither work. They either do nothing or produce the error "Warning: invalid content of \{\}". Is $var=="title" (same case, no leading/trailing whitespace, etc.)? If so, then perhaps try: ereg_replace("\{" . $title . "\}",$value,$string) If not, then perhaps one of these: eregi_replace("\{" . $title . "\}",$value,$string) eregi_replace("\{title\}",$value,$string) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] $DOCUMENT_ROOT
In article 039901c08a48$3d4b5740$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Toby Miller") wrote: Whenever I include files in Apache I always do it like this: include($DOCUMENT ROOT."/folder/file.php"); However, now I am doing a site in IIS and I do not have $DOCUMENT ROOT at my disposal. What do most of you usually do to workaround this? Aside from installing Apache and Linux and bypassing the whole Windows thing :) Why not either include the doc root in the include_path of php.ini? Or define you own DOCUMENT_ROOT constant? -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] expressions
[re-arranging quotes to bottom posting] In article 9556pp$sna$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Jeff Warrington") wrote: hi, im trying to fix this couple of hours but i couldnt find the mistake... can somebody look at it... first i want to check the $co_area for 3 digital ... it must contain 3 digital if ($co_area != !ereg("([0-9]{3})",$co_area)) { echo " * Area code must be 3 digital"; } if (eregi("[^0-9]{3}",$co_area)) { print("area code must be digits"); } or if (eregi("[^[:digit:]]{3}",$co_area)) if you use the POSIX regex fields. Those pass any string except where there occurs a sequence of three non-digit chars. So "123AB", "AB", "A", "1 2 3", etc. would all slip through as apparently valid area codes. Instead, how about: //-if anything but a sequence of exactly three digits from beginning to end... if (!eregi("^[[:digit:]]{3}$",$co_area)) { //throw an error message echo "Sorry, only a three digit area code is permitted!"; } -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP news groups
In article 95i2ch$1u8$[EMAIL PROTECTED], [EMAIL PROTECTED] ("McShen") wrote: I am just wondering if there are any PHP newsgroups like this one. There are several newsgroups on PHP, but the only one I'd recommend is the most active of them, news:alt.php. The others tend to have much less traffic, and almost all of that is stuff cross-posted or multi-posted to alt.php anyway. I am looking for PHP newgroups so that i can ask people questions. Well, shrug there's no reason why you can't go somewhere else if really want to. Still...you do know that's what this list is for, right? -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Extract() with 2D array
Does extract() work on multidimensional arrays? IOW, I have an array like... array($elem1=array($val1,$val2),$elem2=$val3) ...from which I'd like to extract $elem1 and $elem2. Should this be possible with extract()? The docs just say the function takes an array as a parameter, but don't specify whether or not the array can have more than one dimension. Since I'm having trouble making this work, I have a feeling the answer is no, but wanted to double-check in case it's actually my code that's at fault. TIA! -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Inserting DATE in mySQL!!
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Thomas Edison Jr.") wrote: I'm using the following code to insert date into my mySQL table named "Booking". I've created variables that store the date with dashes "-" seperating them. But it's not working. It's giving me an error on the $SQl line. following is the code : ?php $db = mysql_connect("localhost","root"); mysql_select_db("motorola",$db); $realsdate="$syear"."-"."$smonth"."-"."$stdate"; $realedate="$eyear"."-"."$emonth"."-"."$endate"; $realstime="$shh".":"."$smm"."-"."$sttime"; $realetime="$ehh".":"."$emm"."-"."$entime"; $sql = INSERT INTO booking (room,sdate,edate,stime,etime,purpose,reserved) VALUES ('$rooms','$realsdate','$realedate','$realstime','$realetime','$purpose','$res '); $result = mysql_query($sql) or Die ("An unexpected error occured. Please go back and book again."); ? Your value for the variable "sql" isn't enclosed in quotes. BTW, tracking down problems with a sql query gets easier when you give yourself a more informative die() message, such as: or die ("MySQL says: " . mysql_errorno() . " " . mysql_error() . "\nPHP says: $errormsg"); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] help functions
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Montgomery-Recht, Evan") wrote: Has anyone spent any time and thought into including help within the library, ie. so you could do a. mysql.connect().help() or something like that so as a developer addeds a new function we as end users might be able to understand the function. Most likely by creating a help file to return to the browser because right now I'm finding a lot of undocumentented features. But at the point where a function would be sufficently documented to have this built-in help file, wouldn't the same information be readily available in the online manual? -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Quick Regex Question
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Jeff Oien") wrote: if (preg_match("/[a-Z],[a-Z]/",$text)) { Can you tell me where I'm failing here. I want to do something if the string has commas in between words with no spaces. Like: blah,blah,blah "Does it have *any instance where a string of letters is separated only by a comma?" preg_match("/[a-z]+,[a-z]+/i",$text) "Does it consist *entirely of strings of letters separated only by comma?" preg_match("/^[a-z]+,[a-z]+$/i",$text) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HELP with Multi Dimensional Array Problem
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Yev) wrote: So, it sees $name="field[text][email]", and attempts to retrieve the value, so in essense $HTTP_GET_VARS[$name] should return "[EMAIL PROTECTED]", but it doesn't work.. However, if i try to access $HTTP_GET_VARS[field][text][email] that properly returns "[EMAIL PROTECTED]". The reason "it doesn't work" is because these are not the same reference. $HTTP_GET_VARS[$name] expands to: $HTTP_GET_VARS[field[text][email]] Which, as you can see, is not the same as: $HTTP_GET_VARS[field][text][email] Since you're apparently trying to access the data submitted in input type=text name="field[text][email]" value="[EMAIL PROTECTED]" input type=text name="field[text][url]" value="http://www.email.com" How about using something like: extract($HTTP_GET_VARS['field']['text']); //note that index names are quoted echo $email; echo $url; ? Otherwise, if you want to stick with the original method, I believe you would use something like: $name="['field']['text']['email']"; //index names quoted, brackets added echo $HTTP_GET_VARS$name; //brackets dropped -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Error codes from 'mysql_error()'
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Dennis Gearon) wrote: I do an insert using phpadmin, and i get back the error message (or maybe it's a warning?) The insert is of a duplicate on a unique field. I expected an error, but when I do mysql_error() or mysql_errno(), nothing comes back(and I do it the next line in the script). the 'mysql_query($sql, $link)' function DOES insert when the value is unique, DOES return false, but I'd like to inform the user what the error was. PHP Admin can get the 'error' why can't I? Where are the calls placed? mysql_error() or mysql_errno() can only be used after a valid mysql connection has been established, so for instance this will not return an error message from mysql: mysql_connect(stuff) or die(mysql_error()); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Multiple Inserts
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: $SQLStatement = "INSERT INTO Members (Email) VALUES ('".$GetEmails[$a] ."')" or die ("Problem"); $db = mysql_select_db($dbase, $connection); $SQLResult = mysql_query($SQLStatement); Whoa, you're mixing apples with oranges. Try: $db = mysql_select_db($dbase, $connection); $SQLStatement = "INSERT INTO Members (Email) VALUES ('" . $GetEmails[$a] . "')"; //removed the 'or die' portion $SQLResult = mysql_query($SQLStatement,$connection) or die ("Problem " . mysql_error() ); //moved 'or die' here, using more detailed info -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] search a text file
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Peter Benoit) wrote: I've got a bit of a task where I need to poll a text file for several lines of text which is buried deep within the file. These lines change each day, but the text surrounding them do not. Is it possible to extract these lines of information based on the text surrounding them? Sure. preg_match() would be one way. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] search a text file
[quotes returned to bottom-posting, for clarity] In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Peter Benoit) wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Peter Benoit) wrote: I've got a bit of a task where I need to poll a text file for several lines of text which is buried deep within the file. These lines change each day, but the text surrounding them do not. Is it possible to extract these lines of information based on the text surrounding them? Sure. preg_match() would be one way. OK, I'm a little new to this, else I would have known that. Any examples out there I could use/modify? Probably. You could check the manual's page on preg_match (the user annotations often have very useful code examples), phpbuilder.com, hotscripts.com, etc. A quick, oversimplified example: Let's say your complete text was (no laughing now g) "Mary had a little lamb, its fleece was white as snow." where "Mary had a " and "fleece was white as snow." are always consistent but whatever's happens to be the portion of the text between them is what you want to extract. You could do something like-- $search_string="Mary had a little lamb, its fleece was white as snow."; $status=preg_match("/^Mary had a(.*)(?=fleece was white as snow.)$/i",$search_string,$match_text); In which case, $status would evaluate to true if a (case-insensitive) match was found, and $match_text[1] would contain " little lamb, its ". -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] In my attempt to read from a text file...
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Peter Benoit) wrote: I'd like to search inside the text file for my name, then pull all the info from that point till the next name which is Fred. The text file would be called names.txt So I'm trying to preg_match("Peter",names.txt,$myname) then do the same for Fred, and grab all the stuff in between. Is this the right way to do this? Nope. (But see the example in my response to your previous post on the same topic.) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] search a text file
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Peter Benoit) wrote: Very good info, but this text is located in a text file. How can I reference it this way? Get the contents of the text file--for example, using fopen() with fread()--into a variable. Then use that variable as the second argument to preg_match(). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting location bar and stripping file-ending of a string..
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Aviv Revach) wrote: 2. Let's say I have a string such as: "http://www.blabla.com/dir1/dir2/file.php3", How can I can strip the file-ending(".php3") out the string? Option 1: parse_url() Option 2: strpos() str_replace() Option 3: ereg_replace() or preg_replace() -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Finding existence of a value in a table
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Dennis Gearon) wrote: I would like to return ONE ROW if possible from a query that would tell me whether a value exists in a table. If the query could result in more than one record, but you only want to see one, 'limit 1' is helpful. SELECT FieldValueIn, COUNT(*) FROM TableOfInterest WHERE FieldValueIn=ValueOfInterest GROUP BY FieldValueIn; I can't seem to figure out how to test the return results to see if there is no rows with that value. http://www.php.net/mysql-num-rows -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Stripping Single Quotes
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Elan) wrote: I have a string, "'abc'". How do I convert it to "abc" (i.e. how do I strip the embedded single quotes) with a minimum of overhead? If there's no chance that the string could also contain legit single-quotes (such as as an apoostrophe), you can simply use str_replace(). Otherwise, either str_replace() with strpos() -- to search/replace only on 2nd char and 2nd-to-last character -- or good ol' preg_replace() by itself. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] just wondering ....
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Peter Houchin") wrote: If I have a email script and use the mail() function ... am i able to do this .. mail(values); if ($mail=1){ do this } else { error } Are you trying to test whether mail() returned true? if (mail(values)){ do this } else { error } (Keeping in mind that when mail() returns true, it's not saying whether the mail really reached the destination server, only that it the function executed successfully.) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Couple Questions
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (acleave) wrote: 1) How do I return multiple data types at once from a function? For instance I might want to return 5, "apple", and true (an int, a string, and a boolean) all at once from a function. return array(5, "apple", TRUE); 2) How does the predefined variable $HTTP_REFERER work with forms? I know the documentation says that it doesn't work with all browsers as the browser has the actual info but I tested it with IE 5 and NS 4.7 and it worked perfectly (for me). My real concern is could it be fooled in a simple manner or even turned off by selecting different settings in either of those two browsers? Or would it require a dedicated cracker and/or someone writing their own browser to give a false report (vs. no report at all)? IE and NS aren't the only browsers in use today. I know iCab allows the user to disable sending of HTTP_REFERER. I believe Opera may too. I'm not sure about the capabilities of Konqueror and Lynx in this regard. Also, AFAIK, no browser will send an HTTP_REFERER where the url request was typed/pasted in directly by the user, or where the request came via a bookmark. Most of the robots which visit my sites also don't leave an HTTP_REFERER. So there are some common examples of "no report". And while I haven't actually tried this, I assume that anyone could write their own HTTP_REFERER simply by using fsockopen(). Thanks to PHP's ease of use, using fsockopen does not require one to have the skills of a "dedicated cracker". (Relying on HTTP_REFERER for any security-related check is generally considered a Bad Idea.) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Couple Questions
In article 9984hb$c4e$[EMAIL PROTECTED], [EMAIL PROTECTED] (CC Zona) wrote: And while I haven't actually tried this, I assume that anyone could write their own HTTP_REFERER simply by using fsockopen(). Thanks to PHP's ease of use, using fsockopen does not require one to have the skills of a "dedicated cracker". Err, obviously I meant fwrite(). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mail() question
In article 00be01c0b175$1cee4080$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Wade DeWerff") wrote: is there a way to do this in a mail() ? I need to add the $Phone and $Email variables too the $message, but I need to format it so that it is on a new line in the emailI tried using br and /n, but it formats as text not code function. $message = $Info ."br". $Phone ."br". $Email; "br" is used in hypertext markup language (HTML). Email (unless specially encoded--MIME headers, ugh!) does not use HTML. "/n" is a slash followed by the letter n. "\n" is a newline on *nix system (Unix, Linux, etc.). "\r\n" is a Wintel linebreak. It's also the standard for linebreaks within emails. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] enum and set possible values
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Michael George) wrote: So if I have an enum with possible values "Yes" and "No" or a set with possible values "Single", "Married", "Divorced", "Widowed", I seek a function that will return an array of strings containing those possible values. Does such a function exist? I suppose if not it would be possible to write one from the output of a "show columns from X" query... You do the latter. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Catch timeouts
I'm resetting set_time_limit() with each iteration of a rather long loop. Right now when the script reaches its time limit I sometimes end up getting just a blank page. Even though I call flush() within each iteration and do lots of error checking along the way, it seems to not be enough. I could have sworn I once saw a function that would check whether the script was being cancelled because a timeout had occured, thereby allowing you to make a more graceful exit from the script. But now I can't seem to locate anything like that in the manual. If someone could point me to the right function, or suggest an alternative method for catching those timeouts, I would be grateful. TIA! -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Catch timeouts
In article 998dqa$akd$[EMAIL PROTECTED], [EMAIL PROTECTED] (CC Zona) wrote: I could have sworn I once saw a function that would check whether the script was being cancelled because a timeout had occured, thereby allowing you to make a more graceful exit from the script. But now I can't seem to locate anything like that in the manual. Never mind. Found it: connection_timeout() and register_shutdown_function(). Perfect. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Web Based PHP Content Manager Problems
In article 99dcc5$vm0$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Phil") wrote: I have tried using multiple PHP content manager programs and cannot seem to get any of them to save files that have been edited over the web interface unless the file permissions are set to let everybody write to them. Of course, we don't want to have out files writeable by the world. I have tried using these different managers in their own directories, even protected the directories with a .htaccess file. The same ID that I allow to access the directory is also the owner of the file. What seems to happen once I get authenticated and allowed into the directory, I may be wrong here, is that my server thinks I am a 'nobody' and so when I submit the file changes I get permissions error. Everything works fine with all of the different programs I've tried; if I simply give everybody write access to the file, but that is not an option. Yes, your web server is apparently running as user "nobody", a common configuration. See the manual chapter on security for more info on setting proper file permissions with PHP. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Array confusion.
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Sterling) wrote: $m = "03"; $list = array(01="Jan", 02="Feb", 03="Mar", 04="Apr", 05="May", 06="Jun", 07="Jul", 08="Aug", 09="Sep\", 10="Oct", 11="Nov", 12="Dec"); $month = $list[$m]; print "$month\n"; What I want to print is the month in Text format, which in this instance should be Mar . I even tried: $month = array_keys($list, $m); Now I know that $list[x]; references the location of an item so I know why the previous code doesn't work in that respect, since nowhere is 01 a location but an association within the array. Right? The keys to an associative array should be quoted. Also, that escaped quote on "Sep\" is throwing everything off. Try: $m = "03"; $list = array("01"="Jan", "02"="Feb", "03"="Mar", "04"="Apr", "05"="May", "06"="Jun", "07"="Jul", "08"="Aug", "09"="Sep", "10"="Oct", "11"="Nov","12"="Dec");//keys quoted, no escaped quotes $month = $list["$m"];//associative array element index quoted print "$month\n"; -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Register session in function without global?
In article 99dn35$duo$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Tobias Talltorp") wrote: I am trying to register a session variable in a function without using the global in the beginning. You can pass the variable(s) to the function as an argument. Perhaps it will be easier to deal with a variable number variables g by packing all of them into a single array, then passing the array. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mail(): carriage return required??
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Eelco de Vries) wrote: "this is line 1 this is line 2 this the 3rd etc etc" I read the mail fine in my hotmail.com account, but when I read that same mail in my MS Outlook client the mail is one long line of text: "this is line 1 this is line 2 this the 3rd etc etc" I understand from this difference in layout that the 'carriage return' is required. Is there a function that adds a 'carriage return' after every 'newline' found in a string? Or is this another problem? Use \r\n for email line breaks. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delaying Printed Output
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Greg Scott) wrote: sleep(seconds); usleep(microseconds); I've tried those 2 functions, in an example like this: PRINT "Thisbr"; SLEEP(2) ; PRINT "Is abr"; SLEEP(2); PRINT "TEST"; But the way it works in the browser is to wait for a total of 4 seconds and then it displays all the text at once, not one line at a time - which is what I'm after. You might try using flush() after the prints. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Delaying Printed Output
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Greg Scott) wrote: You might try using flush() after the prints. I tried that too, but at least in Netscape 6, it still waits until everything is done before displaying. I think Jack must be correct that this isn't possible for browser display. By any chance is this within a table? Not sure what v.6 expects, but at least in earlier versions Netscape refused to show table content until it encountered the closing /table tag. With the end result that flush() appears not to be working, when actually PHP is doing its job fine but NN is being a bit of a PITA. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Strange Error Reporting
In article p04320407b6e35b98ce1b@[209.246.86.33], [EMAIL PROTECTED] (Kristofer Widholm) wrote: Warning: Bad escape sequence: \. in validate.inc.php on line 142 CODE: Line 142: if (!eregi("index\.php",$PHP_SELF)) { blah blah blah; } I didn't know there was any other escape sequence possible in RegEx! In a way, there is another "escape": using square braces. eregi("index[.]php",$PHP_SELF) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] URL parsing
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jaxon) wrote: Any way to combine both forms of url parsing? I want to use standard slash notation for navigation ,but also account for the occasional variable used within a single page. e.g. URL can be either: domain.com/index.php/main/index.html?ii=1 or: domain.com/index.php/main/index.html?ii=1 Umm, how are these different? (If you're trying to extract info from a url, perhaps parse_url(),basename(), and/or dirname() are what you're seeking...?) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] getting numeric index of array
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Christian Dechery) wrote: $myArray = array( "one" = "something", "two" = "otherthing", "three" = "whatever" ); I want to, given the key (or value), it returns me the numeric index for that ocurrence... examples: given "one" - returns 0 given "whatever" - returns 2 given "two" - returns 1 given "four" - returns NULL or false... http://php.net/manual/en/function.array-search.php (It's only avaliable in PHP4 CVS so far, but see the annotations for examples of user functions to do the same thing.) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] What could I be doing wrong here
In article 99oh2o$f95$[EMAIL PROTECTED], [EMAIL PROTECTED] ("YoBro") wrote: I can't figure out why this doesn't work. Rather than echo $myrow[0] which works, I want to use the feild name. Like $myrow[make] to make reading the code easier. IS this possible? Here is some code: $db = mysql_connect("localhost", $user, $pass)OR DIE("Unable to connect to database"); mysql_select_db("database",$db) OR DIE("Unable to connect to database"); $result = mysql_query("SELECT * FROM stock",$db); while ($myrow = mysql_fetch_row($result)) { echo "$myrow[id]br"; //Usually $myrow[0] etc echo "$myrow[make]br"; echo "$myrow[model]br"; echo "$myrow[sub_model]br"; } Try quoting the index key (which is, after all, a string), and moving the variable outside the double quotes. Since that leaves just plain string text, you might as well turn the remaining double quotes to singles too. Save an extra microsecond or so g. echo $myrow['id'] . 'br'; -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Strings in URL
In article 99ou1p$tif$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Claudia") wrote: $headline=urlencode("$headline"); print "a href ='http://www.contus.com/test_quote/quotepage.php3?site=$sitepage=miniquote; subject=$headline'bContact us for more information/b/a/font"; Then in the quotepage.php3 file if( $page == "miniquote" ) { print "Get A Quotebr"; print "$subject"; print "$site"; INCLUDE "mini_quote.inc.php3"; } ---The print "$subject"; line prints nothing. If I print $headline right after I assign the variable it prints correctly with +s in place of the blanks for this variable. By any chance is that "print" line occuring within a function? The fact that it prints fine then becomes "blank" later sounds like a classic global scope vs. local scope symptom. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Dynamic constant names
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Geoff Caplan) wrote: I am trying to create a constant name dynamically and then get at the value. // We set up the constant define( CONSTANT_1 , "Some value" ) ; // Later we try to use it dynamically ... $constant_number = 1 ; $constant_name = ( "CONSTANT_" . $constant_number ) ; // We try to assign the constant value to a variable... $constant_value = $constant_name ; But we find that $constant value still contains the NAME of the constant, and not the VALUE. Am I misunderstanding something? Is there any way that this can be done? Your error_reporting level must not be all the way up to E_ALL, because when I tried your code PHP reported errors that might have helped you solve the problem. Try this: // We set up the constant define("CONSTANT_1", "Some value" ) ; //constant name must be in quotes // Later we try to use it dynamically ... $constant_number = 1 ; eval( "echo CONSTANT_$constant_number;" ) ;//tell PHP to treat the name as code not as a text string -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] search safe URLs
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Joe Sheble aka Wizaerd) wrote: In order to use URLs without ? and , there has to be some re-configuration in Apache, correct? So somebody who didn't have access to httpd.conf couldn't use this methodology? Or if this is completely incorrect, where can I find more info on implementing it strictly in PHP? Apache allows use of urls without "?" and "" right out of the box. That's just a URI without an optional query string: http://www.php.net, for example. I'm guessing you want to use URLs that *do have a query string and transform them into ones that don't: http://www.php.net/find_stuff.php?query=foomethod=bar becoming http://www.php.net/find_stuff/foo/bar/, right? You can use an .htaccess file to direct Apache to rewrite URLs as long as mod_rewrite is installed. See http://httpd.apache.org/docs/misc/rewriteguide.html for a detailed tutorial. For a how-to on implementing this in PHP, check out some of the tutorial sites like phpbuilder.com,weberdev.com, webmonkey.com, etc. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Copy data from one mysql table to another?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Bob Stone) wrote: Dear PHP Helpers, I cannot find any documentation on how to copy the data from one mysql table to another, i.e. table1, columnx to table2, columnx. Please don't post the same question to multiple PHP.net lists. Or at least wait until a day or two without response from one list before re-posting to another of the PHP.net lists. (For the answer to your original question, see my response to the PHP-DB list. Where the question, which is really all-MySQL and no-PHP, comes closest to being on-topic.) Thank you. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] setting $var= multiple $var's
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Peter Houchin") wrote: What is the best way to get set this to one value? $system=$myrow['system']; $serial=$myrow['serial']; $config"=$myrow['config']; snip much more of the same extract($myrow); Done. :-) See http://www.php.net/extract/ for more info. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] This PHP list
In article 9a0jpq$9bg$[EMAIL PROTECTED], [EMAIL PROTECTED] ("Stuart J. Browne") wrote: After being eye-ball deep in documentation 8 hrs a day trying to learn how to do things with MySQL, Interbase, PHP, and CSS.. This list certinaly is a god-send. Not only do questions that are posted GET ANSWERED (questions i've asked in other groups have a tendancy to go un-answered *pout*), but the diversity of people give many possible soltutions. Only problem I have is the 103,000 messages in the group on the news server *cringe*.. Shhh! Don't complain about that or someone will start thinking it's a good idea to start expiring the old messages like other news admins do (wow is that a terrific archive of links, solutions, ideas, examples, and much other useful know-how). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Regexp
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("David Balatero") wrote: So, I guess i need a regexp to remove all the \n and :space: chars. Here are some ideas: $out=preg_replace("/\s+/","",$in); //strip whitespace or $out=preg_replace("/\s+/"," ",$in); //replace whitespace with single space Note that you requested is different from your example, in which it looks like you are simply condensing multiple newlines down into a single newline. For that, something like this might be more appropriate: $out=preg_replace("/(\n|\r|\r\n)+/","\n",$in); Play around with 'em. g -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Passing by reference deprecated?
set_value($variable,$value) { $variable=value; } "Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. " When did passing by reference get deprecated? The documentation at http://php.net/manual/en/language.references.pass.php doesn't suggest what to do instead--in fact, it uses an example like the syntax above. So my next question is: would using a return value or declaring a global be the (only) other options? TIA -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] duplicate tables
In article 9a3fme$4hg$[EMAIL PROTECTED], [EMAIL PROTECTED] ("McShen") wrote: i have a table named "refer" I wanna duplicate a table name "refer2" so that i can mess around with it. Have you checked the manual for your DBMS? Something like "create table refer2 select * from refer" should work with MySQL (assuming that were your DBMS). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Question: Number of Characters
In article [EMAIL PROTECTED], [EMAIL PROTECTED] ("Marcus Ouimet") wrote: How can i determine the number of characters in a string? http://www.php.net/strlen/ -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: How to define subroutine
In article 002901c1980e$4ba456f0$0200a8c0@piii, [EMAIL PROTECTED] (Sanjay) wrote: I am new to PHP and want to do object oriented programming in PHP. I want to write a subroutine and call that subroutine. http://download.php.net/manual/en/functions.php http://download.php.net/manual/en/language.oop.php -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Maybe OT but I was wondering....
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Ben Turner) wrote: I am trying to find somewhere that I can identify a custom 404 error page and then pull the page based on the document directory. If you just want to customize your 404 page (presumably to call a PHP script?), your web server documentation should be of assistance. For instance, Apache's ErrorDocument directive http://httpd.apache.org/docs/mod/core.html#errordocument is quite simple to implement, as long as the hosting setup at least permits use of an .htaccess file. By pull the page based on the document directory do mean that you want to display different versions of a 404 page depending upon what URL resulted in the 404 status? For instance, /dir1/badpath1 would get No such page, bozo while /dir2/badpath2 would get That page is not available, but here's our site map instead, etc.? If so, then you may want to direct all 404s to a single PHP script, then let the script generate appropriate output based on an env var such as PHP_SELF, REQUEST_URI, SCRIPT_NAME (see phpinfo() for a bunch of possibilities). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: stripping high ascii from a string
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Bill) wrote: Is there a function that can strip high ascii from a string? How about a regex? preg_replace() supports matching on octal or hex ranges http://www.php.net/manual/en/pcre.pattern.syntax.php, so perhaps one of these...? $newstring=preg_replace('/[\200-\377]/','',$oldstring); //octal $newstring=preg_replace('/[\x80-\xff]/','',$oldstring); //hex -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] echo problem NEW
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Steven Cayford) wrote: You can tell php to treat quotes as text by escaping them: putting a \ in front of them like this: echo table border=\0\; Or you could drop out of php mode entirely to do your html like this: ?php ...php stuff here ... ? table border=0 ?php ...more php stuff... ? One of these methods should get you going. There's also the heredoc option (variable interpolation, no need to escape of quotes, no jumping back and forth between PHP mode and HTML mode) http://www.php.net/manual/language.types.string.php: echoEOF; table border=$bordersize tr td$mycontent/td tr /table style type=text/css .$classname { margin: 10px; background-color: black; color: white; } /style p class=$classnameBlah blah.../p EOF; -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: unshift a key value pair
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Marc Logghe) wrote: So it is really easy to *remove* a key-value pair, but how do you put one in ? $arr[$key]=$val; -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Operators
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Gerard Samuel) wrote: If != is the opposite of == What is the opposite of === ?? !($something===$somethingelse) -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: include with call
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (John Cuthbert) wrote: I have a file which does several different things depending on how its called Ie file?mode=show is to show it etc But I want to include the output from the show so I tried ?php include(file.php?mode=show); ? but this causes errors. It goes away with including as only file.php but doing that also causes problems because mode isnt set yet. $mode='show'; include(file.php); Include() brings in the content of a file just as if you'd copy/pasted it there. It's not an HTTP GET request. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Errors?
In article 01a601c19de8$adc1b050$5e01a8c0@ben, [EMAIL PROTECTED] (Ben Sinclair) wrote: It is possible to disable error reporting, but you would probably remember doing it. A call to phpinfo() to check the global and local settings for error_reporting and display_errors would be the first thing to check. If it's not what you expect, see what filepath phpinfo() says the php.ini file is located under; the new install may not be using the old config file. Another possiblity is your page having tables that are not closed because the script has stopped on an error, and your browser doesn't know how to render the page. View the source to the page, the error might be in there. Correction: *that* should be the first thing you check g. Then phpinfo(). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: querying results already queryed once before
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Phil Schwarzmann) wrote: Dumb question: How do I query results from a MySQL that I've already queried once before in the same page? Here is my code: // querying the database for the first time. $query = select * from table where thingA = $searchA; $result = mysql_query ($query); // now I want to query my results I just made. If you merely want to re-use the result set, see http://www.php.net/manual/en/function.mysql-data-seek.php. If you want to do something more akin to a subquery (i.e. extracting a subset of data from the original query's result set), then use a new SQL statement. For example: $query2=select * from table where thingA=$searchA and thingB=$searchB; $result2 = mysql_query ($query2); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Arrrr The Space is gone.
In article 002801c1a6ed$1a9c10a0$0401a8c0@philip, [EMAIL PROTECTED] (Philip J. Newman) wrote: $q=preg replace(/[ \W]/,,$q); I have this to remove all the bad things, but it takes out the space to ... )o; why? There's a space in your character class, so of course it will be among the characters matched/replaced. But merely deleting it from the character class doesn't solve the problem either, since a space character also meets the criteria for not a word character (\W). If the objective is to strip all characters that are neither a space nor a word (a-zA-Z0-9_), then try: $q=preg replace(/[^ \w]/,,$q); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Arrrr The Space is gone.
In article 004d01c1a6f2$cb909070$0401a8c0@philip, [EMAIL PROTECTED] (Philip J. Newman) wrote: This returns an error $q=preg replace(/[^ \w]/,,$q); Parse error: parse error in d:\hosting\http\philipsdomain\config.php on line 41 Suggestions? I think ezmlm must strip underscores from messages, 'cuz a lot of posts (though, oddly, not all...) seem to be missing them from otherwise valid/functioning code. The function is named preg_replace (an underscore between the words), not preg replace (with a space). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Getting an include file into a string after PHP evaluates the vars?
In article 007601c1a91f$ea9ecac0$6401a8c0@kevin, [EMAIL PROTECTED] (Kevin Stone) wrote: I don't know why I didn't think of this ahead of time but in order to produce the HTML-based ePostcard email I have to get the evaluated template into a string. I can fopen() the template file and read it into a string but the PHP won't evaluate. And since most of the template is HTML with some Javascript of course eval() won't work on the string. Did I paint myself into a corner here? Or is there a way out that I just don't see. You could use output buffering. Start a buffer, include template(s), manipulate buffer content, end/flush the buffer. http://www.php.net/manual/en/ref.outcontrol.php -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: preg_replace() 'space' the final frontier
In article 000801c1a9c5$26007460$017f@localhost, [EMAIL PROTECTED] (Hugh Danaher) wrote: What I am trying to do is have a line of text break at a space after reading 19 words. Having read the various methods of finding and replacing one character with another, I settled on preg replace as my best choice, but this function doesn't accept a space in the regular expression slot. What can I do to get around this, or is there a better function than the one I selected? $statement=preg replace( ,br,$original,19); Warning: Empty regular expression in /home/www/host/document.php on line 71 It's not the space character that's prompting the error, it's the absence of regex delimiters around the space. $statement=preg replace(/ /,br,$original,19); http://www.php.net/manual/en/ref.pcre.php http://www.php.net/manual/en/pcre.pattern.syntax.php -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] unset a function?
In article Pine.BSF.4.10.10201302054330.27254-10@localhost, [EMAIL PROTECTED] (Philip Olson) wrote: ? include(file1); function_somename(); include(file2); function_somename(); ? file1 and contain a function definition, but the function in both files had the same name. This will give Cannot redeclare . So can i unset the function before the second include? This sounds like a job for include_once www.php.net/include_once No, this isn't a case of function being re-declared when the same file gets included a second time, it's two separate files declaring two separate functions which happen to have the same name. Give the functions unique names. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: A function that executes php code in a string?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Leif K-Brooks) wrote: I want to execute code in a mysql datrabase, but is this possible? I want it to run exactly as if I had tyyped it in to the php file. http://php.net/eval -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: try/catch type constructs?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jon Drukman) wrote: the idea being that if any of the commands in the block fail, the database package automatically does a die() and the block is terminated. the nearest i could get with php is: do { mysql_query(UPDATE ...); if (mysql_error()) { $error.=Couldn't update: . mysql_error(); break; } mysql_query(SELECT ...); if (mysql_error()) { $error.=Couldn't select: . mysql_error(); break; } and so on } while (0==1); if ($error) { do error stuff } else { it worked } Have you read http://www.php.net/manual/en/features.error-handling.php yet? There are some ideas there which you might find useful. FWIW, there is a die() function in PHP, so you can simplify the above to: mysql_query(UPDATE ...) or die(Couldn't update: . mysql_error()); mysql_query(SELECT ...) or die(Couldn't update: . mysql_error()); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: pushing array index
In article 006101c1ab7b$27ec01b0$9d0e533e@mazingerz, [EMAIL PROTECTED] (Borja martín) wrote: $img[3][src]= img1; $img[6][src]= img2; $img[9][src]= img3; and I would like to change the array index adding one to their values,but only on the two last arrays, so that I have: $img[3][src]= img1; $img[7][src]= img2; $img[10][src]= img3; the problem using the php functions like array splice to add a new array, is that the keys are reindexed. unset() the array elements you don't want, assign the ones you do. Ex: $img[10][src]=$img[9][src]; unset($img[9][src]); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Address unknown
In article 001001c1ac45$406eab00$017f@localhost, [EMAIL PROTECTED] (Hugh Danaher) wrote: Thank you for your help regarding parsing the url (Hey, go figure, they named the function almost exactly the same as my question.). I am still at sea about getting all the information from the url header. If I leave the brackets empty [e.g. parse_url() ] I get an error saying I have a parameter mismatch. When I fill the brackets with $query_string, I get an answer but it's in the form of an array. Finally when I echo the array, the query string echos in the path slot. Any ideas? Hugh $p=parse_url($QUERY_STRING); echo $p[host]. 1 .$p[path]. 2 .$p[query]. 3 ; If you feed parse_url() something other than a URL (a query string being a URL *fragment* rather than a URL itself), it's not surprising that it will return weird results. When you echo $QUERY_STRING, what value are you getting? For... file:///C:/php/museum/DB MUSE/someplace.php?98,165 I'd expect it to be 98,165. IOW, pre-parsed, no need to parse_url(). -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: !isset ??
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Erik Price) wrote: Pretty confusing. Can anyone shed some light on whether or not there is a final definite way to do this? I've used (!($_POST['var'])) with no problems in the past, but does good coding style suggest that I use (!isset($_POST['var'])) now? !$somevar != !isset($somevar) isset() evaluates as true only if the variable (or array index) exists. PHP's loose typing means that !$somevar evalutes as true if the variable is null, if it has an (integer, float, or string) value of zero, if it's an empty string, or if it is set to boolean false. Or if the variable/index does not exist. Both methods have their place (though for tests of the latter, I prefer empty()). The important part is understanding the implications of a method when you use it, so that your code isn't wrongly relying on !$somevar to mean the variable isn't set; it may well have been set, to a meaningful value which just happens to evaluate to false. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure form handling
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Obo) wrote: Sorry, perhaps I've misunderstood. You would like to charge a customer's card without the customer knowing how much you're charging them? i want the user to be able to see the amount being charged on the screen, but not to be able to view it in a hidden field in the source code. most shopping cart applications are like this. What would be the point of that? If they can see it onscreen anyway (as they should), why hide it in the source? Could you point out some URLs where there are shopping carts like this? -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] secure form handling
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Wm) wrote: Cc Zona wrote: In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Obo) wrote: Sorry, perhaps I've misunderstood. You would like to charge a customer's card without the customer knowing how much you're charging them? i want the user to be able to see the amount being charged on the screen, but not to be able to view it in a hidden field in the source code. most shopping cart applications are like this. What would be the point of that? If they can see it onscreen anyway (as they should), why hide it in the source? Could you point out some URLs where there are shopping carts like this? amazon.com vitaminworld Many shopping carts track persistent data (including running totals) via cookies. If you just want to know *how* to do what they do, the short answer is cookies http://php.net/sessions http://php.net/set-cookie. But I doubt any of them are doing so with the *intent* to prevent onscreen data from being viewable in the source. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: I'm new here is there.....
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Cyberskydive) wrote: I know this php.general - is there another newsgroup which specifically deals with help issues? PHP General does deal with help issues. Alternatively, you can post to news:alt.php. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Table exists?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Nick Wilson) wrote: What would be the easiest way to see if a MySQL table exists with PHP? I can do it by checking against mysql_list_tables() but that seems a little clumsy. Is there a better way? See MySQL's documentation of the CREATE TABLE and DROP TABLE syntax: both support table existance checks. create table if not exists mytablename... drop table if exists mytablename... -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Implement @-domains with PHP?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Christian Blichmann) wrote: Anybody got some code how to access the first part of a URI (the string just before the @)? I don't want to use HTTP-authentication and I'm using Win2k with IIS as CGI... Example: http:[EMAIL PROTECTED]/myPathTo/myFile.ending I'd like to retrieve the http://someReallyWeirdAtDomain-part. http://php.net/parse-url -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Implement @-domains with PHP?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Christian Blichmann) wrote: My problem is much more trivial, how to retrieve the string the user type into the address bar of his/her browser??? You can look over the environment vars available to you with a quick call to phpinfo() http://php.net/phpinfo. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP not parsed in HTML
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Spyproductions Support Team) wrote: I am with a hosting company that doesn't want to parse PHP in HTML files because they are afraid it will slow down their server(s) too much. So. I really like them and don't want to move the site if I don't really *have* to. There are some neat things I would love to be doing in the HTML on it, though. I was thinking; could I make some sort of little javacript calling on, or including the PHP file I want to run on the HTML page? Does the hosting company support server side includes (SSIs)? If so, using !--#include virtual...-- syntax may be an option. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Implement @-domains with PHP?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Christian Blichmann) wrote: Cc Zona [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can look over the environment vars available to you with a quick call to phpinfo() http://php.net/phpinfo. Thanks for replying, but as Philip stated in his reply to my question its that the actual location doesn't appear in the environment block. That's true, the URL does not appear there as a single preset variable; it's up to you to re-assemble a URL out of the variables that are available, and thus the need to scan the vars phpinfo() has to offer. Since you're using PHP as a CGI, somewhat different variables get set than when PHP is run as a module, so a call to phpinfo() is the best way to identify the right vars for accomplishing your task. Question: before you dismissed phpinfo() as useless, did you call it and look at what's there? Because more than likely the info that you envision extracting in a two step process (access URL, break down into needed components) can be directly accessed from one or more environment/server vars. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: storing arrays
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Clark) wrote: 1) Is it possible to write an array to a file? http://php.net/serialize http://php.net/fopen http://php.net/fwrite 2) Is it possible to specify the name of the key to each item of an array when you get the array using file(). You can take the array returned by file() and manipulate its keys however you want. But beforehand...? No. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Frustrating ?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jtjohnston) wrote: Heres's a frustrating, and maybe not so stupid question? I'm getting Warning: Supplied argument is not a valid MySQL result resource on this line: while ($mydata = mysql_fetch_object($news)) So what am I doing wrong here: $where = id like $id; $news = mysql_query('select * from ccl where '.$where.' order by AU desc'); //desc = z-a A) Have you already confirmed that a valid database connection was made? B) String values in mysql have to be quoted. For example, where foo='bar' or where foo like 'bar%'. C) Error checking on database operations is a really good idea. Even just a short or die() on the mysql_* calls can help you track down problems much more effectively. For example: $result=mysql_query($sql) or die(MySQL reports error: . mysql_error() . for query . htmlentities($sql)); For more sophisticated error handling, see http://www.php.net/manual/en/ref.errorfunc.php. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: More: Frustrating ?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jtjohnston) wrote: $where = id like $id; snip So I do? $news = mysql_query(select * from ccl where '.$where.' order by AU desc); or ? $news = mysql_query(select * from ccl where '.%$where%.' order by AU desc); Neither. Where $id==1, these would interpolate to: select * from ccl where '.id like 1.' order by AU desc select * from ccl where '.%id like 1%.' order by AU desc This is why repeaterror checking with an echo of your query to the browser/repeat is valuable. You can see exactly what the complete query string looks like, and also copy/paste it to the commandline for further testing. The % are not necessary? because id is an auto_increment number from 0 to 1,000+. The like keyword is used with a wildcard operator, either % or _. If you're matching against an exact value, then use the = operator instead of like. See the MySQL manual for more info on the like keyword and wildcards. If id has a numerical field type instead of one of the string types, you don't need to quote $id. See the MySQL manual for more info on quoting string values. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: preg_match vs ereg etc
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Digitalkoala) wrote: I was just wondering what your opinions were on using preg_match, preg_split instead of ereg and explode? I have to write a script to parse a lot of html and text files.. and I'm looking to use the fastest possible functions to do this... preg_match() vs. ereg(): preg_* functions are supposed to be siginficantly faster than their ereg_* equivalents, so preg_match() should be the winner here. preg_split() vs. explode(): these aren't equivalent functions. The former splits on a regular expression; the latter splits on a string value. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: argh!
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Richard Baskett) wrote: Ok this is getting frustrating! I am serializing a variable and passing it through the url, in the url and when I echo it on the next page it shows s:608:, and when I unserialize it and echo it, it doesnt show anything! How can I pull that data out in the next page? That looks like the full serialization didn't make it through. After you serialize, you also have to urlencode() the serialized value before passing it through the url. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Removing every thing between ( )
In article 001901c1ba5d$634e3840$89010a0a@bpaulson, [EMAIL PROTECTED] (Brian Paulson) wrote: What would the regular expression be to remove all the text between ( ) $string = This is a (001 Test) and (002 Test); $string=preg_replace(/\(.+\)/U,'',$string); Note that leading/trailing spaces are left in, and the parens are dropped, so you may want to adjust it a bit. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unable to process form data
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jeremy Reed) wrote: I was able to fix the 'unable to find dynamic etc.' error thanks to you guys. Now I have a new problem. It seems that I am unable to process form data. Before upgrading to 4.1.1, you were able to refer to the form data simply by concatenating a '$' and the form element name i.e. As of 4.1, you need to use the new arrays $_GET, $_POST, $_COOKIE, etc. or else turn register_globals back on. See http://www.php.net/release_4_1_0.php for more info. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: gzip?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jtjohnston) wrote: What header do I type to gzip something out on the screen? To make the output go faster, such as this text output: http://ccl.flsh.usherb.ca/db/export_to_nb_format.php I don,t want to actually zip the output, just make it go faster. Someone once told me I could do that so the server spits output faster. http://www.php.net/manual/en/ref.outcontrol.php http://www.php.net/ob-gzhandler -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php 4.1.1 vs 4.0.6
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Ezra Nugroho) wrote: I am deciding between 4.0.6 and 4.1.1 (or maybe 4.1.2 if it's comming soon). I heard that there is some significant difference between 4.0.x and 4.1.x What is the main difference between 4.0.6 and 4.1.1 ? Are the 4.1.x completely backward compatible with 4.0.x? http://www.php.net/release_4_1_0.php -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Changing arguments in the php.ini file
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Kostas Karadamoglou) wrote: When I change an argument from off to on and then restart the Apache server the php.info() function displays thats no changes took place. Exambles like register_global and display_errors. I dont know what is wrong any idea? When you call phpinfo(), look for the line near the top which gives the path to the current php.ini file. Does it match the path to the file you are altering? -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: multilanguage support
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Leonid Zilber) wrote: On our site, we have page with a form a user puts his/her information such as company name, givenname, etc. Currently, if a name entered is anything but English characters, PhP fails. For example, if I enter Norwegian characters lsløæ PhP returns the following errors: Last name field must contain a valid last name etc. That doesn't sound like a PHP error, but rather a custom message from your application's developer, based on his/her assumptions about what constitutes valid text input. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is there a way to put a scroll in a table ???
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (J.F.Kishor) wrote: I'am breaking my head by trying to put a scroll in a table, my problem is, using php 'am trying to display a report and the report should have three tables, data to display are taken from three different tables and number of rows returned are three different values, the number of rows returned may be 10, 100 or more then 100, since I have to show all three table in a single form, I have decided to display five rows in each table, so I need to put a scroll in all the tables through which the user could scroll till the last records. 1. Is there any other solution to solve it out ? 2. Is there a way to put a scroll in a table ? I tried using layers and its working fine in Internet explorer, and in Netscape the scroll does'nt work. The tbody,thead, and tfoot elements of HTML http://www.w3.org/TR/html4/struct/tables.html#h-11.2.3 are intended for this purpose, but you may not consider browser support to be sufficient. See http://www.blooberry.com/indexdot/html/tagpages/t/tbody.htm, for instance. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Reading a conf file
In article 01af01c1bfd7$be373ed0$0200a8c0@wiaka, [EMAIL PROTECTED] (Brandon Orther) wrote: Does anyone have a good idea of how I can pull the info out of a conf file setup like this? Maybe pull it into an array. ## Conf File ## ServerName domain.websites.com /ServerName ServerName newsite.worldwideweb.net /ServerName http://www.php.net/file -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: global variables w/o access to global php.ini
In article Pine.WNT.4.44.0202271857090.3884-10@associate, [EMAIL PROTECTED] (Timothy J. Luoma) wrote: I have a virtual domain under Apache and do not have access to the global php.ini file Apache lets me set site-wide configuration in an /.htaccess file Is there something similar for PHP? Forget similar, you can set PHP config options in the .htaccess file itself. See http://php.net/configuration. You can also set PHP options on a per-script basis using the ini_set() function http://php.net/ini-set. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: global variables w/o access to global php.ini
In article Pine.WNT.4.44.0202272245210.1448-10@associate, [EMAIL PROTECTED] (Timothy J. Luoma) wrote: I have a virtual domain under Apache and do not have access to the global php.ini file Apache lets me set site-wide configuration in an /.htaccess file Is there something similar for PHP? Forget similar, you can set PHP config options in the .htaccess file itself. See http://php.net/configuration. Thanks for your reply. I'm afraid I did a poor job of asking my question(*). My apologies. I would like to set some variables of my own creation (ie $DOMAIN_NAME) on a global basis. In that case, the auto_prepend_file config option may be of interest. It's described on the page previously mentioned. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: regex
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Paul A. Procacci) wrote: ticket_id=3change_name=statuschange_value=3ticket_id=32=1= And all I want is 2=1=. Well, the closest I came was : $string = preg_replace(/[^0-9]+\=/, , $QUERY_STRING); Assuming QUERY_STRING was the data. $string=preg_replace(/[^0-9]+=[^]/, '', $QUERY_STRING); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unsetting global variables from an function
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Enrico Weigelt) wrote: is there a way for unsetting an global variable from an function ? global $var; unset ( $var ); does not work since, unset only removes the reference in from local namespace. but i need to remove it from the global one. any chance to do it ? Instead of using the 'global' keyword, use the $GLOBALS array: $var='foobar'; function gUnset() { echo BEFORE: {$GLOBALS['var']}; unset($GLOBALS['var']); echo AFTER: {$GLOBALS['var']}; } gUnset(); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with functions.
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Sean Kennedy) wrote: I need some help with functions. Does anyone know of a good place to learn about functions? http://www.php.net Will someone be willing to teach me what I need to know about functions in PHP? If you find after reading that that you still need help, posting specific questions here will usually get a quick, helpful response. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Value of $_* variables
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (James Taylor) wrote: $result = mysql_query(select user from users where id = $_SESSION['id], $db); That just doesn't work, so I have to first go: $sid = $_SESSION['id']; $result = mysql_query(select user from users where id = $sid, $db); Anyway to get around this? Curly braces: $result = mysql_query(select user from users where id = {$_SESSION['id']}, $db); -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Value of $_* variables
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Jason Wong) wrote: echo $doo[dah]; # is correct If constant 'dah' is defined, and its value is the name of the key you wish to access from array '$doo'. But if the string literall 'dah' is itself the name of the key you are trying to access, then the above is *not* correct. For that, use: echo $doo['dah']; # is correct or echo $doo[dah]; # also correct -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: dealing with # in urls
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Mark) wrote: in php.ini there is a variable called arg separator.input that looks like it can help but when I add the line: arg separator.input = # I still get $id = 0#top Did you restart the server after modifying php.ini? As for http://mysite.com/test.php?id=0#top; sometimes resulting in id='0' and sometimes id='0#', perhaps this is a situation where letting PHP register the globals automatically is not the way to go. You could instead extract the query string from the URL by using parse_url() http://php.net/parse-url, then turn that query string into variables by using parse_str() http://php.net/parse-str. -- CC -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php