Re: [PHP] What is wrong here?
Are you using a relative url for the redirection? Cesar Aracena wrote: Hi all, I'm making a site which will reside in a remote server and had several problems... most of them where solved once I saw that register_globals are OFF, but now I dont know which other settings are affecting my scripts. I have trouble with header("Location... because the browser is NOT redirected. If I set an echo statement after I detected that the username and password using $_POST[""], the echo goes OK but if I comment the echo and un-comment the header("Location: http://www.domainname.com";); exit; nothing happens... and no, there isn't anything before that... what can be wrong? Thanks in advance, Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Browser going to page twice?
I'm having a weird problem. When I submit a form on my site, it often sends twice. I'm not sure if this is a client-side or server-side problem, but it doesn't happen on other sites. Is this a common problem, or am I making some dumb mistake? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] BBCode?
I'm working on adding simple BBCode to my site. I'm currently using the [i] tag for testing, with the following code: function bbcode($text){ $text = ereg_replace('\\[i\\](.{1,})\\[/i\\]','\\1',$text); return $text; } print bbcode('[i]This[/i] is a [i]test[/i].'); ?> But it prints "This[/i] is a [i]test". Is there a better way to do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
Thanks, but that isn't what I want. The point behind BBCode is allowing a small, simpler, securer, subset of HTML. I.e. [img=http://domain.com/image.gif] changes to http://domain.com/image.gif"; alt="" /> Kyle Gibson wrote: Leif K-Brooks wrote: I'm working on adding simple BBCode to my site. I'm currently using the [i] tag for testing, with the following code: function bbcode($text){ $text = ereg_replace('\\[i\\](.{1,})\\[/i\\]','\\1',$text); return $text; } print bbcode('[i]This[/i] is a [i]test[/i].'); ?> But it prints "This[/i] is a [i]test". Is there a better way to do this? ",$text); return $text; } print bbcode("[i]This[/i] is a [i]test[/i]."); ?> -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
Thanks a lot, but do you know how to do the same with ereg_replace? I'm trying to learn PCRE, but until I do, I won't be able to add anything to this... Jason Wong wrote: It's not working because it's doing a greedy match. Try (I prefer the PCRE functions over EREG): $text = preg_replace("/\[i\](.*)\[\/i\]/U", "$1", $text); -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: BBCode?
Thanks, but that doesn't allow nested tags (a [b] tag inside of an [i] tag, for example). Kyle Gibson wrote: Thanks a lot, but do you know how to do the same with ereg_replace? I'm trying to learn PCRE, but until I do, I won't be able to add anything to this... \\2',$text); return $text; } print bbcode('[i]This[/i] is a [i]test[/i].'); ?> Works... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Making verification code harder to OCR?
I'm using a verification code image to stop automated sign ups, but two hackers seem to be OCRing it. I've looked through the registration script, and there's definitley no security holes. Does anyone have any ideas as to making the image harder to OCR? // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 10); } $seed = make_seed(); mt_srand($seed); $dbh = mysql_connect ("", "", "") or exit; mysql_select_db ("",$dbh) or exit; $authimage = ImageCreate(40,15); $bgnum = mt_rand(1,3); switch($bgnum){ case 1: $white = ImageColorAllocate($authimage, mt_rand(250,255), mt_rand(250,255), mt_rand(250,255)); break; case 2: $green = ImageColorAllocate($authimage, mt_rand(0,5), mt_rand(250,255), mt_rand(0,5)); break; case 3: $yellow = ImageColorAllocate($authimage, mt_rand(250,255), mt_rand(250,255), mt_rand(0,5)); break; } $black = ImageColorAllocate($authimage, mt_rand(0,30), 0, 0); header("Content-type: image/png"); $getcode = mysql_fetch_array(mysql_query("select * from signupcodes where id = '$id'")); imagestring($authimage,mt_rand(4,5),mt_rand(0,5),0,$getcode['code'],$black); imageline($authimage,0,mt_rand(0,15),40,mt_rand(0,15),$black); imageline($authimage,0,mt_rand(0,15),40,mt_rand(0,15),$black); imagepng($authimage); imagedestroy($authimage); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Browser going to page twice?
I'm having a weird problem. When I go to a page on my site, it often goes twice. I'm not sure if this is a client-side or server-side problem, but it doesn't happen on other sites. Is this a common problem, or am I making some dumb mistake? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nl2br ( ) and forms
Ryan Smaglik wrote: When I call data from a form, How do I integrate nl2br to it so that it displays with linebreaks? Example code: Thanks in advance, Ryan -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Browser going to page twice?
Nope, it happens on all of the pages, but it seems to be fairly random. It doesn't happen all of the time, just sometimes. Morgan Hughes wrote: On Mon, 2 Dec 2002, Leif K-Brooks wrote: I'm having a weird problem. When I go to a page on my site, it often goes twice. I'm not sure if this is a client-side or server-side problem, but it doesn't happen on other sites. Is this a common problem, or am I making some dumb mistake? Is it the index.php of a directory? Often if you go to http://server/directory Apache rewrites that to http://server/directory/ with a Location header or some such. If entering it in your browser with the slash fixes it, that's the one. Modern browsers seem to automatically add a slash if you just put in www.domain.com as part of converting it to http://www.domain.com/ but for subdirectories there is often a redirect. hope this helps! -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Browser going to page twice?
Yes, I'm using Apache 1.3.22. Mind giving specifics on what to set those options to? I'm not very great with configuring apache... Morgan Hughes wrote: On Mon, 2 Dec 2002, Leif K-Brooks wrote: Nope, it happens on all of the pages, but it seems to be fairly random. It doesn't happen all of the time, just sometimes. You're using what server... Apache I hope? There is an Apache directive (in 1.3 at least) that controls whether the server sends back replies with the name it was called by, or the "official" name of the server. UseCanonicalName and ServerName may be the answer. I've seen this effect with those options using authentication... If not that, then I don't have a solution, but I sure admire the problem! ^_^ -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Browser going to page twice?
Hmm, nope. It's now off and it's still doing that. (I did restart apache) Morgan Hughes wrote: On Mon, 2 Dec 2002, Leif K-Brooks wrote: Yes, I'm using Apache 1.3.22. Mind giving specifics on what to set those options to? I'm not very great with configuring apache... Basically, you can have any number of names resolve to the server's IP address, via DNS or hosts files (/etc/hosts, c:\windows\hosts, or c:\windows\system32\drivers\etc\hosts). This is especially true if you're doing virtual hosting on the server. You use ServerName to tell the server what it's DNS name is, so it doesn't have to look it up. This may be just one of the several names you can give the server, but it's the one it will reply with, and the one it will print out on directory indexes and error messages. As long as you set UseCanonicalName, the server will use with the ServerName, or whatever it looked up for its IP address. This may be different to whatever you accessed it by, so it may redirect you to the same page with the new name. If you turn off UseCanonicalName, the server will reply with whatever name you used to contact it, which may solve this problem. I almost always run with UseCanonicalName off, on my development servers... For production servers one doesn't usually have that level of control... If you can turn it off, try that. I'm not sure it'll help, but it's worth a try. Good luck! -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP] [SEMI-OT] Making secure flash high scoring?
Sorry for the semi-ot post, but this is both a flash and php question, and I'm not a member of any flash lists, so I decided to post it here. Anyway, I have a game site with virtual pets, virtual shops, user accounts, etc. One feature request I get alot is flash games. I could find someone to make them, but I'm not sure about ways of making the score submitting secure. Any thoughts? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen over a network
Link them to a page like this to download the file: Dara Dowd wrote: Hello, I'd like a user to be able download a file from a file server on my LAN. Using works ok, but this simply displays the file in the browser and I want to force the download dialog box to appear. So now i have , and i want to do something like fopen("file://server/directory/filename",rb") but i just get an invalid argument warning. Am i on the right track?Is there a way around this? Cheers, Dara -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP] Sending no content-type header?
I'm running a few simple php scripts from the (windows) command line. Since I'm not using a web browser to view it, the HTTP headers are annoying and pointless. I've turned expose_php off in php.ini, but commenting out default_mimetype changes nothing, and setting it to an empty string sends a blank content-type header. Is there any way to do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending no content-type header?
Ok, thanks a lot. For what it's worth, here's my simple .bat file for executing php files: @ECHO OFF IF NOT EXIST %1.php goto usage php.exe -q %1.php goto end :usage echo ÚÄÄÄ¿ echo ³ USAGE ³ echo ³Type "php.bat" (without quotes)³ echo ³ followed by the name of a³ echo ³valid php file without the .php³ echo ³extension. ³ echo ÀÄÄÄÙ :end Chris Wesley wrote: On Thu, 5 Dec 2002, Leif K-Brooks wrote: I'm running a few simple php scripts from the (windows) command line. Since I'm not using a web browser to view it, the HTTP headers are annoying and pointless. I've turned expose_php off in php.ini, but commenting out default_mimetype changes nothing, and setting it to an empty string sends a blank content-type header. Is there any way to do this? php.exe -q ~Chris -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP] Making random string function function more random?
I'm using the following function to generate a random string: function randstring($minasc = 32,$maxasc = 255,$minlength = 0,$maxlength = 0){ //If maximum length is lower than minimum length, return string representation of false if($maxlength != 0 and $minlength != 0 and $minlength > $maxlength){ return ''; } //Initialize $return $return = ''; //Start infinite while loop, which will be exited with break; while(true){ //Add another random character to $return $return = $return.chr(mt_rand($minasc,$maxasc)); //Break out of loop when it's time to if((strlen($return) == $maxlength) or (mt_rand(1,2) == 2 and (strlen($return) >= $minlength or $minlength == 0) and (strlen($return) <= $maxlength or $maxlength == 0))){ break; } } //Return the value of $return return $return; } But when I run it with: randstring(65,90,4,4); and I check how many strings it generates before reaching a certain string, some strings take much longer than others. Is this just a problem with using pseudo-random numbers, or is there a better way to randomize this function? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] evaluating vars in a var
$htmlEmail = 'hello $firstName $lastName'; //Start loop eval("\$thisemail = $htmlemail"); //Send mail out, using $thisemail for mail body //End loop rolf vreijdenberger wrote: Hi, this problem came forth from my previously posted -Mail(): how much time-, but is different so I posted it seperately. I make html emails with personal stuff in it e.g. hello $firstName $lastName etc. Problem: I would like to put the whole email html layout in one var, like this: $htmlEmail = "hello $firstName $lastName"; and then I want to have the values of firstName and $lastName updated in every iteration of a loop where I put in new Values of these vars. In order to do this, I have to reevaluate the whole $htmlEmail variable. Is this possible, and if so, how? thanks a lot -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] evaluating vars in a var
Yes. If it was in double quotes, it would parse the variables before the loop started. Another way would be to put it in double quotes and escape the dollar signs. Rolf Vreijdenberger wrote: I notice that you put everything in single quotes and then escape it. is there any special reason for that? thanks -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Spaces
This isn't really a PHP question, but look at the html tag. Patrick McKinley wrote: Is there a way of getting a php to display all the spaces in a file. i have used this to display an nfo file on my site: ---nfoload.php $fol = $_GET['fol']; $nfono = $_GET['nfono']; require("nfo/".$fol."/ind.txt") ?> $file = "nfo/".$fol."/".$nfo.""; $fp = fopen($file, "r"); $fc = fread($fp, filesize($file)); echo nl2br($fc); fclose($fp); ?> nfo/$fol/ind.txt (tells the script filenames for the nfo files) if $nfono == "1" { $nfo = "nfo_file_1.nfo } else if $nfono == "2" { $nfo = "nfo_file_2.nfo } ?> now since nfo files tend to include a fair bit of of ASCII art in them, i was wandering if there's a way to preserve the spaces in this file, so the ASCII art is preserved. thanks -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Just Curious
I use the mailing list. conbud wrote: I was just curious, but what program or website do you all use to view and reply to the newsgroups with ? Lee -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP_SELF Variable
Not quite sure what you mean, but I'm guessing you're trying to use $PHP_SELF and it's not set. If that's the case, use $_SERVER['PHP_SELF'] instead. Register_globals defaults to disabled now. [EMAIL PROTECTED] wrote: Hello List, anybody knows how to set the PHP_SELF variable? Short answers are welcome... Oliver Etzel -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP_SELF Variable
Odd. Mind doing: print_r($GLOBALS); and tsending the results? [EMAIL PROTECTED] wrote: Hello Johannes, hello all, I compiled it as CGI-php and the variable $_SERVER['PHP_SELF'] has no value either. What can I do on order to give PHP_SELF the right value? Oliver Etzel On Tuesday 10 December 2002 12:36, info AT t-host.com wrote: > after successfully compiling and installing php.4.3-dev from tarball > ... > PHP_SELF has no value. How can I set this? Try using $_SERVER['PHP_SELF'] if it works look at the release notes and look for "register_globals" johannes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP_SELF Variable
It's because register_globals is off by default in your 4.3 installation. Change it in php.ini, or use the superglobal array instead. [EMAIL PROTECTED] wrote: Hi Leif, hi all, when I run the following script from commandline (RedHat7.3) PHP_SELF has a value and I will get the following result: --- snip [_] => /usr/local/bin/php [OLDPWD] => /home/fritz/htdocs3/bildvote/admin [PHP_SELF] => info70.php [SCRIPT_NAME] => info70.php [SCRIPT_FILENAME] => info70.php [PATH_TRANSLATED] => info70.php [DOCUMENT_ROOT] => [argv] => Array --- snip How can I get this value when I run it as a CGI? Oliver Etzel - Original Message - From: Leif K-Brooks To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Tuesday, December 10, 2002 1:03 PM Subject: Re: [PHP] PHP_SELF Variable Odd. Mind doing: print_r($GLOBALS); and tsending the results? [EMAIL PROTECTED] wrote: >Hello Johannes, hello all, > >I compiled it as CGI-php >and the variable $_SERVER['PHP_SELF'] has no value either. > >What can I do on order to give PHP_SELF the right value? > >Oliver Etzel > On Tuesday 10 December 2002 12:36, info AT t-host.com wrote: > > after successfully compiling and installing php.4.3-dev from tarball > > ... > > PHP_SELF has no value. How can I set this? > > Try using $_SERVER['PHP_SELF'] if it works look at the release notes and look > for "register_globals" > > johannes > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Change the html to: John Mary Beauford.2002 wrote: Hi, I'm sending this to both lists as I'm not sure where the problem is, but I believe it is an issue with my HTML form. Here's the problem: I have a drop-down menu form on my webpage with employee names in it. When I choose a name and click submit it gets passed to a php page which accesses a mysql database and displays information about that employee. The problem is that the form is not sending the employee name to the php page. If I insert the name in the php page manually, it works fine, so the problem appears to be with the form. Can someone help me out here - a sample of my code is below. I'm not sure how to explain this, but whatever gets sent to the PHP page has to be one variable - i.e. if I choose John, then the variable that gets sent to the PHP should have the value John, if I choose Mary, the value of the variable should be Mary. Hope this makes sense. TIA John Mary -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trimming nans from a string
$variable = ereg_replace('[^0-9]','',$variable); Frands Sørensen wrote: I want a user to type a number in an html-form. Afterwards I want to check for wrong typing. How do I remove all non numbers from the string? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] "include" question
Variables don't get parsed in single quotes, use double quotes. RClark wrote: Hello all, I am passing a variable like so: On the "link.php" page, I have this simple code: $job = $_GET['foo']; echo "$job"; // for error checking include 'path/to/$job'; ?> The 'echo "$job";' statement works just fine, but the outbout for the include statement looks like this: bar.php Warning: Failed opening 'scripts/$job' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/www/data-dist/link.php on line 142 Can I not use a $variable in an include 'something.php '; statement? Thanks in advance, Ron Clark -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpinfo page doesn't display anything
I'm guessing you don't have the short start tag enabled, try Jody Cleveland wrote: You're calling it through a web server, right? Yup: http://email.winnefox.org/wals/info.php Jody -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] What's the Difference?
str_replace() doesn't have regex. Stephen wrote: I can't quite figure this out... What exactly is the difference between str_replace() and ereg_replace()? Don't they both do the exact same thing? Thanks, Stephen Craton http://www.melchior.us "What is a dreamer that cannot persevere?" -- http://www.melchior.us -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting full HTTP request the page was requested with?
Is there a way to find out exactly what HTTP request was made for a page? Something like: GET http://myserver.com/whatever.php HTTP/1.1 Host: myserver.com -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting full HTTP request the page was requested with?
Thanks, but I'm trying to see what the client sent to get my page, not what a host returns when I send it a request... Hatem Ben wrote: $url = "http://myserver.com";; $sockhandle = @fsockopen($url, 80, &$errno, &$errstr); if(!$sockhandle) { $mes = "server $url not available!"; $result = "$mes"; return $result; } else { $request = "GET / HTTP/1.1\r\n"; $request .= "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)\r\n"; $request .= "Host: $url\r\n"; $request .= "Connection: Close\r\n\r\n"; fputs($sockhandle, $request); $res = ""; $line = fgets($sockhandle, 1024); //Request Method $res .= "$line\n"; $line = fgets($sockhandle, 1024); //Close Method $res .= "$line\n"; $line = fgets($sockhandle, 1024); //Server Type $res .= "$line\n"; $line = fgets($sockhandle, 1024); //Date $res .= "$line\n"; $line = fgets($sockhandle, 1024); //Transfer-Encoding $res .= "$line\n"; $line = fgets($sockhandle, 1024); //Content-Type $res .= "$line\n"; $line = fgets($sockhandle, 1024); //Cache-control $res .= "$line\n"; $line = fgets($sockhandle, 1024); //Set-Cookie $res .= "$line\n"; $line = fgets($sockhandle, 1024); //End Header "space" $res .= "$line\n"; $res = addslashes($res); return $res; - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, December 15, 2002 4:54 PM Subject: [PHP] Getting full HTTP request the page was requested with? Is there a way to find out exactly what HTTP request was made for a page? Something like: GET http://myserver.com/whatever.php HTTP/1.1 Host: myserver.com -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] PHP/MySQL Query
mysql_query("update table set field=field+1 where whatever='whatever'"); Steven M wrote: How do i make a form that will allow me to add 2 to the value of a MySQL field? I am trying to change it from 75 to 77. Is this possible? Thanks -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP shell scripting not working right?
I'm trying to do shell scripting in PHP. I have PHP installed in /usr/bin/php. I have the following script: #!/usr/bin/php -q print "Success!\n"; ?> It's saved as test.php and CHMODed to 777. When I type "test.php" at the command line, it says: bash: test.php: command not found When I type "test", it acts like I just hit enter. Typing "/usr/bin/php -q test.php" does work. Does anyone know what I'm doing wrong? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP shell scripting not working right?
Ever answered your own question five seconds after asking it? Apparently, I have to type "/path/to/test.php" even though I'm already in the right directory. Leif K-Brooks wrote: I'm trying to do shell scripting in PHP. I have PHP installed in /usr/bin/php. I have the following script: #!/usr/bin/php -q print "Success!\n"; ?> It's saved as test.php and CHMODed to 777. When I type "test.php" at the command line, it says: bash: test.php: command not found When I type "test", it acts like I just hit enter. Typing "/usr/bin/php -q test.php" does work. Does anyone know what I'm doing wrong? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Put text matching regex into array?
Is there a way to put each part of a string matching a regex into an array? Example: $string = "-_-_--- --_-_-- random text here-_"; $array = regextoarray($string,"[-_]{1,}"); //Produces array of "-_-_---","--_-_--","-_" -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_SERVER['DOCUMENT_ROOT'] on localhost
No, PHP version. With virtually no information, I'm going to guess that you're using a version below 4.1, which is where the $_* variables were introduced. Upgrade or use $HTTP_SERVER_VARS. Rolf Vreijdenberger wrote: yes, the server var doesn't exist in phpifno(); no difference winxp pro with iss -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Good program to indent large quantity of files?
I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good program to indent large quantity of files?
Thanks, but that's not what I'm looking for. I already have a good php editor, what I'm looking for is something to indent exsiting files. Mike Bowers wrote: I use Ultra-Edit 32 .. It auto-indents when u set highlight mode to PHP .. It also has a syntax higlight feature to show you when it recoginises PHP4.2.3 code .. http://www.ultraedit.com Mike Bowers PlanetModz Gaming Network Webmaster [EMAIL PROTECTED] ViperWeb Hosting Server Manager [EMAIL PROTECTED] [EMAIL PROTECTED] All outgoing messages scanned for viruses using Norton AV 2002 -Original Message----- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 9:53 PM To: [EMAIL PROTECTED] Subject: [PHP] Good program to indent large quantity of files? I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good program to indent large quantity of files?
But as far as I can tell, there's no "indent all" option. I'd have to do it by hand, or remove and recreate the line breaks in the text files. Justin French wrote: on 20/12/02 4:04 PM, Leif K-Brooks ([EMAIL PROTECTED]) wrote: Thanks, but that's not what I'm looking for. I already have a good php editor, what I'm looking for is something to indent exsiting files. ... so open them up in the editor, indent them, save them, continue using your old editor. Justin Mike Bowers wrote: I use Ultra-Edit 32 .. It auto-indents when u set highlight mode to PHP .. It also has a syntax higlight feature to show you when it recoginises PHP4.2.3 code .. http://www.ultraedit.com Mike Bowers PlanetModz Gaming Network Webmaster [EMAIL PROTECTED] ViperWeb Hosting Server Manager [EMAIL PROTECTED] [EMAIL PROTECTED] All outgoing messages scanned for viruses using Norton AV 2002 -----Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 9:53 PM To: [EMAIL PROTECTED] Subject: [PHP] Good program to indent large quantity of files? I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] syntax to reference $_POST within function
You don't need to import the request variables for that to work. The variable names in the function definition have no relationship to variables outside of it. Most likely, you're calling with something like: check_banlist($banlist,$p_email); but you could also call it with: check_banlist($variable_with_a_totally_different_name,$another_oddly_named_variable); or call it with check_banlist('some string','another string'); or even call it with check_banlist($banlist,$_POST['email']); so importing the request variables is pointless. What you call the variables inside the function doesn't have anything to do with whether there is a global variable with the same name! Jamie wrote: Thanks for the vote of confidence. I ended up getting it working with this: import_request_variables('p', 'p_'); function check_banlist($banlist, $p_email) { This is what I had been trying to accomplish but was writing it this way: function check_banlist($banlist, $_POST['email']) { Maybe you could also point me to the lesson that needs to be learned here. Is it that it is an array? or syntax? Thanks for the assistance! Jamie Sullivan Philip Olson wrote: First, read this: http://www.php.net/variables.external Second, assuming you have a PHP version equal to or greater than 4.1.0 and the method of the form is POST, you'd do something like this: $banlist = array('[EMAIL PROTECTED]'); echo check_banlist($banlist, $_POST['email']); Your question sounds like you're wondering if the function definition should change, it doesn't. You leave it as $email and use $email within the function. This is just how functions work, you pass in values. So: function foo ($email) { print $email; } foo($_POST['email']); // Or as you used to do with register_globals foo($email); Or you could always just do: function bar () { print $_POST['email']; } bar(); This is why they are SUPERglobals, because this is what you would have done in the past (old school): function baz () { global $email, $HTTP_POST_VARS; print $email; print $HTTP_POST_VARS['email']; } Also it's worth mentioning that $HTTP_POST_VARS has existed since PHP 3, so just in case that might be important to you too. It is not super. Now if you don't care if 'email' comes from GET, POST, or COOKIE ... you could use $_REQUEST['email']. Or, import_request_variables() is another option. For example: import_request_variables('p', 'p_'); print $p_email; See the manual for details, and have fun! It really isn't that complicated and you'll be yelling out Eureka! pretty soon now. Regards, Philip Olson P.s. Superglobals work with register_globals on or off. On Thu, 19 Dec 2002, Jamie wrote: I am attempting to modify an old script to support the superglobal $_POST with register_globals=Off. These register globals are definately challenging when you are new to php and every example shown anywhere uses the old method but I guess what doesn't kill you only makes you stronger. I am trying to convert this line, $email is coming from an html form so I would typically call it with $_POST['email'] but this doesn't work in this case and I thus far haven't been able to find anything that explains what I should be doing. function check_banlist($banlist, $email) { Any assistance is appreciated! Thanks, Jamie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Good program to indent large quantity of files?
Thanks, but it inserts two line breaks where there should be one, and puts spaces in my html tags so they don't work. Any other ideas? :( michael kimsal wrote: Leif K-Brooks wrote: I haven't been indenting any of my code, but I want to start indenting to make the code more readable. It would be near-impossible for me to manually indent what's already there, though. So, I'm looking for a program to indent an entire folder of PHP files at once. Any suggestions? phpedit.com (I believe) has a 'code beautifier' program which will take existing files and make them 'pretty' (indented, etc) Not sure if it can do things in batches or not, but still faster than doing things manually. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strings and default values...
1) You most likely have magic_quotes_gpc set to on. Either set it to off or stripslashes() the input. 2) No, it won't print. Think of a heredoc as a quotes string without the quotes. You can, however, do something like: $variable = <<< WHATEVER whatever text goes here WHATEVER; $variable.= executesomephp(); $variable = <<< WHATEVER whatever other text goes here WHATEVER; Steven Kallstrom wrote: Dear List, This is a simple problem, but I can't really find a good solution. and I have a general question also. 1) I have a webform that is save to a variable $html using heredoc. $html = <<< WEBFORM . . the problem is that when you enter an apostrophe, and then repost the page with the stored values, the apostrophe appears escaped in the edit form. how can I solve this? 2) is it possible to put additional ('nested') php inside a heredoc, or will that text simply print out? Thank you, Steven Kallstrom -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Undefined Functions
Try defining them at the top instead... Beauford.2002 wrote: Then based on the one below that doesn't work, what is the problem with it? As I said, the functions are at the bottom of the script. The only thing after them is the closing ?>. I also said that they work if I don't call them from within an if/else. This tells me it is not where it is defined but where it is being called from. Your saying this doesn't matter, but have not given any reasons for my problems. If you could elaborate on this it would be appreciated. Beauford - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]> Cc: "PHP General" <[EMAIL PROTECTED]> Sent: Monday, December 23, 2002 11:14 AM Subject: Re: [PHP] Undefined Functions Like I said, where you define your function is important, not where you call it. If you are defining and calling it all in the same place, then yes, obviously it makes a difference. -Rasmus On Mon, 23 Dec 2002, Beauford.2002 wrote: I have a function at the bottom of my script which is called from withing an if/else statement. If I take it out of the if/else and just call the function it works fine (except I don't get the results I want). So it appears where you are calling it from does matter. See the examples below. This isn't the first time either, I have had to redo several scripts for this project because of it. If I'm doing this wrong based on the examples below, please let me know. Thanks. i.e. This doesn't work.This does. some code .. some code . If ($bob) { gotofunction($bob); } gotofunction($bob); elseif ($sally) { gotonextfunction($sally); } gotonextfunction($sally) else { gotolastfunction(); } gotolastfunction() some other code . some other code function gotofunction($bob) function gotofunction($bob) function gotonextfunction() function gotonextfunction() function gotolastfunction() function gotolastfunction() - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]> Cc: "PHP General" <[EMAIL PROTECTED]> Sent: Sunday, December 22, 2002 11:16 PM Subject: Re: [PHP] Undefined Functions An undefined function error has nothing to do with where you are calling the function from. It has to do with whether or not you have defined the function you are calling. -Rasmus On Sun, 22 Dec 2002, Beauford.2002 wrote: Hi, I previously asked a question about getting undefined function errors in my script and someone mentioned that it may be that I am calling it from within an if or else statement. This turned out to be the case. Now the question - is there a way around this? What I need to do resolves around many different conditions, and depending on the what's what I call the necessary function. I have looked my script over and over and can not see any other way of doing this. I am fairly new to PHP and maybe there is a better way, and I'm open to suggestions. TIA Example: if ($a == $b) call function one; elseif ($a > $b) call function two; elseif ($a == $c) call function two; elseif ($a < $b) call function two; elseif ($c > $b) call function two; elseif ($d == $e) call function two; -- 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 -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
[PHP] Good class for managing settings stored in INI (or other format)file?
I'm looking for a class to manage settings stored in a .ini (or other format) file. I could store them in a database, but they need to be there even when the DB's down. Any ideas? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_escape_string is deprecated?
I was looking at the PHP 4.3 changelog, and it said that mysql_escape_string is deprecated. Is this true, and if so, what should I be using instead? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how could a php script return a dns error ?
No, it is IE specific. It's IE's general error message, which means the document contains no data in this case. Hatem Ben wrote: it's not an IE specefic :)) netscape or opera or whatever will return the same error message. - Original Message - From: "Paul Reed" <[EMAIL PROTECTED]> To: "'Hatem Ben'" <[EMAIL PROTECTED]> Sent: Saturday, December 28, 2002 10:19 PM Subject: RE: [PHP] how could a php script return a dns error ? It's not really a dns error, that the general error that MS Internet Explorer spits out when it can't find the file, as opposed to showing you the erro 404 file not found ... PHP cannot give a dns error, looks like your just linking to a file that doesn't exist and that's IE's friendly way of telling you so ... yes .. a bit confusing to the developer. (Thanks again MS...) Try it with netscape, and I bet you'll get a 'file not found' error instead... Paul. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] HTML module problem under Linux/APache2.0
No idea what you mean html module, but it looks like a register_globals problem. Tiziano Crimella wrote: Im' sorry but I discovered a problem when I try to send an HTML module to a PHP file. Watch the example below: module.html: Module welcome.php: Welcome Print "Welcome $user"; ?> Under Microsoft XP's IIS with Php4 modules installled ther isn't any problem but under Linux with Apache 2.0 and Php 4 modules installed, doesn't appear nothing. TO NOTE: Php's modules under this last system (linux/Apache2.0) run correctly and other scripts have been execute correctly. Thank you for any help Tiziano Crimella - Switzerland -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Keeping script running, but returning control to user?
I need a way to keep the script running on the server, but control to the user. I'm doing some lengthy processes on the server, and it seems stupid to keep the user waiting pointlessly. I'm trying to do something like: if(array_key_exists('secondrun',$_GET)){ print "Processing complete!"; exit; } header("Location: http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?secondrun=1"); //Do long processing here ?> but it waits till the long processing is done, and then redirects. Is there another way to do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting short (DOS) name of file?
I'm trying to run some (often user-defined) files on my windows server. Thing is, it seems to want short names (like C:\PROGRA~1\WHATEVER\PROG.EXE). Is there any way to get the short name from a long name? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting short (DOS) name of file?
Thanks... thing is, it can be anything from c:\whatever.exe to c:\program files\program name\bin\program.exe. I'll write a function that goes to each directory in a string and does a dir /x if I have to, but isn't there a simpler way? Michael Sims wrote: On Tue, 31 Dec 2002 01:12:47 -0500, you wrote: I'm trying to run some (often user-defined) files on my windows server. Thing is, it seems to want short names (like C:\PROGRA~1\WHATEVER\PROG.EXE). Is there any way to get the short name from a long name? Take a look at this: http://makeashorterlink.com/?V25A32BE2 -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Getting short (DOS) name of file?
I'm using exec(). Frank M. Kromann wrote: PHP should not have any problems with long file names. I use it often on both WIndows 2000 and Windows XP without anu problems. What is it you are trying to do ? - Frank Thanks... thing is, it can be anything from c:\whatever.exe to c:\program files\program name\bin\program.exe. I'll write a function that goes to each directory in a string and does a dir /x if I have to, but isn't there a simpler way? Michael Sims wrote: On Tue, 31 Dec 2002 01:12:47 -0500, you wrote: I'm trying to run some (often user-defined) files on my windows server. Thing is, it seems to want short names (like C:\PROGRA~1\WHATEVER\PROG.EXE). Is there any way to get the short name from a long name? Take a look at this: http://makeashorterlink.com/?V25A32BE2 -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Limit to size of autoindex in MySQL/PHPMyAdmin?
The limit to tinyint is 255... use int. Jim MacCormaic wrote: Hi all. I'm new here, currently implementing my first PHP/MySQL website on an iMac running Mac OS X v.10.2.3. All has been going really well until just now while I was adding records to the MySQL database. I have a table which includes an auto-incremented field which is set as the Primary key. I was happily entering information and then suddenly got a warning of an error in my MySQL query, telling me that I had a 'duplicate entry "255" for key 1'. I've checked the relevant table in PHPMyAdmin and, sure enough, under Row Statistic in the Structure option it gives a value of 255 for the Next Autoindex even though that value was already assigned in the previous record. I feel as if I've hit a brick wall on this one. I ran Check Table, Analyze Table and Optimize Table in PHPMyAdmin Operations and all reported 'OK'. I'm using a PHP form to insert the records and have code included to print out the MySQL query and to report errors (hence the warning which I received). The field in question is of type tinyint(4), unsigned, not NULL and, as stated, is the Primary key and set to auto-increment. Have I hit some sort of limit by reaching an id of 255? If so, can I fix this? Any help would be appreciated, as my database has to all intents and purposes lost its functionality once I cannot add further records. Jim MacCormaic Dublin, Ireland iChat/AIM : [EMAIL PROTECTED] -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Still executing afte die()?
I have a page called 404.php which is set as the 404 page in a .htaccess file. At the top of this file, it has this: if(strtolower($_SERVER['REQUEST_URI']) != $_SERVER['REQUEST_URI']){ header("Location: http://{$_SERVER['HTTP_HOST']}".strtolower($_SERVER['REQUEST_URI'])); die; } which redirects to the same page with a lowercase URL if there are any uppercase characters. After that, it inserts the 404 into the database for checking later. But, when I test it with something like PaGeTHATSHOULDBELOWERCASE.php, it redirects to pagethatshouldbelowercase.php but still inserts it into the database (with the uppercase page name) even though the redirected page is 404-free. What am I doing wrong? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still executing afte die()?
But it shouldn't get to the database insert because of the redirect either... I only added the die; when it still inserted with the redirect. Rick Emery wrote: You'll never get to the die() statement, because you redirected with the header() statement. - Original Message ----- From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 03, 2003 6:14 PM Subject: [PHP] Still executing afte die()? I have a page called 404.php which is set as the 404 page in a .htaccess file. At the top of this file, it has this: if(strtolower($_SERVER['REQUEST_URI']) != $_SERVER['REQUEST_URI']){ header("Location: http://{$_SERVER['HTTP_HOST']}".strtolower($_SERVER['REQUEST_URI'])); die; } which redirects to the same page with a lowercase URL if there are any uppercase characters. After that, it inserts the 404 into the database for checking later. But, when I test it with something like PaGeTHATSHOULDBELOWERCASE.php, it redirects to pagethatshouldbelowercase.php but still inserts it into the database (with the uppercase page name) even though the redirected page is 404-free. What am I doing wrong? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still executing afte die()?
Because URLs are case-sensitive. A user may have cap lock on and go to something like MYPAGE.PHP, but the 404 page is supposed to redirect them to mypage.php. Mike Mannakee wrote: My question would be what's the point? Why have it redirect to itself at all? You could more easily just convert it to lowercase and insert that value. I can't figure what possible advantage there is to doing the redirect to a custom error page. Only difference is what the user would see in the URL, no? Mike "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... But it shouldn't get to the database insert because of the redirect either... I only added the die; when it still inserted with the redirect. Rick Emery wrote: You'll never get to the die() statement, because you redirected with the header() statement. - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 03, 2003 6:14 PM Subject: [PHP] Still executing afte die()? I have a page called 404.php which is set as the 404 page in a .htaccess file. At the top of this file, it has this: if(strtolower($_SERVER['REQUEST_URI']) != $_SERVER['REQUEST_URI']){ header("Location: http://{$_SERVER['HTTP_HOST']}".strtolower($_SERVER['REQUEST_URI'])); die; } which redirects to the same page with a lowercase URL if there are any uppercase characters. After that, it inserts the 404 into the database for checking later. But, when I test it with something like PaGeTHATSHOULDBELOWERCASE.php, it redirects to pagethatshouldbelowercase.php but still inserts it into the database (with the uppercase page name) even though the redirected page is 404-free. What am I doing wrong? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Still executing afte die()?
But I only want it to insert if the page was all lowercase when they went to it. I understand it continuing after redirecting, but why after die()ing too? Putting the insert code into an else statment solved the problem, but it's ugly, and the question still remains... why does it do this? Jason Wong wrote: On Saturday 04 January 2003 11:00, Leif K-Brooks wrote: But it shouldn't get to the database insert because of the redirect either... I only added the die; when it still inserted with the redirect. As you have already found out, the code _does_ continue to execute after the header() redirect. Try this: if (not_lowercase) { insert_into_db(); header(); die(); } -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Still executing afte die()?
As I understand it, your situation is this: a) all your pages are named in lowercase b) if someone tries to access a non-existent page on your site (eg using a URI which is not fully lowercase) they'll hit your 404.php Correct. But if the page was all lowercase they wouldn't be hitting your 404.php page in the first place? Or am I missing something? They can still go to nonexistantpage.php. It cannot continue after a die(), unless there's a bug in PHP. If you still think that it does then post your full code and the circumstances under which it happens. Hmm, odd. When I try to duplicate it, I can't. Either this bug doesn't always happen, or I made a really dumb mistake, or something... -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Perl > PHP
Not good at perl, but you need to do: Sam wrote: I don't know what the heck this is but it works: #!/usr/bin/perl $ENV{LD_LIBRARY_PATH} .=":.:..:../lib"; $ENV{CLASSPATH} .= ":Verisign.jar:."; print `javac PFProJava.java`; print `java PFProJava test-payflow.verisignscks.com`; How can it be done with PHP? OR run the perl script from a PHP script. didn't work. Thanks, Sam -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printer_open
PHP is server-side. You can't do anything to the client besides give them data. This may be possible with javascript (I don't think so, though), but not with PHP. Kathy wrote: Hi, I'm Kathy and just a beginner in php. I'm using the printer_open and printer_draw_text etc. to print a report. It works in my localhost, but when I run it in a remote server, the error message 'couldn't connect to the printer' shown. I think this was caused by no printer was setup in the remote server. Can you suggest how I can print to a local printer with the programs reside in remote server. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php $query help
What the heck is if($name == $name){ supposed to mean? I've never seen a variable that's not equal to itself... :-) - [ Paul Ferrie ] - wrote: > Here is my problem > >I have created a user login system (flash+php+mysql) >And it just about works > >Here's the prob when i go to register as a new user the code wont properly >check to see if the username already exsist's in the DB, I am pretty sure >the problem lies in my first $query > > >PHP: >-- >$query = "SELECT name FROM contacts WHERE name='$name'"; >if ($name == $name) { >print "loginT=UserName in Use"; >}else{ >$query = "INSERT INTO contacts (name, pass, email, id) VALUES ('$name', >'$pass', '$email', NULL);"; >} >$result = mysql_query($query); >// Gets the number of rows affected by the query as a check. >$numR = mysql_affected_rows($Connect); >if ($numR == 0) { >// Sends output to flash >print "loginT=Error - Register Again"; >} >else if ($numR == 1) { >// Sends output to flash >print "loginT=Success&checklog=1"; >} > > >-- > > >If i take out >PHP: >-- >$query = "SELECT name FROM contacts WHERE name='$name'"; >if ($name == $name) { >print "loginT=UserName in Use"; > > >-- > >THe login system works fine but dupilcate entries can be submitted to the >database. > >Please help i would love to get this up and running > >Cheers > > > > > -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Changing order of just one array item?
I need to change where one item is ordered in an array. I know how to sory an array, but I need to move one item up/down in the array. Example: $array is: 0 => "element one" 1 => "element two" 2 => "element three" 3 => "element four" I call array_order_up($array[1]) and $array is now: 0 => "element one" 2 => "element three" 1 => "element two" 3 => "element four" If there aren't any native functions to do this, can anyone think of a way to make my own function to do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing order of just one array item?
Thanks, but that's not what I'm trying to do. I know how to change the keys, but I'm looking to change the internal order of the key/value pairs. Timothy Hitchens (HiTCHO) wrote: This would do it: $first[] = 'hello'; $first[] = 'bye'; function swap(&$list, $first, $second) { $tempOne = $list[$first]; $list[$first] = $list[$second]; $list[$second] = $tempOne; } swap($first, 0, 1); print_r($first); ?> Timothy Hitchens (HiTCHO) Open Source Consulting e-mail: [EMAIL PROTECTED] -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Sunday, 19 January 2003 12:36 PM To: [EMAIL PROTECTED] Subject: [PHP] Changing order of just one array item? I need to change where one item is ordered in an array. I know how to sory an array, but I need to move one item up/down in the array. Example: $array is: 0 => "element one" 1 => "element two" 2 => "element three" 3 => "element four" I call array_order_up($array[1]) and $array is now: 0 => "element one" 2 => "element three" 1 => "element two" 3 => "element four" If there aren't any native functions to do this, can anyone think of a way to make my own function to do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] NEED HELP URGENTLY
First of all, you don't need to type in all caps like that. I thought this was the Nigerian Scam for a minute there! :-) Anyway, in PHP 4.2+, the php.ini setting register_globals is off by default. You'll need to either turn it on, or start using the newer $_POST superglobal array. For more information, take a look at http://www.php.net/manual/en/security.registerglobals.php. Dale wrote: I SETUP THE PHP PARSE ENGINE ON ABOUT A YEAR AGO ON ONE OF MY WEB SERVERS AND EVERYTHING WORKED JUST FINE. I, HOWEVER, RECENTLY ACQUIRED A NEW SERVER AND TRIED TO SETUP PHP AGAIN ON IIS 5.0 ON A WIN 2K SERVER PLATFORM. EVERYTHING SEEMS TO BE WORKING CORRECTLY, BUT FOR SOME REASONS WHEN I TRY TO ACCESS ANY VARIABLES PASSED FROM A HTML FORM, I ALWAYS GET AN ERROR. FOR EXAMPLE IF I HAVE A FORM THAT PASSES THE VARIABLE $ACTION I GET THE FOLLOW ERROR WHEN I TRY TO ACCESS THE SAME VARIABLE IN PHP PAGE: Notice: Undefined variable: action in C:\...\otelzoo.com\cust_care.php on line 9 I HAVE REINSTALLED THE PHP PARSER THREE TIMES NOW AND I HAVE HAD NO LUCK IN GETTING RID OF THIS PROBLEM. I KNOW MOST PEOPLE WILL JUMP TO THE CONCLUSION THAT THERE IS A SIMPLE ERROR IN THE ACTUAL SOURCE CODE ITSELF, BUT I PROMISE YOU THAT I HAVE BEEN PROGRAMMING IN THIS LANGUAGE FOR AT LEAST TWO YEARS AND I AM 100% SURE THAT I AM PASSING THE VARIABLE CORRECTLY. PLEASE HELP. THANK YOU. - DALE -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] continue after break
Then just don't have the image inside the loop... Remon Redika wrote: I have put Image inside of my loop... and that image located between and I want the image not doing loop too. cause i just need one image.., I just do looping for my data: and John W. Holmes writes: The solution is to take out your break... why is it there?? ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -Original Message- From: Reymond [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 22, 2003 10:45 PM To: [EMAIL PROTECTED] Subject: [PHP] continue after break Hi everyone, I made a while loop and i'd like to know how to continue looping after I break it, and . Here is my script : I found just break looping on my page, can't continue :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Size of images (in bytes)
No, it's not sent to the browser. Your output buffer catches it, and the output buffer is then erased with ob_end_clean(). Oliver Witt wrote: Marek Kilimajer schrieb: Use output buffer: ob_start(); ImageJPEG($im); $imagestring=ob_get_contents(); ob_end_clean(); Thanks for the answer. But if I do it like that, the picture has been sent to the browser. That's what I don't want. I need to know the size of the picture before it is sent to the browser. Olli -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] URLencode issues - halp! - code included
Take the $name = urldecode($name); bit out. The decoding is all handled by PHP before your script runs. Also, you should look into using $_GET['name'] instead of $name. SpyProductions Support Team wrote: Here is some code: From a form, I get username as $name and it goes to the processing file for the form, where a sale happens and it sends the code to a different server like this: $data = urlencode($name); print " CONTENT='0;URL=http://somedestination.php?name=$data'>"; That server then processes the person and puts them into the MySQL - but if the name is bad, it errors out and stops the script: $name = urldecode($name); if(!$name) { print "You entered an invalid name. Please stop and call us at"; } else { Inserts record into database. } That's it. It doesn't seem to matter what the name entered is; there is no rhyme or reason (seemingly) to the names it fails on (as per my previous post). urlencode may just be a flaky thing to use? Perhaps depending on the browser? Thanks, -Mike -Original Message- From: David T-G [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 23, 2003 3:31 PM To: PHP General list Cc: SpyProductions Support Team Subject: Re: [PHP] URLencode issues - halp! Mike -- ...and then SpyProductions Support Team said... % % I am having some issues, apparently, with URL encode. ... % % I decided to use this because people are allowed to use *any* key as part of % their name, so a name like "rt'$%^*&'rt" is perfectly allowable. Makes sense, but I'd use base64_encode (with base64_decode, of course) rather than urlencode; it will properly shield everything. No, I don't know why 'normal' names fail and goofy ones don't; without some code and some specific examples we can't really tell too well :-) HTH & HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] [url] to html
Take a look at my BBCode class, http://www.phpclasses.org/browse.html/package/951.html. Niels Uhlendorf wrote: hi, how to chang [url=%link%]%descr%[/url] in %descr% thx 4 help. Niels -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Switch statement || How to output html without using echo()or print()
No. You can either echo/print with a heredoc (which is still echoing/printing, but is a lot easier) or you can exit PHP. For example: switch($somevar){ case 'case1': print <<< END some html some html some html END; break; case 'case2': print <<< END some html some html some html END; break; } ?> Or: switch($somevar){ case 'case1': ?> some html some html some html break; case 'case2': ?> some html some html some html break; } ?> CF High wrote: Hey all. Don't know if this is possible, but here goes: I've got a simple switch statement that carries out one of several operations based on the switch statement variable value. Each operation has @ 50 lines of html -- do I have to echo or print all this html!? I'm new to PHP so pardon my ignorance here. I'm used to the relative ease of Cold Fusion Thanks for any ideas/suggestions, --Noah -- -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CRON?
The problem is, PHP would have to be running as root. This creates a huge security risk... if I was you, I'd just learn to edit cron jobs at the command line. Nicole wrote: Does anyone have a PHP script to enter cron jobs? I have a limited control panel (ensim) that doesn't have anyway to do cron, and I don't know how to do it at the command line yet. Anyone have a good tutorial or a PHP script to do this? Thanks! -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Found a PHP bug!!!!!!!!!
No, it's floatval. Doubleval is an alias left over from hwen floats were called doubles... Scott Fletcher wrote: Whoop! FOund it, it is doubleval()... What does settype() do exactly "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I do know that integer, string, double, float, etc are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be floatval() for float... strval() for string settype() for whatever.. intval() for integer Um, what about double??? Thanks, Scott F. "Chris Hayes" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use "08" (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then "08" = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). "Kirk Johnson" <[EMAIL PROTECTED]> wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Found a PHP bug!!!!!!!!!
doubleval doubleval -- Alias of floatval() <http://www.php.net/manual/en/function.floatval.php> Description This function is an alias of floatval() <http://www.php.net/manual/en/function.floatval.php>. Note: This alias is a left-over from a function-renaming. In older versions of PHP you'll need to use this alias of the floatval() <http://www.php.net/manual/en/function.floatval.php> function, because floatval() <http://www.php.net/manual/en/function.floatval.php> wasn't yet available in that version. Scott Fletcher wrote: Double and Float are not exactly the same thing. Double is ---> 11.123 Float is --> .00238823993 "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... No, it's floatval. Doubleval is an alias left over from hwen floats were called doubles... Scott Fletcher wrote: Whoop! FOund it, it is doubleval()... What does settype() do exactly "Scott Fletcher" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I do know that integer, string, double, float, etc are different.. I have been using hte appropriate method like in javascript and c programming, like converting it to integer and so on But when I start using PHP, I find no such document of it and I have been using it for 3 years without a problem. I asked people is there such a thing as converting it by using the function and they told me there is no such a thing and that it is done automatically... Now my time is a little bit wasted. So, I will correct the problem with the php script... I recently looked up on the manual as Jason Wong instructed me to. I havne't found the answer since the document is a little bit mixed up. Okay, I'm going back to my old way as I did in javascript and c programming. So for php, it would be floatval() for float... strval() for string settype() for whatever.. intval() for integer Um, what about double??? Thanks, Scott F. "Chris Hayes" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Re: [PHP] Found a PHP bug! uh oh... I don't see why a string wouldn't work when I use "08" (string) and match it against the integer 8, or 08. They're just different types. Normally PHP is veeery flexible with types, like javascript, but it just can't be flexible for you here because it needs to choose the most logic to the entire pool of programmers, and then "08" = a string 8 = a decimal integer 08 = by definition an impossible octal integer, so 0. Since you cannot tell PHP that $var is of a certain type like in [other] programming languages, for example you want it to be treated as an integer, PHP will handle it as what seems to be the most logic. You can try to use intval (does not alter a variable, only the value as it is used in a calculation or an if() statement) or settype (alters the variable). "Kirk Johnson" <[EMAIL PROTECTED]> wrote in message B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef">news:B11731D518B5D61183C700A0C98BE0D9FFBE5D@chef... -Original Message- From: Scott Fletcher [mailto:[EMAIL PROTECTED]] Found a PHP bug, I'm using PHP version 4.2.3. I have been struggling with why PHP code failed to work with the month is August or September I stumbled into this one a short while ago myself. It is not a bug, but a feature! ;) When passing values of 08 or 09 (Aug and Sep), PHP interprets them as octal numbers (because of the leading 0). However, 08 and 09 are invalid octal numbers, so PHP converts them to zero. The fixes are numerous: - remove the leading zero; - add zero to them before passing (addition forces a type conversion to int); - force a type conversion to integer using (int); - quote them (when PHP converts a string to an integer, it removes the leading zero); Kirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Variables
$HTTP_SESSION_VARS and $_SESSION don't magically update when you add a session variable with session_register(). Jed R. Brubaker wrote: I have a quirky problem that should be a breeze for someone who is smarter than I. I have a script where I am registering a HTML form post variable as a session variable and then echo it. In the real script I use it in a MySQL query, but for the sake of this post, here is the "script": $user1 = $HTTP_POST_VARS["user1"]; session_register("user1"); echo $HTTP_SESSION_VARS["user1"]; This doesn't work, however, if I hit the refresh button the var miraculously appears! What am I doing wrong? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printing
Yes. You'd better hope your server has a printer, though! :-) Seriousley though, PHP runs on the server. By the time the viewer sees it, it's already executed. Which means it can't do anything to the client's machine. Look into some client-side scripting. Shaun van den Berg wrote: Hey, Is there a way in php to print to a printer? say i have a order from , when someone clicks the submit button - then print the form plus the entered details to a page ? Thanks for you help Shaun -- Novtel Consulting Tel: +27 21 9822373 Fax: +27 21 9815846 Please visit our website: www.novtel.co.za -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Variables not getting passed || Apache, MySql, Win2k Setup
RTFM! Your problem is register_globals. CF High wrote: Hey all. This driving me nuts: I've got Apache, MySql, and Windows 2000 running on my local machine. In order to get passed php variables evaluated, whether via a url query string, or through a form post, I have to use this syntax: $_REQUEST[$my_passed_variable] I have no such problem with our hosting company servers; i.e. I can access query_string and form posted variables as $my_passed_variable. What is going on here? Is there something in php.ini that needs to be adjusted? Any help whatsoever here is much appreciated, --Noah -- -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Variables not getting passed || Apache, MySql, Win2k Setup
Mind giving a code snippet? Noah wrote: Thanks for the pleasant acronym, Leif. However, setting register_globals on or off makes no difference. The variables are still not getting evaluated BTW works fine on my laptop (Apache, MySql, Linux) --Noah - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: "CF High" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, January 29, 2003 1:38 PM Subject: Re: [PHP] Form Variables not getting passed || Apache, MySql, Win 2k Setup RTFM! Your problem is register_globals. CF High wrote: Hey all. This driving me nuts: I've got Apache, MySql, and Windows 2000 running on my local machine. In order to get passed php variables evaluated, whether via a url query string, or through a form post, I have to use this syntax: $_REQUEST[$my_passed_variable] I have no such problem with our hosting company servers; i.e. I can access query_string and form posted variables as $my_passed_variable. What is going on here? Is there something in php.ini that needs to be adjusted? Any help whatsoever here is much appreciated, --Noah -- -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Knowing what page u came from...
$_SERVER['HTTP_REFERER'] Mr. BuNgL3 wrote: Hi again... There is any way to know what page we came from in php? I want to make a clause if i came from certain page in my web site... Thanks -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Variable objects?
I'm planning to use variable objects in a new project I'm working on. The problem is, I can't find one page of documentation on them, so I can't be sure if I'm going to be using an accidential feature that will disappear. As an example of them working, the following outputs "In a_class.": class a_class{ function a_class(){ echo 'In a_class.'; } } $foo = 'a_class'; new $foo(); ?> -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting key of value added to array with []?
Is there any way to get the key of an element added to an array with []? I need to use this for a reference to it. The only idea I can think of is to foreach through the array and use the last key looped through, but that seems very dirty. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and Cookies
acleave wrote: My Questions: If I create a cookie with set_cookie how do I read it/check it? $_COOKIE superglobal array. How do I use sessions if they can't be sent in the code? The session_start function has to be at the VERY top of the of the code, below ANY output (even blank spaces and new lines). What use are sessions if I can only mess with them in one place? What if I need to do some processing first to decide what to do with them? You can use them anywhere in your code, but the session_start function has to be before any output (the rest can be anywhere). -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Creating associative array
Try: $image_array = array(); $image_array[$file_name] = $image_url; PHP wrote: I am trying to create associative array in a while loop.. $image_array = array(); $image_array = array_push("$file_name"=>"$image_url"); what i am doing wrong?? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Redirecting errors
Because apache has the same access when a user requests it as when a page requests it. Try putting it outside of the web root... Brad Esclavon wrote: I have written a script that validates a username/pwd input and if usr/pwd is correct, includes the protected page, or if usr/pwd is wrong, input page reloads the form onto itself with a form submit. all of the code is correct, except that the secured page is viewable from the internet if i explicitly enter the url. I have set the secured page's permissions to 700 and the input page to 755. even though my permissions disallow outside access, why can you get to the secured page? any help or thoughts is appreciated -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] testing for negative numbers
Is it possible that the value is actually " -2" (with the space)? Robert Samuel White wrote: Well, I just tried your test script and that works just as it should, so I must be having some other issue. But that still doesn't explain why I can print out the results of $row["dir_id"] and it shows it being -2, yet my script (as printed in the last email) never makes it to the correct conditional statement. Rasmus Lerdorf wrote: Please provide a complete test script. Are you perhaps not realizing that array indices along with all variables in PHP are case sensitive? $row["ID"] and $row["id"] are not the same thing. The trivial test of your example: $myArray["id"] = -2; if ($myArray["id"] < 0) echo "Negative"; else echo "Positive"; Prints "Negative" as expected. -Rasmus On Thu, 6 Feb 2003, Robert Samuel White wrote: I realize this should be about the simplest thing in the world to do, but for this reason or that it's not working... I'm using PHP version 4.2.3 Whether I have a negative number in an array, for example: $myArray["ID"] = -2 Or the number comes from the database, for example: $row["id"] = -2 I cannot get this simple operation to work: if ($row["id"] < 0) Instead, positive or negative, it seems to think this expression is always true: if ($row["id"] > 0) It's like it takes the absolute value of the number (whether the number is 2 or -2, it thinks it is 2) I've tried many things, including type casting using (int) in front of the expression. Nothing has worked. Any ideas why in the world this is happening? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scripting language in PHP?
Out of pure boredom, I'm considering writing a simple scripting language in PHP. Has anything like this been done before? Any open-source projects I should look at? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Passing ARRAY through URL
Servers usually have limits on the get method (usually 500 characters IIRC), and some browsers may as well. I reccomend you look into using the post method through javascript. Squirrel User wrote: Help. I've tried to pass large array through URL but it keep telling me page can not be displayed: $mList = arrary(); ...// fill array with values $mList = urlencode( serialize( $mList ) ); header( "location: page2.php?mL=$mList" ); ?> $mList = stripslashes( unserialize( $mL ) ); print_r( $mList ); ?> - This mail sent through ISOT. To find out more about ISOT, visit http://isot.com -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Beginners question
My guess is that the new lines are there, but since you're (most likely) outputting HTML, you don't see them. Take at look at the br HTML tag. Martin Purdy wrote: >Hi everybody > >I am totally new to PHP, and I have a problem with the Print statement. >When I send a newline using "\n" nothing happens. > >I cannot get any linebreaks into my code. > >The following line is copied from the PHP Manual, and is sopposed to give me >the text split into 3 lines, but they come out as one line. > >echo "This spans\nmultiple lines. The newlines will be\noutput as >well."; > >Can someone please tell me what I am doing wrong? > >Martin Purdy > > > > > -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] Beginners question
No, you can output the directly. echo "This spansmultiple lines. The newlines will beoutput as well."; Martin Purdy wrote: Thanks for your prompt answer. I think that sounds very likely, but do I have to break out of PHP, and send a every time I need to send a linefeed? Martin Purdy -Oprindelig meddelelse- Fra: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sendt: 9. februar 2003 19:18 Til: Martin Purdy Cc: [EMAIL PROTECTED] Emne: Re: [PHP] Beginners question My guess is that the new lines are there, but since you're (most likely) outputting HTML, you don't see them. Take at look at the br HTML tag. Martin Purdy wrote: >Hi everybody > >I am totally new to PHP, and I have a problem with the Print statement. >When I send a newline using "\n" nothing happens. > >I cannot get any linebreaks into my code. > >The following line is copied from the PHP Manual, and is sopposed to give me >the text split into 3 lines, but they come out as one line. > >echo "This spans\nmultiple lines. The newlines will be\noutput as >well."; > >Can someone please tell me what I am doing wrong? > >Martin Purdy > > > > > -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION variable and register_globals
1. Yes. 2. No. Mohanaraj wrote: Hello guys, I have a few questions regarding the subject and was hoping you could help me out. 1.If register_globals is on, then doing an unset($_SESSION["blah"]), to unset a session variable will not work as the variable will be unset in that particular instance but will be restored in next instance of that session. Hence session_unregister("blah") also must be used to properly unset the session with global_register on. Is this true ? 2.Furthermore, can the session be registered via the direct assignment of $_SESSION["aaa"] = $someValue if register globals is on? Thank you for your time. Mohan -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global Vars = Off Windows/Linux Differeces???
Pretty hard to tell anything without any details about what you're doing... Sascha Braun wrote: Hi, I've made a website and because of presentationproblems I changed the oldstyle vars to the new globalvars mode (Hope its the right name for it, dont know if $_SESSION['user'] is a global or it is not???). Now the Website works perfect on my WAMP System with Apache 1.3.27 and PHP 4.3.0, but on my Linux Server the Login Functionality of the Website lets the User log in (Sessionmanagement is used at this point), but as i click on a link, the area where the username of the registered user should be shown, it shows just a number and doesnt let me log out. Instead it just shows a "0". Normaly it should be possible to do a login again from this point. On Windows everything works just fine. The Linux Machine is an Debain Woody / Apache 1.3.27 / php 4.2.3 Please help me, because my customers will jump on my neck if I dont, find out, where the problem is located. Hope you'll help me! Thanks very much Sascha -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Delimited file values behaving strangely...
I'm guessing it containt a trailing space, which wouldn't display in HTML. Try trim()ing it. Geoff Caplan wrote: Hi folks, A strange one - unless I am having a brainstorm... I am reading in tab delimited files created in Excel on Windows and uploaded to Linux. Cell A1 contains a numeric id - I extract this into a variable, $id, by exploding on \n and \t. But for some files, the values of $id do not behave as expected. Say the value should be "23". If I echo, it prints as "23". But comparisons fail to match: if( $id == 23 ) ... It also fails if I try to find the value as a key in an array: if( isset( $my_array[$id] ) ) ... On the other hand, values from some of the files work as expected. One clue: if I try and cast the values that are failing to int, the cast produces the value 0 (zero). On the other hand, the values that are working as expected cast from, say, the string 22 to the int 22 as expected. Never seen anything like this before - can anyone give me a pointer?? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class within a class
Use $GLOBALS['db'] (or whatever the variable name of the global variable is). Justin Mazzi wrote: I have made a Mysql database class. I wanted to know how I could use that class in another class without using extend. For example: include 'db.php'; $db = new db(); ...some php code... class blah { var $test = 1; function blah() { .. $db->query(some query); //mysql class being used here } } I don't want to create an instance of db class in the blah class because I use db in other parts of the script so an instance already exists. Any way I can do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class within a class
If the DB object is already a global, like you seem to be saying, then you're already using globals... Justin Mazzi wrote: Is there anyway to do this without using globals? -Original Message- From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] Sent: Monday, February 10, 2003 2:46 PM To: Justin Mazzi Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Class within a class Use $GLOBALS['db'] (or whatever the variable name of the global variable is). Justin Mazzi wrote: I have made a Mysql database class. I wanted to know how I could use that class in another class without using extend. For example: include 'db.php'; $db = new db(); ...some php code... class blah { var $test = 1; function blah() { .. $db->query(some query); //mysql class being used here } } I don't want to create an instance of db class in the blah class because I use db in other parts of the script so an instance already exists. Any way I can do this? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] passing array as a form variable
www.php.net/serialize www.php.net/unserialize Edward Peloke wrote: Can I take the select array Ex. $myrow=mysql_fetch_array($result); and pass this as a form variable to another page? Thanks, Eddie -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Print_r bug?
I think I've found a print_r bug with reference recursion. The following example script runs forever: $GLOBALS['foo'] = &$GLOBALS; print_r($GLOBALS); ?> Am I correct in thinking this is a bug that should be reported? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Print_r bug?
But according to the manual: Note: Prior to PHP 4.0.4, print_r() will continue forever if given an array <http://www.php.net/manual/en/language.types.array.php> or object <http://www.php.net/manual/en/language.types.object.php> that contains a direct or indirect reference to itself. An example is print_r($GLOBALS) because $GLOBALS is itself a global variable that contains a reference to itself. IMHO, it should do the same for a variable that contains a reference to a reference to itself (does that make sense?). Johannes Schlueter wrote: On Wednesday 12 February 2003 16:53, Leif K-Brooks wrote: I think I've found a print_r bug with reference recursion. The following example script runs forever: $GLOBALS['foo'] = &$GLOBALS; print_r($GLOBALS); ?> Am I correct in thinking this is a bug that should be reported? No, thats no bug. $GLOBALS includes $GLOBALS which include $GLOBALS Use var_dump for $GLOBALS instead ;-) johannes -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] string to array
There's no built-in function, but try this (copied from manual): $chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY); Kevin Waterson wrote: >What is the best method to convert a string to an array > >I need to able to loop through each letter of the string >not just use $string[47] > >Is there a definitive method to do this? > >Kevin > > > -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing CSV with parameters?
I'm trying to parse CSV data with parameters, i.e. foo(something),bar(something),something(foobar). Any suggestions on doing this, hopefully with some way to escape )s in the parameters? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing CSV with parameters?
Thanks, but you totally misunderstood me. I'm not looking to get normal CSV data (as in foo,bar,foobar), I'm looking to get CSV data with parameters and get each piece of data and its parameter. For example, I have a string something like foo(data),bar(data),foobar(data). I need to get each parameter, and each value, and put them into arrays. I also need to have a way to escape any )s in the parameter. Marek Kilimajer wrote: fgetcsv() - for reading the file str_replace('(', '\(', $string) - for escaping )s Leif K-Brooks wrote: I'm trying to parse CSV data with parameters, i.e. foo(something),bar(something),something(foobar). Any suggestions on doing this, hopefully with some way to escape )s in the parameters? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail question
Try: mail('[EMAIL PROTECTED]','subject','hello '.($a ? 'andreas')); Jonas Geiregat wrote: is it possible to do something like mail("[EMAIL PROTECTED]","subject","hello if($a){ return andreas; }"); or what would be the best solution for this ? -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems with cookies and PHP
You have to set the cookie again. Fireborn Silvaranth wrote: ok now it will print it's value correctly but what about actually changing the cookie's value? this line: $_COOKIE['userInfo']="userID"; sets $_COOKIE['userInfo'] to "userID" but it does not change the cookie file itself. what must I do to accomplish that? - Original Message - From: "Leif K-Brooks" <[EMAIL PROTECTED]> To: "Fireborn Silvaranth" <[EMAIL PROTECTED]> Sent: Thursday, February 13, 2003 9:41 AM Subject: Re: [PHP] problems with cookies and PHP print "$_COOKIE['userInfo']"; Should be: print $_COOKIE['userInfo']; -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
Re: [PHP] Removing a comma from a form field
If the comma is all you have to worry about, you don't need regex. Use www.php.et/str-replace. Ben C. wrote: I'm trying to update a field which contains a $USD figure. But when I update it as 200,000 it become 200. I need to take out the comma. Is using ereg_replace function the best way of doing so? What do you think. Thanks, Ben -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php