[PHP] MSDE with PHP 4
Hi, Has anyone used PHP alongside MSDE? I've recently taken a brief look at freetds which allows a UNIX/LINUX box to talk to an MSSQL/SYBASE server, but I cannot find any metion of MSDE. Can anyone shed any light on this or report any successes? Cheers Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Disabling Browser "BACK" button
An Idea I have just had but not tested. To start:- Page1 - Input Form Page2 - Data Handling (i.e. processing the form) Page3 - Redirect handler. So, User fills in form on Page1 then submits it. Page2 then processes this data and if it handles it correctly it simply sends a redirect (something like a Meta Refresh with time set to 0) to Page3 which then sends you onto the final page. By using a querystring variable and checking this in page2 you could probably get rid of Page3 and have its part handled in page2. I hope this makes sense. Cheers Lee - Original Message - From: "César Aracena" <[EMAIL PROTECTED]> To: "'Petre'" <[EMAIL PROTECTED]> Cc: "'php-general'" <[EMAIL PROTECTED]> Sent: Wednesday, July 31, 2002 7:06 PM Subject: RE: [PHP] Disabling Browser "BACK" button Well... you simple can't unless you take advantage from all the wonderful features of PHP like it's capability to know where the request comes from. Another interesting point would be to see if your program is made correctly, so your script(s) will handle just the right stuff. That is, if you point your form in Page1 to a Script in Page2, you should be pretty sure that it will handle the right stuff. After all the handling was done, you should be able to unset the variables in order *FORBID* the user to push the REFRESH or BACK buttons, submitting the data all over again. > -Original Message- > From: Petre [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, July 31, 2002 2:50 PM > To: César Aracena > Cc: php-general > Subject: Re: [PHP] Disabling Browser "BACK" button > > I hear you, but how do I know if the POST comes from a valid form > submit, or from a "back" ? I cannot simply unset the $_POST vars, as > that will prevent anything from being posted correctly, right? > > > César Aracena wrote: > > >I think that would be easy just by UNSETTING or emptying the variables > >that the form passed after they are processed. Do I make sence? > > > >César > > > >>-Original Message- > >>From: Petre [mailto:[EMAIL PROTECTED]] > >>Sent: Wednesday, July 31, 2002 2:43 PM > >>To: Martin Clifford > >>Cc: php-general > >>Subject: Re: [PHP] Disabling Browser "BACK" button > >> > >>Well, OK, then, How do you design the app NOT to allow the form to > >> > >POST > > > >>again when the user hits "BACK" > >> > >>Martin Clifford wrote: > >> > >>>There is never a way to disable back, forward, home, etc buttons. > >>> > >They > > > >>all have shortcuts that will ALWAYS work, so there's really no point. > >>Additionally, it's all nice and good that your site works fine without > >>using cookies, and don't take this offensively, but if the client > >> > >cannot > > > >>use the back button without getting mishapen results, then it doesn't > >>sound as if the site is designed very efficiently. > >> > >>>Just my opinion. > >>> > >>>Martin Clifford > >>>Homepage: http://www.completesource.net > >>>Developer's Forums: http://www.completesource.net/forums/ > >>> > >>> > >>>>>>Petre <[EMAIL PROTECTED]> 07/31/02 01:16PM >>> > >>>>>> > >>>HI > >>>Is there a way I can disable the client's browser back button, > >>> > >forcing > > > >>>them to use the navigation I built into the page? > >>>Ideally, when they try to press "BACK" on browser, a popup asking > >>> > >them > > > >>>to use the navigation instead would win first prize. > >>> > >>>The reason I'm asking is again to do with sessions, I have an app > >>>running 100% now without using cookies, but if the user hits BACK and > >>>ignores the expire warning, the app produces unwanted results ( adds > >>>form data again to the db etc.) > >>>Just want to patch the holes. > >>> > >>>Maybe write my own little browser that has no back button?? > >>> > >>> > >>> > >> > >> > >>-- > >>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] include()
--snip-- > If you run your own server, you can set it up so that each webmaster is > locked into a private environment, but it's messy. According to me, you > would need a separate copy of apache for each site, each running under a > different user, and they would need to run on separate ports, which is a > nuisance. --snip-- Though I would add my 2 pennies worh on this but it is probably more on an Apache list answer but, I recently asked a question about something similair myself on the Apache mailing list. You can have mutiple apache servers running on the same machine as long as you have used the "Listen IP:Port" Directive on each Apache server Instance to limit the IP it listens to. Therefore as long as each site has its own IP address you would not need to use different ports. I am not aware of any ISP/web host that runs like this though, due to the extract resources (e.g. memory & CPU time) required to run the muliple instances. Cheers Lee - Original Message - From: "Simon Ritchie" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 01, 2002 11:30 AM Subject: RE: [PHP] include() > > I suppose include() can be used to include files from remote > > systems(not on > > WINDOWS). > > Only if the sysadmin running your web server allows it, which they should > not. > > > > A webmaster on the same server can always use a path like > > "/home/htdocs/.../config.php" and include my config .php which contains my > > database password !! > > Not quite, but if you are on a shared server hosted by somebody else, there > is a potential problem. If somebody can figure out the name of the function > that opens the database, they could call it, potemtially giving access to > the data. You could use the solution posted by Justin French to make sure > that the function does nothing for them when they call it. > > As other people have said, your hosting organisation should set the system > up so that nobody can read your PHP code, and that nobody outside the host > computer can include it. However, I think it would be difficult for them to > stop another user on the same server including your code. > > If you run your own server, you can set it up so that each webmaster is > locked into a private environment, but it's messy. According to me, you > would need a separate copy of apache for each site, each running under a > different user, and they would need to run on separate ports, which is a > nuisance. > > Simon Ritchie > > Download my introduction to PHP for $25: > http://merrowinternet.com/downloads?source=ml > > > -- > 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 Dynamic Pages & Apache Server
You could try using the readdir function to read a list of files (full docs available from http://www.php.net/manual/en/function.readdir.php) Here is an expanded version of the example give on the above link. File List $file"; } closedir($handle); } ?> This example assumes that the PHP script and files are in the same directory and are all publically accessible (i.e. a user could simple type http://www.example.com/filename) Hope this helps Regards Lee - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 01, 2002 5:57 PM Subject: [PHP] Php Dynamic Pages & Apache Server > I am trying to create a php page that will show the files on an apache server. > Each file will show up as a link on the page. When clicked, the user will be > able to download the file. Is there anyone out there that can lead me in the > right direction. > > -- > 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] Sessions not expiring
Hi, I have having problems getting the session to automatically destroy itself after inactivity. Currently I am using the following code, just to test my setup before writing a bigger project. Current Cache Expire = " . session_cache_expire(); // currently set to 1 in php.ini ?> my php.ini file has the following session settings:- [Session] session.save_handler = files 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 = 1 session.referer_check = session.entropy_length = 0 session.entropy_file = ;session.entropy_length = 16 ;session.entropy_file = /dev/urandom session.cache_limiter = nocache session.cache_expire = 1 session.use_trans_sid = 1 The server is running Apache 1.3.26, PHP4.2.1(apache module) on FreeBSD 4.6 Can anyone help, cheers Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ASP style "application-level" variables
Hi, Apologies if this question has already been asked in the past, but I have only just registered for this list. Does PHP in anyway support ASP style application-level variables in a similair way to how standard sessions are used. Though of implementing this as either files or database records but the additional coding could be more error-prone or eat more system resources than using a feature built into PHP itself. I would be interested to hear other peoples views on this feature. Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include files or fopen
Hi, I am trying to write a program that is very modular in nature & one of the features I need the user to be able to do is install/uninstall or enable/disable the module though the interface. I have though of 2 ways this could be done, either when the module is installed it adds additional lines to an include file, which means the next time the page is loaded the new module will also be included. Alternatively I though of writing my own config files and using fopen etc to read in the values and store them as appopriate. If I was writing this as a compiled program in C / Java, I would definately use the fopen method as the operation only needs to be done either a program start or when a new module is added. However with PHP the operation would need to be done on each page request. As far as I can tell both methods ultimately come down to opening a file and reading it in, but I would think that the built in include directive would be less of a performance risk that writing my own handler. The problem is by using include files I run the risk of if my script/server crashes half-way though a write or the user makes an error when editing the page directly it would possibly bring down the whole app, where as if I read the values in via my own file & methods I can ensure that the values and syntax are valid before acting upon what is read in. Therefore if my assumptions are correct I am caught between either possibily having a faster program but is possibly not a resiliant to error, or a slower program that is more resiliant and can exit nicely on error. Any thoughs that people have on this would be appriciated. Regards Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CANT GET STUFF TO WORK
I am new to PHP & Sessions myself. But I think $_SESSION['varname'] may be what you are looking for. e.g. $_SESSION['count'] = 2; - Original Message - From: "Mike" <[EMAIL PROTECTED]> To: "Jay Blanchard" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 09, 2002 8:37 PM Subject: Re: [PHP] CANT GET STUFF TO WORK > I have read that, I am still confused, I have made it so that the > session_start is at the top of all the pages, and I can't get some of the > variables out of the script (i.e. I set a variable with > session_register('user')) and on the next page I could not get the user > variable out of the session on the next page.. does that help out? > Thank You, > Mike > > - Original Message - > From: "Jay Blanchard" <[EMAIL PROTECTED]> > To: "'Mike'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, July 09, 2002 3:25 PM > Subject: RE: [PHP] CANT GET STUFF TO WORK > > > > http://www.php.net/manual/en/ref.session.php > > > > Start there, and then when you can tell us what the more specific problems > > are with your sessions we will be able to help. > > > > Jay > > > > -Original Message- > > From: Mike [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, July 09, 2002 2:20 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] CANT GET STUFF TO WORK > > > > > > Hello, I am wondering if you could help me... I can't seem to figure out > how > > to get sessions working. > > Thank You, > > Mike > > > > > > > > > -- > 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] CANT GET STUFF TO WORK
I am new to PHP & Sessions myself. But I think $_SESSION['varname'] may be what you are looking for. e.g. $_SESSION['count'] = 2; Regards Lee. - Original Message - From: "Mike" <[EMAIL PROTECTED]> To: "Jay Blanchard" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 09, 2002 8:37 PM Subject: Re: [PHP] CANT GET STUFF TO WORK > I have read that, I am still confused, I have made it so that the > session_start is at the top of all the pages, and I can't get some of the > variables out of the script (i.e. I set a variable with > session_register('user')) and on the next page I could not get the user > variable out of the session on the next page.. does that help out? > Thank You, > Mike > > - Original Message - > From: "Jay Blanchard" <[EMAIL PROTECTED]> > To: "'Mike'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, July 09, 2002 3:25 PM > Subject: RE: [PHP] CANT GET STUFF TO WORK > > > > http://www.php.net/manual/en/ref.session.php > > > > Start there, and then when you can tell us what the more specific problems > > are with your sessions we will be able to help. > > > > Jay > > > > -Original Message- > > From: Mike [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, July 09, 2002 2:20 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] CANT GET STUFF TO WORK > > > > > > Hello, I am wondering if you could help me... I can't seem to figure out > how > > to get sessions working. > > Thank You, > > Mike > > > > > > > > > -- > 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] CANT GET STUFF TO WORK
>From the work I have done, I have found that in the event PHP doesn't do this automatically (such as in some javascript code), you need to ensure you include a PHPSESSID varible in the URL something like: print "www.mysite.net?PHPSESSID= " . session_id(); - Original Message - From: "Mike" <[EMAIL PROTECTED]> To: "Jay Blanchard" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 09, 2002 8:56 PM Subject: Re: [PHP] CANT GET STUFF TO WORK > I used both a post and a get (using print " href=\"$PHP_SELF\".session_name()."=".session_id(). ">click here";) and > a post, but they don't seem to work. > Mike > - Original Message - > From: "Jay Blanchard" <[EMAIL PROTECTED]> > To: "'Mike'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, July 09, 2002 3:43 PM > Subject: RE: [PHP] CANT GET STUFF TO WORK > > > > How did you do it, POST? GET? Is there a form involved? Can you show us > the > > code from the two pages? Maybe my ESP will kick in :^) > > > > -Original Message- > > From: Mike [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, July 09, 2002 2:37 PM > > To: Jay Blanchard; [EMAIL PROTECTED] > > Subject: Re: [PHP] CANT GET STUFF TO WORK > > > > > > I have read that, I am still confused, I have made it so that the > > session_start is at the top of all the pages, and I can't get some of the > > variables out of the script (i.e. I set a variable with > > session_register('user')) and on the next page I could not get the user > > variable out of the session on the next page.. does that help out? > > Thank You, > > Mike > > > > - Original Message - > > From: "Jay Blanchard" <[EMAIL PROTECTED]> > > To: "'Mike'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Tuesday, July 09, 2002 3:25 PM > > Subject: RE: [PHP] CANT GET STUFF TO WORK > > > > > > > http://www.php.net/manual/en/ref.session.php > > > > > > Start there, and then when you can tell us what the more specific > problems > > > are with your sessions we will be able to help. > > > > > > Jay > > > > > > -Original Message- > > > From: Mike [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, July 09, 2002 2:20 PM > > > To: [EMAIL PROTECTED] > > > Subject: [PHP] CANT GET STUFF TO WORK > > > > > > > > > Hello, I am wondering if you could help me... I can't seem to figure out > > how > > > to get sessions working. > > > Thank You, > > > Mike > > > > > > > > > > > > > > > > > > > > > > -- > 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] Installing MYSQL on Windows
Have a look at http://www.mysql.com/doc/W/i/Windows_installation.html Cheers Lee. - Original Message - From: "Varsha Agarwal" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 15, 2002 10:12 PM Subject: [PHP] Installing MYSQL on Windows > Hi, > Can anyone tell me steps for installing MYSQL on > windows ?? > -Varsha > > __ > Do You Yahoo!? > Yahoo! Autos - Get free new car price quotes > http://autos.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No text in form submission
Create a new php file and just put the following in it: should get you all the info you need Cheers Lee - Original Message - From: "Dean Ouellette" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, July 21, 2002 9:08 PM Subject: RE: [PHP] No text in form submission > Is there a way to tell, just contacted my host and they do not know, > they said they could look it up Monday when back in office > > -Original Message- > From: Jason Wong [mailto:[EMAIL PROTECTED]] > Sent: Sunday, July 21, 2002 2:26 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] No text in form submission > > On Monday 22 July 2002 01:52, Dean Ouellette wrote: > > Been working on trying to get form submission to work. > > > > Now have it so when click enter it e-mails me, but there is no text > > subitted in the e-mail > > What version of php are you using? > > > > $MailToAddress = "[EMAIL PROTECTED]"; > > $MailSubject = "Group volunteer list"; > > if (!$MailFromAddress) { > > $MailFromAddress = "$email"; > > } > > $Header = ""; > > $Footer = ""; > > > > foreach($_POST as $key => $val) > > { > > $val = stripslashes($val); > > $Message .= "$key = $val\n"; > > } > > What do you see when you: print_r($_POST) > > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > regex are more than some crappy posix thing > they are an art form > > - Marc Zealey on #kernelnewbies > */ > > > -- > 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] Application servers / job priorities ?
Hi, I am developing a portal that will allow users to perform various calculations on their data sets. These calculations (handled by C / Fortran programs) will be run as external processes (and may take up to a few hours to complete). I am wondering if there is something that I can use (either in PHP or as another external process) to act as an application server i.e. allow multiple users to submit requests for calculations, but place these requests in a queue - perhaps associating each calculation with a priority, and handling each request as appropriate. Can anyone suggest anything that may faciliate this? Any links/hints would be greatly appreciated. Thanks very much in advance. - Best regards, Lee -- 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] Serious Problems (Apache/PHP/Sessions)
Ive been trying to get IMP 3.0 RC3 (web-based IMAP client) to work under php / apache / imap2000 c-client. When I install php 4.0.6 or 4.1.0 with apache 1.3.20 or 1.3.22 using dso/apxs everything works except for one major problem: After one is logged in (a session is opened) for a while (and other users open sessions), when you click on a page that relies on sessions the page never loads, it just stalls continuosly before timing out to "cannot display page" after about 3 - 4 minutes. If you close your session (close your browser) or clear the /tmp/sessions folder on the server, everything is fine the links work again temporarily. I might think this is something to do with IMP, but Ive tried other IMAP webmail clients, and Ive had the same problem. Ive tried 5 different platform/browser combinations. I have this problem with 4.0.6/4.1.0 and apache 1.3.20+ So next I tried compiling php into apache with -activate-module=php.. and when I do this, Apache segfaults 11 when an imap connection is opened! Ahhh! Does anyone have IMP or any other imap software running under a current version of php apache with a moderate load? Thanks, Lee
[PHP] Parse error
I'm new to PHP and am slowly learning it. I have the following code that is giving me errors could someone take a look and suggest a fix? Parse error: parse error in /home//public_html/Info/datain.php on line 7 -- Thanks __ Brent Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Parse error
Everything works great now. Thanks for the quick responses everyone. "Brent Lee" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm new to PHP and am slowly learning it. I have the following code that is > giving me errors could someone take a look and suggest a fix? > > Parse error: parse error in /home//public_html/Info/datain.php on > line 7 > > > $db = mysql_connect("localhost", "","xx"); > mysql_select_db("learndb",$db); > $sql = "INSERT INTO personnel (firstname, lastname, nick, email, salary) > VALUES ('$first','$last','$nickname',) > $result = mysql_query'($sql); > echo "Thank you! Information entered.\n"; > ?> > > > > > > -- > > Thanks > __ > Brent Lee > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] valid MySQL result resource
Here is another error I'm getting while trying to view my db. I copied and pasted these statements from a pdf file I'm using to learn PHP but they keep creating errors. I am writing all your tips into my notes to try to keep my questioning to a minimal. Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxx/public_html/Info/viewdb.php on line 8 "; echo"Full NameNick NameSalary"; while ($myrow = mysql_fetch_array($result)) { echo ""; echo $myrow["firstname"]; echo " "; echo $myrow["lastname"]; echo ""; echo $myrow["nick"]; echo ""; echo $myrow["salary"]; } echo ""; ?> -- Thanks __ Brent Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Transition Page?
I'm interested in how most would create a transition page.. I have an upload process that takes a bit before it changes the page displayed on the browser. I would like to create a transition page [Uploading Now .. please standby] that would refresh to a result page once the upload is done. Now I've seen this done on other sites (loading pages) and I'm sure there are many ways to do this, just looking for methods and pro/cons to the various approaches. thanks.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Transition Page?
>> I'm interested in how most would create a transition page.. > > One thing you might consider is using flush() to output > what you have so far to the browser rather than sending The problem I'm having is that the uploading of the file takes time, and the screen simply sits there while this is being done .. I don't know if there is a way around that. Flush would be fine if it could be done before the upload started; problem is, hitting submit starts the upload process which waits until it's done before receiving instructions included in the upload processing script. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if (a == b) ...
$a === $b TRUE if $a is equal to $b, and they are of the same type. (PHP 4 only) > -Original Message- > From: David Freeman [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 29, 2003 7:39 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] if (a == b) ... > > > > > I have a conditional: > > if (a == b) > > > > a is the number 0, but b is a string "Friday August 22". > > > > The condition is evaluating as true, which is not what I want. > > What am I misunderstanding? > > You're comparing a string to a number perhaps? > > I tried this: > > -8<- > $a = 0; > $b = "Friday August 22"; > > if ($a == $b) > { > echo "match"; > } else { > echo "no match"; > } > -8<- > > and resulted in 'match', then I tried this: > > -8<- > $a = "0"; > $b = "Friday August 22"; > > if ($a == $b) > { > echo "match"; > } else { > echo "no match"; > } > -8<- > > and resulted in 'no match'. > > It's worth remembering that the number 0 has somewhat special meaning in > php as a true/false indication. > > 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
[PHP] fputs / fwrites ?
Okay, so I want to open a file, get a small number from it (less than 3 digits) then overwrite a new number (incremented the original by 1) and close the file. The goal is to do this in the fastest way possible .. I don't like having to open the file more than once to do this. I've tried: $cfile = fopen("lcnt.txt", 'r+'); $lcnt = fgets($cfile,10); This results in $lcnt having a value of 1 (from value in text file) Now, if I increment it: $nc = $lcnt+1; then write it back to the file: $nul = fwrite($cfile, $nc); It writes starting at where the last read left off -- I want to start at zero offset so to overwrite the existing value. I can't find a method for resetting the offset pointer without having to close the file and reopen it with w+ There must be a simpler way to do this and I have a mental block. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fputs / fwrites
Okay, so I want to open a file, get a small number from it (less than 3 digits) then overwrite a new number (incremented the original by 1) and close the file. The goal is to do this in the fastest way possible .. it seems that there should be a way of doing this without having to open and close the file twice. I've tried: $cfile = fopen("lcnt.txt", 'r+'); $lcnt = fgets($cfile,10); This results in $lcnt having a value of 1 (loaded from value within text file) Now, if I increment it: $nc = $lcnt+1; then write it back to the file: $nul = fwrite($cfile, $nc); It writes starting at where the last read left off -- I want to start at zero offset so to overwrite the existing value. I can't find a method for resetting the offset pointer without having to close the file and reopen it with w+ There must be a simpler way to do this ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: any windows php developers out here?
"Victor" <[EMAIL PROTECTED]> wrote in message 01c2cfc7$b6ecd0d0$237b7018@JUMPY">news:01c2cfc7$b6ecd0d0$237b7018@JUMPY... > Hello, I am wondering if any of you got a reliable php and MySQL > installation (MySQL is easy) I am mostly wondering if there is a point > in tying to use windows as a development platform for PHP. I have a nice > and working red hat 8.0 installation, but I did an upgrade from 7.3 and > now apache doesn't work cuz it wants me to switch form apache 1.X to 2.X > and all I want is to erase the old apache and use the new one or erase > the new one and use the old one, whichever works. But anyway... I also > do design and I have people submit me illustrator and Photoshop files > and word docs, so for now I might have to stick to windows for work. BUT > what do u suggest? I it futile to try to get php to work in windows? > With IIS preferably so that I can play with ASP and Cold Fusion once in > a while. Please help if you are using windows with php and send me some > instructions if you feel like it, much appreciated. > > - Vic > > __ > Post your free ad now! http://personals.yahoo.ca Vic, I currently have PHP working both on IIS & Apache with Windows 2000. My personal recommendation to you would be to install Apache on Windows with the relevent PHP download, remember that certain features of PHP won't work though a CGI executable with I believe is still the only stable way of running PHP though IIS. I normally have IIS running on a port other than 80 which allows me0 to have both the IIS and Apache available simultaniously. Hope some of this helps. Regards Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: html tags
"Erich C. Beyrent" <[EMAIL PROTECTED]> wrote in message 008d01c2cfa3$fc752630$0a64a8c0@wolf">news:008d01c2cfa3$fc752630$0a64a8c0@wolf... > Hi everyone, > > A quick question about html tags and PHP. I have a text area where users > can submit text, and I need them to able to have links in the text if they > so choose. > > The contents get written to an ini style flat file database. > Is there any particular reason why you are using ini-style files. IMHO they are not very good for storing information that could potentially store multi-line content. I don't recall any programs using multi-line content back in the win-3.1 days. You wish to try using some other form of delimiter (or if available a database). For example. Using "**" to seperate records and "--" to indicate that start and end of the text data, e.g. month:day:year:time:bands:venue -- Event description, line 1 Event description, line 2 -- ** month:day:year:time:bands:venue -- Event description, line 1 Event description, line 2 -- ** month:day:year:time:bands:venue -- Event description, line 1 Event description, line 2 -- This is only a simple example, but may solve your problem. The only issues with doing this that I can see is that it would require a lot more work of the programmer but should not be to difficult to implement. Regards Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Why use XML?
"Christian Calloway" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > well Im out of a job so I am sitting around learning XML. It seems like a > great tool, but I am trying to figure out why I would actually use it? All > it does is seperate content and data, albeit on the client, but that is what > I have been doing with Smarty and MySQL for awhile now. Why would I choose > to parse XML documents with PHP and do transformations on the server, it > sounds terribly inefficient and complicated, as opposed to just pulling data > out of a database. I also realize that I can generate XML dynamically (ie > include PHP code in an actual XML template) by editing my Apache config, but > that is not always an option and what would be the point? It would just add > another layer of content/data seperation that would have to processed on the > other end. Thanks > > Chris > > Have a look at the following link: http://www.w3schools.com/xml/default.asp The section on "How XML Can be used" may provide the answers you need. Regards Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP mail function From header not working
"Marco Alting" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > When I try to use a php script, to send an email, the From header is > replaced by a senders email address of my provider. Is there any way to make > it so my email address shows up in the From header? > > In the script I used fake addresses, because of client privacy reasons... > > $email = "[EMAIL PROTECTED]"; > $mailheaders = "From: My Name\n"; > $mailheaders .= "Reply-To: [EMAIL PROTECTED]\n\n"; > > $message2 ="MESSAGE GOES HERE"; > mail($email,"TITLE",$message2,$mailheaders); > ?> > > Are you running this on Windows? If you are have a look at: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP mail function From header not working
"Marco Alting" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > When I try to use a php script, to send an email, the From header is > replaced by a senders email address of my provider. Is there any way to make > it so my email address shows up in the From header? > > In the script I used fake addresses, because of client privacy reasons... > > $email = "[EMAIL PROTECTED]"; > $mailheaders = "From: My Name\n"; > $mailheaders .= "Reply-To: [EMAIL PROTECTED]\n\n"; > > $message2 ="MESSAGE GOES HERE"; > mail($email,"TITLE",$message2,$mailheaders); > ?> > > Are you running this on windows? If you are have a look at: http://www.php.net/manual/en/ref.mail.php The "sendmail_from" setting may be what you are looking for. You will need to set it using ini_set. Regards Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Array
> "Michael" == Michael Smith <[EMAIL PROTECTED]> writes: Michael> Hey, I'm looking for a function to take an XML file and Michael> turn it into a PHP array with the same structure. here's something that I found on the internet a few months back. I've used it a number of times: C U TH E R E C U TH E R E C U TH E R E /* xmlize() is by Hans Anderson, [EMAIL PROTECTED] * * Ye Ole "Feel Free To Use it However" License [PHP, BSD, GPL]. * some code in xml_depth is based on code written by other PHPers * as well as one Perl script. Poor programming practice and organization * on my part is to blame for the credit these people aren't receiving. * None of the code was copyrighted, though. * * This is a stable release, 1.0. I don't foresee any changes, but you * might check http://www.hansanderson.com/php/xml/ to see * * usage: $xml = xmlize($array); * * See the function traverse_xmlize() for information about the * structure of the array, it's much easier to explain by showing you. * Be aware that the array is somewhat tricky. I use xmlize all the time, * but still need to use traverse_xmlize quite often to show me the structure! * */ function xmlize($data, $WHITE=1) { $data = trim($data); $vals = $index = $array = array(); $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $WHITE); xml_parse_into_struct($parser, $data, $vals, $index); xml_parser_free($parser); $i = 0; $tagname = $vals[$i]['tag']; if ( isset ($vals[$i]['attributes'] ) ) { $array[$tagname]['@'] = $vals[$i]['attributes']; } else { $array[$tagname]['@'] = array(); } $array[$tagname]["#"] = xml_depth($vals, $i); return $array; } /* * * You don't need to do anything with this function, it's called by * xmlize. It's a recursive function, calling itself as it goes deeper * into the xml levels. If you make any improvements, please let me know. * * */ function xml_depth($vals, &$i) { $children = array(); if ( isset($vals[$i]['value']) ) { array_push($children, $vals[$i]['value']); } while (++$i < count($vals)) { switch ($vals[$i]['type']) { case 'open': if ( isset ( $vals[$i]['tag'] ) ) { $tagname = $vals[$i]['tag']; } else { $tagname = ''; } if ( isset ( $children[$tagname] ) ) { $size = sizeof($children[$tagname]); } else { $size = 0; } if ( isset ( $vals[$i]['attributes'] ) ) { $children[$tagname][$size]['@'] = $vals[$i]["attributes"]; } $children[$tagname][$size]['#'] = xml_depth($vals, $i); break; case 'cdata': array_push($children, $vals[$i]['value']); break; case 'complete': $tagname = $vals[$i]['tag']; if( isset ($children[$tagname]) ) { $size = sizeof($children[$tagname]); } else { $size = 0; } if( isset ( $vals[$i]['value'] ) ) { $children[$tagname][$size]["#"] = $vals[$i]['value']; } else { $children[$tagname][$size]["#"] = ''; } if ( isset ($vals[$i]['attributes']) ) { $children[$tagname][$size]['@'] = $vals[$i]['attributes']; } break; case 'close': return $children; break; } } return $children; } /* function by [EMAIL PROTECTED], a HUGE help! * * this helps you understand the structure of the array xmlize() outputs * * usage: * traverse_xmlize($xml, 'xml_'); * print '' . implode("", $traverse_array . ''; * * */ function traverse_xmlize($array, $arrName = "array", $level = 0) { foreach($array as $key=>$val) { if ( is_array($val) ) { traverse_xmlize($val, $arrName . "[" . $key . "]", $level + 1); } else { $GLOBALS['traverse_array'][] = '$' . $arrName . '[' . $key . '] = "' . $val . "\"\n"; } } return 1; } -- Flowers of morning glory. +-+ The sky above this street |donate to causes I care about: | Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25 | --Sugita+-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML Array
>>>>> "Lee" == Lee Doolan <[EMAIL PROTECTED]> writes: >>>>> "Michael" == Michael Smith <[EMAIL PROTECTED]> writes: Michael> Hey, I'm looking for a function to take an XML file and Michael> turn it into a PHP array with the same structure. Lee> here's something that I found on the internet a few months Lee> back. here I am following up my own post yet again.. I forgot to include an example of use. here's a little snippet that uses xmlize(): ## probably actually should use join here. I guess I was too concerned ## about the whitespace $xData=""; while (list($k, $v)= each($xml)) { $xData .= trim($v); } ## turn the XML into an array $ary= xmlize($xData); ## split into several different arrays depending on donation amount $hofTable= $ary['patronHofTable']['#']['tableData']['0']['#']['hofTableEntry']; $platinumAry= $goldAry= $silverAry= $insiderAry= array(); if (!isset($hofTable['0']['#']['text'])) { foreach($hofTable as $hofkey => $hofVal) { $entry= $hofVal['#']['Data']['0']['#']; if ($entry > 999) { $platinumAry[]= $hofVal; } else if ($entry > 499) { $goldAry[]= $hofVal; } else if ($entry > 99) { $silverAry[]= $hofVal; } else { $insiderAry[]= $hofVal; } } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Nested page calls
I would like to perform nested page calls, where a page does conditional includes to itself The problem is how to avoid stepping over the variables Is there a way to define the page or parts of it as a function and still have the HTML sections of it editable by an html editor? That means without using the print command to create the output. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 14/07/2003
RE: [PHP] Nested page calls
Nice workaround - thanks, I will use it if I don't think of a better option What I wanted was something along the lines of my file be defined like this: ... Some HTML stuff ... ... Some HTML stuff ... there is also the question what happened when I include this file from another file -I think the include should be at the top and then later on the file should simply call the function - much like H file in C lee -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: þù 19 éåìé 2003 2:53þ To: [EMAIL PROTECTED] Subject: Re: [PHP] Nested page calls Lee Elenbaas <[EMAIL PROTECTED]> wrote: > I would like to perform nested page calls, where a page does conditional > includes to itself > The problem is how to avoid stepping over the variables not sure why but um.. $current_scope++; if ($condition) { include(__FILE__): } $scoped_vars[$current_scope]['varname'] = 'only for this file'; > > Is there a way to define the page or parts of it as a function and still > have the HTML sections of it editable by an html editor? That means without > using the print command to create the output. depends on the html editor, vi handles my html sections inside my functions pretty well.. Curt. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 14/07/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.501 / Virus Database: 299 - Release Date: 14/07/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: replacing everything between 2 strings
> "Matt" == Matt Palermo <[EMAIL PROTECTED]> writes: Matt> Is there a way to replace everything between 2 given strings Matt> if it exists? Say I have: Matt> $str = "replace anything and everything in here."; Matt> Now I want to replace everything between the word "replace" Matt> and "here.", so the new string could read something like Matt> this: Matt> $str = "replace NOTHING here."; how about something like this (untested) $newStr= preg_replace("/^(replace).*(here)$/", "${1} NOTHING ${2}", $str); sort of like in the manual: http://www.php.net/manual/en/function.preg-replace.php -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Debugging a Session Problem
I'm moving an application that I'm in the trying to move to a new platform. It was running fine on an older Linux platform with PHP 4.0.3 and Apache 1.3.14. The new platform is also Linux, with PHP 4.2.2 and Apache 1.2.26 -- with register_globals on. (I just upgraded it from 4.2.2.36 to 4.2.2.69 which is the latest rpm on SuSE's site, with no change in the problem.) The symptom is that when I attempt to save a session variable, it creates the session file in /tmp, but with a zero length - no variable names or values stored. (/tmp is globally read/write) This happens not only with the application I'm moving, but also with the "world's simplest global test pages" below. [page1.php] [page2.php] "; ?> You can try it yourself at http://4.43.81.92/page1.php and also see PHPinfo at http://4.43.81.92/phpinfo.php Because no one else seems to have this problem, I assume it's something on my system, or in the way things are set up, as opposed to a PHP code problem. What I'm looking for is any hints or tips of how to begin debugging it and finding how come it will create the session files, but leave them with zero length and no information... Any suggestions would be appreciated... Lee Stewart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Debugging a Session Problem
At 11:55 AM 7/25/2003, you wrote: If you are relying on cookies to transmit the session ID, make sure you have session cookies enabled in your browser. Also check that you don't have an .htacess file in your directory that is overriding the register_globals setting. Turn your error_reporting up to E_ALL and see if PHP has anything to say to you. Yes, cookies are enabled in the browser (and the same browser works with the application on the old system). And no .htaccess files. When I set error_reporting to E_ALL I do get: Notice: Undefined variable: test in /srv/www/htdocs/etrak/page2.php on line 3 which is the reference to $test in echo "test is $test"; because $test was to have been a session variable, but wasn't passed. Other than that, no errors. CPT John W. Holmes wrote: Seem to remember something about starting a session and then redirecting with header causing trouble. Try using session_write_close() before you redirect. I also tried adding the session_write_close() with no change... Each time I get a new session file in /tmp, but all are zero length... ls -l /tmp drwxrwxrwt6 root root 592 Jul 25 12:48 . drwxr-xr-x 18 root root 408 Jul 25 12:47 .. -rw---1 wwwrun nogroup 0 Jul 25 12:49 sess_39e04150efb3de58764ce04dae572401 -rw---1 wwwrun nogroup 0 Jul 25 11:57 sess_4d9573209bf3688c380d33c94f64be47 -rw---1 wwwrun nogroup 0 Jul 17 16:55 sess_5160b002714849a598a8a1e62a78a2eb -rw---1 wwwrun nogroup 0 Jul 20 08:36 sess_7a053a0dd515170e6d0ace739860b71f -rw---1 wwwrun nogroup 0 Jul 25 11:55 sess_903ef4579ee2f596981aad08efd3bc9d Thanks for any debugging suggestions... Lee -- Lee Stewart, Senior SE Sytek Services, a Division of DSG (719) 566-0188 , Fax (719) 566-0655 [EMAIL PROTECTED] www.sytek-services.com www.dsgroup.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Debugging a Session Problem
I agree that it's probably a config problem -- somewhere... Yes, the session ID is passed correctly, but since page1.php doesn't end up with any variables or values in the session file, so regardless that it has the right session ID, there's nothing in the session file to restore... The php.ini file is in /etc/php.ini (but that's where it's supposed to be in this distribution), and phpinfo shows it there, and when I turn register_globals on and off there, I see it change both in phpinfo and from a php script. And if you want to look, a copy of my php.ini is available at http://4.43.81.92/phpini.txt Lee At 02:51 PM 7/25/2003, Johnson, Kirk wrote: Your original code works for me, so it is a config issue somewhere. Add this code to each file, to verify that the session ID is being correctly passed: echo "session id is " . session_id() . ""; Also, is your php.ini in /usr/local/lib? If PHP can't find it, it will use its built-in defaults, which is register_globals off. Kirk -- Lee Stewart, Senior SE Sytek Services, a Division of DSG (719) 566-0188 , Fax (719) 566-0655 [EMAIL PROTECTED] www.sytek-services.com www.dsgroup.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to make a global scope array
//I have an array a[] like this: //Thanks for any help.!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to make a global scope array
It works! Thanks guys! "David Nicholson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, This is a reply to an e-mail that you wrote on Fri, 25 Jul 2003 at 23:51, lines prefixed by '>' were originally written by you. > <[EMAIL PROTECTED]> > Jack Lee: > > //I have an array a[] like this: > > > $a[]=0; > > //How to define and use it in a function like this? > > function myfunc(something) > > { > > echo $a[0]; //got error here Notice: Undefined variable: > > } > > //Thanks for any help.!!! > global $a; .. or echo $GLOBALS['a'][0]; David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Debugging a Session Problem
Using the $_SESSION[] style produces the same results... Zero length session file in /tmp, and no data passed... (available at http://4.43.81.92/page1a.php) So where do I go from here...Is there any way to debug it? Like I said, I suspect it's not a PHP code bug, but I'm at a loss as to where to go from here (other than re-writing the entire application in some other language -- which I really don't want to do)... Help? Lee At 04:36 PM 7/25/2003, Johnson, Kirk wrote: Sorry, I am stumped. I don't see any problems in the .ini file. Have you tried some simple code in "register_globals off" style? "; ?> Kirk -- Lee Stewart, Senior SE Sytek Services, a Division of DSG (719) 566-0188 , Fax (719) 566-0655 [EMAIL PROTECTED] www.sytek-services.com www.dsgroup.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to make a global scope array
Thank you very much! "David Nicholson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello, This is a reply to an e-mail that you wrote on Sat, 26 Jul 2003 at 00:50, lines prefixed by '>' were originally written by you. > Ouch! > Sometimes I wish global didn't exist Yes, it can be better to pass in a variable (by reference if you need to write to it from within a function and not have it as the value that you return), e.g. function doSomething(&$a){ $a = 20; return true; // to signify success } $a = 10; doSomething($a); echo $a; // prints 20 -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Get Local IP Address
How can I get the local Computer IP Address when running PHP program in Windows command line (i.e. php getmyip.php) ** Since the PHP did not are run on Webserver, so _SERVER["SERVER_ADDR"] won't work. Many thanks in advance. Regards, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Local IP Address
How can I get the local Computer IP Address when running PHP program in Windows command line (i.e. php getmyip.php) ** Since the PHP did not are run on Webserver, so _SERVER["SERVER_ADDR"] won't work. Many thanks in advance. Regards, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get Local IP Address
>Try this: >exec('ipconfig',$catch); >foreach($catch as $line){ >if(eregi('IP Address',$line)){ >list($t,$ip) = split(':',$line); >echo 'IP is '.$ip."\n"; >} >} >?> Thanks Tom, but I think it only work for Win NT, how about Win 9x? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Debugging a Session Problem
The only thing in the Apache error log is: [Fri Jul 25 16:19:31 2003] [error] PHP Notice: Undefined variable: test in /srv/www/htdocs/page2.php on line 3 No other messages I can find in any logs. df shows the file system only 70% full... At 08:38 AM 7/28/2003, Johnson, Kirk wrote: Anything in the Apache or PHP error logs? Permissions are OK, there is space on the drive? Kirk -- Lee Stewart, Senior SE Sytek Services, a Division of DSG (719) 566-0188 , Fax (719) 566-0655 [EMAIL PROTECTED] www.sytek-services.com www.dsgroup.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Sessions
Hi Curt, No I didn't see a post about space on /tmp... Using df it shows the file system to only be about 70% full, so there's plenty of space there. Did you mean something else? Any other thoughts on where to look? Thanks, Lee * Thus wrote Lee Stewart ([EMAIL PROTECTED]): > Using the $_SESSION[] style produces the same results... Zero length > session file in /tmp, and no data passed... (available at > http://4.43.81.92/page1a.php) You did see my post about space left on /tmp? > > So where do I go from here...Is there any way to debug it? Like I > said, I suspect it's not a PHP code bug, but I'm at a loss as to where to > go from here (other than re-writing the entire application in some other > language -- which I really don't want to do)... another language? how dare you say such thing here on this list :) Curt -- "I used to think I was indecisive, but now I'm not so sure." -- Lee Stewart, Senior SE Sytek Services, a Division of DSG (719) 566-0188 , Fax (719) 566-0655 [EMAIL PROTECTED] www.sytek-services.com www.dsgroup.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: preg_match
> "Michael" == Michael Temeschinko <[EMAIL PROTECTED]> writes: Michael> Hello, Michael> I would like to split a String containing ingredience with additional Michael> assigned footnotes... Michael> my problem I only get the first ingredience ($zutat at line 32 has Michael> only one times the awaited value) but the print on line 29 shows me Michael> that the value of $zutat is right at this point. Michael> what's wrong Michael>1 2 Michael>3 $products_ingredience = 'Gersten-Grütze²*, Gerstenmehl²*, Michael> Haferflocken*, Gemüse 12 % (Lauch*, Möhren*, Zwiebeln*), Haferkleie*, Michael> Steinsalz, Petersilie*, Kartoffelstärke*, Hefeextrakt, Sellerieblatt*, Michael> Kurkuma*, Muskatnuß*, Pfeffer*, Liebstöckl*'; Michael>4 Michael>5 ArtikelZutaten ($products_ingredience); Michael>6 Michael>7 Michael>8 function ArtikelZutaten($products_ingredience) { Michael>9 Michael> 10 Michael> 11 print "\n\n\n$products_ingredience)"; Michael> 12 $Zutaten = explode(",", $products_ingredience); Michael> 13 Michael> 14 foreach ($Zutaten as $zutat) { Michael> 15 if (preg_match("/\²/", $zutat)) Michael> 16 $FussnoteID = 2; Michael> 17 else Michael> 18 $FussnoteID = ''; Michael> 19 Michael> 20 if (preg_match("/¹/", $zutat)) Michael> 21 $FussnoteID = 1; Michael> 22 Michael> 23 if (preg_match("/\*/", $zutat)) Michael> 24 $kbA = 1; Michael> 25 else Michael> 26 $kbA = 0; Michael> 27 Michael> 28 preg_match("/\b.*\b/", $zutat, $matches); Michael> 29 print "\n-->>$zutat"; Michael> 30 $zutat = $matches[0]; Michael> 31 Michael> 32 print "\nZutat $zutat FussnotenID $FussnoteID kbA $kbA"; Michael> 33 Michael> 34 } Michael> 35 Michael> 36 } Michael> 37 Michael> 38 ?> what do you get if you print "\nmatches matches..."; var_dump($matches); right after line 32? -- no toll on the internet; there are paths of many kinds; whoever passes this portal will travel freely in the world -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session does not end when browser is closed.
Hi, I am using $_SESSION and each php page has session_start() Session Handling is working fine, except for one problem: when I close my browser and re-open it again, I am still logged in. I tested the log in and log out functions and they work fine. How can I terminate a session when the user closes the browser? All the while I thought a new session will be initiated when a new instance of the browser is used to access a page. Hanxue -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How can I load load Additional extensions ?
My OS is Winxp . My web server is apache 2 which is installed as a NT service . My php version is 4.32 , and I extracted it into "c:\php" . I run php as a apache module . I want to load Additional extensions .They are php_mbstring.dll, php_xslt.dll and php_domxml.dll . I have made changes to php.ini as follow. extension_dir = "c:\php\extensions" extension=php_mbstring.dll extension=php_xslt.dll extension=php_domxml.dll then I restarted apache2 . but it told me that the modules could not be located . what was wrong ? thanks for any useful words . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I load load Additional extensions ?
I am sure they are in c:\php\extensions . any other idea ? "Leif K-Brooks" <[EMAIL PROTECTED]> news:[EMAIL PROTECTED] > Dennis Lee wrote: > > >what was wrong ? thanks for any useful words . > > > Are those extensions in c:\php\extensions? > > -- > The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How can I load load Additional extensions ?
I am really confused . When I just run php as CGI without changing anything else, It works quite well . Why it is wrong when I run php as module under apache 2.0.46 ? Is it a bug or anything else ? Any help will be appreciated . "Dennis Lee" <[EMAIL PROTECTED]> дÈëÓʼþ news:[EMAIL PROTECTED] > My OS is Winxp . My web server is apache 2 which is installed as a NT > service . > > My php version is 4.32 , and I extracted it into "c:\php" . > > I run php as a apache module . > > I want to load Additional extensions .They are php_mbstring.dll, > php_xslt.dll and php_domxml.dll . > > I have made changes to php.ini as follow. > extension_dir = "c:\php\extensions" > extension=php_mbstring.dll > extension=php_xslt.dll > extension=php_domxml.dll > > then I restarted apache2 . > > but it told me that the modules could not be located . > > what was wrong ? thanks for any useful words . > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to write my own php extensions
Hi all : I want to write my own php extensions , but I don't know how to start . Please tell me where I can find some examples or resources such as tutorials . Thanks in advance . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cannot output before input
Hi All, I run the following program at Windows command prompt c:\php\cli\php.exe input.php The program did not show out "Input:" and waiting for input after run! Any hint to flush the output first? I am using PHP 4.3.2 (cli) (built: May 28 2003 15:10:38) Regards, Chris Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot output before input
>ob_flush() Thanks curt, it's working ^_^ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: dl() unable to open library
Make sure all other dlls that your dll depends on are also obtainable by php . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help! Unable to load DLLs.
Copy all the files in C:\php\dlls to you system directory . "Larry Li" <[EMAIL PROTECTED]> news:[EMAIL PROTECTED] > Got error message: Unable to load dynamic library > '.\extension\php_mssql.dll' - The specified module could not be found. > > I tried change php.ini many times, still got same error. I'm pretty sure > these DLLs in such directory. > > Any ideas, Thanks! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reserver variable names
I could swear that I once saw a statement to the effect that certain variable names were reserved in PHP. Something along the lines of ''variable names starting with two underscores (__) are reserved... '' Is anyone else aware of this or do I have a circuit crossed somewhere? thanx --lee -- Flowers of morning glory. +-+ The sky above this street |donate to causes I care about: | Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25 | --Sugita+-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions?
Hi, I have failed to find the information I am looking for on session management by PHP do they use cookies? Is there a way to use URL rewriting? How do I find the timeout time? is there a way to close a session manually? It seem to me like all those questions got to have answers for them somewhere, I just look in the wrong place Help is appreciated :-) lee --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003
[PHP] Re: OO Programming - get practical
> "Paul" == Paul Dionne <[EMAIL PROTECTED]> writes: [. . .] Paul> So, I guess my point is that if people want to encourage use Paul> of OO programming, they need to use more examples in their Paul> books instead of what is "easy." [. . .] then again there is the time honored tradition of reading code. this is really not as hard as it seems. may i recommend this link? http://phpclasses.optip.com/browse.html/browse.html i'm sure that if you look around, you can find others. php is everywhere. -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Credit card checks?
> "Kristopher" == Kristopher Yates <[EMAIL PROTECTED]> writes: [. . .] Kristopher> I dont know about AuthorizeNet, but LinkPoint has an Kristopher> API written in PHP that is supposed to be inexpensive, Kristopher> and easilly integratable into any PHP apps. I heard Kristopher> it was only $125.00.. Not a bad price for a few Kristopher> hundred lines of code. I am in no way affiliated with Kristopher> or trying to advertise for these companies. Hope this Kristopher> helps, Kris The linpoint API is, indeed, easy o integrate into a PHP app. Linkpoint's level of service could use some improvement, however. -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: parsing
> "Dave" == Dave At Sinewaves Net <[EMAIL PROTECTED]> writes: Dave> Okay, I want to know if anybody has a clue which is more Dave> efficient, processorwise/parsingwise: Dave> this: -- echo Dave> "".$somevar."".$somevardesc.""; Dave> or this: -- echo Dave> "{$somevar}{$somevardesc}"; Dave> I almost always use the first method (just seems more Dave> readable to me), but with all of the discussion popping up Dave> about curly brackets, i was wondering if it really makes a Dave> difference? Any vets out there care to put in their $0.02? I bet that this would beat the pants off of both: echo ''. $somevar . '' . $somevardesc . ''; -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Question about using if elseif ...
Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to debug mail() problem?
>>>>> "Manuel" == Manuel Lemos <[EMAIL PROTECTED]> writes: [. . .] Manuel> Anyway, if all else fails, you may want to try to use this Manuel> class: Manuel> http://www.phpclasses.org/smtpclass Manuel> maybe in conjunction with this Manuel> http://www.phpclasses.org/mimemessage Just by way of affirmation, here --as _though_ it were actually needed-- I've been using the smtpclass for a while now. It rocks. -lee -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to become a good PHP coder?
> "Wee" == Wee Keat <[EMAIL PROTECTED]> writes: [. . .] Wee> might be new, but I deeply appreciate the generosity that all Wee> of you have given us One way to show your appreciation sincerely would be to help others in the same way that people have helped you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cookie array
> "Jan" == Jan <[EMAIL PROTECTED]> writes: Jan> Hi ! How can I stoor array in to a cookie ? Jan> Do I just define an array and stoore it in a cookie ? How do Jan> I access the data in the array then ? you can use serialize() / unserialize() but be careful because the amount of storage allowed in a cookie is limited. what i do is to store thing like serialized arrays and serialized objects in a database table indexed by the session id. -- Flowers of morning glory. +-+ The sky above this street |donate to causes I care about: | Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25| --Sugita+-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mssql_query
I'm running PHP 4.1.1 on Win2K server with SQL 2K and my connect and select db statements are fine, but when I use the mssql_query() statement, PHP just hangs. I have no idea on whats going on and I've checked the forums, php's site, and I do have the MSSQL connectivity installed on the server. The server PHP runs on is server A (which has the connectivity) and the actual SQL server is on server B. I'm running PHP in the CGI mode, just because these are production servers and I don't know if the API version will knock out our current usage of ASP. HELP! PLEASE! This is driving me nuts! please send back to email address and this one [EMAIL PROTECTED] I'll be travelling and I want to be able check up on the status of your replies. Thanks, Jordan, CMS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mod_php / apache config
I apologize beforehand in case this message is posted twice. If there is some way to do this, then it has eluded me for several hours. I would like to set a variable in the apache config file which I can then access in a php script. I'm running mod_php4 and apache 1 I have tried things like this: php_value WSERVER red2.office.com and this: SetEnv WSERVER red2.office.com with and without quotes. mod_env is loaded. I can't find the variable WSERVER in $GLOBALS or $_ENV of $_GET. can someone help out? -- Flowers of morning glory. +-+ The sky above this street |donate to causes I care about: | Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25| --Sugita+-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mod_php4 / apache config question
If there is some way to do this, then it has eluded me for several hours. I would like to set a variable in the apache config file which I can then access in a php script. I'm running mod_php4 and apache 1 I have tried things like this: php_value WSERVER red2.office.com and this: SetEnv WSERVER red2.office.com with and without quotes. mod_env is loaded. I can't find the variable WSERVER n $GLOBALS or $_ENV of $_GET. can someone help out? -- Flowers of morning glory. +-+ The sky above this street |donate to causes I care about: | Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25| --Sugita+-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with starting apache in win2k with mcrypt and mhash
Hello i've uncommended the mcrypt and mhash line in c:\winnt\php.ini. then i try to start the apache but encounter the following error msg "The procedure entry point _ecalloc could not be located in the dynamic link library php4ts.dll" "Unable to load dynamic library 'c:\php\extensions\php_mcrypt.dll" - The specified procedure could not be found." "mhash: Unable to initialize module Module compiled with module API=20010901, debug=0, thread-safety=1 PHP compiled with module API=20020429, debug=0, thread-safety=1 There options need to match" i m sure that the "php_mcrypt.dll" is already in that location. i've also tried to change the "extension_dir" in c:\winnt\php.ini to c:\php c:\php\extensions\ c:\winnt c:\winnt\system32 and copied all the required dll to corresponding directories. same error was encountered when i start the apache. can you advice how can i solve it? i've also installed the terence -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem on starting apache in win2k with mcrypt and mhash module
Hello (i've confirmed my email address but not sure if you will read my previous mail, so i send it once more.) i've uncommended the mcrypt and mhash line in c:\winnt\php.ini. then i try to start the apache but encounter the following error msg "The procedure entry point _ecalloc could not be located in the dynamic link library php4ts.dll" "Unable to load dynamic library 'c:\php\extensions\php_mcrypt.dll" - The specified procedure could not be found." "mhash: Unable to initialize module Module compiled with module API=20010901, debug=0, thread-safety=1 PHP compiled with module API=20020429, debug=0, thread-safety=1 There options need to match" i m sure that the "php_mcrypt.dll" is already in that location. i've also tried to change the "extension_dir" in c:\winnt\php.ini to c:\php c:\php\extensions\ c:\winnt c:\winnt\system32 and copied all the required dll to corresponding directories. same error was encountered when i start the apache. can you advice how can i solve it? Terence -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] largest value of 2nd parameter in fgets functions
hello i've tried to read a line from a text file by fgets($fp,8192). it work fine. however, there is a line over 8192 char and i tried to increase the 2nd parameter (e.g. 8193, 16384, 88192) still only 8192 char are read to my string variables. is it a limit of fgets or length of a string? any way to achieve getting more than 8192 char from a line in a text file? pls advice. terence -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DEV] problem in starting apache in win2k with mcrypt and mhash module
hi Markus thanks for your reply. what is the compatible version of mcrypt lib and php in win32? also for linux? terence Markus Fischer wrote: > You're mixing an older library with a newer php version (or > the other way around). Please clean up your system first. > > Please ask on [EMAIL PROTECTED] next time. > (Reply-To set). > > - Markus > > On Fri, Sep 06, 2002 at 09:56:59AM +0800, Terence Lee wrote : > > Hello > > > > i've uncommended the mcrypt and mhash line in c:\winnt\php.ini. then i > > try to start the apache but encounter the following error msg > > > > "The procedure entry point _ecalloc could not be located in the dynamic > > link library php4ts.dll" > > > > "Unable to load dynamic library 'c:\php\extensions\php_mcrypt.dll" - The > > specified procedure could not be found." > > > > "mhash: Unable to initialize module > > Module compiled with module API=20010901, debug=0, thread-safety=1 > > PHP compiled with module API=20020429, debug=0, thread-safety=1 > > There options need to match" > > > > i m sure that the "php_mcrypt.dll" is already in that location. i've > > also tried to change the "extension_dir" in c:\winnt\php.ini to > > c:\php > > c:\php\extensions\ > > c:\winnt > > c:\winnt\system32 > > > > and copied all the required dll to corresponding directories. same error > > was encountered when i start the apache. can you advice how can i solve > > it? i would like to use the mhash and mcrypt functions. > > > > Terence > > > > > > > > > > -- > > PHP Development Mailing List <http://www.php.net/> > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc > "In short, the window belongs to me. > The document belongs to the web site designer." > - Poster on opera.wishlist -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to time an http request
is there a program which i can run in a unix environment (FreeBSD or redhat) which can run, say, 100 requests on a url and then report the total time spent on the requests? i know that i could run curl or wget in a loop, but i would have to account for the fork-exec time somehow. i hope that the question is clear. -- Flowers of morning glory. +-+ The sky above this street |donate to causes I care about: | Begins to overcast.| http://svcs.affero.net/rm.php?r=leed_25| --Sugita+-+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] my i ramble for a while?
I am posting this message to the php.general newsgroup because I used php to construct the dynamic portion of our site and because I value the opinions of many people who frequently post here. I hope that this will not be viewed as off-topic --if it is, I will take it elsewhere. At affero we are beginning to think in terms of publishing certain data to whomsoever might wish to use it for whatever reason. Here's a first cut attempt to provide such a service: http://pws.affero.net/hof/topPatrons returns an HTML ... structure suitable for use as, say, a server side include. Another kind of data which we might publish is what we refer to as a 'dense reputation' or a 'reputation summary'. For an example of a dense reputation you can point a browser at this URL http://svcs.affero.net/user-history.php?u=Poole the dense reputation appears highlighted after the user id on the top line of the page. One of the things that concerns me lately is how to make data such as these available as widely as possible. I have looked in to RSS for a few days and, while I am somewhat confused, I have begun to come more or less to the conclusion that RSS is employed mainly for syndicated news feeds and probably is not appropriate for publishing tabular data and short strings. Maybe some kind of procedure call mechanism, eh? SOAP and XML-RPC seem to be competing technologies, though. If we support one of them, how many sites will be excluded from accessing the data which we wish to make available? Should we support both? XML seems attractive because it can be styled into so many different kind of presentations, but I just can't tell if this would be appropriate. I was wondering if anyone might be able to share thoughts or opinions or experience related to such issues. -lee -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Phasing HTML
OK I am trying to take some content from another site (I have total consent) and convert all the prices on the site to 5% more. I can get all the content off the site and display it where I want. I can ereg_replace all the money to one price such as ($23.50) but I cant change the price based on what it was before I am using the following ereg_replace statements to change all the prices, I have tried several different ideas on how to change them bases on what they were before but have yet to succeed. $code = ereg_replace('[^[:space:]][0-9][0-9][0-9][0-9][^0-9][0-9][0-9]', (string) $stupid, $code); $code = ereg_replace('[^[:space:]][0-9][0-9][0-9][^0-9][0-9][0-9]', (string) $stupid, $code); $code = ereg_replace('[^[:space:]][0-9][0-9][^0-9][0-9][0-9]', (string) $stupid, $code); $code = ereg_replace('[^[:space:]][0-9][^0-9][0-9][0-9]', (string) $stupid, $code); I know that the ereg_replace statements arent right for what I want to do but I need to make them to figure out what regular expressions to use. Here is what I am trying to make happen: Select $20.25 from site a Convert it to $21.26 So basically let P = current price on site A And P * .05 = price I want to display on my site. Thanks for any help -Brian _ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] countries
Why not go to the source? http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html -- Eugene Lee [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PCRE Problem
$string = [b]Test[/b] I want to change it to $string = Test How?
[PHP] question about ? :
the arrays below have dates like dateA= array( 0=> "03", 1=> "22", 2=> "02") for 22march2002. why does this work: $retval= ($dateA[2] != $dateB[2]) ? strcmp($dateA[2], $dateB[2]) : (($dateA[0] != $dateB[0]) ? strcmp($dateA[0], $dateB[0]) : (($dateA[1] != $dateB[1]) ? strcmp($dateA[1], $dateB[1]) : 0)); but not this: $retval= ($dateA[2] != $dateB[2]) ? strcmp($dateA[2], $dateB[2]) : ($dateA[0] != $dateB[0]) ? strcmp($dateA[0], $dateB[0]) : ($dateA[1] != $dateB[1]) ? strcmp($dateA[1], $dateB[1]) : 0; -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about ? :
>>>>> "Miguel" == Miguel Cruz <[EMAIL PROTECTED]> writes: Miguel> On 13 Jun 2002, Lee Doolan wrote: >> the arrays below have dates like dateA= array( 0=> "03", 1=> >> "22", 2=> "02") >> >> for 22march2002. >> >> why does this work: >> >> $retval= ($dateA[2] != $dateB[2]) ? strcmp($dateA[2], >> $dateB[2]) : (($dateA[0] != $dateB[0]) ? strcmp($dateA[0], >> $dateB[0]) : (($dateA[1] != $dateB[1]) ? strcmp($dateA[1], >> $dateB[1]) : 0)); >> >> >> but not this: >> >> $retval= ($dateA[2] != $dateB[2]) ? strcmp($dateA[2], >> $dateB[2]) : ($dateA[0] != $dateB[0]) ? strcmp($dateA[0], >> $dateB[0]) : ($dateA[1] != $dateB[1]) ? strcmp($dateA[1], >> $dateB[1]) : 0; Miguel> Why does this: Miguel> $x = 3 + 5 * 7; Miguel> produce different results from this: Miguel> $x = (3 + 5) * 7; Miguel> ? Miguel> miguel The two cases are not the same. In the case above, all operators are ternary --with equal precedence-- but in your case, the operators are of different precedence. As I pointed out to you in e-mail, both of the ternary forms in my original question would evaluate to the same thing if they were in s C program. That, admittedly, is no reason why they should evaluate to he same thing in PHP but it was enough to make me wonder... -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date Comparsion
> "Jack" == Jack <[EMAIL PROTECTED]> writes: Jack> Dear all I had a form which let user to input the leave_from Jack> and leave_to date into, the format of the date that user Jack> input is "-mm-dd". Now i want to compare the leave_from Jack> and leave_to date to find out the number of days between! well, here's one way: $interval_days= (strtotime($to_date) - strtotime($from_date)) / 3600 * 24 adjust to taste. -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I hide download link ...
Thanks for the code, I think I am getting there but an empty file gets downloaded when I load the following script. See any problems? I verified my server is setup to handle tar files with application/x-tar. I also replaced ... header("Content-Type: application/x-tar"); with header("Content-Type: application/octet-stream"); and it did not make a difference. I am using IE 6 if it matters. Any ideas? "1lt John W. Holmes" <[EMAIL PROTECTED]> wrote in message 00c401c216d4$4fc1bd50$2f7e3393@TB447CCO3">news:00c401c216d4$4fc1bd50$2f7e3393@TB447CCO3... > I thought we answered this question already! > > It's simple. On your login page or whatever, you start a session and set a > variable saying that the user is logged in. > > session_start(); > //check username and password > //if good... > $_SESSION['logged_in'] = 1; > ?> > > Now, the most secure way to protect your files is to place them above your > web root. Then no one can ever get to them through a browser (directly to > the file). If you can't do that, then place them in a folder with a long > name that's going to be hard to guess. > > Then, you have a download.php file that you direct all requests for > downloads to. You'll also have to pass it a code to identify which file the > user means to download. This can be an ID from a database, or an actual > filename. > > download.php?ID=4 > download.php?Filename=music > etc... > > In download.php you check for an active session. If it's good, then you send > the appropriate header() for the file the user wants to download and then > use passthru() to send them the file. Make sure you are only sending them a > file from your download directory, wherever that is. Make sure they don't > pass you a path to a file they shouldn't be looking at. > > session_start(); > if(isset($_SESSION['logged_in'])) > { > //session is good > //retrieve name of file (whether in URL or Database > $file = $_GET['Filename'] . ".mp3" > $download_dir = "/home/user/me/downloads/music/ > $download_file = $download_dir . $file > header("content-type: application-whatever-mp3-x"); > header("content-disposition: attachement filename='$file'"); > passthru($download_file); > exit(); > } > else > { > echo "Please log in"; > } > ?> > > I don't remember the exact header() format, and it's dependent on the types > of files your offering, but you should get the idea. > > Adapt to your needs, but this is the basics of it. Check for a valid > session, if it exists, send appropriate headers and use passthru() to send > the file. (you can use file(), fopen(), whatever, as long as you send the > content of the file after the headers...). If session doesn't match up, send > an HTML page. > > Hopefully this thread will die now... > > ---John Holmes... > > > - Original Message - > From: "Nathan Taylor" <[EMAIL PROTECTED]> > To: "Fargo Lee" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, June 18, 2002 5:42 AM > Subject: Re: [PHP] How do I hide download link ... > > > > > > - Original Message - > > From: "Fargo Lee" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Wednesday, June 12, 2002 4:14 PM > > Subject: [PHP] How do I hide download link ... > > > > > > > Hi, my customers go through a password authentication to access a link > on > > my > > > site to download a file. I want to prevent the distribution of the > > location > > > of this file on my server by making it hidden. Is there any php > > function(s) > > > that could assist in doing this? > > > > > > All I can think of so far is storing the original file in a hard to > guess > > > directory, when a authenticated customer goes to download it, send them > to > > a > > > script that copys the original file to a temp directory, they download > the > > > file in the temp directory and then run a cron every so many minutes to > > > clear out the files in the temp directory. > > > > > > If anyone has any ideas, examples or a way to improve on what I came up > > with > > > please respond. Thanks! > > > > > > > > > > > > -- > > > 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] How do I hide download link ...
Hi, if using the header command for attaching a file really prevents the user from seeing the actual download link, is it really all that important that the file is read from behind the document root if it is in a very hard to guess directory? "Martin Towell" <[EMAIL PROTECTED]> wrote in message news:6416776FCC55D511BC4E0090274EFEF508A4B5@EXCHANGE... > Have a page that checks the user's authentication > > if they're "invalid" then display an error msg and exit the script > > otherwise, send the header command(s) for attaching a file (can't remember > the exact syntax right now) > > read the file from somewhere that's not accessable from the web and spit it > out to the browser > > HTH > Martin > > > -Original Message- > From: Fargo Lee [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 13, 2002 6:15 AM > To: [EMAIL PROTECTED] > Subject: [PHP] How do I hide download link ... > > > Hi, my customers go through a password authentication to access a link on my > site to download a file. I want to prevent the distribution of the location > of this file on my server by making it hidden. Is there any php function(s) > that could assist in doing this? > > All I can think of so far is storing the original file in a hard to guess > directory, when a authenticated customer goes to download it, send them to a > script that copys the original file to a temp directory, they download the > file in the temp directory and then run a cron every so many minutes to > clear out the files in the temp directory. > > If anyone has any ideas, examples or a way to improve on what I came up with > please respond. Thanks! > > > > -- > 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] How do I hide download link ...
Ok think I am all good now. Added ... $fh = fopen("$download_file", "r"); then changed ... passthru($download_file); to fpassthru($fh); Thanks, again! "Fargo Lee" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thanks for the code, I think I am getting there but an empty file gets > downloaded when I load the following script. See any problems? > > $filename = "backup.tar"; > $download_file = "/absolute/path/backup.tar"; > header("Content-Type: application/x-tar"); > header("Content-Disposition: attachment; filename=$filename"); > passthru($download_file); > exit(); > ?> > > I verified my server is setup to handle tar files with application/x-tar. I > also replaced ... > > header("Content-Type: application/x-tar"); > > with > > header("Content-Type: application/octet-stream"); > > and it did not make a difference. I am using IE 6 if it matters. Any ideas? > > "1lt John W. Holmes" <[EMAIL PROTECTED]> wrote in message > 00c401c216d4$4fc1bd50$2f7e3393@TB447CCO3">news:00c401c216d4$4fc1bd50$2f7e3393@TB447CCO3... > > I thought we answered this question already! > > > > It's simple. On your login page or whatever, you start a session and set a > > variable saying that the user is logged in. > > > > > session_start(); > > //check username and password > > //if good... > > $_SESSION['logged_in'] = 1; > > ?> > > > > Now, the most secure way to protect your files is to place them above your > > web root. Then no one can ever get to them through a browser (directly to > > the file). If you can't do that, then place them in a folder with a long > > name that's going to be hard to guess. > > > > Then, you have a download.php file that you direct all requests for > > downloads to. You'll also have to pass it a code to identify which file > the > > user means to download. This can be an ID from a database, or an actual > > filename. > > > > download.php?ID=4 > > download.php?Filename=music > > etc... > > > > In download.php you check for an active session. If it's good, then you > send > > the appropriate header() for the file the user wants to download and then > > use passthru() to send them the file. Make sure you are only sending them > a > > file from your download directory, wherever that is. Make sure they don't > > pass you a path to a file they shouldn't be looking at. > > > > > session_start(); > > if(isset($_SESSION['logged_in'])) > > { > > //session is good > > //retrieve name of file (whether in URL or Database > > $file = $_GET['Filename'] . ".mp3" > > $download_dir = "/home/user/me/downloads/music/ > > $download_file = $download_dir . $file > > header("content-type: application-whatever-mp3-x"); > > header("content-disposition: attachement filename='$file'"); > > passthru($download_file); > > exit(); > > } > > else > > { > > echo "Please log in"; > > } > > ?> > > > > I don't remember the exact header() format, and it's dependent on the > types > > of files your offering, but you should get the idea. > > > > Adapt to your needs, but this is the basics of it. Check for a valid > > session, if it exists, send appropriate headers and use passthru() to send > > the file. (you can use file(), fopen(), whatever, as long as you send the > > content of the file after the headers...). If session doesn't match up, > send > > an HTML page. > > > > Hopefully this thread will die now... > > > > ---John Holmes... > > > > > > - Original Message - > > From: "Nathan Taylor" <[EMAIL PROTECTED]> > > To: "Fargo Lee" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Tuesday, June 18, 2002 5:42 AM > > Subject: Re: [PHP] How do I hide download link ... > > > > > > > > > > - Original Message - > > > From: "Fargo Lee" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Sent: Wednesday, June 12, 2002 4:14 PM > > > Subject: [PHP] How do I hide download link ... > > > > > > > > > > Hi, my customers go through a password authentication to access a link > > on > > > my > > > > site t
[PHP] Re: How to convert seconds to days, hours, minutes & seconds?
Thanks! "Fargo Lee" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Hi, if I have a variable containing a number of seconds what function would > I use to output something like ... > > 13 Hours, 12 Minutes, 3 Seconds > > or > > 23 Days, 13 Hours, 12 Minutes, 3 Seconds > > Any examples appreciated, thanks! > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I import tables into MySQL from web page ...
Hi, I am trying to import some tables from a dump file into a MySQL database from a php web page. What is the best way to do this without using backticks (fpassthru, system, exec or something else) and test for success or failure? I tried the following and while it works, my test for success or failure always produces a "Success" even when I change something to make it fail. I thought system() outputs the last line of the command on success and FALSE on failure. Any examples appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I import tables into MySQL from web page ...
Thanks for pointing out the syntax error. I added the space after the -u but it did not make any difference. It still gives the same result, that is "Success", when it actually fails. What I am trying to figure out is how I can tell if it failed (did not create the tables)? The $status variable does not appear to hold the output of the system() function. Anyone know how to get the output of system, passthru or exec into the $status variable to check for success or failure? "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tue, Jul 09, 2002 at 06:09:36PM -0700, Fargo Lee wrote: > > > > $status = system("mysql -umyuserid -pmypassword mydbname < > > You need a space between "-u" and "myuserid" > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I import tables into MySQL from web page ...
Thanks but it still returns "Success" on a failure. If anyone knows if it is even possible to assign the output of system, passthru or exec to a variable to check for success or failure and how to do it, please advise. The $status variable seems to always be empty on success or failure when I try to echo it. "Jason Wong" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Wednesday 10 July 2002 13:27, Fargo Lee wrote: > > Thanks for pointing out the syntax error. I added the space after the -u > > but it did not make any difference. It still gives the same result, that is > > "Success", when it actually fails. What I am trying to figure out is how I > > can tell if it failed (did not create the tables)? The $status variable > > does not appear to hold the output of the system() function. Anyone know > > how to get the output of system, passthru or exec into the $status variable > > to check for success or failure? > > Your test for failure should be: > > if ($status === FALSE) > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Extreme fear can neither fight nor fly. > -- William Shakespeare, "The Rape of Lucrece" > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I import tables into MySQL from web page ...
Thanks for pointing me in the right direction. Could not get the output (success or failure) assigned to a variable in front of the system call but got it to assign a 0 (success) or 1 (failure) to the return_var argument as you suggested so I am happy. What mixed me up and I still don't understand is the manual entry for system() says ... "Returns the last line of the command output on success, and FALSE on failure." When it says it "Returns", where does it return this information and how can it be captured for comparison? The return_var appears to only return a 0 or a 1. I thought I could capture it by assigning the system call to a variable in front but that appears to capture nothing on success or failure. "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tue, Jul 09, 2002 at 10:59:04PM -0700, Fargo Lee wrote: > > > > Thanks but it still returns "Success" on a failure. If anyone knows if it is > > even possible to assign the output of system, passthru or exec to a variable > > to check for success or failure and how to do it, please advise. The $status > > variable seems to always be empty on success or failure when I try to echo > > it. > > The way you set things up, $status is the last line of text returned by > executing the command. Add the return_var argument to your system() > statement. Take a look at the manual again. > http://www.php.net/manual/en/function.system.php > > You can only make an accurate if() statement if you know what the values > are you're expecting. > > Now, do some hacking. Set up the test to fail. Echo $status and $return > to the screen and see what they look like. Set up the test to succeed. > What do $status and $return look like then? > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I import tables into MySQL from web page ...
Yes, on success the command I am issuing does not produce any output on the command line and thus the $status variable should be blank on success. But when made to fail MySQL does return an error on the command line yet the variable does not hold FALSE as the manual suggests it should or anything else. This suggests, as do a few posts I just noticed in the manual, that one cannot assign the output of system() and perhaps passthru() and exec() to a variable. I think this is only possible using backticks, which I can't use as this needs to be run in safe mode. So I guess I just need to use the return_var as you suggested. Thanks! "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Tue, Jul 09, 2002 at 11:41:47PM -0700, Fargo Lee wrote: > > > got it to assign a 0 (success) or 1 (failure) to the return_var argument as > > you suggested so I am happy. > > Good! > > > > What mixed me up and I still don't understand is the manual entry for > > system() says ... > > > > "Returns the last line of the command output on success, and FALSE on > > failure." > > > > When it says it "Returns", where does it return this information and how can > > it be captured for comparison? > > The thing that's tripping you up is, I believe, executing MySQL programs > at a prompt doesn't produce any visible output. But, if you executed a > command that returns some output to STDOUT, like "ls", you'd see the last > line of output therefrom in the "Return." > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I import tables into MySQL from web page ...
Thanks that explains why I did not initially have a space after the -u as I copied the code from another of my applications that used backticks without reviewing it. It appears that using backticks is also the only way to assign the output of a command to a variable as system(), passthru() and exec() don't appear to be able to do this. Unfortunately this snippet of code needs to be compatible with PHP installations running in safe mode so I can't use backticks. "John Holmes" <[EMAIL PROTECTED]> wrote in message 021501c22807$a91e42d0$b402a8c0@mango">news:021501c22807$a91e42d0$b402a8c0@mango... > Try using backticks, and you don't need spaces after -u and -p > > $result = `MySQL -uuser -ppassword databasename < filename.sql` > > Note that if it succeeds, nothing will be returned. Same as when you run > the command on the command line. > > ---John Holmes... > > > -Original Message- > > From: Fargo Lee [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, July 10, 2002 1:27 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [PHP] How do I import tables into MySQL from web page ... > > > > Thanks for pointing out the syntax error. I added the space after the > -u > > but > > it did not make any difference. It still gives the same result, that > is > > "Success", when it actually fails. What I am trying to figure out is > how I > > can tell if it failed (did not create the tables)? The $status > variable > > does > > not appear to hold the output of the system() function. Anyone know > how to > > get the output of system, passthru or exec into the $status variable > to > > check for success or failure? > > > > "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in > message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > On Tue, Jul 09, 2002 at 06:09:36PM -0700, Fargo Lee wrote: > > > > > > > > $status = system("mysql -umyuserid -pmypassword mydbname < > > > > > > You need a space between "-u" and "myuserid" > > > > > > --Dan > > > > > > -- > > >PHP classes that make web design easier > > > SQL Solution | Layout Solution | Form Solution > > > sqlsolution.info | layoutsolution.info | formsolution.info > > > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > > > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 > > > > > > > > -- > > 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] How do I import tables into MySQL from web page ...
I ran a few tests as well and the few system commands I tried only saved the *last* line of the output in a variable on success as the manual suggests it should - better than nothing - but not the entire output as you seem to suggest you were able to do and what I have been trying to do. "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Wed, Jul 10, 2002 at 12:14:58PM -0700, Fargo Lee wrote: > > > > This suggests, as do a few posts I just noticed in the manual, that > > one cannot assign the output of system() and perhaps passthru() and exec() > > to a variable. > > I forgot to mention, that's not accurate. I just ran a test to make sure. > Got the results just fine. > > Just for clarity, here's my test (PHP 4.2.1, NT 4.0): > > # real directory. > # result: output shows file list, false no, return 0 > # $output = system('dir c:\books', $return_var); > > # fake directory. > # result: output shows nothing, false yes, return 1 >$output = system('dir y:\fake', $return_var); > >echo "output: $output"; >echo ''; >echo 'output false? ' . ( ($output == FALSE) ? 'yes' : 'no' ); >echo ''; >echo "return: $return_var"; > > > --Dan > > > I think this is only possible using backticks, which I can't > > use as this needs to be run in safe mode. So I guess I just need to use the > > return_var as you suggested. Thanks! > > > > "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > On Tue, Jul 09, 2002 at 11:41:47PM -0700, Fargo Lee wrote: > > > > > > > got it to assign a 0 (success) or 1 (failure) to the return_var argument > > as > > > > you suggested so I am happy. > > > > > > Good! > > > > > > > > > > What mixed me up and I still don't understand is the manual entry for > > > > system() says ... > > > > > > > > "Returns the last line of the command output on success, and FALSE on > > > > failure." > > > > > > > > When it says it "Returns", where does it return this information and how > > can > > > > it be captured for comparison? > > > > > > The thing that's tripping you up is, I believe, executing MySQL programs > > > at a prompt doesn't produce any visible output. But, if you executed a > > > command that returns some output to STDOUT, like "ls", you'd see the last > > > line of output therefrom in the "Return." > > > > > > --Dan > > > > > > -- > > >PHP classes that make web design easier > > > SQL Solution | Layout Solution | Form Solution > > > sqlsolution.info | layoutsolution.info | formsolution.info > > > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > > > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I import tables into MySQL from web page ...
But if system() thinks it is a success because the command executed, even though MySQL returns an internal error on the command line, why is'nt the last line of the MySQL error message stored in the variable as the system() manual suggests it should be when system() thinks it is a success? "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Wed, Jul 10, 2002 at 12:14:58PM -0700, Fargo Lee wrote: > > > > when made to fail MySQL does return an error on the command line yet the > > variable does not hold FALSE as the manual suggests it should or anything > > else. > > The behaviour of returning FALSE upon failure has to do with the system() > call not being able to be made due to things like the command itself not > being able to execute, such as when the name of the program is wrong. > But, since the program in this case actually executed, there's no failure. > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I import tables into MySQL from web page ...
> Run the command manually at a shell prompt. What happens? Here's what > happens for me on WinNT. In an error condition, say my password is > invalid, it retuns the error message then a blank line and then I'm back > at the prompt. So, if system() is true to the manual, that blank line is > the last line, so it's the one that gets put into the variable. > My bad, it is a blank line after the error message on my system too. I missed the blank line last time, I need some glasses. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: another pair of eyes?
> "Jas" == Jas <[EMAIL PROTECTED]> writes: Jas> Hello all, Jas> I have a parse error and I am not sure why, I think my eyes are giving up on Jas> me, or its a friday. Any help is appreciated. Jas> // just trying to compare the session var $date to timeout if older than 5 Jas> minutes Jas> [snippit] Jas> /* Begin Session and register timeout, random image & client info variables Jas> */ Jas>session_start(); Jas>session_register('$var1); . /\\ / \ \ \ missing single quote ' Jas>session_register('$var2'); Jas>session_register('$var3'); Jas>session_register('$var4'); Jas>session_register('$var5'); Jas> } elseif (isset($HTTP_SESSION_VARS[$hour]) => $hour + 5*60)) { . /\\ / \ \ \ extra parenthesis ---' Jas>header("Location: https://localhost/index.php"}; . /\\ / \ \ \ should be paren, not curly' Jas> } else { Jas> endif(); } ?? . /\\ / \ \ \ huh? ---' Jas> [end snippit] -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Submit code
here's an excerpt from a script in which I do something like that: $pdArgs= "demo=" . urlencode($argAry['demo']) . "&" . "first_name=" . urlencode($argAry['first_name']) . "&" . "last_name=" . urlencode($argAry['last_name']) . "&" . [. . .] $URL= "https://HOST.DOMAIN/SCRIPT.php";; exec("/usr/bin/curl -m 120 -d \"$pdArgs\" $URL -L", $httpResponse, $exitCode); if ($exitCode != 0) { header ("Location: error.php?code=" . urlencode("https: failure. Exit code is $exitCode")); exit; } -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about using if elseif ...
When viewing examples of using if and elseif I often see the example ending with an else like ... if($a == '1'){ echo '1'; } elseif ($a == '2'){ echo '2'; } else { echo '0'; } Is there any problem with leaving out the last else and just ending it with an elseif such as ... if($a == '1'){ echo '1'; } elseif ($a == '2'){ echo '2'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie's question about \n
Dear ALL, It seems that i have a very silly problem. I can't get the new line escape character to work. the following is my SIMPLE script and corresponding output. PHP script: http://www.w3.org/TR/html4/loose.dtd"; > TEST Output in IE6: this should be printed out: this is a second line regards, KK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie's question about \n
Dear ALL, Thanks. KK Kk Lee ¼g¤J¡G > Dear ALL, > > It seems that i have a very silly problem. > I can't get the new line escape character to work. > the following is my SIMPLE script and corresponding output. > > PHP script: > "-//W3C//DTD HTML 4.0 Transitional//EN" >"http://www.w3.org/TR/html4/loose.dtd"; > > > > TEST > > >echo "this should be printed out:\n"; > echo "this is a second line"; > ?> > > > > Output in IE6: > this should be printed out: this is a second line > > regards, > > KK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Comma question
> "B" == B I G D O G <[EMAIL PROTECTED]> writes: B> Tried to check the archive, but it is offline... What does the B> "," and "{}" do in this type of statement? B> Example: echo "{$strName}", htmlspecialchars( in this case, the {}s don't really do anything; but {}s allow variables like this echo "{$obj->strName[$i]}"; and so forth. -- When the birdcage is open, | donate to causes I care about: the selfish bird flies away, |http://svcs.affero.net/rm.php?r=leed_25 but the virtuous one stays. | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] search result highlighting / regexp voodoo
At the risk of this looking like a cheap tactic for getting someone else to do my work for me, I'll put the disclaimer at the top. Understand that what I'm looking for is new perspective on a problem that I've spent too much time dealing with. PROBLEM: I want to produce short "snippets" for search result pages. The search results are already partially processed (search terms get wrapped in [strong] tags), but I keep hitting dead-ends with this step. Now, I've tried a wide number of approaches, spent an embarasing amount of time and arrived at no viable solution. Learning regular expressions would probably have been less painfull, but there you have it. REQUIREMENTS: - the snippet should be made up of five words on either side of the search terms. - end product cannot have any unclosed/unmatched tags. SETUP: - Search terms are (already) marked up in [strong] tags with a class attribute of term1 - term3. - No other tags exist in the string (other than aforementioned [strong] tags) EXAMPLE INPUT: The journalist/critic Edmund Gosse begins championing Ibsen in English periodicals. His article "Ibsen the Norwegian Satirist" (Fortnightly Review, January 1873) is later expanded in his book Studies in the Literature of Northern Europe (1879). In contrast, the conservative dramatic critic Clement W. Scott begins writing columns for London's Daily Telegraph; he comes to consider the influence of Ibsen the worst thing that ever happened to English drama. His hysterically negative attack on Ibsen's Ghosts in 1891 will be paraphrased (and reduced to ridicule) by Shaw in the first chapter of The Quintessence of Ibsenism (1891). EXAMPLE OUTPUT: ... journalist/critic Edmund Gosse begins championing Ibsen in English periodicals. His article ... Scott begins writing columns for London's Daily Telegraph; he comes to consider ... (and reduced to ridicule) by Shaw in the first chapter of The Quintessence... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] search result highlighting / regexp voodoo
On Wed, 03 Sep 2003 00:29:45 -0400, John W. Holmes <[EMAIL PROTECTED]> wrote: This should produce what you want (or darn close): [snipped code example] Thank you John, I still don't understand regualar expression, but your suggestion provided enough insight that I am able to work out the rest of what I want. Cheers, Lee O'Mara -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Startup Seeking Expertise in PHP/MYSQL & Open Source : Remote Interns Welcome!
We're looking for a few excellent programmers who want to rock out in building out a portal/publisher/record-label/video-distributor using the following applications and technologies from sourceforge.net: phpBB xoops phpnuke geeklog oscommerce postnuke gallery drupal cafelog dmoz RSS/RDF/blogging FOAF (friend of a friend) We're here to work hard and grow fast! We're in an old house in a college town, and we have enough rooms for a few more programmers, so send along your resume! We'll consider full-time, part-time, and internships, so if you own skillz, send your resume to [EMAIL PROTECTED] . We'll consider full-time, part-time, and internships, so if you own skillz, send your resume to [EMAIL PROTECTED] . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php