[PHP] Re: Lots of Variables
Cesar, the first thing you need to work out is a data structure. Start with your database design. I would envisage something along the lines of : TABLE : Questions FIELDS : question_id, question_text TABLE : AnswerOptions FIELDS : answer_id, question_id, answer_text TABLE: QALink FIELDS: answer_id, question_id TABLE: UserAnswers FIELDS: user_id, answer_id Store you questions in 'Questions'. Store you answers (the options for each question, e.g. 'Yes', 'No'..etc..) in 'AnswerOptions', linking them up with the question_id field. Then link the options on to the next set of questions with the 'QALink' table. Store each answer in 'UserAnswers', where user_id uniquely identifies the user, a record for each answer option selected. You'll then need to do something with the set of answers produced by each user. Some sort of matrix. Once you've set this up, you should be able to start building the site around it. Good luck, Ben "César aracena" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > I'm about to make a site and I need all the help I can to get started. > This can be a long e-mail so please be patient and read all of it :-) > > I will create an "intelligent" PHP script that will guide the visitors > through several questions, which will lead to different options, depending > on their answers, but also with the possibility to start based on > different options. > > To make myself clear, this is a "fly fishing how-when-where-what guide" > that a very experienced fisherman of my Country wants to setup in order to > give free advises to no-so-expert fishermen, so he needs to know HOW do > they want to go fishing (what kind of fly they use), WHEN they will go > (which month of the season), WHERE will they go (assuming they have > predefined destination) and most important of all WHAT do they want to > fish when they go there. > > When all this questions are answered by the visitor, the script should > automatically present a general solution telling IF they will catch THAT > piece THERE in that MOMENT of the season and using THAT fly. He also will > receive a brief description on how he or she should fish that area and > which hours are best for those conditions. > > One more thing to have in mind, is the availability of the visitor so he > must be able (at the beginning of the script) to decide if he or she wants > to make their decisions based upon WHEN, WHAT, HOW or WHERE. > > Has anyone ever made such a complex script or program? I don't realize how > to start and how to face this one... not even the DB (which will be > MySQL)... > > Any help will be very much appreciated, > > - > Cesar Aracena > [EMAIL PROTECTED] > www.icaam.com.ar > Cel: +54.299.635-6688 > Tel: +54.299.477-4532 > Fax: +54.299.477-7773 > Cipolletti, Rio Negro > R8324BEG > Argentina > > > - > Soluciones profesionales en > Internet y Comunicaciones > http://www.icaam.com.ar > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email being blocked
Hi, I have a very frustrating problem that I hope someone can give me an answer to. I'm trying to send out emails from a script, using the mail() function. This works, but only for email addresses that are in the same domain as the website ! So, if the website domain that the script is running within is www.mysite.com, then [EMAIL PROTECTED] is fine [EMAIL PROTECTED] will not go The script is running on a Cobalt RaQ, Linux machine, with sendmail. Accessing sendmail from perl CGI presents no such difficulties, so I assume its not a sendmail / firewall / OS problem. I have also tried talking to sendmail directly, from PHP, rather than using the mail() function, and have found that the same problem occurrs. Could it be something in PHP.INI ? Please help ! Thanks, Ben Peters -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email being blocked
No, its definitely not that. I've set the sendmail_from and it's still not working. Also, the mail() function actually fails to return a success code for the non-sitedomain addresses, implying that the problem is at the source, not the destination. Can anyone help? Thanks Ben "Lowell Allen" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > From: "Ben" <[EMAIL PROTECTED]> > > > [snip] > > > > I'm trying to send out emails from a script, using the mail() function. This > > works, but only for email addresses that are in the same domain as the > > website ! > > > > So, if the website domain that the script is running within is > > www.mysite.com, then > > > > [EMAIL PROTECTED] is fine > > [EMAIL PROTECTED] will not go > > > > The script is running on a Cobalt RaQ, Linux machine, with sendmail. > > > > Accessing sendmail from perl CGI presents no such difficulties, so I assume > > its not a sendmail / firewall / OS problem. > > > > I have also tried talking to sendmail directly, from PHP, rather than using > > the mail() function, and have found that the same problem occurrs. > > > > Could it be something in PHP.INI ? > > > > The value of sendmail_from can affect the return path header and cause > receiving systems to block as spam. There's a user contributed note in the > manual: <http://www.php.net/manual/en/ref.mail.php> > > -- > Lowell Allen > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email being blocked
Problem solved ! The emails were being resolved on the box, and not escaping to the ISP DNS where they would have been MX redirected to the office. Other email is getting out fine. Sorry for the stupid and non-PHP related post. I will endeavor to contribute in future to make up for it ! Thanks, Ben "Timothy Hitchens )" <[EMAIL PROTECTED]> wrote in message 008201c2c859$a4320020$0500a8c0@bambino">news:008201c2c859$a4320020$0500a8c0@bambino... > The box does have a default route to get out of your network I trust?? > > > Timothy Hitchens (HiTCHO) > Web Application Consulting > e-mail: [EMAIL PROTECTED] > > > -Original Message- > > From: Ben [mailto:[EMAIL PROTECTED]] > > Sent: Thursday, 30 January 2003 9:45 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] Email being blocked > > > > > > No, its definitely not that. I've set the sendmail_from and > > it's still not working. > > > > Also, the mail() function actually fails to return a success > > code for the non-sitedomain addresses, implying that the > > problem is at the source, not the destination. > > > > Can anyone help? > > > > Thanks > > > > Ben > > > > "Lowell Allen" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > From: "Ben" <[EMAIL PROTECTED]> > > > > > [snip] > > > > > > I'm trying to send out emails from a script, using the mail() > > > function. > This > > > works, but only for email addresses that are in the same domain as > > > the website ! > > > > > > So, if the website domain that the script is running within is > > > www.mysite.com, then > > > > > > [EMAIL PROTECTED] is fine > > > [EMAIL PROTECTED] will not go > > > > > > The script is running on a Cobalt RaQ, Linux machine, with sendmail. > > > > > > Accessing sendmail from perl CGI presents no such difficulties, so I > assume > > > its not a sendmail / firewall / OS problem. > > > > > > I have also tried talking to sendmail directly, from PHP, rather > > > than > using > > > the mail() function, and have found that the same problem occurrs. > > > > > > Could it be something in PHP.INI ? > > > > > > > The value of sendmail_from can affect the return path header and cause > > > receiving systems to block as spam. There's a user contributed note in > > > the > > manual: <http://www.php.net/manual/en/ref.mail.php> > > > > -- > > Lowell Allen > > > > > > -- > 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] Re: postmaster@hanmir.com
I just got two, Expecting two more now "Joe Harman" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hey is every one getting a returned message from > [EMAIL PROTECTED] > > Joe Harman > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Php - union
You could try... SELECT 'Count1', COUNT(*) FROM table1 WHERE cno = 3 UNION SELECT 'Count2', COUNT(*) FROM table2 WHERE cno = 3 UNION etc. At least you could fill an array to see what was missing. "Ryan A" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > In my php script i am running a sql statement, > I am using a union statement via a count to get the number of records from 5 > differient tables with the cno=3, its working fine except for one thing, if > the any one of the tables dont have cno=3 it does not give me back a zero. > Heres what i am doing: > $theResult="SELECT COUNT(*) FROM table1 WHERE cno = 3 > UNION > SELECT COUNT(*) FROM table2 WHERE cno = 3 > UNION > SELECT COUNT(*) FROM table3 WHERE cno = 3 > UNION > SELECT COUNT(*) FROM table4 WHERE cno = 3 > UNION > SELECT COUNT(*) FROM table5 WHERE cno = 3"; > > this will return 5 rows in result, f.e.: > > COUNT(*) > > 12 > 10 > 9 > 23 > 7 > > but if table1 didnt have cno=3 it gives me: > COUNT(*) > > 10 > 9 > 23 > 7 > > I am sure this must have been a problem with you guys to so how did you > solve it? how can i know (in my script) if its contains a positive number or > is 0? > I can run 5 counts but that would be a waste of connections if the site gets > a lot of members (which by the looks of it, it will). > > Any help appreciated, thanks in advance. > > Cheers, > -Ryan > > > We will slaughter you all! - The Iraqi (Dis)information ministers site > http://MrSahaf.com > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and SQL Server
Todd I use the ODBC drivers to connect a w2k server running PHP to a w2k server running MSSql. It is used mainly for real time reports on sales etc. I have had trouble in the past connecting. Downloading & installing MDAC from MS on the php server helped. Not much data is transferred, so never really run into performance problems. $db = "odbbcname"; $cx=odbc_connect($db,'sa','password'); $sql = "select * from table"; $cur=odbc_exec($cx,$sql); while(odbc_fetch_row($cur)){ $rep=odbc_result($cur,1); } "Todd Cary" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I have a client that insists that I use SQL Server as the DB (vs. MySQL or Interbase). I have not used PHP's ODBC interface and I am wondering if anyone on this list has had experience with ODBC and SQL Server.
[PHP] Using variables from includes
Ok, I'm sort of a beginner at this, so cut me some slack. :-) Ok, I have an if then statement that after you click a link it looks like this: blah?page=pagename It looks something like this: http://www.site.com/home.php";); } else{ include ("http://www.site.com/"; . "$page" . ".php"); } ?> This code is in the index.php file. When home.php is included, I want to echo a variable like $title on the index.php page. But $title is defined on home.php. For some reason, I can't get $title to echo on index.php after it's included. Anyone know?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using variables from includes
How would I do this then? "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ben wrote: > > >Ok, I'm sort of a beginner at this, so cut me some slack. :-) Ok, I have an > >if then statement that after you click a link it looks like this: > >blah?page=pagename It looks something like this: > > >if(!$page) { > >include ("http://www.site.com/home.php";); > >} > >else{ > >include ("http://www.site.com/"; . "$page" . ".php"); > >} > >?> > >This code is in the index.php file. When home.php is included, I want to > >echo a variable like $title on the index.php page. But $title is defined on > >home.php. For some reason, I can't get $title to echo on index.php after > >it's included. Anyone know?? > > > > > > > > > > > When you access it by HTTP, PHP has no way to get its variables. It > simply gets its output, just like a web browser. You need to include it > locally to use its variables. > > -- > 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] Using variables from includes
thanks a bunch "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ben wrote: > > >How would I do this then? > > > > include('foo.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] Using variables from includes
But how would I go about using the IF THEN statement but allowing the page to see the variables. "Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ben wrote: > > >How would I do this then? > > > > include('foo.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] Sorting a multi-dimensional array
I have looked at array_multisort, asort, etc. NONE of them do what I need. My array looks like this: $array[0][0] = First Id; $array[0][1] = First Name; $array[0][2] = First Rating; $array[1][0] = Second Id; $array[1][1] = Second Name; $array[1][2] = Second Rating; $array[2][0] = Third Id; $array[2][1] = Third Name; $array[2][2] = Third Rating; Now, I want to sort the array (very very fast if possible cuz the array is huge...150 such values) based on the "Rating" for each candidate, which is the third column inside this matrix array. How should I ask PHP to do this? Also, when I do sort by the Rating I want the ID and the name to remain the same for each candidate, i.e., I want the indexes to be maintained. HELP! Thanks in advance Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular expression help
I need someone to tell me exactly what this regular-expression means: if(ereg("[^ \t\n]",$val)) { // do the job here } I'm looking for an intermittent bug, and I need to understand this to make sure I have found the bug. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression help
Thanks Bronislav for your answer but this can't be it as the following test code passes validation: ' . nl2br($val); ?> Anyone has an idea? "Bronislav kluèka" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > This condition is true if there is no space, new line or tabulator in $val > > > > I need someone to tell me exactly what this regular-expression means: > > if(ereg("[^ \t\n]",$val)) { > > // do the job here > > } > > > > I'm looking for an intermittent bug, and I need to understand this to make > > sure I have found the bug. > > > > Thanks > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > S pozdravem > Bronislav Klucka > > =[ pro2-soft.com ]= > Bronislav Klucka Pro2-Soft > +420 605 582 922 [EMAIL PROTECTED] > > * Windows & Web applications, Computer training http://pro2-soft.com > -- - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular expression help
That's it! Thank you very much, you have the answer. I wonder why the programmer did not write the following line instead: if (strlen(trim($val))) { // Do the job here } Anyways, you just proved that I did not fix the bug! Now I have to work even more! :-P Thanks "Matthias Nothhaft" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > ^ inside [] means "not the following chars", so your expression means: > > if ($val contains no space " ", no tab "\t" and no newline "\n") { > //do the job ... > } > > Regards, > Matthias > > > > Ben wrote: > > I need someone to tell me exactly what this regular-expression means: > > if(ereg("[^ \t\n]",$val)) { > > // do the job here > > } > > > > I'm looking for an intermittent bug, and I need to understand this to make > > sure I have found the bug. > > > > Thanks > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace help
I am trying to build a pattern to do the following: - Find all occurences of HREF=" and SRC=" except those that include the HTTP:// in their path - Insert my own domain string (e.g.: http://www.my_domain.com) So has an example the input string would be : $val = ' http://www.my_domain.com/test.php";>my_domain hello http://www.my_domain.com/images/tstimg.jpg> '; And I would like to end up with: $val = ' http://www.my_domain.com/test.php";>my_domain http://www.my_domain.com/hello.com";>hello http://www.my_domain.com/images/test.jpg";> http://www.my_domain.com/images/tstimg.jpg> '; Thank you in advance.
[PHP] preg_replace help
I am trying to build a pattern to do the following: - Find all occurences of HREF=" and SRC=" except those that include the HTTP:// in their path - Insert my own domain string (e.g.: http://www.my_domain.com) So has an example the input string would be : $val = 'http://www.test.com/test.php";>ssdf2http://www.test.com/images/dfgdf.jpg";>'; And I would like to end up with: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HELP insert still dosn't work
On Tue, 20 Mar 2001, David Robley wrote: > On Tue, 20 Mar 2001 03:32, Rudolf Frint wrote: > > > > I want to insert the Values into my Database like this > > > > $handle = ora_logon("iusr@test","kiwi1"); > > $cursor1 = ora_open($handle); > > $query = "insert into internet_tmp select > > rv_ret($FF),$FF,$sesid,(sysdate+0.0021) from dual"; > > ora_parse($cursor1,$query) or die; > > ora_exec($cursor1); > > ora_close($cursor1); > > > > tring the insert query on sql-plus works fine what do I do wrong?? > > > > oh yea error msg is like this > > Warning: Ora_Parse failed (ORA-00923: FROM keyword not found where > > expected -- while processing OCI function OPARSE) in test2.php on line > > 40 > > > > line40 is parse line > > > > plaese help is very urgent > > rudi > > I'm not an Oracle person, but it sounds like you may have a syntax error > in your SQL. Try echo-ing $query and see how it looks. > > -- > David Robley| WEBMASTER & Mail List Admin > RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ > AusEinet| http://auseinet.flinders.edu.au/ > Flinders University, ADELAIDE, SOUTH AUSTRALIA > I've had a few troubles with PHP/MySQL with requests like that... Maybe you could try that (it worked for me) : $query = "insert into internet_tmp select rv_ret(\"$FF\"),\"$FF\",$sesid,(sysdate+0.0021) from dual"; the \"$var\" are important : ".$var." won't do, even if with an echo $query, you _seem_ to get the same results... -- Ben As well look for a needle in a bottle of hay. Miguel de Cervantes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Editing Variables from another script.
On Tue, 20 Mar 2001 [EMAIL PROTECTED] wrote: > I think you didn't get what I meant, > > I need a script such that I can change the content of database.inc from an > external script (form or whatever) Have you tried with global variables (see array $GLOBALS) ? -- Ben Committee, n.: A group of men who individually can do nothing but as a group decide that nothing can be done. -- Fred Allen > - Original Message - > From: "Stewart Taylor" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, March 20, 2001 5:57 PM > Subject: RE: [PHP] Editing Variables from another script. > > > include "database.inc" > > . > > . > > . > > . > > $dbhost='localhost'; > > > > -Stewart > > > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > > Sent: 20 March 2001 09:26 > > To: Jason Stechschulte > > Cc: 'PHP General List. (E-mail)' > > Subject: Re: [PHP] Editing Variables from another script. > > > > Okay, basically, > > > > I'm trying to create a script such that it will change the variables > inside > > of my .inc page. > > > > Something like > > > > lets say I have this file called "database.inc" > > Inside it I have : > > > > $dbhost = 'blah' > > $dbuser= 'blah' > > $dbpass= 'blah' > > > > I would like to make a script such that I can modify the $variables into > > something else like, $dbhost into localhost. > > > > How can it be done? > > - Original Message - > > From: "Jason Stechschulte" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Cc: "'PHP General List. (E-mail)'" <[EMAIL PROTECTED]> > > Sent: Monday, March 19, 2001 11:03 PM > > Subject: Re: [PHP] Editing Variables from another script. > > > > > > > On Sun, Mar 18, 2001 at 01:06:34PM +0800, [EMAIL PROTECTED] wrote: > > > > > > > I'm trying to create a form whereby I can edit the variables with just > > the form. > > > > > > > > It will be something like a form for me to change the database > > details(username,server,password) in a .inc I'm using. > > > > > > > > Is there anyway for me to pass information into another file's > variable > > and have it saved in there? > > > > > > > > If anyone have seen Newspro (CGI) before, when you edit some parts in > a > > form, the information will be saved. How can it be done in PHP? > > > > > > There is probably a hundred or more ways this can be done. For me to be > > > able to give you specifics, you will have to be more specific with what > > > you are doing and what you have tried. > > > > > > -- > > > Jason Stechschulte > > > [EMAIL PROTECTED] > > > -- > > > Well, I think Perl should run faster than C. :-) > > > -- Larry Wall in <[EMAIL PROTECTED]> > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] sessions
i'm trying to use sessions with my project, but it seems that registered variables in a session aren't global by default. It doesn't even seem like the session is global, because if I reference the sessionid (which only shows up if cookies are disabled) by using , it shows up within a function, if I reference it from within the function. if anyone can help me make my variables (such as $user, and $active) globally registered with the session, I would be very grateful. maybe its the cookie not being global, that would explain why the sessionid shows up only from within a function (but not in the global scope) thanks ben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] global sessions
i'm trying to use sessions with my project, but it seems that registered variables in a session aren't global by default. It doesn't even seem like the session is global, because if I reference the sessionid (which only shows up if cookies are disabled) by using , it shows up within a function, if I reference it from within the function. if anyone can help me make my variables (such as $user, and $active) globally registered with the session, I would be very grateful. maybe its the cookie not being global, that would explain why the sessionid shows up only from within a function (but not in the global scope) so...i guess my question is how can i globalize a session? thanks ben [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Faking a form POST
Hi. Does anyone know how to POST data to another script as if a form had done so? I want to POST some data to a script on another site and retrieve the data that is returned so i can poick it apart, i did it in ASP using a 3rd party component... just wondering if the same could be done in PHP. Any help appreciated. Cheers, .ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Faking a form POST
hmm, i was kinda after an in-process component like the ASP components ASPHTTP (http://www.ServerObjects.com) and ASPTear (http://www.alphasieraapapa.com). cheers tho, .b > -Original Message- > From: jon [mailto:[EMAIL PROTECTED]] > Sent: 16 April 2002 05:10 > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Faking a form POST > > > If you're on windows, you can use a program called Achilles. It acts as a > proxy and lets you edit the data you send from your browser... > > Don't have a URL handy, but it's easy to find. > > -- jon > > > > > -Original Message- > From: .ben [mailto:[EMAIL PROTECTED]] > Sent: Monday, April 15, 2002 9:36 PM > To: PHP > Subject: [PHP] Faking a form POST > > > Hi. Does anyone know how to POST data to another script as if a form had > done so? I want to POST some data to a script on another site > and retrieve > the data that is returned so i can poick it apart, i did it in ASP using a > 3rd party component... just wondering if the same could be done in PHP. > > Any help appreciated. > > Cheers, > > .ben > > > -- > 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] Faking a form POST
Erik, thanks for this. Works great, .b > -Original Message- > From: Erik Price [mailto:[EMAIL PROTECTED]] > Sent: 16 April 2002 14:30 > To: [EMAIL PROTECTED] > Cc: PHP > Subject: Re: [PHP] Faking a form POST > > > > On Monday, April 15, 2002, at 09:36 PM, .ben wrote: > > > Hi. Does anyone know how to POST data to another script as if a form > > had > > done so? I want to POST some data to a script on another site and > > retrieve > > the data that is returned so i can poick it apart, i did it in ASP > > using a > > 3rd party component... just wondering if the same could be done in PHP. > > > > Any help appreciated. > > This function will look a lot prettier once you've copied it into a text > editor that can handle > 80 columns -- or you can remove the comments. > > From the archives: > > # === > # PostToHost($host, $path, $data_to_send) > # --- > # "It is a trivial little function." > # -Rasmus > # === > > function PostToHost($host, $path, $data_to_send) > { > $fp = fsockopen($host,80); > // $fp now points > to the "file" opened > by fsockopen > fputs($fp, "POST $path HTTP/1.0\n"); > // write the first header, with > the path and the protocol (annotations suggest using 1.0 over 1.1) > fputs($fp, "Host: $host\n"); > // write the hostname line > of the header > fputs($fp, "Content-type: > application/x-www-form-urlencoded\n");// write > the encoding type line of the header > fputs($fp, "Content-length: " . strlen($data_to_send) . > "\n");// write > the content-length of data to send > fputs($fp, "Connection: close\n\n"); > // close the connection, and > a blank line > fputs($fp, $data_to_send); > // write the data > to send (in POST variable > form) > while(!feof($fp)) { > // until > the end of the "file", eat 128 > bytes at a time > echo fgets($fp, 128); > } > fclose($fp); > // close the "file" > } > > > > > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Faking a form POST
Thanks to everyone who helped out with this question, got it all working nicely now. Will credit you all on finished site. Cheers, .ben > -Original Message- > From: Steve Dix [mailto:[EMAIL PROTECTED]] > Sent: 16 April 2002 12:26 > To: .ben > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] Faking a form POST > > > On 16 Apr 2002 at 12:22, .ben wrote: > > > hmm, i was kinda after an in-process component like the ASP components > > ASPHTTP (http://www.ServerObjects.com) and ASPTear > > (http://www.alphasieraapapa.com). > > > > cheers tho, > > > > .b > > > > Try this : > > You will have to encode your data in a similar manner to a get > method, only without using the ? ie > > to send hello = 1, mouse=brown > > &hello=1&mouse=brown > > in $data_to_send > > function PostToHost($host, $path, $data_to_send) > { > $fp = fsockopen($host,80); > fputs($fp, "POST $path HTTP/1.1\n"); > fputs($fp, "Host: $host\n"); > fputs($fp, "Content-type: application/x-www-form-urlencoded\n"); > fputs($fp, "Content-length: ".strlen($data_to_send)."\n"); > fputs($fp, "Connection: close\n\n"); > fputs($fp, $data_to_send); > while(!feof($fp)) > { > echo fgets($fp, 128); > } > fclose($fp); > } > > ?> > Steve Dix>==<[EMAIL PROTECTED] > http://www.stevedix.de/ > http://www.snorty.net/ > http://www.mp3.com/simpletons > http://www.geocities.com/motorcity/2706 > > > -- > 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] Session Variables
I have a function that i call at the beginning of each page (well, those that require user auth). checkLogin() this checks for a positive integer value in a session variable called intUserID $_SESSION['intUserID']; is that isn't a positive integer, i redirect to the login page. the login is split into two script, prompt and process. prompt is a form which POSTs data to the process script which in turn verifys the username/password and if valid, assigns $_SESSION['intUserID'] the value of the users user ID. all looks fine to me. .b p.s. is it just me or is the reply-to on this list a little odd? > -Original Message- > From: Phil Powell [mailto:[EMAIL PROTECTED]] > Sent: 16 April 2002 22:50 > To: [EMAIL PROTECTED] > Subject: [PHP] Session Variables > > > I understand the concept of session variables, so I want to know the best > methodology of approaching this: > > 1) HTML redirect to PHP page > 2) PHP page looks for session > a) If found, show some stuff > b) If not found, prompt user for username and password > 3) If no session, prompt user for username and password, once entered & is > ok, set session and redirect > > Following is a code snippet I borrowed that I think would work, correct me > if I'm wrong: > > // Setting a name for our session. > session_name("hasLoggedIn"); > // Starting Session. > session_start(); > // Register vars into session > session_register("username"); > // Setting values for session vars. > $HTTP_SESSION_VARS["username"]=$HTTP_POST_VARS["username"]; > // Referring a session info to another PHP. > echo "text"; > > Thanx!! > Phil > > > > > -- > 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] .inc over .php
i'm not sure if the same rules apply to PHP but with ASP I make all my includes contain only functions and constants, no free mark-up, and then save them as .inc.asp so if requested directly they return an empty script. .b > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED]] > Sent: 19 April 2002 11:38 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] .inc over .php > > > On Friday 19 April 2002 17:31, Danny Shepherd wrote: > > A third way could be to append .php onto those files too, > giving .inc.php, > > .class.php etc. > > > > > IOW make them into .php files? > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > So, is the glass half empty, half full, or just twice as > large as it needs to 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] .inc over .php
> On Friday, April 19, 2002, at 07:22 AM, .ben wrote: > > > i'm not sure if the same rules apply to PHP but with ASP I make all my > > includes contain only functions and constants, no free mark-up, and then > > save them as .inc.asp so if requested directly they return an empty > > script. > > Until the ASP processor craps out. Or if you had any scripts in such > format they would be executed -- which might not be desirable. ASP what does what? I've never experienced anything like that... what do you mean? Confused. > Much better to keep includefiles outside of document root or set a > directive with your web server to deny requests for those files > somehow. In Apache it's as easy as > > > Order allow,deny > Deny from all > > > Not sure about IIS though. Not sure if you can do that in IIS, but the method i describe works fine. Keeping includes out of the document root leads to messy webservers ime, tho, i have worked with a messy bunch of SysAdmins in the past :) .b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL question
In brief, and in no way finished (no error trapping, commenting, etc)... \n"; echo " \n"; echo "CatNumber\n"; echo "Title\n"; echo " \n"; while ($myrow = mysql_fetch_row($result)) { echo "\n"; echo " $myrow[0]\n"; echo " $myrow[1]\n"; echo "\n"; } echo "\n"; ?> hth, .ben > -Original Message- > From: Mantas Kriauciunas [mailto:[EMAIL PROTECTED]] > Sent: 22 April 2002 01:07 > To: PHP General List > Subject: [PHP] MySQL question > > > Hey PHP General List, > > Amm... can anybody point me to some good tutorial that talks about > SELECT from detabase? what i need is ... like i have table with lots > of rows and i need to output them all to the page... it goes > like most of news sections in the page... thanks for help. > (i need to learn more about SELECT'ing things from database) > > :--: > Have A Nice Day! > Mantas Kriauciunas A.k.A mNTKz > > Contacts: > [EMAIL PROTECTED] > Http://mntkz-hata.visiems.lt > > > -- > 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] Better standards in PHP-coding
I prefer the following: function doThing() { strFoo = 'bar'; } nice and tidy. at the end of the day, as long as code is commented, consistant in layout style, and works... that's enough. aint it? .b > -Original Message- > From: Frank [mailto:[EMAIL PROTECTED]] > Sent: 21 April 2002 02:52 > To: [EMAIL PROTECTED] > Subject: [PHP] Better standards in PHP-coding > > > > "The nice thing about standards is that there are so many to > choose between". > > Subject: Uses of block markers in coding > > GNU recommends a standard with block-markers aligned under each > other and a > number of people - including myself - find it senseless and > counter-progressive to keep up an older standard resting from old > days and > doing the programmer a disfavor. > > Too many programmers continue to use a style that originates back to the > days where dumb terminals with one-line memory and line-editors > was common. > > Those days it could take long time to submit a line to the mainframe. I > have tried it myself and in worst-case situations it could take > up to half > a minute to submit a line. > > So naturally we put more things into one line. Statements like > > if (tempratureM1>=tempratureSTP) {cout << "Warning! Cooling needed"; > log(tempratureM1, "Warning);}; > > all in one line. > > When editors became a little faster people started to write: > > if (tempratureM1>=tempratureSTP) { >cout << "Warning! Cooling needed"; log(tempratureM1, "Warning); } > > which is nicer to look at but would take many seconds more as one > more line > has to be submitted. > > - - - > > Nowadays few people have any problems with waiting for a CR. > > But for mysterious reasons a rest from the old forced "standard" remains > among people who use C(++) like languages. > > It is still standard to write > > if (some_expression) { >statements; >... > } > > What the "{" - the marking of the beginning of a block that should be > indented - is doing in the end of the line nobody has yet been able to > explain me. > > Why, then, are functions not written as > > function foo(parameter1, foo(parameter1, parameter2, ... parameterN) { > statements > ... > } > > ? > > In other block-structured languages you of course align > block-markers under > each other, allowing for easy scan. > > if expression > begin >statement; >... >... > end; > > I have yet to see anybody write > > if expression begin >statement; >... >... > end; > > - - - > > Does it matter? Oh, yes it does. A lot. As teacher I know from experience > that programmers has a harder time tracking their own block with a number > of "{"s dancing far out of sight in the right side of the screen. This is > not a matter of experience. No experience can ever make it > equally fast to > control structures based on vertically aligned block-markers contra those > where the marker can be found anywhere on a line. > > As an amusing result of the weird practice it has been necessary to > recommend a standard where the { }-pair is always used, even though there > is only one statement following an if: > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) { >oneStatement; > } > > instead of simply > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) >oneStatement; > > > Why the need for the extra "{ }"s? > > Of course because the the difference between > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) >oneStatement; > > (correct) and > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) { >oneStatement; > > (wrong) is easily overlooked because of the block marker put away > to the right! > > > But nobody overlooks the difference betweeen > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) >oneStatement; > > and > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) >{ >oneStatement; > > > where the missing "}" shines in the eyes. > > - - - > > We can only hope that some major standard-setters for PHP should make a > rational decision about what standard to choose and not just keep > "what we > are used to" for the disadvantage of future generations of programmers. > > http://www.gnu.org/prep/standards.htm > http://cs.nmhu.edu/personal/curtis/cs1htmlfiles/essentialssec6.htm > > > Best regards > > SFM > U5com Co Ltd. > > > -- > 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] Better standards in PHP-coding
> From: Martin Towell [mailto:[EMAIL PROTECTED]] > So what I'm basically saying is - choose a style that suits you, and be > _consistant_ with it - oh, and make sure you indent your code, there's > nothing worse than trying to read code that's not indented, or > indented all > over the place! > > Martin hear, hear! .b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP editor for windows
Other than notepad, interdev, ultraedit, etc (which i currently use for editing), does anyone know of a good editor for PHP for Windows, ideally with syntax colouring, etc? Cheers, .ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP editor for windows
thanks for all the replies, will have a play with those suggested. .b > -Original Message- > From: Caspar Kennerdale [mailto:[EMAIL PROTECTED]] > Sent: 22 April 2002 22:40 > To: PHP > Subject: RE: [PHP] PHP editor for windows > > > www.editplus.com > > -Original Message- > From: Scott St. John [mailto:[EMAIL PROTECTED]] > Sent: 22 April 2002 06:26 > To: .ben > Cc: PHP > Subject: Re: [PHP] PHP editor for windows > > > Macromedia/Allaire Home Site 5.0 has PHP color coding, not auto-complete, > but you can customize it for auto-complete if you want. You can also > make it tab 2 instead of 4 :) It's been my editor since the free version > 1.0 and it's a work horse. And Home Site has Ultra Dev/Dream Weaver > integration. > > PS-- This is MY opinion and NOT intended to start any Holy Wars. > > -Scott > > > > > On Mon, 22 Apr 2002, .ben wrote: > > > Other than notepad, interdev, ultraedit, etc (which i currently use for > > editing), does anyone know of a good editor for PHP for Windows, ideally > > with syntax colouring, etc? > > > > Cheers, > > > > .ben > > > > > > > > -- > > > > -- > 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
RE: [PHP] PHP editor for windows
> On Monday, April 22, 2002, at 09:36 AM, .ben wrote: > > > Other than notepad, interdev, ultraedit, etc (which i currently use for > > editing), does anyone know of a good editor for PHP for Windows, ideally > > with syntax colouring, etc? > > > > Cheers, > > > > .ben > > You use etc for editing? Sounds pretty cool. > > (stupid Monday morning humor) > > > > Erik Ahh, nothing like a bit of Python-esque humour to start the day (tho, my day started 8 hours ago!) Cheers, .b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP editor for windows
> > >>> Other than notepad, interdev, ultraedit, etc (which i currently > use > > >>> for > > >>> editing), does anyone know of a good editor for PHP for Windows, > > >>> ideally > > >>> with syntax colouring, etc? > > > >> You use etc for editing? Sounds pretty cool. > > This is a new product Erik, only released at the beginning of this > month, so it's no surprise that you haven't seen it in use yet. "etc" > (TM) is able to follow up the syntax coloring operation by making > changes to the code to correct syntax errors, puts brackets in exactly > the right place to indicate block structure within the code, imposes > data type prefixes in strict convention, chooses better variable names > than any caffeine-driven prog, and alerts designers to most logic errors > (the paid-support version guarantees a higher rate of success at the > last). > > =dn Actually, I think you'll find that those features are actually only available in Etc Plus! 2002 (Gold), Enterprise version. No i do not have a copy. .b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] file download in IE
I think this is only an issue with an un-patched IE5.01, anything higher than that should work fine. .b > -Original Message- > From: Negrea Mihai [mailto:[EMAIL PROTECTED]] > Sent: 23 April 2002 12:26 > To: [EMAIL PROTECTED] > Subject: [PHP] file download in IE > > > Hi! > > How on earth do I make Internet Explorer to download a file > generated with: > > header("Content-type: application/octet-stream"); > header("Content-Disposition: attachment; filename=$fname"); > include($this->dir . $fname); > exit; > > It works on http but I need it on https and if I try to download > it through > https Internet explorer says it can't find the website.. after it > asks me if > I want to save the file. > I have checked the page and it works with: netscape under windows and > konqueror, galeon, netscape under linux. > > I have seen reports on the web about this "feature" of Internet > explorer and > they all say to download some service pack.. I have updated my internet > explorer to the latest 6 version with all the updates on the web > but it still > does not work! > > Anyone knows a workaround for this? I don't want to do it with header > ("Location: somefile") because the file that I want to make available for > download is outside the webroot and i want it to be accessible > only through > my script. > > Thanks a lot! > > Eagerly waiting for a response, > > Mihai > > -- > 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] ASP to PHP
I am in the process of porting an ASP site to PHP and am really chuffed with how easy it is so far. I am slightly worried that doing a straight conversion may not be the best idea, but I plan to go through the site again when i'm done, and optimise for PHP where possible. .b > -Original Message- > From: Cal Evans [mailto:[EMAIL PROTECTED]] > Sent: 23 April 2002 12:53 > To: Chuck PUP Payne; [EMAIL PROTECTED] > Subject: RE: [PHP] ASP to PHP > > > Having moved a moderately sized website last year from ASP to PHP > I can say > from experience that if you can re-write it, the move will go smoother and > you will have fewer lines of code. I ended up with about 1/2 as many lines > of code to maintain after the port was done. > =C= > > * > * Cal Evans > * Journeyman Programmer > * Techno-Mage > * http://www.calevans.com > * > > > -Original Message- > From: Chuck PUP Payne [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 23, 2002 6:38 AM > To: [EMAIL PROTECTED] > Subject: [PHP] ASP to PHP > > > I got a strange request from a client. He wants to be able to take his ASP > pages and move them over to PHP so that he can run them on apache on his > linux server. I saw a tool yesterday ASP2PHP, but I am wanting to > know does > it work, how much is lost, is it easy to use? Is there another > way to change > ASP file to PHP with out a lot of re-writes? > > Chuck Payne > > > -- > 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
RE: [PHP] Upload
http://uk.php.net/manual/en/features.file-upload.php hth, .b > -Original Message- > From: Neil Highley [mailto:[EMAIL PROTECTED]] > Sent: 24 April 2002 15:53 > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Upload > > > Now this IS lazy programming. > > ;-) > > [EMAIL PROTECTED] > --- > "Life must be lived as play." > - Plato (427 - 347 BC) > > > - Original Message - > > From: Gabriele Biondo <[EMAIL PROTECTED]> > > To: Richard Emery <[EMAIL PROTECTED]> > > Sent: Wednesday, April 24, 2002 8:20 AM > > Subject: R: [PHP] Upload > > > > > > nope - to be honest, i didn't think to seek in the manual. > > Do you know where specifically? > > > > Thanks > > > > Gabriele > > > > -Messaggio originale- > > Da: Richard Emery [mailto:[EMAIL PROTECTED]] > > Inviato: mercoledì 24 aprile 2002 14.11 > > A: [EMAIL PROTECTED]; ML PHP > > Oggetto: Re: [PHP] Upload > > > > > > The PHP Manual has complete instructions for this. Did you look there > yet? > > > > - Original Message - > > From: Gabriele Biondo <[EMAIL PROTECTED]> > > To: ML PHP <[EMAIL PROTECTED]> > > Sent: Wednesday, April 24, 2002 8:00 AM > > Subject: [PHP] Upload > > > > > > Hi, guys! > > Does anyone know how to write a php script to upload a file > > from my browser? > > Moreover; how could i avoid security errors? > > > > Thanx in advance > > > > Gabriele > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP with MySQL
Just out of interest, what's the standard/best/tried&tested method for handling errors in relation to connecting to DB's? i.e. how to check that the connection was a success, and if not then display why. any pointers appreciated. .b > -Original Message- > From: Mike Eheler [mailto:[EMAIL PROTECTED]] > Sent: 03 May 2002 02:28 > To: [EMAIL PROTECTED] > Subject: [PHP] Re: PHP with MySQL > > > Typically it's done like: > > $db = mysql_connect('localhost','username','password'); > > The MySQL database detects what host you're connecting from, and appends > that to your username. I'm not sure if it's possible to specify an > alternate host. > > So if both PHP and MySQL are on the same machine, and you connect to the > MySQL server as 'username', MySQL will see you as 'username@localhost'. > > Mike > > > Paras Mukadam wrote: > > Hi Gurus, > > one MySQL - PHP query : while granting permissions to particular user in > > MySQL, the administrator has to give username@machine_address > !! Then how > > can we connect to MySQL through PHP only by passing "username" > as one of the > > arguments to mysql_connect() ? > > > > Thanks. > > Paras. > > > -- > 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: PHP with MySQL
John, presumably I can leave the error reporting on - but pipe it into a file if i wanted, rather than displaying on screen, and then redirect the user to another page? Not asking for code sample here, just whether I can do it or not :) /me goes to look up mysql_error() Cheers, .b > -Original Message- > From: Jon Haworth [mailto:[EMAIL PROTECTED]] > Sent: 03 May 2002 11:34 > To: '[EMAIL PROTECTED]'; PHP > Subject: RE: [PHP] Re: PHP with MySQL > > > Hi .ben, > > > Just out of interest, what's the standard/best/tried > > &tested method for handling errors in relation to > > connecting to DB's? i.e. how to check that the > > connection was a success, and if not then display why. > > Something like... > > $dbh = mysql_connect ("foo", "bar", "baz") > or die (mysql_error ()); > > has always worked well for me. When it comes to queries I > generally tack the > SQL on the end of the error, like this: > > $q = mysql_query ($sql, $dbh) > or die (mysql_error (). "". $sql. ""); > > Obviously it's a good idea to turn this error reporting off on a > production > site, otherwise you risk exposing details of your database structure. > > HTH > Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP with MySQL
Oh, i agree entirely. Ok, i'll look into the logging/mailing solution - something i've been doing in ASP for years but am new to in PHP. Cheers, .b > -Original Message- > From: Jon Haworth [mailto:[EMAIL PROTECTED]] > Sent: 03 May 2002 11:57 > To: '[EMAIL PROTECTED]'; PHP > Subject: RE: [PHP] Re: PHP with MySQL > > > Hi Ben, > > > John, presumably I can leave the error reporting on - > > but pipe it into a file if i wanted, rather than > > displaying on screen, and then redirect the user to > > another page? > > Of course you can - I generally have my pages send me email when > they throw > an error, but that's because I'm really lazy and I can't be bothered to go > and check log files all the time > > It's just not a stunning idea to display an error messages that give away > out any information you could hold back - one of the starting > points for an > attacker is to try and mess up your query strings, and if you're merrily > telling them exactly what the problem is, you're helping them out :-) > > Cheers > Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP with MySQL
Thanks John. > -Original Message- > From: John Holmes [mailto:[EMAIL PROTECTED]] > Sent: 03 May 2002 16:29 > To: [EMAIL PROTECTED]; 'PHP' > Subject: RE: [PHP] Re: PHP with MySQL > > > There's a whole section in the manual on it. There is a log_error() or > errorlog() function that'll write your errors to a file of your > choosing. > > ---John Holmes... > > > -Original Message- > > From: .ben [mailto:[EMAIL PROTECTED]] > > Sent: Friday, May 03, 2002 4:04 AM > > To: PHP > > Subject: RE: [PHP] Re: PHP with MySQL > > > > Oh, i agree entirely. > > > > Ok, i'll look into the logging/mailing solution - something i've been > > doing > > in ASP for years but am new to in PHP. > > > > Cheers, > > > > .b > > > > > -Original Message- > > > From: Jon Haworth [mailto:[EMAIL PROTECTED]] > > > Sent: 03 May 2002 11:57 > > > To: '[EMAIL PROTECTED]'; PHP > > > Subject: RE: [PHP] Re: PHP with MySQL > > > > > > > > > Hi Ben, > > > > > > > John, presumably I can leave the error reporting on - > > > > but pipe it into a file if i wanted, rather than > > > > displaying on screen, and then redirect the user to > > > > another page? > > > > > > Of course you can - I generally have my pages send me email when > > > they throw > > > an error, but that's because I'm really lazy and I can't be bothered > to > > go > > > and check log files all the time > > > > > > It's just not a stunning idea to display an error messages that give > > away > > > out any information you could hold back - one of the starting > > > points for an > > > attacker is to try and mess up your query strings, and if you're > merrily > > > telling them exactly what the problem is, you're helping them out > :-) > > > > > > Cheers > > > Jon > > > > > > -- > > 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] Tailing a log file {!?}
Is there a tail util for NT/W2K? .b > -Original Message- > From: Dave Raven [mailto:[EMAIL PROTECTED]] > Sent: 05 May 2002 10:33 > To: Liam MacKenzie; [EMAIL PROTECTED]; Tom Rogers > Subject: Re: [PHP] Tailing a log file {!?} > > > check directory rights. > > If need be, passwd the user and give it a shell. > then try on the console as the webserver user > to tail the file. > > - Original Message - > From: "Liam MacKenzie" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]>; "Tom Rogers" <[EMAIL PROTECTED]> > Sent: Saturday, May 04, 2002 11:26 AM > Subject: Re: [PHP] Tailing a log file {!?} > > > > That doesn't work either! > > Something's going on here... > > > > > > > > - Original Message - > > From: "Tom Rogers" <[EMAIL PROTECTED]> > > To: "Liam MacKenzie" <[EMAIL PROTECTED]>; > > <[EMAIL PROTECTED]> > > Sent: Sunday, May 05, 2002 6:49 PM > > Subject: Re: [PHP] Tailing a log file {!?} > > > > > > Hi > > The following works for me, give it a try with the correct path. > > > > > exec("tail -n 50 /usr/local/apache/logs/access_log",$result); > > echo count($result)." results returned. "; > > if(count($result) > 0){ > > foreach($result as $line){ > > echo $line.""; > > } > > } > > ?> > > > > Tom > > > > > > At 06:25 PM 4/05/2002, Liam MacKenzie wrote: > > >$cmd = exec("tail -n $len /www/hosting/domains/lanolot/logs/$open", > > >$result); > > > > > >echo "$cmd"; > > > > > >Still returns nothing under the top text. > > > > > >All log files are chmodded 644 and are owned by the web server. > > >The paths to the files are correct. > > > > > >I've run out of ideas =( > > > > > >Thanks > > > > > > > > >- Original Message - > > >From: "Jason Wong" <[EMAIL PROTECTED]> > > >To: <[EMAIL PROTECTED]> > > >Sent: Sunday, May 05, 2002 6:22 PM > > >Subject: Re: [PHP] Tailing a log file {!?} > > > > > > > > >On Saturday 04 May 2002 16:09, Liam MacKenzie wrote: > > > > Sorry, I should have included this in the first email... > > > > > >[snip] > > > > > > > When I call the page, I get the expected at the top: > > > > Excecuting: tail -n 150 /www/hosting/domains/lanolot/logs/error.log > > > > Displaying the last 150 lines of error.log... > > > > > > > > But there's nothing underneath it. > > > > > >1) Check that you have permissions to access the file > > >2) Add a 'return_var' to your exec() call. And check what this > contains. > > > > > >-- > > >Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > > >Open Source Software Systems Integrators > > >* Web Design & Hosting * Internet & Intranet Applications Development * > > > > > >/* > > >DeVries' Dilemma: > > >If you hit two keys on the typewriter, the one you don't want > > >hits the paper. > > >*/ > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > > > >-- > > >PHP General Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > -- > > PHP 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
RE: [PHP] Re: help!!!
Hi, I've locked myself out of my flat and left the oven on, could someone write me a PHP script to let me in, thanks. .b > -Original Message- > From: John Holmes [mailto:[EMAIL PROTECTED]] > Sent: 05 May 2002 23:39 > To: 'George Nicolae'; [EMAIL PROTECTED] > Subject: RE: [PHP] Re: help!!! > > > And I need a PHP script to help me take over the world. It has to be > fewer than 666 lines and I don't have MySQL. Also, could you write the > PHP in ASP, please? > > ---John Holmes... > > > -Original Message- > > From: George Nicolae [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, May 05, 2002 12:25 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Re: help!!! > > > > If you find someone pls tell him to write for me a new portal with > secure > > user authentication and a webmail system with Oracle backend. > > tanx. > > -- > > > > > > Best regards, > > George Nicolae > > IT Manager > > ___ > > PaginiWeb.com - Professional Web Design > > www.PaginiWeb.com > > > > > > "J. H." <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Can anyone here help me write a simple auto shop > > > scheduling program? Would really appreciate it if you > > > would help me out. > > > > > > Jane H. > > > > > > __ > > > Do You Yahoo!? > > > Yahoo! Health - your guide to health and wellness > > > http://health.yahoo.com > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Tailing a log file {!?}
IIS produced plain-text log files, this is what i'd like to tail ideally. cheers. .ben > -Original Message- > From: David Freeman [mailto:[EMAIL PROTECTED]] > Sent: 06 May 2002 02:01 > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Tailing a log file {!?} > > > > > Is there a tail util for NT/W2K? > > Almost certainly there will be a tool that will read the end of files. > The problem will be in what you want to look at. If you want to look at > log files on NT/2K then, AFAIK, they aren't actually vanilla text files > so a tail util won't do the job. I'm not actually sitting near an NT/2K > box at the moment so I can't check that for certain. > > CYA, Dave > > > > -- > 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: Making a Client-side HTTPS Request
> Jonathan Rosenberg wrote: > > I would like to be able to make a client side HTTPS request from > > one of my pages. From searching around, I see that I can do > > everything I want using the CURL library. But the ISP I am using > > does not have the CURL library installed. > > > > I'll ask them if they'll install this library. But, assuming > > they don't, do I have any other options for doing what I want? > > > > -- > > JR > > > > Even if they don't have it compiled into PHP, they might have curl > installed and available from the command line. If you want to do CLEINT-side HTTP requests i think you can use the MSXML-HTTP object within JS, but only if the objects are installed, and this may only be avail inside IE5.5> However, if you want to do it on the server you can do it using sockets. someone helped me with this a month or so ago, mail me for the code. .b -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] issue with PHP_XSLT?
hi, i got a problem. i installed sablotron (expat etc) and it seems to be working. my directory structures are like this: webroot = c:\apache\htdocs phproot = c:\apache\php i try putting my xsl files (1.xsl, 1.xml) into HTDOCS but it doesnt work and tries to look for the files in my PHPROOT! so, when i put the files in "c:\apache\php", it works. why does php_xslt.dll expect the files to be in PHP root? how can i change this to be able to pick up files from the document root itself? thanks, ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Referring Page
I am trying to set up a script that will do different things based on the reffering page, without having to include the information in the URL. Does PHP have a built in variable or function that would tell the rest of the script what page the user came from? Any help is much appreciated. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Referring Page
Trying to go the other way now - and maybe this isn't a PHP issue, but help would be appreciated anyway Is there a way to block the referring page information, so that if I send someone to a site, that site doesn't see what page sent the visitor to them? Looking at this from a marketing stand point, not sharing any marketing information keeps me employed. Thanks in advance all. Ben "Ben" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am trying to set up a script that will do different things based on the >reffering page, without having to include the information in the URL. Does >PHP have a built in variable or function that would tell the rest of the >script what page the user came from? Any help is much appreciated. > > Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] this has got me baffled: imagesx() and imagesy() reporting the wrong size?
On my site I have a web form for users to upload graphics, however there are constraints on the size allowed. Recently, a user has been having problems, because the code is reporting the wrong size - a size too small to be allowed! They sent me a copy of the image so I could confirm the error, and I have: even though the image is a 32x32 image (2-frame animated GIF, if it matters), imagesx() and imagesy() report that the image is 30x24! I have never had this problem before (or, at least, no one has reported it to me) so I'm tempted to think that it's a bug in PHP, or (more likely) I am missing something crucial... The relevant code: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // note: we do not get here if($itype != 'image/gif' && $itype != // 'image/png' && $itype != 'image/x-png'), so the problem should not // lie with an image type we were not expecting $w = imagesx($img); $h = imagesy($img); if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) { $error = 'The graphic\'s dimensions are not correct (' . $w . 'x' . $h . ').'; } else { ... } yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. I'd be happy to link the animated GIF in question... just in case there was a problem with the GIF itself, I tried opening it up in an (old) version of Fireworks, and re-exporting it, but the problem remains. besides the possibility of a bug in PHP, I'm wondering if I need to handle animated GIFs differently, or something like that? but again, this code has been running for... 3ish years without a problem like this ever being reported... quite confusing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] this has got me baffled: imagesx() and imagesy()reporting the wrong size?
Ashley Sheridan wrote: On Sun, 2009-11-15 at 15:07 -0500, Ben wrote: On my site I have a web form for users to upload graphics, however there are constraints on the size allowed. Recently, a user has been having problems, because the code is reporting the wrong size - a size too small to be allowed! They sent me a copy of the image so I could confirm the error, and I have: even though the image is a 32x32 image (2-frame animated GIF, if it matters), imagesx() and imagesy() report that the image is 30x24! I have never had this problem before (or, at least, no one has reported it to me) so I'm tempted to think that it's a bug in PHP, or (more likely) I am missing something crucial... The relevant code: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // note: we do not get here if($itype != 'image/gif' && $itype != // 'image/png' && $itype != 'image/x-png'), so the problem should not // lie with an image type we were not expecting $w = imagesx($img); $h = imagesy($img); if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) { $error = 'The graphic\'s dimensions are not correct (' . $w . 'x' . $h . ').'; } else { ... } yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. I'd be happy to link the animated GIF in question... just in case there was a problem with the GIF itself, I tried opening it up in an (old) version of Fireworks, and re-exporting it, but the problem remains. besides the possibility of a bug in PHP, I'm wondering if I need to handle animated GIFs differently, or something like that? but again, this code has been running for... 3ish years without a problem like this ever being reported... quite confusing. If you could link the gif I think that would help. Also, just to point out, the comment in the script is wrong, if the image is neither png or gif, the rest of the script will still be parsed. The if logic is like this: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); everything after that is executed perhaps you wanted something like this: if($itype == 'image' || $itype == 'image/png' || $itype == 'image/x-png') { if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // execute the rest of the image checking script } Thanks, Ash http://www.ashleysheridan.co.uk what I meant by the comment, is that that previous code DOES exist... to assure you that the problem isn't in having $img unset, or something along those lines. (I added in the comment after the fact.) I have uploaded the image causing the problem here: www.telkoth.net/temp/radioactive-bread-eek.gif I should also add: I have ended up working around the problem by using getimagesize() instead; that function is reporting the correct width and height. this furthers my belief that there's a bug somewhere with imagesx(), imagesy() or imagecreatefromgif()... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help needed with calculation
Chris Payne wrote: Hi everyone, I'm not sure of the correct formula for this, if I have a file - just for example, that is 10245458756 bytes long and the download speed is 60KB a second, what formula would I use to calculate how many seconds/minutes/hours it would take to download the file? Maths really isn't my strong point and formulas go over my head otherwise I wouldn't ask :-( Thanks everyone Chris $size = 1024548756; // in bytes $kb_per_sec = 60; // I assume you'll fill these in from elsewhere? $b_per_sec = $kb_per_sec * 1024; $seconds = $size / $b_per_sec; $minutes = 0; $hours = 0; if($seconds > 60) { // 60 seconds to a minute $minutes = (int)($seconds / 60); $seconds -= $minutes * 60; if($minutes > 60) { // 60 minutes to an hour $hours = (int)($minutes / 60); $minutes -= $hours * 60; // if you want to go further and calculate days, have at :) } } You could also approach this using modulus, but if you're not confident with math, this might be a more intuitive approach. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] this has got me baffled: imagesx() andimagesy()reporting the wrong size?
Ashley Sheridan wrote: On Sun, 2009-11-15 at 16:25 -0500, Ben wrote: Ashley Sheridan wrote: On Sun, 2009-11-15 at 15:07 -0500, Ben wrote: On my site I have a web form for users to upload graphics, however there are constraints on the size allowed. Recently, a user has been having problems, because the code is reporting the wrong size - a size too small to be allowed! They sent me a copy of the image so I could confirm the error, and I have: even though the image is a 32x32 image (2-frame animated GIF, if it matters), imagesx() and imagesy() report that the image is 30x24! I have never had this problem before (or, at least, no one has reported it to me) so I'm tempted to think that it's a bug in PHP, or (more likely) I am missing something crucial... The relevant code: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // note: we do not get here if($itype != 'image/gif' && $itype != // 'image/png' && $itype != 'image/x-png'), so the problem should not // lie with an image type we were not expecting $w = imagesx($img); $h = imagesy($img); if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) { $error = 'The graphic\'s dimensions are not correct (' . $w . 'x' . $h . ').'; } else { ... } yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. I'd be happy to link the animated GIF in question... just in case there was a problem with the GIF itself, I tried opening it up in an (old) version of Fireworks, and re-exporting it, but the problem remains. besides the possibility of a bug in PHP, I'm wondering if I need to handle animated GIFs differently, or something like that? but again, this code has been running for... 3ish years without a problem like this ever being reported... quite confusing. If you could link the gif I think that would help. Also, just to point out, the comment in the script is wrong, if the image is neither png or gif, the rest of the script will still be parsed. The if logic is like this: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); everything after that is executed perhaps you wanted something like this: if($itype == 'image' || $itype == 'image/png' || $itype == 'image/x-png') { if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // execute the rest of the image checking script } Thanks, Ash http://www.ashleysheridan.co.uk what I meant by the comment, is that that previous code DOES exist... to assure you that the problem isn't in having $img unset, or something along those lines. (I added in the comment after the fact.) I have uploaded the image causing the problem here: www.telkoth.net/temp/radioactive-bread-eek.gif I should also add: I have ended up working around the problem by using getimagesize() instead; that function is reporting the correct width and height. this furthers my belief that there's a bug somewhere with imagesx(), imagesy() or imagecreatefromgif()... It does indeed seem to be some sort of bug. I've just tested it with your image on my machine here and for imagesx() and imagesy() it gives 30 and 24 respectively. getimagesize() does return the correct dimensions though. The same image saved as a flat single layer gif from the Gimp behaves exactly the same way. This might not be a proper bug as such, as the image itself might be 32x32, but the first layer (the first frame in the animated version) is 30x24 when you remove the dead, unused, transparent background. Perhaps GD is meant to report on the *actual* size of the image, rather than the dimensions of the frame? Thanks, Ash http://www.ashleysheridan.co.uk ! interesting (that it's doing some kind of trimming). it hadn't occurred to me that it might be doing that. if that's the case, and intended behavior of these functions, I feel like it should definitely be mentioned somewhere on php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can I get the IP address from a visitor?
I happen to have grabbed this function from php.net a while back, and have been using it since: // by "fr600 at hotmail dot com" at http://us2.php.net/getenv function getip() { if(getenv('HTTP_CLIENT_IP') && strcasecmp(getenv('HTTP_CLIENT_IP'), 'unknown')) $ip = getenv('HTTP_CLIENT_IP'); else if(getenv('HTTP_X_FORWARDED_FOR') && strcasecmp(getenv('HTTP_X_FORWARDED_FOR'), 'unknown')) $ip = getenv('HTTP_X_FORWARDED_FOR'); else if(getenv('REMOTE_ADDR') && strcasecmp(getenv('REMOTE_ADDR'), 'unknown')) $ip = getenv('REMOTE_ADDR'); else if(isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], 'unknown')) $ip = $_SERVER['REMOTE_ADDR']; else $ip = 'unknown'; return($ip); } though as others have pointed out, IP address is not a very good way to uniquely identify visitors (at least not on its own). Lars Kristiansson wrote: Hi! This is probably the wrong forum. Please redirect me if im out of place. I would like to find out what IP address my visitor uses when visiting a php script page on my domain. This page would contain a form in which the visitor would state his/her message. My goal is to create purchase-orders written on unique files, and to separate them my idea was to baptize files with the IP addresses, which would ive each visitor an unique purchase-order... Any hints to a newbie? Cheers, Lars -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] After calling a Function the Script aborts without any error :-\
Hi Folks, i got a big problem. I have a script which includes some other script i tried include, require and require once. The problem is, if i do a function call to a function in one of these included files, the script aborts but without any error. The strange thing is, normally require should give an error if it can't include any file. But the files are accessible, error reporting is E_ALL. Some functions are callable but others not and still no error. the only way how i came to this was putting some die()s to see where the script is aborting. I hope anybody can help me because i have no idea what that could be. tia. Ben --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09.04.2004
AW: [PHP] After calling a Function the Script aborts without anyerror :-\
Its the same in my case. That's the point why i was wondering because if the function that i want to call wouldn't exist it would normally print an error... And to this comment >Or you can echo out something in the function you're trying to call... > >function whatever() { > echo ( "" ); > // More Code >} i can say that i did this but it didnt help in any way but i'll try this function exists -Ursprüngliche Nachricht- Von: William Lovaton [mailto:[EMAIL PROTECTED] Gesendet: Montag, 12. April 2004 16:36 An: [EMAIL PROTECTED] Betreff: Re: [PHP] After calling a Function the Script aborts without anyerror :-\ Hi, El lun, 12-04-2004 a las 09:27, John W. Holmes escribió: > From: "Ben" <[EMAIL PROTECTED]> > > > i got a big problem. I have a script which includes some other > > script i tried include, require and require once. The problem is, if > > i do a function call to a function in one of these included files, > > the script aborts but without any error. The strange thing is, > > normally require should give an error if it can't include any file. > > But the files are accessible, error reporting is E_ALL. Some > > functions are callable but others not and still no error. the only > > way how i came to this was putting some die()s to see where > > Do you have display_errors turned on? Sometimes I have this problems too, no matter if that setting is on. -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09.04.2004 --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09.04.2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] After calling a Function the Script aborts without anyerror :-\
But what if the function you are callign doesn't need any passed variable like $bar = foo(); ??? the more strange thing is, on a lamp environment (SUSE 9.0, PHP 4.3.5), the scripts worked, on a wamp (win2k, same PHP) and on a LAMP RH9 same PHP it didn't work. -Ursprüngliche Nachricht- Von: William Lovaton [mailto:[EMAIL PROTECTED] Gesendet: Montag, 12. April 2004 22:33 An: [EMAIL PROTECTED] Betreff: Re: [PHP] After calling a Function the Script aborts without anyerror :-\ El lun, 12-04-2004 a las 14:12, Don Read escribió: > > Sometimes I have this problems too, no matter if that setting is on. > > > > If the error occurs within a table element on a web page, Mozilla > won't display because it's waiting for the '' to begin > figuring out the display properties. I know that but this is not the case, I dont mix HTML with PHP, I use Smarty and the error is generated inside business logic functions. Sometimes it occurs when calling a method in a null variable. This usually shows the error message, but sometimes it doesn't and I don't know why. I use allow_call_time_pass_reference = Off and sometimes this triggers the problem: $x = foo("bar"); $y = foo($obj->getBar()); With this setting in off he two lines of code sometimes fails and some others doesn't fail. But when it fails it does it completely silent. To workaround the problem I have to do: $tmp = "bar"; $x = foo($tmp); or $tmp = $obj->getBar(); $y = foo($tmp); Regards, -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09.04.2004 --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09.04.2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: AW: [PHP] After calling a Function the Script aborts withoutanyerror :-\
to show all the code would be too much but some parts where the error happens are here. now i tried with function_exists.. define('SMARTY_DIR', 'smarty/'); require_once(SMARTY_DIR.'Smarty.class.php'); require_once("ichain/ua_index.php"); require_once("framework/framework.php"); require_once("framework/dbconn.php"); var_dump( function_exists('fw_db_connect') ); //true included from file "framework/dbconn.php" echo ""; var_dump( function_exists('fw_validate_kostenstelle') ); //false included from file "framework/framework.php" echo ""; var_dump( function_exists('ua_getConnect') ); //false included from file "ichain/ua_index.php" die("here"); $ua_lnk = ua_getConnect();// here the script would abort because the function doesn't exist, // but it does well as you can see in the comments the functions exist and are spelled correctly (copy & paste). the thing is in all included files are many functions. the problem here is the first 2 work and functions i want to call that are coded after line 100 or sth. like this in the incldued files can't be found. but i don't know why. now i tried get_included_files() that shows me all the files that i wanted to include correctly. but in the list of get_defined_functions(), in the user list are just some, but not all the functions, that are really in some files, for example in the file ua_index.php the function ua_getConnect(); if you need more source code, just tell me, because i still don't have any idea what that strange beahviour could caused by. thanks a lot. Ben -Ursprüngliche Nachricht- Von: William Lovaton [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 13. April 2004 01:06 An: [EMAIL PROTECTED] Betreff: Re: AW: [PHP] After calling a Function the Script aborts withoutanyerror :-\ Mmmm... very strange... can you print_r() the array returned by get_defined_functions(), get_included_files() and get_declared_classes() and see if every thing is going on right?? Use the last one if your included file define classes too. Can we review the code in the mailing list?? is it big? -William El lun, 12-04-2004 a las 17:51, Ben escribió: > But what if the function you are callign doesn't need any passed > variable like > > $bar = foo(); ??? > > the more strange thing is, on a lamp environment (SUSE 9.0, PHP > 4.3.5), the scripts worked, on a wamp (win2k, same PHP) and on a LAMP > RH9 same PHP it didn't work. > > > -Ursprüngliche Nachricht- > Von: William Lovaton [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 12. April 2004 22:33 > An: [EMAIL PROTECTED] > Betreff: Re: [PHP] After calling a Function the Script aborts without > anyerror :-\ > > > El lun, 12-04-2004 a las 14:12, Don Read escribió: > > > Sometimes I have this problems too, no matter if that setting is > > > on. > > > > > > > If the error occurs within a table element on a web page, Mozilla > > won't display because it's waiting for the '' to begin > > figuring out the display properties. > > I know that but this is not the case, I dont mix HTML with PHP, I use > Smarty and the error is generated inside business logic functions. > > Sometimes it occurs when calling a method in a null variable. This > usually shows the error message, but sometimes it doesn't and I don't > know why. > > I use allow_call_time_pass_reference = Off and sometimes this triggers > the problem: > > $x = foo("bar"); > $y = foo($obj->getBar()); > > With this setting in off he two lines of code sometimes fails and some > others doesn't fail. But when it fails it does it completely silent. > > To workaround the problem I have to do: > > $tmp = "bar"; > $x = foo($tmp); > > or > > $tmp = $obj->getBar(); > $y = foo($tmp); > > > Regards, > > > -William -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09.04.2004 --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.656 / Virus Database: 421 - Release Date: 09.04.2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] smarty
But i don't see an alternative in your "Example 3". I hate that coding mixed up with the rest of HTML/CSS. It may be fact, that the perfomance could get worse a bit when using smarty* but since your not coding sth. for a high traffic site the usability of code is more important than that little peace of loss in performance. Nevertheless it might be a neverending discussion like windows vs *nix... -Ursprüngliche Nachricht- Von: Chris de Vidal [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 14. April 2004 17:34 An: Kelly Hallman Cc: [EMAIL PROTECTED] Betreff: Re: [PHP] smarty > To make that claim, you're dropping a pretty heavy dis on a lot of > people who have invested a great deal of time, effort, and > subsequently realized great benefits from Smarty and it's templating > brethren. Not to mention all those who have devoted great effort in > the development of these tools. I believe it and most templating engines were written because many people didn't know they had an alternative. I could be wrong; if so, it is a "heavy dis." Didn't mean it that way, so if I am wrong I humbly apologize. --- __ Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.657 / Virus Database: 422 - Release Date: 13.04.2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page Numbering
I found the easiest solution is to use the 'Pager' package in pear http://pear.php.net/package/Pager Ben On Wednesday 19 Sep 2007 15:45, T.Lensselink wrote: > On Wed, 19 Sep 2007 10:23:58 -0400, "Dan Shirah" <[EMAIL PROTECTED]> > wrote: > > Becase I am using MSSQL not MYSQL. MSSQL does not have anything easy to > > use > > like LIMIT in MYSQL. So, to achieve the same functionality you have to > use > > the subqueries. > > > > Having the largest number as the inner most subquery value tells the > query > > to retrieve the records that are equal to that number minus 10(my results > > per page) > > > > So, if the inner most query has has a value of 30, the outer query will > > select records 21-30. > > > > And, it does this just fine because if I echo out my variables I see the > > numbers changing. But for whatever reason, the data being displayed is > not > > changing. > > > > > > On 9/19/07, T. Lensselink <[EMAIL PROTECTED]> wrote: > >> > >> On Wed, 19 Sep 2007 10:05:40 -0400, "Dan Shirah" <[EMAIL PROTECTED]> > >> wrote: > >> > Hello all, > >> > > >> > I am having a problem with trying to display a set amount of records > >> from > >> > my > >> > result. > >> > I have verified that the correct values for my variables are being > >> passed > >> > to > >> > the query. > >> > The calculation for the records that should be displayed per page is > >> > correct. > >> > The total number of records returned from my query is correct. > >> > And the calculated number of total pages to be displayed is correct. > >> > > >> > So, initially it displays the first 10 results as it should, and has > > the > >> > pages numbers at the bottom. The problem is, when I click on a > >> different > >> > page number the same 10 results are ALWAYS displayed. Even though my > >> > $page > >> > variable IS being updated. > >> > > >> > Any ideas why my results are not reflecting the page I select? > >> > > >> > > >> > >> > if(!isset($_GET['page'])){ > >> > $page = 1; > >> > } else { > >> > $page = $_GET['page']; > >> > } > >> > // Define the number of results per page > >> > $max_results = 10; > >> > // Figure out the limit for the query based > >> > // on the current page number. > >> > $from = (($page * $max_results) - $max_results); > >> > echo $from."FROM"; > >> > $page_results = $max_results + $from; > >> > echo $page_results."PAGE RESULTS"; > >> > // Query the table and load all of the records into an array. > >> >$sql = "SELECT DISTINCT * FROM ( > >> > SELECT TOP $max_results Value1, Value2 FROM ( > >> > SELECT TOP $page_results Value1, > >> > FROM my_table > >> > WHERE my_table.column = 'P' > >> > ) as newtbl order by credit_card_id desc > >> >) as newtbl2 order by credit_card_id asc"; > >> > > >> > print_r ($sql); > >> > $result = mssql_query($sql) or die(mssql_error()); > >> > //print_r ($result); > >> > $number_rows = mssql_num_rows($result); > >> > ?> > >> > >> > cellspacing='2' > >> > bordercolor='#00'> > >> > >> > if(!empty($result)) { > >> > while ($row = mssql_fetch_array($result)) { > >> > $id = $row['credit_card_id']; > >> > $dateTime = $row['date_request_received']; > >> > //print_r ($id_child); > >> > ?> > >> > > >> > >> > align='center'> > href='javascript:editRecord($id)'>$id" > >> > ?> > >> > >> > align='center'> > >> > >> > align='center'> > >> > >> > align='center'> > >> > > >> > >> > } > >> > } > >> > ?> > >> > > >> > >> > border="0"> > >> > > >> > >> > align='center'>Results: >> > ?> > >> > > >> > > >
Re: [PHP] Upgrade
It really depends on your situation. We are an ISP hosting lots of website. Upgrading from 4 to 5 means a lot of sites will have trouble. Personally I have some problem of upgrading from 4 to 5. The below codes work on 4: include("DB/DataObjects.php"); $pro = DB_DataObject::factory('Product'); $pro->find(); while($pro->fetch()) $allPro[] = $pro; But on 5, it has to be modified to include("DB/DataObjects.php"); $pro = DB_DataObject::factory('Product'); $pro->find(); while($pro->fetch()) $allPro[] = clone $pro; The above is only an example. So upgrading to 5 is not an option for us. -- Ben Web Design Shropshire, Software programing http://www.sparkcomputing.co.uk On Friday 21 Sep 2007 13:43, Zoltán Németh wrote: > 2007. 09. 21, péntek keltezéssel 08.16-kor Ed Curtis ezt írta: > > I'm currently running Debian Woody with PHP 4.1.2 installed by default. > > It's really stable and I like it alot. Would I run into any problems > > upgrading it to say 4.3.0. There are some functions I need in it that > > 4.1.2 doesn't have. I'm not ready to make the jump to PHP5 yet. I've > > tried it on a test server and have run into a couple of problems with > > the upgrade. > > I really don't think you should upgrade to 4.3.0 instead of going php5. > All versions of php4 are discontinued from the end of this year, see > php.net > If you insist on 4.3.0, I don't know of any problems with upgrading to > it, but pay attention to all the extensions - upgrade them also if > needed, etc... > > greets > Zoltán Németh > > > > > Thanks, > > > > Ed > > > > -- > 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] Redirection
Is there a way to take all the variables, no matter what their names and values are, from the parameters in a url and POST them to another URL so that they don't show up in the address bar? I've noticed a huge increase in my bounce rate since I added some tracking parameters to my urls, but I need the tracking parameters so I don't trust a client-side redirect. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Arrays
I hope this is not a stupid question, but I am learning how to work with Arrays, and am having trouble figuring out how to move array values from page to page and/or store in a db. Once again, I am new to arrays (and fairly new to PHP for that matter), so please don't get too technical in replies. Thanks so much for help. ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Please save me from insanity - PHP4 / OO
class Ob { var $prop; } class Test { function setMe(&$ob) { $ob->prop = $this; } } $ob = new Ob(); $test = new Test(); $test->setMe($ob); if ($ob->prop) error_log("PHP is OK"); else error_log("PHP is a fucking MARE"); What is my problem here? Please help! Thanks, Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Please save me from insanity - PHP4 / OO
Thanks a lot for your responses guys. Unfortunately it still isn't working for me. I've tried both : $ob->prop = &$this and $ob->prop &= $this (just in case) Neither produce a "PHP is OK". I'm using version 4.2.2 btw. (If ONLY I was on 5) Thanks again, Ben Greg Beaver wrote: Ben wrote: class Ob { var $prop; } class Test { function setMe(&$ob) { $ob->prop = $this; } } $ob = new Ob(); $test = new Test(); $test->setMe($ob); if ($ob->prop) error_log("PHP is OK"); else error_log("PHP is a fucking MARE"); What is my problem here? Please help! You've run into the "I really need PHP5" problem :) prop = &$this; // note another & } } $ob = new Ob; $test = new Test; $test->setMe($ob); if ($ob->prop) { error_log("PHP is more than OK"); } else { error_log("I forgot the second &"); } ?> Here's your PHP5 version prop = $this; } } $ob = new Ob; $test = new Test; $test->setMe($ob); if ($ob->prop) { error_log("PHP5 is *way* more than OK"); } else { error_log("This can't happen"); } ?> Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Please save me from insanity - PHP4 / OO
Thanks a lot Greg - those pesky &s! Code now all working... Greg Beaver wrote: Ben wrote: class Ob { var $prop; } class Test { function setMe(&$ob) { $ob->prop = $this; } } $ob = new Ob(); $test = new Test(); $test->setMe($ob); if ($ob->prop) error_log("PHP is OK"); You should use "if (is_a($ob->prop, 'test'))" Greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.3.10 breaking things?
Hi All, I just upgraded to 4.3.10 and have found a number of scripts have broken including: phpMyAdmin-2.6.1-rc1 squirrelmail-1.4.3a + the xss patch Both of these worked just fine with php 4.3.9 with the switch to 4.3.10 being the only change that has been made. In addition pdflib functions pdf_stringwidth, pdf_show_boxed, and pdf_get_value (plus more as I am quickly discovering) now require additional parameters although the current php documentation appears to suggest that these additional parameters are only required when using php5. Is anyone else experiencing similar problems? - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 4.3.10 breaking things? Back working after reverting to 4.3.9
Ben wrote: Hi All, I just upgraded to 4.3.10 and have found a number of scripts have broken including: phpMyAdmin-2.6.1-rc1 squirrelmail-1.4.3a + the xss patch I know, bad form replying to one's own message... Reverting back to 4.3.9 with the same build configuration options used in 4.3.10 has fixed the problems with the various scripts. Because I haven't found any other mention of others having a similar problem (both here and on the SM and phpmyadmin lists) I'm wondering if this is something stupid I've done. Any pointers would be most appreciated. Here are the build configuration options I used and my php.ini file. - Ben Build Configuration Options (used for both 4.3.9 and 4.3.10): ./configure \ --with-apxs=/usr/bin/apache-1.3.33/bin/apxs \ --with-mysql \ --with-pdflib=/usr/local \ --with-gd \ --enable-ftp \ --enable-gd-imgstrttf \ --enable-calendar \ --with-png-dir=/usr/lib \ --with-zlib-dir=/usr/include \ --with-freetype-dir=/usr/local/include/freetype2 \ --with-jpeg-dir=/usr/lib \ --with-tiff-dir=/usr/lib \ --enable-track-vars \ --enable-sockets \ --enable-trans-sid \ --with-mm=/usr/lib \ --enable-gd-native-ttf \ --with-dom=/usr/lib \ --with-xslt=/usr/lib \ --with-crack=/usr/lib php.ini (same file used for both 4.3.9 and 4.3.10 - pretty much stock): [PHP] engine = On short_open_tag = On asp_tags = Off precision= 14 y2k_compliance = Off output_buffering = Off zlib.output_compression = Off implicit_flush = Off allow_call_time_pass_reference = On safe_mode = Off safe_mode_exec_dir = safe_mode_allowed_env_vars = PHP_ safe_mode_protected_env_vars = LD_LIBRARY_PATH disable_functions = highlight.string = #CC highlight.comment = #FF9900 highlight.keyword = #006600 highlight.bg = #FF highlight.default = #CC highlight.html= #00 expose_php = On max_execution_time = 30 ; Maximum execution time of each script, in seconds memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) error_reporting = E_ALL & ~E_NOTICE display_errors = On display_startup_errors = Off log_errors = Off track_errors = Off warn_plus_overloading = Off variables_order = "EGPCS" register_globals = On register_argc_argv = On post_max_size = 8M gpc_order = "GPC" magic_quotes_gpc = On magic_quotes_runtime = Off magic_quotes_sybase = Off auto_prepend_file = auto_append_file = default_mimetype = "text/html" doc_root = user_dir = extension_dir = ./ enable_dl = On file_uploads = On upload_max_filesize = 2M allow_url_fopen = On [Syslog] define_syslog_variables = Off [mail function] SMTP = localhost sendmail_from = sendmail_path = /usr/lib/sendmail -t -i [Logging] [Java] [SQL] sql.safe_mode = Off [ODBC] odbc.allow_persistent = On odbc.check_persistent = On odbc.max_persistent = -1 odbc.max_links = -1 odbc.defaultlrl = 4096 odbc.defaultbinmode = 1 [MySQL] mysql.allow_persistent = On mysql.max_persistent = -1 mysql.max_links = -1 mysql.default_port = mysql.default_socket =/var/lib/mysql/mysql.sock mysql.default_host = mysql.default_user = mysql.default_password = [mSQL] msql.allow_persistent = On msql.max_persistent = -1 msql.max_links = -1 [PostgresSQL] pgsql.allow_persistent = On pgsql.max_persistent = -1 pgsql.max_links = -1 [Sybase] sybase.allow_persistent = On sybase.max_persistent = -1 sybase.max_links = -1 sybase.min_error_severity = 10 sybase.min_message_severity = 10 sybase.compatability_mode = Off [Sybase-CT] sybct.allow_persistent = On sybct.max_persistent = -1 sybct.max_links = -1 sybct.min_server_severity = 10 sybct.min_client_severity = 10 [bcmath] bcmath.scale = 0 [browscap] [Informix] ifx.default_host = ifx.default_user = ifx.default_password = ifx.allow_persistent = On ifx.max_persistent = -1 ifx.max_links = -1 ifx.textasvarchar = 0 ifx.byteasvarchar = 0 ifx.charasvarchar = 0 ifx.blobinfile = 0 ifx.nullformat = 0 [Session] session.save_handler = files session.save_path = /tmp session.use_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_maxlifetime = 28800 session.referer_check = session.entropy_length = 0 session.entropy_file = session.cache_limiter = none session.cache_expire = 180 session.use_trans_sid = 1 url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" [MSSQL] mssql.allow_persistent = On mssql.max_persistent = -1 mssql.max_links = -1 mssql.min_error_severity = 10 mssql.min_message_severity = 10 mssql.compatability_mode = Off [Assertion] [Ingres II] ingres.allow_persistent = On ingres.max_persistent = -1 ingres.max_links = -1 ingres.default_database = ingres.default_user = ingres.default_password = [Verisign Payflow Pro] pfpro.defaulthost = "test.signio.com" pfpro.defaultport = 443 pfpro.defaulttimeout = 30 [Sockets] sockets.use_system_read = On [com] [Printer] zend_extension="/usr/local/lib/php_accelerator_
[PHP] Re: PHP + MSSQL Problem
Alaor Barroso wrote: It looks like PHP can't communicate with MSSQL but it connect! Strange... What server platform are you using? If you are on *nix you will need to install freetds and then build php with freetds support before you can use mssql with it. Under a windows server platform this may not be necessary, I have never tried on windows. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: 4.3.10 breaking things? Back working after reverting to 4.3.9
Michael Sims wrote: Ben wrote: Reverting back to 4.3.9 with the same build configuration options used in 4.3.10 has fixed the problems with the various scripts. Do you use Zend Optimizer? No, but thanks for the suggestion! Turning off php accelerator in my php.ini seems to have solved the problem for phpmyadmin and squirrelmail. Many thanks! FWIW, if you are building pdflib 6.0.1 support into php I found I had to use the php binding files from pdflib instead of the ones included in the ext/pdf directory of the php source. And you should also be aware that the previously optional parameters for some of the pdf functions are no longer optional. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using encrypted passwords
Symbulos Partners wrote: Jason Wong wrote: Why? It's not going to offer any protection. If I know your encrypted password and am able to access your database using it there is no reason for me to know what your cleartext password is. In other words if I am able to read the file containing your password (whether encrypted or cleartext) then I can access your database. Sorry for the silly question, you are probably right. Would it be possible to encrypt the whole file, so that the password could not be read? Somewhere on your web server you are going to need to have whatever information is necessary for the web server to decrypt the file so that it can make use of it. That information will need to be readable by the user your web server is running as, just like your current file. About the only security benefit I can see from something like this is if the information required to decrypt the file came from the web site user over an SSL encrypted session, otherwise you are simply moving your plain text information to a different file. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie, easy question...
Garyh wrote: Below is a simple php file that recieves input from a form html file. The php file outputs the first and last name, but their is no space between the names. Does anyone know how I can get a space between name in the php file? As a minimum this will work: print(""$fusername." ".$lusername.""); ?> But it's a better idea to do something like this (assuming your form on the preceding page is like the following): You'd want to do this in yourscript.php: // Remove any tags from all $_POSTed variables to avoid xss problems foreach($_POST as $key => $value) { $_POST[$key]=strip_tags($value); } print("".$_POST['fusername']." ".$_POST['lusername'].""); ?> - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Exploit via phpBB?
Ashley M. Kirchner wrote: You're missing the fact that you need to read phpBB's web site from time to time. And subscribe to BugTraq. It would have given you a month's warning. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 4.3.10 failure
PaulWB wrote: My advise to everyone is not to install this version, the problems is creates are worse than the ones it fixed, a website with a few security wholes is better than no website. No website is better than a website with security holes, especially from the perspective of your fellow netizens who have to endure yet another infected machine on the net and whatever nastiness it is being used for. As for your 4.3.10 related troubles, mine cleared up once I got rid of the caching software I had been using. Post more information about the problem(s) you are having and you will likely find a solution. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to argue with ASP people...
Daniel Schierbeck wrote: Tony Di Croce wrote: What points can I bring up in PHP's favor? In what areas does PHP trounce ASP? First of all, ASP doesn't run on anything but Windows servers (unless you're willing to use ChiliASP... *hiss*) Exactly! Portability is key. Not being locked into a particular OS or web server allows for much more flexibility as you go forward. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sending multiple headers (session_start() and setcookie() )
Hi all, In my .php file, I'm using both session_start() and setcookie() before tag. It gives me following warning message: Warning: Cannot modify header information - headers already sent by (output started at D:\Apache Group\Apache2\htdocs\YC\songs.php:4) in D:\Apache Group\Apache2\htdocs\YC\ycphpfunc.php on line 148 My .php file looks like this: check_login($_POST['logusername'], $_POST['logpassword'], $_POST['remember']); } ob_end_flush(); ?> ... ... The call to check_login()calls setcookie() function through another function inside my "ycphpfunc.php" file. Can someone show me a way to include both session_start() and setcookie() before ? Thanks for your time! Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking a date for validity
Todd Cary wrote: My need has to do with claimants for class action lawsuits, so I guess having drop downs for months, days and years is one answer. Drop down menus can certainly make your life easier, especially if you're dealing with an international audience and wondering what order to put the year, month, and day. Once the info has been submitted you can check them against the checkdate function (http://ca3.php.net/manual/en/function.checkdate.php) to make sure they're valid (ie February 31st, etc.). - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..
bruce wrote: as an exercise, i took a look at mambo (the cms) and realized that it doesn't handle users who simply shut down their browser while on the system... thoughts/comments... The only way to deal with such situations is through a garbage collection routine that periodically deletes or marks as stale records for users who haven't requested a new page within a set period of time. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trying to figure out the best/efficient way to tell whois logged into a site..
bruce wrote: my question is still how do i determine for a given session, that a user is still on the site, or that the user is no longer on the site/system. i don't see an automated/system way of doing this. The web is stateless... There is no automated/system way of doing this. You know the last time a user requested a file, that's it. It's up to you to determine what's a reasonable timeout between page requests so that you can determine when someone has gone elsewhere. it appears that i might have to capture the session vars in a db, along with the associated time creation. it then appears that i'm going to have to have some way of continually updating the session 'time' to reflect that the user is still on the system/site. this kind of approach could be done via some include file for every page that the user hits on the site. i could then trigger off this to determine who's live/on the site. You can keep doing your session variables however you're currently doing them, just store a timestamp for each user in a db or file and update it every time the user requests a file. Your script that tells you how many users are online can then check against the db/file and count the timestamps less than $timeout seconds old, which will be your "users online". The script should also do garbage collection for any entries with timestamps older than your $timeout. the downside to this is that i could kill someone who might be on the system, but just not actively using the site.. maybe they stepped away... So have $extended_timeout which is a ridiculously long time out period during which users are marked as stale, but not deleted. If they request a file during the $extended_timeout you start counting them again, if they don't then after the $extended_timeout they are deleted. now, if there was/is away to examine the session var that i store using the session handler, such that i could determine which session var is still alaive.. then that would solve my issues Not really... Sessions are no more or less likely to be accurate for counting users on your site than what I've described above. They too time out after a period of time (set in php.ini) and are then subject to garbage collection. They hang around long after the user. however, as i've stated, i can't find any code sample/articles that get to this point.. any code/thoughts/comments/etc... Most forums have some type of "who is online" functionality, have a look at how they do it. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick Poll: PHP 4 / 5
Manuel Lemos wrote: I guess this should ring a lot of bells for those that expect to develop products targetted to PHP 5, because the numbers seem to show that PHP 5 is a flop, despite PHP 5.0.0 was released more than 1 year ago. I think it points more to hosting providers who don't want to force their clients to ensure their sites are php5 compatible. I'm sure if a client were to ask they would host them on a machine with php5, but if they are already on one with php4 they won't rock your boat. Hosting providers, which account for the vast majority of hosted domains, are pretty conservative. Personally, SimpleXML was all I needed to switch after a particularly frustrating bought with php4 and xml parsing. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..
Gustav Wiberg wrote: All you guys, please comment if the code is well or bad written and why... :-) Since you asked, a few things popped out from a security perspective, though I didn't read through your code very thoroughly Why limit your usernames/passwords to lower case? You've just made them significantly easier to brute force. $sql = $sql . "SELECT IDAnvandare FROM tbanvandare WHERE"; $sql = $sql . " Anvandarnamn=" . safeQuote($un) . " AND"; $sql = $sql . " Losenord=" . safeQuote($pw) . " AND"; Where is your safeQuote() function coming from? From what I can see of your code you aren't doing any testing against the username and password before they are used as part of your SQL query. Sure would suck to have an unauthenticated user drop or otherwise muck with your db! if (isset($_REQUEST["frmUsername"])) { $un = $_REQUEST["frmUsername"]; If you're going to use $_REQUEST you might as well just turn on register globals (no, don't!). If you're expecting a post look for a $_POST, if you're expecting a get look for a $_GET. Ditto with cookies. You really need to know where your variables are coming from if you want a measure of security. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: trying to figure out the best/efficient way to tell whois logged into a site..
Dan Baker wrote: Why is using $_REQUEST a security issue? You know every value in the entire array came from the end-user, and needs to be validated somehow. If your code is written so the end-user can send this data to you via a POST/GET/COOKIE, why not use $_REQUEST? On the one hand, you can't trust anything that came from the client, but on the other if you're expecting a variable to come from a cookie and instead it comes from a get you know something weird is going on, but using $_REQUEST you'll be oblivious. You ought to know where your variable values are coming from, $_REQUEST hides this. In older versions of PHP4 this is even more of an issue since $_FILE information was also included in $_REQUEST. If someone uploades a file while including conflicting information from another source (cookie, post, get) this could lead to all sorts of problems. And the lazy guy answer... typing $_POST and $_GET is faster than typing $_REQUEST ;-). - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: trying to figure out the best/efficient way to tell whois loggedinto a site..
Dan Baker wrote: On the one hand, you can't trust anything that came from the client, but on the other if you're expecting a variable to come from a cookie and instead it comes from a get you know something weird is going on, but using $_REQUEST you'll be oblivious. You ought to know where your variable values are coming from, $_REQUEST hides this. Interesting, but I think I wouldn't spend the extra code to detect if I was expecting a POST, but got a GET. If I didn't get the value from POST, I'd just assume it wasn't there -- I wouldn't go looking elsewhere for it, and report an error. Sorry, I didn't mean to suggest you spend the extra time checking to see if you got a get when expecting a cookie, I meant to suggest that if you were expecting a cookie you only look for a cookie and therefore ignore the get (and generate whatever error is appropriate if you didn't get the value). No point doing any extra coding. The point was that you shouldn't accept a variable from where you weren't expecting it, which $_REQUEST doesn't allow you to do. The *main* reason I use $_REQUEST is so I can code up GET and POST pages that all are handled by the same php functions. I may have an item called "Key" that contains what the end-user is expected to be doing ("User.Create" or "User.Edit" or whatever). Then I may have a link (GET) that has ?Key=User.Create, while a form (POST) that has a hidden value "Key" with value "User.Create". I don't really care if it came from a GET or POST -- if the data is all valid, I'll allow it to work. How are you passing your values to your functions? If you stick to local variables in your functions they won't care where you got the values from. Deal with the post or get values in whatever script handles your form submissions and have it pass the values on to your functions. IE In your post handling script: $result=doSomething($_POST['this'],$_POST['that']); In your get handling script: $result=doSomething($_GET['this'],$_GET['that']); - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: help out a noob w/ include & switch?
jay thompson said the following on 09/20/05 15:41: > My problem occurs only on the server (NT 5 b.2195, PHP 4.3.10, IIS 5.0) but > works great on my dev rig (XAMPP 1.4.15, VectorLinux). At first guess I'd say register globals is on for your test rig and off for your server. Since your variables are being passed in the url you should be referencing them with $_GET[''], so for instance at the top of navigate.php you should have: switch ($_GET['nav']) - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SUCCESS! Re: help out a noob w/ include & switch?
jay thompson said the following on 09/20/05 17:35: > Thank you all for the kind help. I have The site working now (once i move it > from the test loc. I'll post a link here. It's for a performance art > festival here in vancouver). The was actually with $_GET in the switch as > suggested by Ben. Thnks! I do however know about it's usage and even > investigated it on php.net and google searches but for whatever reasons > (novice??) I passed over it. > > One last time - Thank you! You're very welcome, I'm glad it helped. At the noob point you'd be wise to get into the habit of referencing your user provided variables with $_GET, $_POST, and $_COOKIE regardless of whether register globals is on or off on your server as it's a good habit to get into and will save you grief in the future. More info here: http://ca3.php.net/variables.predefined BTW, what festival is the site for (I'm also in Vancouver)? - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: email validation (no regex)
Jim Moseby said the following on 09/21/05 11:00: >>>So, what is the general thought about validating email >> >>addresses in this >> >>>manner? >>> >>>JM >> >>Thre is a good reason why virtually everyone uses regex >>patterns for email validating. > > > Excellent start! And that good reason is...? > How can regex ensure that the email address that is submitted is a valid (ie > working, able to receive email) address? > Why is regex a better way? Personally I would go for a combination. Regex is much faster so if you can eliminate fake addresses with regex you won't have to waste your time attempting to look up MX records or connect to mail servers that don't exist. My apologies for the line wrapping, but the following is a slightly modified function I found online and have been using for a while. It doesn't actually connect to the remote server and try sending to the address provided like your function does, it merely checks for a valid MX for the domain. The extra time spent attempting a fake send to an address was deemed not worth the bother as some mail servers (especially qmail) do not, by default or without patching, block messages from being sent to non-existant email addresses. Instead the message is accepted and bounced. Your method will not detect this. - Ben function isValidEmail($address, $checkMX = false) { // Return true or false depending on whether the email address is valid $valid_tlds = array("arpa", "biz", "com", "edu", "gov", "int", "mil", "net", "org", "aero", "ad", "ae", "af", "ag", "ai", "al", "am", "an", "ao", "aq", "ar", "as", "at", "au", "aw", "az", "ba", "bb", "bd", "be", "bf", "bg", "bh", "bi", "bj", "bm", "bn", "bo", "br", "bs", "bt", "bv", "bw", "by", "bz", "ca", "cc", "cf", "cd", "cg", "ch", "ci", "ck", "cl", "cm", "cn", "co", "cr", "cs", "cu", "cv", "cx", "cy", "cz", "de", "dj", "dk", "dm", "do", "dz", "ec", "ee", "eg", "eh", "er", "es", "et", "fi", "fj", "fk", "fm", "fo", "fr", "fx", "ga", "gb", "gd", "ge", "gf", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gs", "gt", "gu", "gw", "gy", "hk", "hm", "hn", "hr", "ht", "hu", "id", "ie", "il", "in", "io", "iq", "ir", "is", "it", "jm", "jo", "jp", "ke", "kg", "kh", "ki", "km", "kn", "kp", "kr", "kw", "ky", "kz", "la", "lb", "lc", "li", "lk", "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", "mr", "ms", "mt", "mu", "mv", "mw", "mx", "my", "mz", "na", "nc", "ne", "nf", "ng", "ni", "nl", "no", "np", "nr", "nt", "nu", "nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", "pn", "pr", "pt", "pw", "py", "qa", "re", "ro", "ru", "rw", "sa", "sb", "sc", "sd", "se", "sg", "sh", "si", "sj", "sk", "sl", "sm", "sn", "so", "sr", "st", "su", "sv", "sy", "sz", "tc", "td", "tf", "tg", "th", "tj", "tk", "tm", "tn", "to", "tp", "tr", "tt", "tv", "tw", "tz", "ua", "ug", "uk", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi", "vn", "vu", "wf", "ws", "ye", "yt", "yu", "za", "zm", "zr", "zw", "coop", "info", "museum", "name", "pro"); // Rough email address validation using POSIX-style regular expressions if (!eregi("[EMAIL PROTECTED],}\.[a-z0-9\-\.]{2,}$", $address)) { return false; } else { $address = strtolower($address); } // Explode the address on name and domain parts $name_domain = explode("@", $address); // There can be only one ;-) I mean... the "@" symbol if (count($name_domain) != 2) // There can be only one ;-) I mean... the "@" symbol if (count($name_domain) != 2) return false; // Check the domain parts $domain_parts = explode(".", $name_domain[1]); if (count($domain_parts) < 2) return false; // Check the TLD ($domain_parts[count($domain_parts) - 1]) if (!in_array($domain_parts[count($domain_parts) - 1], $valid_tlds)) return false; // Search DNS for MX records corresponding to the hostname ($name_domain[0]) if ($checkMX && !getmxrr($name_domain[1], $mxhosts)) return false; return true; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: session and cookie by javascript
Alex Andrew Mosqueda said the following on 09/22/05 06:28: > Hi! > I there a way I can get the cookie data stored by javascript(client side) in > php(server side) and vice versa? > Thanks. It never hurts to check php.net, plenty of useful information there... $_cookie[''] http://ca3.php.net/manual/en/features.cookies.php - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with Internet Explorer when downloading / viewing dynamically generated PDF files
Frank Arensmeier said the following on 09/22/05 03:59: > Explorer shows the PDF document as plain text only. Trying to save the > linked document to the computer (right click) gives something like "The > server can not be reached or the document does not exist." > > I know that explorer is a real p.i.t.a. when it comes to all kinds of > web standards. And my best guess is that this could have to do with > headers, or? I've been down this road... The following works for me. Note that it will cause IE to open the PDF via the acrobat reader plugin, if you want to force IE to download the PDF you'll need to change the header (look at the header page from php.net for info). // Dump the PDf to the browser $filename="FileNumber".$_SESSION['fileNumber']."_ReportNumber".$_SESSION['reportNumber'].".pdf"; $len=strlen($reportPDF); if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) { // IE Bug in download name workaround ini_set( 'zlib.output_compression','Off' ); } header("Content-type: application/pdf"); header("Content-Length: $len"); header("Content-Disposition: inline; filename=".$filename); print $reportPDF; Let me know if this doesn't solve your problem. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Trying to install PHP
Chris Boget said the following on 09/27/05 14:41: > I'm running a freshly installed Redhat 9, kernel version 2.4.20. Well, > at least > that's what rpm is reporting though I know the up2date utility (supposedly) > updated my kernel as well. > > Has anyone else had problems similar to this? If so, how did you end up > resolving those problems? Alternately, if anyone has an idea on what I can > do next, it would be most appreciative. My limited experience with Linux > in general and RedHat in particular has me at the end of my rope. If it's any consolation, just about everyone who has dealt with rpm packages has also experienced "dependency hell". It isn't fun, and it's been known to put a smirk on debian users' faces. It sounds like the libxml2 package you are trying to install is built for a different distribution. rpmfind.net is your friend: http://rpmfind.net//linux/RPM/dag/redhat/9/i386/libxml2-2.6.16-1.0.rh9.rf.i386.html You can also build from source. As an aside, if this is a new install and you're not too far down the set-up path you may want to reconsider your choice of RH9 as it is no longer supported by RH and as such there are no security updates being released by RH for it which will mean extra admin overhead in order to keep the machine secure. You may wish to look at RHEL, Fedora or CentOS distros if you want to stick with a RH based distro (although fedora has a quick update cycle that may make it unacceptable for server use). At the very least you should check out the fedora legacy project (http://www.fedoralegacy.org/) which releases security fixes for RH9 and older Fedora versions. If you have any more questions on this feel free to email me off list since this is not really php related. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP & SOAP for production
Reuben D. Budiardja said the following on 10/01/05 14:41: > Hello, > On Saturday 01 October 2005 17:13, jonathan wrote: > >>you could try the native SOAP extension in php5. > > I've looked at the php.net and saw "(no version information, might be only in > CVS)" in the docs. So is this already in the released version of PHP 5 or > not ? Yes, already in the release version: http://ca3.php.net/manual/en/ref.soap.php For php4 try nusoap: http://sourceforge.net/projects/nusoap/ - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How can I connect a remote server from phpmyadmin?
Ethilien said the following on 10/12/05 15:55: You need to edit the config.inc.php file in the phpmyadmin directory and set the appropriate server address/username/password information for your remote server. You might have to set a remote server up in cpanel for this to work however. And of course the mysql server has to be configured to allow remote access for the user(s) involved. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] prevent user from getting scripts outside the web folder [this better?]
Graham Anderson said the following on 10/13/05 15:31: Is this a bit better ? As directed, I 'sanitized' all user input variables with trim and mysql_real_escape_string. thanks for everyone's patience as I am starting at ground zero concerning security. if( isset($_REQUEST['cmd']) OR isset($_REQUEST['path'] )) { // decrypt and santize variables $cmd = isset($_REQUEST['cmd']) ? cleanser(decrypt($_REQUEST ['cmd'])) : $cmd="null"; $path = isset($_REQUEST['path']) ? cleanser(decrypt($_REQUEST ['path'])) : $path="null"; . . . the cleanser script: function cleanser( $value ) { return mysql_real_escape_string( trim( $value ) ) ; } the 'decrypt' function uses MCRYPT_RIJNDAEL_256 with a $key stored outside the web folder. many thanks :) My understanding is that mysql_real_escape_string will only work while you are connected to mysql. Not sure if that is the case in your situation. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fckeditor and PDF and pesky users
Richard Lynch said the following on 10/14/05 13:39: So... Do I: A) Attempt to hack fckEditor to "allow" a PDF to get uploaded, and then display a link to the PDF instead of alink to the fckEditor output. Good luck! B) Give them a separate, possibly confusing, input to upload files to tie in as links to the fckEditor area If you can teach them how to use it this would work well. Perhaps you could have them upload the file and then on the page with fckEditor on it you could provide them with the URL to use for creating the link. C) Dump fckEditor and only allow file upload, requiring them to compose HTML pages in some external application I'd stay away from this if they are already used to using fckEditor, especially if they can't figure out option B. Has anybody faced this, and with VERY non-technical users had better luck one way or another? Which of these fit in best with PHP, and why? I'm mostly used to educable users who can flex on functionality to get what they want, but this is more a case of needing to make this WORK for them their way. There are a number of PDF conversion programs available for pretty much every platform. http://jeff.cs.mcgill.ca/~luc/PSto.html You could convert the file to jpeg or gif and then make the graphic available for using in fckeditor. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Still struggeling with my first script...
twistednetadmin said the following on 10/14/05 17:15: All: Sorry. I forgot to write what's wrongstupid me... Mike:1) I'm not sure how to indent the code... By putting spaces in front of some of the lines, it will make your code much easier to read and your life much, much easier. At its most basic you want to group lines within braces using indents so that you can easily tell what code is included in a particular loop/conditional statement. Here's a totally nonsensical example: This is equal to that\n"); foreach($otherThing AS $key => $value) { // Now we're looping through all the other things if($value!=$that) { print("That's the wrong value!\n"); } } // After looping through all the other things do something else here print("Finished with all those other things\n"); } else { // This is NOT that print("This is not that... how was I to know?\n"); } ?> 2) I'm using Dreamweaver, but not to write the code for me. I'm not that lazy :). And that's not the way for me to learn. It's just rather annoying that all the tutorials I have tried seems to fail. How can I learn when I'm apparently given the wrong information. Are you 100% certain that your php install is working properly? What error messages are you receiving? Make a page with only the following: What do you see when you open it? - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: php-general Digest 17 Oct 2005 10:35:46 -0000 Issue 3742
Richard Lynch said the following on 10/17/05 13:14: On Mon, October 17, 2005 6:06 am, Aftab Alam wrote: i want to generate Pdf file using php. how can i & what tools is required for this. One way is to start here: http://php.net/pdf When reading the above link note the last sentence under the Installation heading. You want to install the pdflib extension using PEAR with the command: pear install pdflib Once you've done that edit your php.ini and make sure it includes the line: extension=pdf.so Then restart your web server. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php, expect and screen
Olivier Cant said the following on 10/18/05 02:53: Hi list, I'm wondering if any one has any experience at connecting to a screen session under linux with a PHP script, and reading the pty output (and maybe writing somme stuff as well) I have an interactive program runing under screen which give me some status info, and I may also issue command to it and would like to interfce that whole thing using PHP... and screen because I can(t keep a console attached forever to it. Any idea ? man screen suggests you might be attempting the impossible. Does your program have to be run interactively or are there other non-interactive ways to get your status information? - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: moving website from windows to linux hosting
pedro mpa said the following on 10/24/05 10:13: Hi! I have to move my website from Windows hosting to a linux hosting machine. Does anyone have special tips, procedures I should consider? (Like changing directory paths from \ to / ). It's a classifieds posting website and it's in final testing stage. Pedro. Apologies for my bad English. Absolutely nothing wrong with your english! Aside from the paths you will want to check any system calls that you are doing. The only problem I have ever run into was that I had the error reporting level set differently on one platform than the other so I was getting errors about undeclared variables (bad habit) on one platform that I wasn't getting on the other. Otherwise I think you will find the move to be relatively painless. That said, I'd start testing on the Linux server as soon as possible just in case. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Decompress a zlib'd string in PHP
Graham Anderson said the following on 10/26/2005 09:07 AM: I'm sure if I can decompress the string, then it will not be too hard to do the rest :) To decompress the string you'll want gzuncompress. More on zlib & php: http://ca.php.net/manual/en/ref.zlib.php The on-line manual is your friend :-). - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: str_split() and errors?
Jason Gerfen said the following on 10/26/2005 12:12 PM: I am recieving this error in the logs when attempting to split strings with str_split(). I am not sure but isn't this a default function for PHP, as in there aren't any dependant packages involved during the ./confgure time? Errors: PHP Fatal error: Call to undefined function: str_split() in file.php on line 21 Did you read the second comment on the str_split manual page? I suspect you're using php4. http://ca.php.net/manual/en/function.str-split.php - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP for accsess control, preventing access to staticfiles
Dan Trainor said the following on 10/27/2005 10:39 AM: Jason Motes wrote: However, how do people protect against the downloading of real files, ones which are not parsed by PHP? .WMV, .MOV, .ZIP, .EXE and so on? I want to protect access to these as well, and if a visitor just types in a URL and is able to access the file because my access control mechanism simply doesn't work on those types of files, what should be the solution here? I'd like to keep the application as portable as possible; thus, I cannot use any kind of htaccess hackery because I want this PHP application to run on IIS, as well. Move the files outside the document root so that they aren't available via a direct URL, then create a 'file access page' in php that will check for the session variable and either send or not send the file based on whether the user has access. - Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php