[PHP] sending/notifying a server process
Hi All, I have a server process that sends fax,print, etc (both in C# and in Java). Currently it polls says the fax table in the database for any fax jobs. How can I get my PHP script to call or notify these services directly so not having to wait for the next poll. I can't open a socket to the server vai the PHP so what mechanism do I use? Any hints will be grateful -- Tony Yau -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php session in ie
Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); if(isset($_POST['submit'])){ include(../database.inc); $login=trim($_POST['login']); $pass=trim($_POST['pass']); $Effectivelogin=strtoupper($login); $auth=false; $connection=mysql_connect($host,$user,$password); mysql_select_db($database,$connection); $query=SELECT password FROM students WHERE userID='$Effectivelogin'; $result=mysql_query($query); if(mysql_num_rows($result)){ while($row=mysql_fetch_array($result)) { if($row[0]!=$pass) echo (Wrong Username/Password!); else $auth=true; } } if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } } ? html head titleUser Authentication/title /head body form method=post LoginID: input type=text name=loginbr Password: input type=password name=passbr input type=submit name=submit value=Login /form /body /html then the user is redirected back to the page he visited. it workd fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php session in ie
Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); $auth=false; if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } it works fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! regards, sunaram -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mod_rewrite, apache2, php5RC1 and osx bsd
On 10 Nov 2005, at 21:36, Richard Lynch wrote: On Wed, November 9, 2005 10:36 pm, Dan Rossi wrote: RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/(.+\.(video))$ ../../phpscript.php I should think all those .* should be .+ instead... I mean, if somebody surfs to this URL: http://example.com//example.video There's nothing really wrong with a URL like that, and I used to do the same thing until I discovered another fly in this particular ointment. Should source URLs like these ever appear in Microsoft Outlook, they are likely to get 'corrected', for example a URL that goes in as: http://example.com//example.video When you click it, you're quite likely to have it go to: http://example.com/example.video thus completely missing all your mod_rewrite patterns. This is why we love MS so. I've taken up using _ as a pattern separator as a workaround. There's also a very nasty bug in current mod_rewrite (at least in Apache 2.0.54) where mod_rewrite url decodes submatches between input and output URLs, so for example: RewriteRule ^(.*) blah.php?x$1 if you feed that a URL that contains a URL encoded value like 'Hello% 20there', your resulting URL will be: 'blah.php?x=Hello there', which is obviously broken. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
On 11 Nov 2005, at 11:43, sunaram patir wrote: it works fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! It just sounds like you have cookies disabled or not allowed for this site in IE. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
sunaram patir wrote: Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); It might not fix your problem but you should exit after location header. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 OO performance exceptions
Some more thought. To solve this problem would be necessary to create some utility class like System in java and that way should be possible to do a System::echo($string) based on type, i guess this can be accomplished using overloading. Am I making any sense? - Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thursday, November 10, 2005 6:47 PM Subject: Re: [PHP] PHP 5 OO performance exceptions I was not considering that, I was using $obj_string-getValue(), the __toString method and type casting could save me some keystrokes :) Anyway, did you abandon the development with the basic types class? Angelo - Original Message - From: Jake Gardner [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 09, 2005 1:37 PM Subject: Re: [PHP] PHP 5 OO performance exceptions I myself was considering creating classes such as String, but I ran into more basic problems before performance, for example: class String { protected $Value; function __construct($Value) { $this-Value = $Value; } } $SomeString = new String(Hello World!); Print($SomeString); // Does not print Hello World! The way around this was still unsatisfactory: class String { protected $Value; function __construct($Value) { $this- Value = $Value; } function __toString() { return $this-Value; } } $SomeString = new String(Hello World!); Print($SomeString); // Prints Hello World! Because this has obvious limitations, and is only a fix for strings; this doesnt work for functions that expect integer values. In reality, there really is no way to use PHP to rewrite a type in PHP without using the PHP omni-type. However, you can use type casting as it is: http://us2.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting http://us2.php.net/manual/en/function.settype.php On 11/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, Currently I'm make some utilities classes and I took the idea from java to make some wrappers class like String, Integer and so on. This allows me to use the type hint for basic types in php. Anyone have a clue if replacing the all in one type in php for objects types will degrade the performance? Also for every controller class that I'm making I'm also making exceptions class of every error that it can generate. Same questions: It will degrade performance to throw an exception instead of lest say a pear error or return false? Just for know, I'm doing this because I believe that it will eliminate some o problems o development and will eliminate some basic validations. Any tips appreciate Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: security code
Richard Lynch wrote: On Thu, November 10, 2005 10:11 am, Jochem Maas wrote: rant mode=troll sarcasm=true anger=+3 replies=duck ... or put another way - is there a good reason why the web should be any less discriminating than the rest of society. Yes. It's the WORLD WIDE WEB. shucks, now your getting all pedantic. I really don't think that a few words and well meant principles should be getting in the way of world-domination and/or global-brainwashing aspirations of a couple of media-cartels. ;-) I mean, it's all very well to discriminate against those people way far away whom you will never see in the first place, but they're not any farther away any more, are they? :-^ [tongue firmly planted in cheek, folks!] And if you are a large corporation, you very well may be subject to laws with significant risks attached ($$$) for not being accessible. Google for Olympic Committee blind user Australia big fine for more on that topic. That alone makes it worth considering. Probably the best reason not to use CAPTCHA is that it can already be bypassed by OCR in most cases by a determined person. (Google for it) That means that within a very short period of time, script kiddies and web-POST-spammers [*] will have OCR anti-CAPTCHA technology rolled into their tool-kits. Another very good reason is that even normal users have a not-so-good experience with the damn things. I've gotten way too many indecipherable images and had to click multiple times to get one that was usuable in a single session for some stupid forum post I wanted to contribute. Not my idea of a pleasant web-surfing experience. Certainly not something that makes me want to contribute more to that site. I slapped a CAPTCHA (bad, home-rolled) into a guestbook on a site that had been targetted and was getting hundreds of junk posts a day -- but it's not something I deploy as a matter of course. And I don't expect it to survive more than a year before I have to just get rid of the guestbook. (Assuming the client keeps the site up at all, which is under review.) * So, is there a term for the web moral-equivalent of spammer? Those link-farm visitors who clutter up your site. blammers, perhaps? (blog-spammers). blammer just doesn't sound evil enough ;-). for the rest, good stuff, as usual, Richard :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: security code
Hello. Richard Lynch wrote: On Thu, November 10, 2005 10:45 am, Gustavo Narea wrote: CAPTCHA tests are indispensables. The problem comes when you *only* use visual tests (such as visual turing numbers). If you need CAPTCHA tests, you may use them both visuals and audibles. This is a good example: https://www.e-gold.com/acct/login.html So the user who is both blind AND deaf? Or the blind user who is at a library computer with no audio output? You may find many possible solutions on the web-page I suggested. For example: Logic puzzles http://www.w3.org/TR/2003/WD-turingtest-20031105/#logic. As I said previously, It depends on the target of your website. For instance, if your website is for web designers, you may only need to use visual turing numbers: They must have a user agent which is able to process images and I cannot imagine a blind web designer. On the other hand, if your website is for programmers, you may want to know that programmers can be blind (although you won't take this into account): http://www.blindprogramming.com I saw some research where out of four people with normal hearing, all four were unable to distinguish the crappy audio output into the correct word and use a site. Granted, a very small sample, and the audio from the test site may well have been at the low end of the spectrum for quality. But it was a real site, and these were just regular people roped in for a test of the audio's usefulness. As cool as CAPTCHA seems at first, I don't think it's going to be a long-term solution. In the meantime, I think It's the best we can do. Best regards. -- Gustavo Narea. PHP Documentation - Spanish Translation Team. Valencia, Venezuela. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 OO performance exceptions
read the internals@ archive - there is a chap there who is developing an php module that makes objects wrappers for basic types available. but imho: $str = new String(W T F !!); echo $str-getValue(), $str, $str-__toString(); is just a bit OTT. also creating and rolling out (to a group of developers) a set of classes to use in place of basic types on the basis of a _belief_ that it may eliminate some development errors seems to be not an unsound basis for such as decision. chances are that half the time developers will 'forget' the 'basetype' classes, your dealing with egos you know :-). but then again maybe in a couple of years we will only have objects to represent types - although so long as at least Rasmus is 'on the bridge' of starship NCC-17-PHP I imagine that won't be happening - IFAIR the creator is a fan of straigtforward procedural code in most cases - apologies to Rasmus if I misread him. [EMAIL PROTECTED] wrote: Some more thought. To solve this problem would be necessary to create some utility class like System in java and that way should be possible to do a System::echo($string) based on type, i guess this can be accomplished using overloading. Am I making any sense? - Original Message - From: [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Thursday, November 10, 2005 6:47 PM Subject: Re: [PHP] PHP 5 OO performance exceptions I was not considering that, I was using $obj_string-getValue(), the __toString method and type casting could save me some keystrokes :) Anyway, did you abandon the development with the basic types class? Angelo - Original Message - From: Jake Gardner [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, November 09, 2005 1:37 PM Subject: Re: [PHP] PHP 5 OO performance exceptions I myself was considering creating classes such as String, but I ran into more basic problems before performance, for example: class String { protected $Value; function __construct($Value) { $this-Value = $Value; } } $SomeString = new String(Hello World!); Print($SomeString); // Does not print Hello World! The way around this was still unsatisfactory: class String { protected $Value; function __construct($Value) { $this- Value = $Value; } function __toString() { return $this-Value; } } $SomeString = new String(Hello World!); Print($SomeString); // Prints Hello World! Because this has obvious limitations, and is only a fix for strings; this doesnt work for functions that expect integer values. In reality, there really is no way to use PHP to rewrite a type in PHP without using the PHP omni-type. However, you can use type casting as it is: http://us2.php.net/manual/en/language.types.type-juggling.php#language.types.typecasting http://us2.php.net/manual/en/function.settype.php On 11/9/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, Currently I'm make some utilities classes and I took the idea from java to make some wrappers class like String, Integer and so on. This allows me to use the type hint for basic types in php. Anyone have a clue if replacing the all in one type in php for objects types will degrade the performance? Also for every controller class that I'm making I'm also making exceptions class of every error that it can generate. Same questions: It will degrade performance to throw an exception instead of lest say a pear error or return false? Just for know, I'm doing this because I believe that it will eliminate some o problems o development and will eliminate some basic validations. Any tips appreciate Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: security code
Hello. Richard Lynch wrote: On Thu, November 10, 2005 10:11 am, Jochem Maas wrote: rant mode=troll sarcasm=true anger=+3 replies=duck ... or put another way - is there a good reason why the web should be any less discriminating than the rest of society. Yes. It's the WORLD WIDE WEB. I mean, it's all very well to discriminate against those people way far away whom you will never see in the first place, but they're not any farther away any more, are they? :-^ [tongue firmly planted in cheek, folks!] Yes, I agree with you here. And if you are a large corporation, you very well may be subject to laws with significant risks attached ($$$) for not being accessible. Google for Olympic Committee blind user Australia big fine for more on that topic. That alone makes it worth considering. But it depends on the country. It should be something international. At least in Venezuela, It isn't so. Another very good reason is that even normal users have a not-so-good experience with the damn things. I agree with you. On the other hand, in many sites, visual turing numbers are very hard to understand. Regards. -- Gustavo Narea. PHP Documentation - Spanish Translation Team. Valencia, Venezuela. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
For security.. *never* store the password in a cookie.. if you must... instead do some sort of encryption on it and some other value store that and use it for verification. On Friday 11 November 2005 05:43 am, sunaram patir wrote: Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); $auth=false; if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } it works fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! regards, sunaram -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: security code
Gustavo Narea wrote: Hello. [snip] As I said previously, It depends on the target of your website. For instance, if your website is for web designers, you may only need to use visual turing numbers: They must have a user agent which is able to process images and I cannot imagine a blind web designer. Well, that's debatable, even among the designers who have use of their eyes. ;) But all kidding aside, I have met one and I'm sure that there are others. Who better to design an accessible site than a designer who experiences the same difficulties as other impaired web surfers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cannot find bison and Flex even when those are installed
Dear group I tried to install php 4.3.11 on Linux Suse 6.4. I've installed bison and flex in /usr/local/ When I run ./configure in my php-dir he tells me he can't find bison and flex. How can I solve this matter Jurgen Campforts Lichtaartsebaan 58 2460 Kasterlee Tel: 0496/60.25.75 http://www.wandelmee.be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] a code question..??
would the approach be to use an iframe, and some sort of ajax code, to allow the user to interact with the dialog/code within the iframe. keep in mind, that the code within the iframe would be running on the remote server... -bruce -Original Message- From: comex [mailto:[EMAIL PROTECTED] Sent: Thursday, November 10, 2005 7:57 PM To: php-general@lists.php.net Subject: Re: [PHP] a code question..?? the app B server would then return a result, based on the user input... i'm trying to figure out how to essentially allocate a section of the page, to a remote application. after i've finished with the remote stuff, the user could go ahead and select other items/buttons on the page that are in the current environment You could just use an iframe... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot find bison and Flex even when those are installed
You might have to change the configure option from with-bison=/usr/local/bison to with-bison=/usr or even with-bison= Happens to me alot. This would also be a better email for the PHP INSTALL list On 11/11/05, Jurgen [EMAIL PROTECTED] wrote: Dear group I tried to install php 4.3.11 on Linux Suse 6.4. I've installed bison and flex in /usr/local/ When I run ./configure in my php-dir he tells me he can't find bison and flex. How can I solve this matter Jurgen Campforts Lichtaartsebaan 58 2460 Kasterlee Tel: 0496/60.25.75 http://www.wandelmee.be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cannot find bison and Flex even when those are installed
Everything is installed, I already have a running PHP on my box but without gd-support, now i wanted to add gd-support, so i builded gd with the proper extensions (jpeg, png, etc), then i made make clean in the php-folder where the source is, then the configure and it fails on bison and flex, strange because it is installed regards Jurgen Campforts Lichtaartsebaan 58 2460 Kasterlee Tel: 0496/60.25.75 http://www.wandelmee.be http://www.scnoorderwijk.be In 2010 naar Compostella, of naar Rome? In ieder geval, ik ga naar het zuiden. -Oorspronkelijk bericht- Van: Marco Kaiser [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 11 november 2005 17:51 Aan: Jurgen Onderwerp: Re: [PHP] Cannot find bison and Flex even when those are installed Hi, When I run ./configure in my php-dir he tells me he can't find bison and flex. try to install also the dev packages and the automake and buildconf tools. -- Marco Kaiser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
Stephen Leaf wrote: For security.. *never* store the password in a cookie.. OP stores the password in session -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cannot find bison and Flex even when those are installed
Hi again, Nothing of your ideas helped out. mayby i'm not sure if this was right, but i performed followed command: PATH=/usr/local/bin:$PATH I installed bison, flex and all others in /usr/local/ so I put the bin-dir in my path-var. Fired the whole configure-bunch again and it was up and running. Jurgen Campforts Lichtaartsebaan 58 2460 Kasterlee Tel: 0496/60.25.75 http://www.wandelmee.be http://www.scnoorderwijk.be In 2010 naar Compostella, of naar Rome? In ieder geval, ik ga naar het zuiden. -Oorspronkelijk bericht- Van: Dan McCullough [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 11 november 2005 18:04 Aan: Jurgen Onderwerp: Re: [PHP] Cannot find bison and Flex even when those are installed Yes but if you haven't installed the dev packages then the libraries that PHP needs isn't available. If you have installed the dev then you should try the bison flag with only the = sign and no path. On 11/11/05, Jurgen [EMAIL PROTECTED] wrote: Everything is installed, I already have a running PHP on my box but without gd-support, now i wanted to add gd-support, so i builded gd with the proper extensions (jpeg, png, etc), then i made make clean in the php-folder where the source is, then the configure and it fails on bison and flex, strange because it is installed regards Jurgen Campforts Lichtaartsebaan 58 2460 Kasterlee Tel: 0496/60.25.75 http://www.wandelmee.be http://www.scnoorderwijk.be In 2010 naar Compostella, of naar Rome? In ieder geval, ik ga naar het zuiden. -Oorspronkelijk bericht- Van: Marco Kaiser [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 11 november 2005 17:51 Aan: Jurgen Onderwerp: Re: [PHP] Cannot find bison and Flex even when those are installed Hi, When I run ./configure in my php-dir he tells me he can't find bison and flex. try to install also the dev packages and the automake and buildconf tools. -- Marco Kaiser -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: security code
On Fri, November 11, 2005 8:47 am, Gustavo Narea wrote: On the other hand, if your website is for programmers, you may want to know that programmers can be blind (although you won't take this into account): http://www.blindprogramming.com What I found most interesting about this site: PHP's total presence there is one (1) link to a site with one (1) on-line tutorial from 2002... Which, as far as I can tell, is not particularly enhanced for the vision-impaired. Hopefully this is not actually an authoritative reference. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
i will for sure. thanks. On 11/11/05, M [EMAIL PROTECTED] wrote: Stephen Leaf wrote: For security.. *never* store the password in a cookie.. OP stores the password in session -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
On Fri, November 11, 2005 5:20 am, sunaram patir wrote: session_start(); This one here... (see below) header(Location: login.php); Not crucial, but you'd save some HTTP connections by just doing: require 'login.php'; exit; instead of bouncing the user's agent back and forth session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); ... will probably not match this one here. You've set the Cookie Parameters here to very specific values. You should do that consitently on every session_start() to make sure your site's cookies are always operating under the same conditions. if(isset($_POST['submit'])){ include(../database.inc); $login=trim($_POST['login']); $pass=trim($_POST['pass']); $Effectivelogin=strtoupper($login); $auth=false; You really ought to do more validation than that... http://php.net/mysql_real_escape_string Possibly limit 'login' to alphanumeric and 'pass' to non-control characters. then the user is redirected back to the page he visited. it workd fine You also won't need to re-direct the user back to what they wanted -- The URL will already be what they asked for when the login works. Change the ACTION= to ACTION=?php echo $_SERVER['PHP_SELF']? -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sending/notifying a server process
On Fri, November 11, 2005 4:57 am, tony yau wrote: I have a server process that sends fax,print, etc (both in C# and in Java). Currently it polls says the fax table in the database for any fax jobs. How can I get my PHP script to call or notify these services directly so not having to wait for the next poll. I can't open a socket to the server vai the PHP so what mechanism do I use? Why can't you open a socket to the server? http://php.net/fsockopen If you really can't do that, then just make it poll more often, I guess, so the wait time is insignificant. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a code question..??
would the approach be to use an iframe, and some sort of ajax code, to allow the user to interact with the dialog/code within the iframe. keep in mind, that the code within the iframe would be running on the remote server... Sorry, I had forgotten the content of the original question. If what you want is a login dialog, then it would probably be easiest to make your own login form, then use CURL (or HttpClient (http://scripts.incutio.com/httpclient/index.php), which doesn't require anything external) like the other posters suggested when the form is submitted, to pretend to be a person filling out app B's login dialog. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array_merge, safety and race condition?
On Thu, November 10, 2005 6:44 pm, Ezra Nugroho wrote: $array1 = array_merge ($array1, $array2); So far the code gives me what I want. However, suppose if $array1 is extremely huge, am I introducing a bug here because of possible race condition? It's possible that array_merge has two write something to $array1 (left hand side) before it even finishes reading it (argument) in the first place. Let alone merging the two. The assignment operator (=) computes the right-hand side completely before putting its value in the left-hand side. Your large arrays might get dumped to swap on the hard drive and burn pits into the platters, and they might thrash the CPU until it catches on fire, but there's no race condition in this statement. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Unable to send variables to MySQL table
It is a good idea to check for errors, like this: mysql_query($add_to_db) or die('Error inserting SQL data at ' . __LINE__ . ' br/' . $add_to_db .'br/' . mysql_error()); If there is no error (non-null return value from mysql_query()) the expresion after the OR does even get looked at, since (TRUE or whatever) is TRUE so it doesn't even bother to check 'whatever'. If the first evaluates as FALSE (in this case null) then it needs to evaluate the part after the OR, which is irrelevant in this case since it will die. Stewart Priest [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi folks... a bit of a newbie question I'm afraid... I've written this script shown below. It gets its variables from a form, and then it (supposedly!) writes these values into a MySQL table ('invoices'). The script executes with no errors, but when I check the table, the table is still empty. I can manually insert the data directly into the table, and when I echo the variables in the script, the values are displayed whe I run it, but for reasons unknown, the values are not written to the table. Any ideas? The code is below. Many thanks. Stewart ?php // this opens the connection to the db include 'library/opendb.php'; // this adds detals to the invoice table $item1_desc = $_REQUEST['item1_desc']; $item2_desc = $_REQUEST['item2_desc']; $item3_desc = $_REQUEST['item3_desc']; $item4_desc = $_REQUEST['item4_desc']; $item1_cost = $_REQUEST['item1_cost']; $item2_cost = $_REQUEST['item2_cost']; $item3_cost = $_REQUEST['item3_cost']; $item4_cost = $_REQUEST['item4_cost']; $delivery_cost = $_REQUEST['delivery_cost']; $add_to_db = insert into invoices (item1_desc, item1_cost, item2_desc, item2_cost, item3_desc, item3_cost, item4_desc, item4_cost, delivery_cost) values ('$item1_desc', '$item1_cost', '$item2_desc', '$item2_cost', '$item3_desc', '$item3_cost', '$item4_desc', '$item4_cost', '$delivery_cost'); mysql_query($add_to_db); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
instead of bouncing the user's agent back and forth session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); ... will probably not match this one here. You've set the Cookie Parameters here to very specific values. You should do that consitently on every session_start() to make sure your site's cookies are always operating under the same conditions. i included the tfollowing two lines to my starting script on each page, but still not working session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); when i call var_dump($_COOKIE), it returns null. i can't make out what's happening! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Inserting a NULL value into MySQL via PHP
On Thu, November 10, 2005 11:15 pm, Curt Zirzow wrote: ?php $sql_quoted = array(); // shiflett' -- style $myFieldValue = isset($POST['myFieldValue'])? $_POST['myFieldValue']: ''; if (strlen(trim($myFieldValue)) { $sql_quoted['myField'] = ' . mysql_real_escape_string($myFieldValue) . '; } else { $sql_quoted['myField'] = 'NULL'; } I personally would do this part all in one shot: $field = (isset($_CLEAN['field']) strlen($_CLEAN['field'])) ? '$_CLEAN[field] : 'NULL'; Otherwise, I find myself too distracted by all the assignments and if/else logic, and too likely to mess them up later with code changes in earlier/later lines. Note that you already have the apostrophes in $field for non-NULL, so you would just do: $query = insert into foo (field) values($_CLEAN[field]); with no apostrophes $_CLEAN represents an escaped and filtered string, or an unset index, if nothing was in $_POST to start with. Or you can just use the empty string '' in $_CLEAN if you find that easier to process. More than one way to skin a cat. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] a code question..??
On Thu, November 10, 2005 6:02 pm, bruce wrote: in your example, wouldn't app A, essentially download the code from app B, and run the source on app A? or would the code be run on app B, with the resulting html/content/page being transferred to app A? Yes, but I've NEVER in this entire thread understood which server you wanted to run the code in the first place... If you want B to run the code, then just web-scrape the results. If you want A to run the code, then have B deliver code to A to run. You can do whichever one you want. would this be better if it were perhaps done as a soap client/server process... of course, the fact that the user's php would have to have the soap extensions installed would be an issue... Which goes back to our earlier statement, that you've abstracted this out so well, and left out so many details, that none of us really understand what you're trying to do in the first place. Which doesn't really matter: Whichever one you want to do, you can do it. If you want to add the overhead of SOAP and require B to have SOAP to play with you, that's fine. If not, that's fine too. I've been thinking about buying a new car. Which car should I buy? This is the level at which you're asking us to help you, so it should be no surprise our answer seems like it's just Yes. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] a code question..??
On Thu, November 10, 2005 7:41 pm, bruce wrote: +---+ | | | user| | 'sub_btn'| | | | | | | | | | blah | | blah | | blah | | | | | | | +---+ in this example, the user/sub_btn is generated from the app B server/system. Presumably blah, blah, blah is on A, right?... the user would then fill in the 'user' and hit the 'sub_btn', causing the information to be sent back to the app B server. the app B server would then return a result, based on the user input... i'm trying to figure out how to essentially allocate a section of the page, to a remote application. after i've finished with the remote stuff, the user could go ahead and select other items/buttons on the page that are in the current environment i'm not sure what's the best approach to this... How much do you trust the remote applications? How much power do you need to give them for them to be able to generate the correct output for their space allocated to them? How much data needs to transfer for them to know what content to generate? How much content will the be generating? How flexible will this need to be for A and B content decisions? What sort of volume of traffic are you looking at? Until we know more, our answer remains: Yes, you can do this any number of ways, depending on what you want to do You can web-scrape, you can SOAP, you can RPC, you can require source code back and forth, you can get the elves to do all the work for you. We don't know which way you want to go with this either, because we don't know any of the parameters that affect the decisions, much less know what you're actually trying to do. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Changing databases from MySQL to Oracle
I am new to PHP and am trying to learn how it works. We have a PHP program that is using MySQL. We are wanting to use our Oracle database instead. The Oracle database is on a different server that our PHP program. Does any one know how I can change connections from MySQL to Oracle? We have this line in our dba.php... $tli_connection = dbconnect($dsn, $user, $pass); In our config.php we have the following that defines the above $dsn = some.where.com; // MySQL hostname ([EMAIL PROTECTED]) $user = MYSQL USER NAME GOES HERE; // Username with sufficient rights to the DB - need update, select, delete, insert only $pass = MYSQL PASSWORD FOR ABOVE USER; // Password for the above user Thanks Jan Smith Systems Analyst Indiana State University Terre Haute, Indiana Phone: (812) 237-8593 Email: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
He's not storing the password in a Cookies. He's storging it in a $_SESSION Which is still a Risk, especially on a shared server, but it's not necessarily in the category of Never do this On Fri, November 11, 2005 9:48 am, Stephen Leaf wrote: For security.. *never* store the password in a cookie.. if you must... instead do some sort of encryption on it and some other value store that and use it for verification. On Friday 11 November 2005 05:43 am, sunaram patir wrote: Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); $auth=false; if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } it works fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! regards, sunaram -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
On Fri, November 11, 2005 12:06 pm, sunaram patir wrote: session_start(); session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); when i call var_dump($_COOKIE), it returns null. i can't make out what's happening! Is $_COOKIE NULL in the browsers that work, or just in IE? If it's only in IE, then is IE configured to not accept Cookies from your site, or perhaps never from 3rd-party sites, or perhaps Security settings are preventing the Cookies from being accepted... You can't force the User to accept your Cookies. Perhaps consider using trans_sid in php.ini to embed the Session ID in the URL instead of a Cookie. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Changing databases from MySQL to Oracle
[snip] I am new to PHP and am trying to learn how it works. We have a PHP program that is using MySQL. We are wanting to use our Oracle database instead. The Oracle database is on a different server that our PHP program. Does any one know how I can change connections from MySQL to Oracle? We have this line in our dba.php... $tli_connection = dbconnect($dsn, $user, $pass); In our config.php we have the following that defines the above $dsn = some.where.com; // MySQL hostname ([EMAIL PROTECTED]) $user = MYSQL USER NAME GOES HERE; // Username with sufficient rights to the DB - need update, select, delete, insert only $pass = MYSQL PASSWORD FOR ABOVE USER; // Password for the above user [/snip] The first place is to look in the manual http://www.php.net/oracle For a connection; http://us3.php.net/manual/en/function.ora-plogon.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Security Issues - Where to look?
Richard Lynch wrote: On Thu, November 10, 2005 3:29 pm, GamblerZG wrote: IMO, the best way is to re-generate SIDs on each request, but such method will decrease perfomance of a script. But if Cookies are off, you just destroyed their Back button in their browser, which should be a crime. Call me evil, but I prefer not to use GET-based sessions (after seing at least 3 websites hacked because of that stuff), so users without cookies can't login anyway. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing databases from MySQL to Oracle
On Friday 11 November 2005 19:21, Janet Smith wrote: I am new to PHP and am trying to learn how it works. We have a PHP program that is using MySQL. We are wanting to use our Oracle database instead. The Oracle database is on a different server that our PHP program. Does any one know how I can change connections from MySQL to Oracle? [..] Thanks Hi, have a look at http://de3.php.net/manual/en/ref.oci8.php Greets Boerni -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing databases from MySQL to Oracle
On Friday 11 November 2005 19:29, Bernhard Janetzki wrote: On Friday 11 November 2005 19:21, Janet Smith wrote: I am new to PHP and am trying to learn how it works. We have a PHP program that is using MySQL. We are wanting to use our Oracle database instead. The Oracle database is on a different server that our PHP program. Does any one know how I can change connections from MySQL to Oracle? [..] Hi, have a look at http://de3.php.net/manual/en/ref.oci8.php Greets Boerni -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
array(1) { [PHPSESSID]= string(32) 337a44c0d6c9ed3cf4ba4e97d707589e } is returned by firefox on calling var_dump($_COOKIE). NULL in ie. On 11/11/05, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, November 11, 2005 12:06 pm, sunaram patir wrote: session_start(); session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); when i call var_dump($_COOKIE), it returns null. i can't make out what's happening! Is $_COOKIE NULL in the browsers that work, or just in IE? If it's only in IE, then is IE configured to not accept Cookies from your site, or perhaps never from 3rd-party sites, or perhaps Security settings are preventing the Cookies from being accepted... You can't force the User to accept your Cookies. Perhaps consider using trans_sid in php.ini to embed the Session ID in the URL instead of a Cookie. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
On 11/11/05, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, November 11, 2005 12:06 pm, sunaram patir wrote: session_start(); session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); when i call var_dump($_COOKIE), it returns null. i can't make out what's happening! Is $_COOKIE NULL in the browsers that work, or just in IE? Perhaps consider using trans_sid in php.ini to embed the Session ID in the URL instead of a Cookie. Please look at http://schools.zenrays.com/phpinfo.php . trans_sid is on. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
Try setting session.use_cookies to Off so PHP won't even try to use Cookies. On Fri, November 11, 2005 12:49 pm, sunaram patir wrote: On 11/11/05, Richard Lynch [EMAIL PROTECTED] wrote: On Fri, November 11, 2005 12:06 pm, sunaram patir wrote: session_start(); session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); when i call var_dump($_COOKIE), it returns null. i can't make out what's happening! Is $_COOKIE NULL in the browsers that work, or just in IE? Perhaps consider using trans_sid in php.ini to embed the Session ID in the URL instead of a Cookie. Please look at http://schools.zenrays.com/phpinfo.php . trans_sid is on. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
- Original Message - From: sunaram patir [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Friday, November 11, 2005 5:31 AM Subject: [PHP] php session in ie Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); if(isset($_POST['submit'])){ include(../database.inc); $login=trim($_POST['login']); $pass=trim($_POST['pass']); $Effectivelogin=strtoupper($login); $auth=false; $connection=mysql_connect($host,$user,$password); mysql_select_db($database,$connection); $query=SELECT password FROM students WHERE userID='$Effectivelogin'; $result=mysql_query($query); if(mysql_num_rows($result)){ while($row=mysql_fetch_array($result)) { if($row[0]!=$pass) echo (Wrong Username/Password!); else $auth=true; } } if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } } ? html head titleUser Authentication/title /head body form method=post LoginID: input type=text name=loginbr Password: input type=password name=passbr input type=submit name=submit value=Login /form /body /html then the user is redirected back to the page he visited. it workd fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hello, I used this article for sessions with success http://www.sitepoint.com/article/users-php-sessions-mysql Best regards, Andras Kende http://www.kende.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot find bison and Flex even when those are installed
I'm not pretty sure, but I think I did this before running ./configure: # export YACC=bison Cheers. Dan McCullough wrote: You might have to change the configure option from with-bison=/usr/local/bison to with-bison=/usr or even with-bison= Happens to me alot. This would also be a better email for the PHP INSTALL list On 11/11/05, Jurgen [EMAIL PROTECTED] wrote: Dear group I tried to install php 4.3.11 on Linux Suse 6.4. I've installed bison and flex in /usr/local/ When I run ./configure in my php-dir he tells me he can't find bison and flex. How can I solve this matter Jurgen Campforts Lichtaartsebaan 58 2460 Kasterlee Tel: 0496/60.25.75 http://www.wandelmee.be -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Gustavo Narea. PHP Documentation - Spanish Translation Team. Valencia, Venezuela. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] arrays question
I have this that looks like this array(3) { [0]= array(2) { [0]= string(1) 1 [1]= string(1) 2 } [1]= array(2) { [0]= string(3) 492 [1]= string(3) 211 } [2]= array(2) { [0]= string(2) 11 [1]= string(2) 20 } } I want to loop through so I can get and print 1,492,11 and 2,211,20 What is the best way to do this? I suck with arrays and I can't get my looping right. Thanks for your help anybody!
[PHP] REQ: DOMDocument needs a way to format XML code
I have a feature request (and I'm a bit disappointed that this isn't already in the DOMDocument, when there are nearly useless methods like normalize())... Ruby has this built in. xmllint has the --format parameter. But yet PHP's DOMDocument has no way of cleaning up the code. Could someone please make a method in PHP v5.x to format the XML. After adding/deleting nodes, the XML gets fairly messy. Ideally it would have an offset character position to start the indent (default of 0 or left margin), and a parameter for how many spaces to use for each indentation (default of say 4 or 5 (same as a tab)). You could just make this optional parameters to saveXML(), but I think it's more flexible to have a DOMDocument-format(offset,spaces); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fopen on windows
$theFile = fopen(docs/InstallationInstructionMaster.txt, r) || die; while(!feof($theFile)){ $theLine = fgets($theFile, 4096); echo $theLine . br\n; } fclose($theFile); The above code appears to work, but all that is output is lines of line breaksno data. The file is a tab delimited test file; Form Number Date / Rev Description Controlled by Engineering Controlled by RD Controlled by Marketing Located on Thermon.com Copy Located in Shipping Copy Located in Mfg Installation Instructions - Heating Cables / Industrial PN50207 0802Electric Heat Tracing Installation Procedures X X X TEP0066 0800Electric Heat Tracting Maintenance Troubleshooting Guide X X X TMP0006 0901Electrical Safety Precautions for Electric Heat Tracing 10A024 1002Instal Inst. MI Mineral Insulated Heating Cable w/ SS Tie Wire MIQFAB 0802Field Testing Procedures for MI Trace Heating Cable Am I missing something other than an ice cold beer? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen on windows
Jay Blanchard wrote: $theFile = fopen(docs/InstallationInstructionMaster.txt, r) || die; I'm not sure if it would make any difference, but I usually use or in this case rather than ||, and I know they have different operator precedence. while(!feof($theFile)){ $theLine = fgets($theFile, 4096); echo $theLine . br\n; } fclose($theFile); The above code appears to work, but all that is output is lines of line breaksno data. The file is a tab delimited test file; [snip] Am I missing something other than an ice cold beer? Well, it's a pretty model example of a line-by-line file read. I can't see anything wrong with it, so perhaps the problem lies elsewhere. There's no other files with the same name in your include_path? Maybe something to do with auto_detect_line_endings or whatever it's called, in php.ini? (I know, probably a long shot.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fopen on windows
[snip] Well, it's a pretty model example of a line-by-line file read. I can't see anything wrong with it, so perhaps the problem lies elsewhere. There's no other files with the same name in your include_path? Maybe something to do with auto_detect_line_endings or whatever it's called, in php.ini? (I know, probably a long shot.) [/snip] The output now looks like Array ( [0] = ) Array ( [0] = ) Array ( [0] = ) based on the following code; $theFile = fopen(docs/InstallationInstructionMaster.txt, rb) || die; while(!feof($theFile)){ $theLine = fgets($theFile); $lineArray = explode(\t, $theLine); print_r($lineArray); } fclose($theFile); It appears that something is getting read, but what? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen on windows
Jay Blanchard wrote: [snip] Well, it's a pretty model example of a line-by-line file read. I can't see anything wrong with it, so perhaps the problem lies elsewhere. There's no other files with the same name in your include_path? Maybe something to do with auto_detect_line_endings or whatever it's called, in php.ini? (I know, probably a long shot.) [/snip] The output now looks like [snip] based on the following code; $theFile = fopen(docs/InstallationInstructionMaster.txt, rb) || die; while(!feof($theFile)){ $theLine = fgets($theFile); $lineArray = explode(\t, $theLine); print_r($lineArray); } fclose($theFile); It appears that something is getting read, but what? Blank lines. Just to see if the problem is fgets(), try this: // Left off the b because it ain't binary :) $theFile = file_get_contents( docs/InstallationInstructionMaster.txt, r ) or die; $lines = explode( \n, $theFile ); foreach( $lines as $line ) { $line = explode( \t, $line ); print_r( $line ); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fopen on windows
I've always used: fopen(C:\\dir\\dir\\file.txt); on windows, I'm not sure how PHP interprets the slashes internally though... Nate Tobik (412)661-5700 x206 VigilantMinds $theFile = fopen(docs/InstallationInstructionMaster.txt, rb) || die; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] fopen on windows
[snip] Blank lines. Just to see if the problem is fgets(), try this: // Left off the b because it ain't binary :) $theFile = file_get_contents( docs/InstallationInstructionMaster.txt, r ) or die; $lines = explode( \n, $theFile ); foreach( $lines as $line ) { $line = explode( \t, $line ); print_r( $line ); } [/snip] That works, as does the following; $lines = file('docs/InstallationInstructionMaster.txt'); foreach ($lines as $line){ echo $line . br /\n; } So, I am perplexed. fgets() seems to have a problem of some sort. Any clues? Not that what I want to do requires fgets(), just curious now as I will use one of the other two methods. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: REQ: DOMDocument needs a way to format XML code
Daevid Vincent wrote: I have a feature request (and I'm a bit disappointed that this isn't already in the DOMDocument, when there are nearly useless methods like normalize())... Ruby has this built in. xmllint has the --format parameter. But yet PHP's DOMDocument has no way of cleaning up the code. Could someone please make a method in PHP v5.x to format the XML. After adding/deleting nodes, the XML gets fairly messy. Ideally it would have an offset character position to start the indent (default of 0 or left margin), and a parameter for how many spaces to use for each indentation (default of say 4 or 5 (same as a tab)). You could just make this optional parameters to saveXML(), but I think it's more flexible to have a DOMDocument-format(offset,spaces); You mean like calling $doc-formatOutput = TRUE; prior to save? Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: REQ: DOMDocument needs a way to format XML code
Holy Shit! Yes. That's awesome! You had me at EHLO --E.Webb (10.04.05) -Original Message- From: Rob Richards [mailto:[EMAIL PROTECTED] Sent: Friday, November 11, 2005 1:41 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: Re: REQ: DOMDocument needs a way to format XML code Daevid Vincent wrote: I have a feature request (and I'm a bit disappointed that this isn't already in the DOMDocument, when there are nearly useless methods like normalize())... Ruby has this built in. xmllint has the --format parameter. But yet PHP's DOMDocument has no way of cleaning up the code. Could someone please make a method in PHP v5.x to format the XML. After adding/deleting nodes, the XML gets fairly messy. Ideally it would have an offset character position to start the indent (default of 0 or left margin), and a parameter for how many spaces to use for each indentation (default of say 4 or 5 (same as a tab)). You could just make this optional parameters to saveXML(), but I think it's more flexible to have a DOMDocument-format(offset,spaces); You mean like calling $doc-formatOutput = TRUE; prior to save? Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] arrays question
Here's a few loops that should work. You can actually just use the first loop to concatenate text string instead create array items, but I wasn't sure what type of processing you wanted to do with the result. //Convert Array from 3 rows by 2 cols - 2 rows by 3 cols for($i=0; $icount($mainArray); $i++ ) { for ( $x=0; $xcount($mainArray[$i]); $x++ ) { $resultArray[$x][]= $mainArray[$i][$x]; } } Resulting Array Array ( [0] = Array ( [0] = 1 [1] = 492 [2] = 11 ) [1] = Array ( [0] = 2 [1] = 211 [2] = 20 ) ) //Convert array items to text string with , separator for($i=0; $icount($resultArray); $i++) { $resultArray[$i]= ''.implode(',',$resultArray[$i]).''; } Resulting Array: Array ( [0] = 1,492,11 [1] = 2,211,20 ) On Nov 11, 2005, at 3:25 PM, cybermalandro cybermalandro wrote: I have this that looks like this array(3) { [0]= array(2) { [0]= string(1) 1 [1]= string(1) 2 } [1]= array(2) { [0]= string(3) 492 [1]= string(3) 211 } [2]= array(2) { [0]= string(2) 11 [1]= string(2) 20 } } I want to loop through so I can get and print 1,492,11 and 2,211,20 What is the best way to do this? I suck with arrays and I can't get my looping right. Thanks for your help anybody! -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Filtering and Escaping (Was: Select and $_POST)
Richard Lynch wrote: Suppose PHP had a superglobal $_CLEAN which was an empty array. This seems like a decent idea, for two reasons: 1. Developers don't have to remember to initialize their array, which offers some protection. PHP can do this for them. 2. Variable scope issues are not a concern. Currently, using this technique within functions and classes is clumsy at best. However, most security issues like XSS and SQL injection aren't really input filtering problems. Often, input filtering can effectively eliminate these vulnerabilities (and there's no excuse to not be filtering input), but escaping addresses the root cause of the problem. For example: ?php header('Content-Type: text/html; charset=UTF-8 '); echo htmlentities($_GET['foo'], ENT_QUOTES, 'UTF-8'); ? Although this example demonstrates a lack of input filtering, it does not demonstrate a cross-site scripting (XSS) vulnerability. The problem is that input is a lot easier to manage, because data is clearly identifiable as such. Output is a completely different story, because what's considered data and what isn't depends upon the context, and only the developer really knows: ?php $first_name = 'Chris'; $last_name = 'Shiflett'; $city = 'New York'; $state = 'NY'; $name = b$first_name $last_name/b; $location = i$city, $state/i; echo pMy name is $name, and I live in $location./p; ? If you think of this example from the perspective of echo, it's difficult to tell what part of the string is meant to be only data. In this case, the data is Chris, Shiflett, New York, and NY. The HTML tags are meant to be interpreted. As the developer, that's easy for me to know, but it's hard to make this easier to keep up with. At best, any solution requires developers to declare their intent somehow. In the past, I've recommended simple naming conventions like Ben demonstrated earlier. These work well, but it takes a good bit of discipline. Now I'm trying to think of something better. I've also been looking around at other languages and frameworks, and I haven't found an elegant solution (meaning, they all require clumsy syntax or just as much discipline). What does Chris Shiflett use to validate an email? Enquiring minds want to know! :-) I'm afraid I'll only disappoint you. :-) I'm pretty lenient with email addresses and use the pattern from the PHP Cookbook (David Sklar and Adam Trachtenberg). I usually modify it to not allow angled brackets, since I don't know any email address that has those (but, they're probably OK as far as the spec goes). I rely on escaping to protect against things like XSS and SQL injection, so the filtering just gives me reasonable assurance that the email address looks right and has a good chance of being a real email address. I always send something (password, token, etc.) to an email address if I care to make sure it works. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Filtering and Escaping (Was: Select and $_POST)
Chris Shiflett wrote: I'm pretty lenient with email addresses and use the pattern from the PHP Cookbook (David Sklar and Adam Trachtenberg). I usually modify it to not allow angled brackets, since I don't know any email address that has those (but, they're probably OK as far as the spec goes). I always try to enter my email address like this when asked for it on a form: Jasper Bryant-Greene [EMAIL PROTECTED] That is a perfectly valid (according to RFC822) email address. Those that do bother to validate usually spit it out as invalid. Just to demonstrate that it's not quite as simple as it might first appear :) Jasper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php session in ie
if it's a risk then it's in my never get into the practice of doing this category. Passwords should always be used to verify and discarded. never saved in any form which can be seen directly or decoded. And true $_SESSION isn't a cookie.. however there are some systems that a cookie is used like a session. in both cases I'd personally feel uneasy storing a password like that. On Friday 11 November 2005 12:23 pm, Richard Lynch wrote: He's not storing the password in a Cookies. He's storging it in a $_SESSION Which is still a Risk, especially on a shared server, but it's not necessarily in the category of Never do this On Fri, November 11, 2005 9:48 am, Stephen Leaf wrote: For security.. *never* store the password in a cookie.. if you must... instead do some sort of encryption on it and some other value store that and use it for verification. On Friday 11 November 2005 05:43 am, sunaram patir wrote: Hi, i am having problem with internet explorer. i am working on a project on building a website where i need to keep track of the users i.e. i use a login system in there in short. with the following code i check whether the user is logged in or not. ?php session_start(); $_SESSION['myurl']=$_SERVER['PHP_SELF']; if(!isset($_SESSION['student_username']) !isset($_SESSION['student_password'])) header(Location: login.php); ? if the user is not logged in, it redirects to the login page login.php as is shown in the above code. now the user is allowed to log in through the following code: ?php session_cache_limiter('private_no_expire'); session_set_cookie_params(0,/,schools.zenrays.com); session_start(); $auth=false; if($auth){ $_SESSION[student_username]=$Effectivelogin; $_SESSION[student_password]=$pass; if(isset($_SESSION['myurl'])) header(Location: http://schools.zenrays.com.$_SESSION['myurl']); else header(Location: http://schools.zenrays.com/students;); } it works fine in firefox and msn explorer. in internet explorer, when i visit to a link in any page it asks for the login details again. could anyone please help me out?! regards, sunaram -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Select and $_POST
Curt Zirzow wrote: There is a pecl extension that you can register, custom superglobals although it comes with some extra stuff as well: http://php.net/runkit I wish it would be a part of core distribution. Would be extremely useful. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is the purpose of sessions extension?
GamblerZG wrote: What is the purpose of sessions extension? The reason I ask is because learning to deal with all its functions, ini options and quirks took me _much_ more time than writing pure-php replacement. (That is, without using session_set_save_handler().) I realise that yours might be a special case, but for most situations I have only had to do session_start() and then simply used $_SESSION as if it were any other array with the simple difference that it persists across requests. When done with the session, use session_destroy() if you feel the need. I'm not sure how that could be harder than writing a pure-PHP replacement for the session extension... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about session
I have session code which written WindowsXP and It wotk properly as expected, but when I'm used in Windows 2K, it got error as; Notice: Undefined index: loginMessage in C:\CentralData\forms\mainForm.php on line 65 I'am used Apache 2.0 and PHP 5.0.4. Is php.ini setting on W2K different with XP Thxs in advance bgs !-- .style1 {font-weight: bold} .style2 { font-size: 24px; font-weight: bold; } .style8 {color: #0066CC; font-weight: bold; font-size: 18px; } --
Re: [PHP] Question about session
There's no code. You need to put your code in the Email so we can see it...
Re: [PHP] Filtering and Escaping (Was: Select and $_POST)
Chris Shiflett wrote: However, most security issues like XSS and SQL injection aren't really input filtering problems. Often, input filtering can effectively eliminate these vulnerabilities (and there's no excuse to not be filtering input), but escaping addresses the root cause of the problem. I decided to blog about this in more detail: http://shiflett.org/archive/168 Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] emailing MySQL list not working
Hello, I am using a template for an email database. This has a MySQL database where the end user can sign up to receive my email newsletter, They subscribe and are entered into a MySQL database that I have set up. Everything works fine as far as being entered into the dataase The problem occurs when I send a test email to the database list. (I am sending one to myself). The email never gets sent! the code to send out the email from the MySQL database list is as follows: ?php // this script is used to as the action for the form on sendmailform.php // it sends the email to all persons who have subscribed to the mailinglist and confirmed their subscription //include the config file include(config.php); $subject = $_REQUEST['subject']; $message = $_REQUEST['message']; //Variables for the headers // customize this stuff $sender = Bruce Gilbert [EMAIL PROTECTED]\n; //put your name and sending address here $reply_to = [EMAIL PROTECTED]\n; //reply-to, insert your address here, might not be supported by your server $return_path = [EMAIL PROTECTED]; // return-path, if you have one, also might not be supported by your server $x_sender = [EMAIL PROTECTED]\n; //your address, another setting possibly not supported by your server $message .= \n\n This is a double opt-in mailing list. All recipients have confirmed their subscription. If you no longer wish to receive these emails, please go to http://$list_owner_domain_name \n Get this custom mailing list system for your site. Go to http://www.karlcore.com for more info! \n; // this selects the table and orders the results by the name // it only selects the listings that have been confirmed $query = SELECT * FROM mailinglist WHERE subscribe=1 AND confirmed=1; $result = mysql_query($query); while ( $row = mysql_fetch_array($result)) { $rec_id = $row[rec_id]; $email = $row[email]; $recipient = $email; $headers = From: $sender; $headers .= Reply-To: $reply_to; $headers .= Return-Path: $return_path; $headers .= X-Sender: $x_sender; $headers .= X-Mailer: PHP4\n; //mailer $headers .= X-Priority: 3\n; //1 UrgentMessage, 3 Normal $headers .= Mime-Version:1.0\n Content-Type: text/plain; charset=\iso-8859-1\nContent-Transfer-Encoding: 8bit\n; mail( $recipient, $subject, stripslashes($message), $headers ); sleep(1); } // run second query to automatically dump unsubscribed email addresses. $query2 = DELETE FROM mailinglist WHERE subscribe='0' AND confirmed='0' ; //run the query mysql_query($query2, $link) or die (mysql_error()); mysql_close(); header(location: mailsent.php); exit; ? The form is located here: http://www.inspired-evolution.com/sendmailform.php let me know if I need to provide any more information. Thanks! Bruce Gilbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] url query problem
Hi PHP Gurus Am new to the php world, I need help to do something. PlZz help I have this link http://www.taximauritius.mu/link1.php. What I want to do : When clicking on the link above, that would bring me to a page http://www.taximauritius.mu/reservation.php?client=apartment1, and in this URL, as can be seen, there is a variable called apartment1. I want to get the name of this variable + other form fields in my email message when the form is sent. Actually I do get the other form fields in my email message. I just don’t get the variable (client=apartment1) Am attaching the codes, It would really be grateful if you could plzzz help me. Thanks a lot for helping Imrose -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.269 / Virus Database: 264.8.0 - Release Date: 9/6/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] url query problem
You've tried accessing $_GET in reservation.php? Like $_GET['client'] would return apartment1 in reservation.php if you clicked on http://www.taximauritius.mu/reservation.php?client=apartment1 -Minuk Imroz wrote: Hi PHP Gurus Am new to the php world, I need help to do something. PlZz help I have this link http://www.taximauritius.mu/link1.php. What I want to do : When clicking on the link above, that would bring me to a page http://www.taximauritius.mu/reservation.php?client=apartment1, and in this URL, as can be seen, there is a variable called apartment1. I want to get the name of this variable + other form fields in my email message when the form is sent. Actually I do get the other form fields in my email message. I just don’t get the variable (client=apartment1) Am attaching the codes, It would really be grateful if you could plzzz help me. Thanks a lot for helping Imrose -- Outgoing mail is certified Virus Free. Checked by AVG Anti-Virus (http://www.grisoft.com). Version: 7.0.269 / Virus Database: 264.8.0 - Release Date: 9/6/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Question about session
poblem was solved by add session_register function before $_SESSION[blablabla]; From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Sat 12-Nov-2005 09:50 To: Bagus Nugroho; php-general@lists.php.net Subject: Re: [PHP] Question about session There's no code. You need to put your code in the Email so we can see it...
Re: [PHP] mail return-path problem
On 11/8/05, Richard Heyes [EMAIL PROTECTED] wrote: Eric Butera wrote: I was just curious if there was a way to set the return path of an email dynamically. I've looked around and all I could find was a Zend tutorial running sendmail from the command line, which I don't want to do. :) I tried setting Return-Path: in the mail() headers, but that didn't seem to make a difference. If anybody knows anything about this and could point me in the right direction, I'd appreciate it. Thanks! Use the fifth argument to the mail() function and the -f option for sendmail: mail('...', '...', '...', null, '[EMAIL PROTECTED]') -- Richard Heyes http://www.phpguru.org The -f was the trick. Thank you for all the input guys. =)