[PHP] referer keywords
Hello ppl, I want to find out what keywords are people exactly using to get to my website and from where are they coming(Which search engine?)...I want to make a custom script, I don't want to use my web server logs or anything... Is it possible..?? - Dhaval _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Measuring Query Times
On Wednesday 22 January 2003 14:45, Peter Janett wrote: > I'm trying to figure out if there is an easy way to measure how long my > queries in PHP/MySQL are taking to execute. Using microtime() before and after your query will give you an rough idea. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* So much food; so little time! */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Measuring Query Times
I'm trying to figure out if there is an easy way to measure how long my queries in PHP/MySQL are taking to execute. Any tips or code examples most appreciated. Thanks, Peter Janett New Media One Web Services New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 PostgreSQL coming soon! http://www.newmediaone.net [EMAIL PROTECTED] (303)828-9882 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Comparing two objects
I'm trying to compare two objects with == and === and getting the following error message: Fatal error: Nesting level too deep - recursive dependency? The object has several child objects which hold a reference to the parent in them. I want to check the reference in the child object to make sure that it is the correct parent object. This is part of a sanity check for debugging purposes. Its quite easy to forget one & somewhere when dealing with the parent which causes a copy to be made. The child objects in the copy then no longer point to the parent that is active (the copy), but instead point to the original parent. This manifests itself in subtle errors revolving around the changes to the parent after the copy was made. I would like to detect this situation. Is there a workaround for this object comparison which involves determining if two variables reference the same object? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
On Tue, 21 Jan 2003 20:17:40 -0700, you wrote: >I tried a test file with this, and the form is sent, and the nph-test2.php >file returns this > >Status: 302 >Content-type: text/html >X-Powered-By: PHP/4.3.0 >Location: test.php >Set-Cookie: testcookie=test I'm a bit confused. Is it working for you now, or not? What do you mean by "returns"is the above sent as an HTTP response header? Or does this show up in the body of the response? Since the above contains the 'Set-Cookie' directive (which IIS would normally strip out) it should be working... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dreading OOP
The most helpful intro to OOP for me is the sidebar here: http://webreference.com/perl/xhoo/php1/5.html --- Jay Paulson <[EMAIL PROTECTED]> wrote: > The easiest way for me to explain and understand OOP > was to think of it this > way. > __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
I tried this one as well. When trying to load, the browser says HTTP 500 - Internal server error Internet Explorer I even rebooted! Mike "Jason K Larson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Follow the ISAPI module install instructions. > > http://www.php.net/manual/en/install.iis.php > > Regards, > Jason k Larson > > > Mike Potter wrote: > > > Do you know how do do this? > > > > Thanks, > > Mike > > > > > > "Jason K Larson" wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > >Discussion on this list has suggested that it can work if PHP is set to > > >run as ISAPI, not CGI. > > > > > >HTH, > > >Jason k Larson > > > > > > > > >Mike Potter wrote: > > > > > >>HELP! > > >>I know I'm new at this so please don't laugh. But I can't get this to > > > > work! > > > > >>I am using Microsoft IIS with the latest PHP installed. > > >>Here's a smple: > > >> > > >>. > > >>. > > >>. > > >>setcookie("testCookie", "testValue", time() + 3600, "/"); > > >>header("Location: http://newpage.php";); > > >>exit; > > >> > > >> > > >>Later, I pull the cookie: > > >> > > >>echo $_COOKIE["testCookie"]; > > >> > > >>and there is no value. If I don't use the header function at the end, > > > > and > > > > >>write something to the page, it works fine. > > >>Why does this cookie not get set? > > >> > > >>Thanks a ton! > > >> > > >>Mike > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Read Mysql & Access
what did you find with a google search? - Original Message - From: Karl James To: php Sent: Monday, January 20, 2003 7:01 PM Subject: [PHP] Read Mysql & Access Is there a free ware program that will, allow me to take mysql dbase and convert it to ms ascess? Thanks Karl IncrediMail - Email has finally evolved - Click Here
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
I tried a test file with this, and the form is sent, and the nph-test2.php file returns this Status: 302 Content-type: text/html X-Powered-By: PHP/4.3.0 Location: test.php Set-Cookie: testcookie=test Here is my code: Thanks for your time. Mike "Michael Sims" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... [top-posting fixed] >"Jason K Larson" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> Discussion on this list has suggested that it can work if PHP is set to >> run as ISAPI, not CGI. >> >Do you know how do do this? Although using the ISAPI dll version of PHP would definitely work, that's a bit of a drastic solution. Chris has pointed you in the direction of a workaround. Why don't you give it a shot and if you can't get it working send another message to myself or the list: http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file uploads received, but mangled
Hi all. 2nd try -- Is the following possible to work around, or is it a bug that I should be reporting? I'm having issues uploading files whose names don't necessarily end with the correct extension, in particular text files which don't end in .txt. (Why they don't is complicated, and it's impractical to insist that they must.) The files are received, but altered -- they are prepended with binary data which makes them difficult to deal with in an elegant automated way. No doubt this is a mime type issue, as the files are received as type "application/x-macbinary" when sent from OSX Explorer. Is there any way to force plain text, or raw data? All I want to happen is for the files to be uploaded completely unchanged. Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on OpenBSD. Thanks, Alex [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn'tset!
Follow the ISAPI module install instructions. http://www.php.net/manual/en/install.iis.php Regards, Jason k Larson Mike Potter wrote: Do you know how do do this? Thanks, Mike "Jason K Larson" wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >Discussion on this list has suggested that it can work if PHP is set to >run as ISAPI, not CGI. > >HTH, >Jason k Larson > > >Mike Potter wrote: > >>HELP! >>I know I'm new at this so please don't laugh. But I can't get this to work! >>I am using Microsoft IIS with the latest PHP installed. >>Here's a smple: >> >>. >>. >>. >>setcookie("testCookie", "testValue", time() + 3600, "/"); >>header("Location: http://newpage.php";); >>exit; >> >> >>Later, I pull the cookie: >> >>echo $_COOKIE["testCookie"]; >> >>and there is no value. If I don't use the header function at the end, and >>write something to the page, it works fine. >>Why does this cookie not get set? >> >>Thanks a ton! >> >>Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
[top-posting fixed] >"Jason K Larson" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> Discussion on this list has suggested that it can work if PHP is set to >> run as ISAPI, not CGI. >> >Do you know how do do this? Although using the ISAPI dll version of PHP would definitely work, that's a bit of a drastic solution. Chris has pointed you in the direction of a workaround. Why don't you give it a shot and if you can't get it working send another message to myself or the list: http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
Do you know how do do this? Thanks, Mike "Jason K Larson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Discussion on this list has suggested that it can work if PHP is set to > run as ISAPI, not CGI. > > HTH, > Jason k Larson > > > Mike Potter wrote: > > HELP! > > I know I'm new at this so please don't laugh. But I can't get this to work! > > I am using Microsoft IIS with the latest PHP installed. > > Here's a smple: > > > > . > > . > > . > > setcookie("testCookie", "testValue", time() + 3600, "/"); > > header("Location: http://newpage.php";); > > exit; > > > > > > Later, I pull the cookie: > > > > echo $_COOKIE["testCookie"]; > > > > and there is no value. If I don't use the header function at the end, and > > write something to the page, it works fine. > > Why does this cookie not get set? > > > > Thanks a ton! > > > > Mike > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I find email patterns in a query string in a text and urlescape them?
If I have a text of string like this: $stuff = "Hi my name is Phil, my email is [EMAIL PROTECTED] and you can find me at http://www.xx.yy?[EMAIL PROTECTED]";; What I want to do is to "validate" all patterns resembling an email address EXCEPT those found within the query string of a URL. I would want to to urlencode(\\1) somehow onto the email address pattern found within the query string of the URL to ensure that it is not "validated" like any other email address (validate means to convert [EMAIL PROTECTED] to mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]). Can anyone figure this out for me? I tried using pattern matching and eval() but the results were completely wrong: function VALIDATE_URL($stuff) { $stuff = preg_replace('/[\n\r]/', '', $stuff); $stuff = preg_replace('/\.\./', ' . .', $stuff); // URL ESCAPE ALL EMAIL ADDRESSES FOUND WITHIN QUERY STRINGS TO ENSURE PROPER VALIDATION // IF USING VALIDATE_EMAIL $stuff = preg_replace('/([\?&][a-zA-Z0-9]+=)([a-zA-Z0-9_\-\.]+@([a-zA-Z0-9_\-]+\.)+[a-zA-Z0-9_\-]+)/', '\\1' . '', $stuff); $stuff = eval('?>' . $stuff); $stuff = preg_replace('/(http[s]?:\/\/([a-zA-Z0-9_\-]+\.)+(\/[a-zA-Z0-9_\-\.\~\^,%\+]+)*[^<\(\)> ]+)/', '\\1', $stuff); return preg_replace('/ \. \./', '..', $stuff); } Thanx Phil
Re: [PHP] Re: fscanf
Actually found a little problem I forgot to mention some lines can be text, t e x t, te xt t e xt, text, text This splits it into more then 3 parts. Any ideas on this? Shouldn't I be able to use just fscanf to get the results I'm after?? Thanks K - Original Message - From: "Brian T. Allen" <[EMAIL PROTECTED]> To: "'Kris'" <[EMAIL PROTECTED]>; "'Jason k Larson'" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, January 22, 2003 10:58 AM Subject: RE: [PHP] Re: fscanf > Given the information below this works: > > > $string ="text1, text2, text3"; > $array = preg_split("/[, ]/", $string, -1, PREG_SPLIT_NO_EMPTY); > echo "|" . $array[0] . "|" . $array[1] . "|" . $array[2] . "|"; > > ?> > > I put it between pipes to confirm the absence of spaces... > > It may or may not be the best way, but it is one way. > > Brian > > > -Original Message- > > From: Kris [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, January 21, 2003 5:02 PM > > To: Jason k Larson > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] Re: fscanf > > > > > > I've tried > > $array = fscanf ($fp, "%s, %s, %s\n"); > > earlier. It picks up > > array[0] == text, > > > > I need > > array[0] == text > > array[1] == text > > array[2] == text > > > > Thanx > > > > K > > > > - Original Message - > > From: "Jason k Larson" <[EMAIL PROTECTED]> > > To: "Kris" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Wednesday, January 22, 2003 9:52 AM > > Subject: Re: [PHP] Re: fscanf > > > > > > > I think he is looking more for: > > > $array = fscanf ($fp, "%s, %s, %s\n"); > > > > > > But with split, wouldn't that need to be: > > > > > > $array = split(', ', $line); > > > > > > http://www.php.net/manual/en/function.split.php > > > or > > > > > > $array = preg_split ('/[\s,]+/', $line); > > > using: http://www.php.net/manual/en/function.preg-split.php > > > > > > HTH, > > > Jason k Larson > > > > > > > > > Philip Hallstrom wrote: > > > > Why not: > > > > > > > > $array = split("[ ,]", $line); > > > > > > > > ? > > > > > > > > On Wed, 22 Jan 2003, Kris wrote: > > > > > > > > > > > >>Hi > > > >> > > > >>I'm having dramers with fscanf > > > >>I have a line: > > > >>text, text, text > > > >> > > > >>I can't work out how to scan removing the comma and whitespace. > > > >>the text can be absolutle anything. > > > >> > > > >>at the moment I have > > > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > > > >> > > > >>Thanks > > > >> > > > >>Kris > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] working with pop up windows
ahh shoot!!! forgot to add the values of the form once submitted go to another page before it's ment to go back to the parent page.. -Original Message- From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 22 January 2003 11:18 AM To: 'Peter Houchin'; 'php gen' Subject: RE: [PHP] working with pop up windows Post the results to the target being the parent window and have a JavaScript self.close() call on the window on submit/click. Timothy Hitchens (HiTCHO) Open Source Consulting e-mail: [EMAIL PROTECTED] > -Original Message- > From: Peter Houchin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 22 January 2003 11:13 AM > To: php gen > Subject: [PHP] working with pop up windows > > > howdy all, > > a page with a link to a pop up window.. > when a user clicks on it a window opens with a little form on > it, now what i want to happen is when the user hits submit > and it does all of it's processing it > > 1) closes the popup window > 2) updates the original page where the user first started > either by just a refresh or what eva.. and I can't just use > meta refreash as it's only on this instance that the page > needs to be refreashed .. > > TIA > > Peter > > > > -- > 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] working with pop up windows
Post the results to the target being the parent window and have a JavaScript self.close() call on the window on submit/click. Timothy Hitchens (HiTCHO) Open Source Consulting e-mail: [EMAIL PROTECTED] > -Original Message- > From: Peter Houchin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 22 January 2003 11:13 AM > To: php gen > Subject: [PHP] working with pop up windows > > > howdy all, > > a page with a link to a pop up window.. > when a user clicks on it a window opens with a little form on > it, now what i want to happen is when the user hits submit > and it does all of it's processing it > > 1) closes the popup window > 2) updates the original page where the user first started > either by just a refresh or what eva.. and I can't just use > meta refreash as it's only on this instance that the page > needs to be refreashed .. > > TIA > > Peter > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fscanf
Thanx Brian...Works good enough for me :) K - Original Message - From: "Brian T. Allen" <[EMAIL PROTECTED]> To: "'Kris'" <[EMAIL PROTECTED]>; "'Jason k Larson'" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, January 22, 2003 10:58 AM Subject: RE: [PHP] Re: fscanf > Given the information below this works: > > > $string ="text1, text2, text3"; > $array = preg_split("/[, ]/", $string, -1, PREG_SPLIT_NO_EMPTY); > echo "|" . $array[0] . "|" . $array[1] . "|" . $array[2] . "|"; > > ?> > > I put it between pipes to confirm the absence of spaces... > > It may or may not be the best way, but it is one way. > > Brian > > > -Original Message- > > From: Kris [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, January 21, 2003 5:02 PM > > To: Jason k Larson > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] Re: fscanf > > > > > > I've tried > > $array = fscanf ($fp, "%s, %s, %s\n"); > > earlier. It picks up > > array[0] == text, > > > > I need > > array[0] == text > > array[1] == text > > array[2] == text > > > > Thanx > > > > K > > > > - Original Message - > > From: "Jason k Larson" <[EMAIL PROTECTED]> > > To: "Kris" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Wednesday, January 22, 2003 9:52 AM > > Subject: Re: [PHP] Re: fscanf > > > > > > > I think he is looking more for: > > > $array = fscanf ($fp, "%s, %s, %s\n"); > > > > > > But with split, wouldn't that need to be: > > > > > > $array = split(', ', $line); > > > > > > http://www.php.net/manual/en/function.split.php > > > or > > > > > > $array = preg_split ('/[\s,]+/', $line); > > > using: http://www.php.net/manual/en/function.preg-split.php > > > > > > HTH, > > > Jason k Larson > > > > > > > > > Philip Hallstrom wrote: > > > > Why not: > > > > > > > > $array = split("[ ,]", $line); > > > > > > > > ? > > > > > > > > On Wed, 22 Jan 2003, Kris wrote: > > > > > > > > > > > >>Hi > > > >> > > > >>I'm having dramers with fscanf > > > >>I have a line: > > > >>text, text, text > > > >> > > > >>I can't work out how to scan removing the comma and whitespace. > > > >>the text can be absolutle anything. > > > >> > > > >>at the moment I have > > > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > > > >> > > > >>Thanks > > > >> > > > >>Kris > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] working with pop up windows
howdy all, a page with a link to a pop up window.. when a user clicks on it a window opens with a little form on it, now what i want to happen is when the user hits submit and it does all of it's processing it 1) closes the popup window 2) updates the original page where the user first started either by just a refresh or what eva.. and I can't just use meta refreash as it's only on this instance that the page needs to be refreashed .. TIA Peter -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read Mysql & Access
Is there a free ware program that will, allow me to take mysql dbase and convert it to ms ascess? Thanks Karl IncrediMail - Email has finally evolved - Click Here
RE: [PHP] Re: fscanf
Given the information below this works: I put it between pipes to confirm the absence of spaces... It may or may not be the best way, but it is one way. Brian > -Original Message- > From: Kris [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 21, 2003 5:02 PM > To: Jason k Larson > Cc: [EMAIL PROTECTED] > Subject: Re: [PHP] Re: fscanf > > > I've tried > $array = fscanf ($fp, "%s, %s, %s\n"); > earlier. It picks up > array[0] == text, > > I need > array[0] == text > array[1] == text > array[2] == text > > Thanx > > K > > - Original Message - > From: "Jason k Larson" <[EMAIL PROTECTED]> > To: "Kris" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Wednesday, January 22, 2003 9:52 AM > Subject: Re: [PHP] Re: fscanf > > > > I think he is looking more for: > > $array = fscanf ($fp, "%s, %s, %s\n"); > > > > But with split, wouldn't that need to be: > > > > $array = split(', ', $line); > > > > http://www.php.net/manual/en/function.split.php > > or > > > > $array = preg_split ('/[\s,]+/', $line); > > using: http://www.php.net/manual/en/function.preg-split.php > > > > HTH, > > Jason k Larson > > > > > > Philip Hallstrom wrote: > > > Why not: > > > > > > $array = split("[ ,]", $line); > > > > > > ? > > > > > > On Wed, 22 Jan 2003, Kris wrote: > > > > > > > > >>Hi > > >> > > >>I'm having dramers with fscanf > > >>I have a line: > > >>text, text, text > > >> > > >>I can't work out how to scan removing the comma and whitespace. > > >>the text can be absolutle anything. > > >> > > >>at the moment I have > > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > > >> > > >>Thanks > > >> > > >>Kris > > > > > > > > -- > > 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] numbers
I used the floor() function -Original Message- From: Brian T. Allen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 22 January 2003 11:49 AM To: [EMAIL PROTECTED]; 'Php-List (E-mail)' Subject: RE: [PHP] numbers Which, for the list, can be number_format(), among other things. Brian > -Original Message- > From: cj [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 21, 2003 5:18 PM > To: Php-List (E-mail) > Subject: RE: [PHP] numbers > > > I just found the answer > > -Original Message- > From: cj [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 22 January 2003 11:07 AM > To: Php-List (E-mail) > Subject: [PHP] numbers > > > G'day all > > I have a calculation which gives me a number ie 6976587.4169922 > This number is works outed by dividing a variable with 1024 > > Is there any way to strip anything after the . > so I just want the number 6976587 and not anything after the . > > Thanks > CJ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] numbers
Which, for the list, can be number_format(), among other things. Brian > -Original Message- > From: cj [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 21, 2003 5:18 PM > To: Php-List (E-mail) > Subject: RE: [PHP] numbers > > > I just found the answer > > -Original Message- > From: cj [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 22 January 2003 11:07 AM > To: Php-List (E-mail) > Subject: [PHP] numbers > > > G'day all > > I have a calculation which gives me a number ie 6976587.4169922 > This number is works outed by dividing a variable with 1024 > > Is there any way to strip anything after the . > so I just want the number 6976587 and not anything after the . > > Thanks > CJ > > -- > 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] session_register() Killing MySQL Connection
Hi, Friday night I upgrade my server with the following: Apache 1.3.27 PHP 4.3.0 MySQL 3.23.54a Mod_SSL 2.8.12 OpenSSL 0.9.7 ZendOptimizer 2.1.0 Immediately I started having really weird problems that proved almost impossible to debug. I finally narrowed it down to a few lines of code that get included at the top of all the pages: (I already know about the register_globals thing and I'm working on getting rid of it, but that will be a long road)... If both $REFER_SITE and $HTTP_REFERER are uninitialized ($HTTP_REFERER may only be empty) then session_register() kills the database connection on the page and none of my queries work... mysql_error() simply shows "Query was empty". I created an otherwise empty page that had only the code above, a database connection, and a query and confirmed that this is the case. I bring this to the list only to help others avoid the same 3 days of nightmarish hell I've just enjoyed on a large production site with goblins... And to confirm that the above is correct and seek possible long term solutions. Adding this line above session_register() is a temporary solution: if(!$REFER_SITE){ $REFER_SITE = ""; } Thanks all! Brian Allen [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security question regarding including files..
Chris Shiflett wrote: --- Sean Burlington <[EMAIL PROTECTED]> wrote: I'm not sure what harm could be done by this though. if a broswer attempts to load an image reference by an I sent a response about this earlier, but you should research CSRF and XSS. It does not matter that the browser shows a broken image if it has already sent the HTTP request. There is no special HTTP request for checking whether the Content-Type is really an image without the receiving Web server taking any action. A GET is a GET. hmmm but what does this have to do with the site allowing users to include links to images this is a security problem for the site that allows you to place purchase orders with a single click. what difference does it make that img links are placed by users ? I could just as easily trick users into making GET requests by puting dodgy img links in a pgae that I control ... I only initiate a small proportion of the requests my browser makes - in fact I go to some trouble to stop some of the requests happening as I don't like to see so many ads - I filter outgoing requests via squid. There are problems in the way the internet is designed and in misconcepotions as to how it works - but if we all code for absolute security we end up disconnecting from the web entirely. -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] numbers
I just found the answer -Original Message- From: cj [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 22 January 2003 11:07 AM To: Php-List (E-mail) Subject: [PHP] numbers G'day all I have a calculation which gives me a number ie 6976587.4169922 This number is works outed by dividing a variable with 1024 Is there any way to strip anything after the . so I just want the number 6976587 and not anything after the . Thanks CJ -- 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] Blueshoes App Framework
If you are looking for Frameworks make sure you select one that you understand the internals of not just because it will reduce your dev time as sooner rather than later something in the internals will fail and you will need to deal with it or your rapid dev becomes the slowest on the planet. Also look at the overheads some of these frameworks create as you will as long as you continue to use it have those inherited overheads. Timothy Hitchens (HiTCHO) Open Source Consulting e-mail: [EMAIL PROTECTED] > -Original Message- > From: Weston Houghton [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, 22 January 2003 10:02 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Blueshoes App Framework > > > > Does anyone have any experience with or comments on > blueshoes? I've not > investigated it much, as the license seems a bit odd, but I > thought I'd > get some info on it if anyone had any, so far I haven't found anyone > who has tried it, which seems a tad weird to me. > http://www.blueshoes.org/ Cheers, Wes -- 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] numbers
G'day all I have a calculation which gives me a number ie 6976587.4169922 This number is works outed by dividing a variable with 1024 Is there any way to strip anything after the . so I just want the number 6976587 and not anything after the . Thanks CJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fscanf
I've tried $array = fscanf ($fp, "%s, %s, %s\n"); earlier. It picks up array[0] == text, I need array[0] == text array[1] == text array[2] == text Thanx K - Original Message - From: "Jason k Larson" <[EMAIL PROTECTED]> To: "Kris" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, January 22, 2003 9:52 AM Subject: Re: [PHP] Re: fscanf > I think he is looking more for: > $array = fscanf ($fp, "%s, %s, %s\n"); > > But with split, wouldn't that need to be: > > $array = split(', ', $line); > > http://www.php.net/manual/en/function.split.php > or > > $array = preg_split ('/[\s,]+/', $line); > using: http://www.php.net/manual/en/function.preg-split.php > > HTH, > Jason k Larson > > > Philip Hallstrom wrote: > > Why not: > > > > $array = split("[ ,]", $line); > > > > ? > > > > On Wed, 22 Jan 2003, Kris wrote: > > > > > >>Hi > >> > >>I'm having dramers with fscanf > >>I have a line: > >>text, text, text > >> > >>I can't work out how to scan removing the comma and whitespace. > >>the text can be absolutle anything. > >> > >>at the moment I have > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > >> > >>Thanks > >> > >>Kris > > > > -- > 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] Blueshoes App Framework
Does anyone have any experience with or comments on blueshoes? I've not investigated it much, as the license seems a bit odd, but I thought I'd get some info on it if anyone had any, so far I haven't found anyone who has tried it, which seems a tad weird to me. http://www.blueshoes.org/ Cheers, Wes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
Mike IIRC this is a known bug with IIS (not PHP) when it gets the http redirect it junks the cookie - sorry I can't remember much more detail than that... Workaround maybe is to spit out an HTML based META refresh redirect tag instead of using the header() call. HTH Rich -Original Message- From: Mike Potter [mailto:[EMAIL PROTECTED]] Sent: 21 January 2003 15:35 To: [EMAIL PROTECTED] Subject: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set! HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple: . . . setcookie("testCookie", "testValue", time() + 3600, "/"); header("Location: http://newpage.php";); exit; Later, I pull the cookie: echo $_COOKIE["testCookie"]; and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set? Thanks a ton! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn'tset!
Discussion on this list has suggested that it can work if PHP is set to run as ISAPI, not CGI. HTH, Jason k Larson Mike Potter wrote: HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple: . . . setcookie("testCookie", "testValue", time() + 3600, "/"); header("Location: http://newpage.php";); exit; Later, I pull the cookie: echo $_COOKIE["testCookie"]; and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set? Thanks a ton! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: fscanf
I think he is looking more for: $array = fscanf ($fp, "%s, %s, %s\n"); But with split, wouldn't that need to be: $array = split(', ', $line); http://www.php.net/manual/en/function.split.php or $array = preg_split ('/[\s,]+/', $line); using: http://www.php.net/manual/en/function.preg-split.php HTH, Jason k Larson Philip Hallstrom wrote: Why not: $array = split("[ ,]", $line); ? On Wed, 22 Jan 2003, Kris wrote: Hi I'm having dramers with fscanf I have a line: text, text, text I can't work out how to scan removing the comma and whitespace. the text can be absolutle anything. at the moment I have $array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); Thanks Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
--- Mike Potter <[EMAIL PROTECTED]> wrote: > I am using Microsoft IIS with the latest PHP installed. > Here's a smple: > > setcookie("testCookie", "testValue", time() + 3600, "/"); > header("Location: http://newpage.php";); > exit; This will not work with IIS. You need to use a meta refresh or something to work around it. You can find out more here: http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2 Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fw: I need my PHP script to call a TCL proc
- Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 5:36 PM Subject: I need my PHP script to call a TCL proc > From: [EMAIL PROTECTED] (Phil Powell) > Newsgroups: comp.lang.tcl,comp.lang.php > Subject: I need my PHP script to call a TCL proc > NNTP-Posting-Host: 65.201.150.91 > Message-ID: <[EMAIL PROTECTED]> > > It's either that my PHP script call a working TCL proc that converts > all string text that looks like a URL ("http://...";) into a hyperlink, > or does someone have a PHP equivalent to do it? My PHP function > VALIDATE_URL fails to do any conversion in its regexp, however, the > TCL proc works every time, and the matching pattern is nearly > identical in both! > > TCL: > > proc VALIDATE_URL {contents} { > regsub -all "\\n" $contents "" contents > regsub -all {\.{2,}} $contents {. .} contents > regsub -all {(http://([a-zA-Z0-9_\-]+\.)+(/[a-zA-Z0-9_\-\.\~\^,%\+]+)*[^<\(\)> > ]+)} $contents " style='text-decoration:none'>\\1" contents > regsub -all {\. \.} $contents {..} contents > return $contents > } > > PHP: > > function VALIDATE_URL($contents) { >$contents = preg_replace("/\\n/e", '', $contents); >$contents = preg_replace('/\.{2,}/e', '. .', $contents); >$contents = preg_replace('/http[s]?:\/\/\([a-zA-Z0-9_\-]+\.\)+\(\/[a-zA-Z0-9_\-\.\~\^,%\ +]+\)*[^<\\(\\)> > ]+\)/ei', "1", $contents); >return preg_replace('/\. \./e', '..', $contents); > } > > So who wins, TCL or PHP? > > Thanx > Phil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple: . . . setcookie("testCookie", "testValue", time() + 3600, "/"); header("Location: http://newpage.php";); exit; Later, I pull the cookie: echo $_COOKIE["testCookie"]; and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set? Thanks a ton! Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: fscanf
Why not: $array = split("[ ,]", $line); ? On Wed, 22 Jan 2003, Kris wrote: > Hi > > I'm having dramers with fscanf > I have a line: > text, text, text > > I can't work out how to scan removing the comma and whitespace. > the text can be absolutle anything. > > at the moment I have > $array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > > Thanks > > Kris > > > -- > 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] ADV SQL Help Needed.
SELECT risk_level, COUNT(*) FROM mytable GROUP BY risk_level; - Original Message - From: "[-^-!-%-" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 6:06 AM Subject: [PHP] ADV SQL Help Needed. Hello everyone, I need help with the following query. I have a table with a column named 'RISK_LEVEL'. RISK_LEVEL can hold three values: Low, Moderate, and High. I need a query that counts the number of occurences of each option. Now, I know I can do 'select count(risk_level) as levelCount where risk_level=low' for each level (low, moderate, and high). But, I was wondering if there's anyway to merge the queries into one. I'm looking for something like "select count(risk_level='low') as lowCount, count(risk_level='moderate')as modCount, count(risk_level='high') as highCount " Which will return, lowCount = 1 , modCount=3, and highCount=1, for table with id | risk_level 1 | low 2 | moderate 3 | moderate 4 | high 5 | moderate How do you do it? Can tha be done? When I run the code above, I get the same number for each record. i.e. lowCount, modCount, and highCount all come out to 5--which is the number of records in the table. Is this possible, or should I just run multiple queries? Please help. =P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity Web Developement. Database. Hosting. Multimedia. -- 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
Fw: [PHP] $header = "Location:........" being ignored!
if ( $_POST['passwd'] != $db['password'] ) {header("Location: loginfailed.html"); exit; } - Original Message - From: "Shams" <[EMAIL PROTECTED]> To: <> Sent: Tuesday, January 21, 2003 3:48 AM Subject: [PHP] $header = "Location:" being ignored! Hi Group, I basically have some simple code such as: == if ( $_POST['passwd'] != $db['password'] {header("Location: loginfailed.html"); } //else $header = "Location: success.html"; == however, when I run this code, using a to submit password, username, etc.. if the passwords do not match, the page is forwarded to success.html ! Is there anything obvious that I am doing wrong? Thanks, Shams p.s. I don't want to use else{} because I have lots of if() checks! -- 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] fscanf
Hi I'm having dramers with fscanf I have a line: text, text, text I can't work out how to scan removing the comma and whitespace. the text can be absolutle anything. at the moment I have $array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); Thanks Kris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HELP HELP on a file parser
> I need some help, I think this is probably really simple and I was wondering > if anyone had some code I could use to help me write this. > > I need a page to parse a text file with a list of numbers, and then take > those numbers and parse another file with over 7MB of information and to > look for those numbers and then to pull out the matches. Now the file that > its looking through each record that has a number in it is in a specific > format with a beginnning and an end. Can you give a short example of each file and what you want to match in each? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] encrypt data with pgp
just for explain me another better: if I had post in this mailing list, it's just because I want to find another way to use this function under windows system function pgp_encrypt($keyring_location, $public_key_id, $plain_text) { $key_id = EscapeShellArg($public_key_id); putenv("PGPPATH=$keyring_location"); // encrypt the message $pipe = popen("pgpe -r $key_id -af", "r"); fwrite($pipe, $plain_text); $encrypted_text = ''; while($s = fgets($pipe, 1024)) { // read from the pipe $encrypted_text .= $s; } pclose($pipe); return $encrypted_text; } thanks for the tip on winPT, I will try it and will post the code of the function I will developp if some are interest in... _ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HELP HELP on a file parser
I need some help, I think this is probably really simple and I was wondering if anyone had some code I could use to help me write this. I need a page to parse a text file with a list of numbers, and then take those numbers and parse another file with over 7MB of information and to look for those numbers and then to pull out the matches. Now the file that its looking through each record that has a number in it is in a specific format with a beginnning and an end. Any help would be appreciated. _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dreading OOP
On Tue, 21 Jan 2003 09:47:28 -0600, Chris Boget wrote: >> > equates an object to a function >> You'd be better off trying to equate an object to a data type. > >Why is that? Please explain? my 2 cents are as follows. Objects have functions that return data types as many objects contain data. and the functions just tell the object how to manipulate and "display" or give some of the data back. I hope that helps. OOP kinda threw me for a loop when I first started wrapping my mind around it. >I do not mean to sound trite. I do not know and am very curious >to hear more. > >Chris > > >-- >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] Page Rendering
This worked ... thanks! But I am confused. It has worked with PHP_SELF in the past. Why would it not evaluate the variable on the server. Or more specifically, why would the page render fine in both Netscape and IE with the links (from PHP_SELF) being the only thing wrong with the page? Just trying to understand. :o) Bill -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 8:56 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Page Rendering On Tuesday 21 January 2003 22:26, Bill Arbuckle, Jr. wrote: > This code is at the top of an include file which is included in pics.php. > It seems that $PHP_SELF is interpreted differently in *some* instances > between the two browsers. I can't figure it out because PHP_SELF is a > server side evaluation. The links are output correctly in IE ... > http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ... > http://www.xyz.com/?page=2 I had this problem once before and > inadvertently fixed it with something else that I was doing. Any hints are > appreciated. Most likely $PHP_SELF is in fact blank. If you're using a relatively new version of PHP use $_SERVER['PHP_SELF'] instead. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* On the road, ZIPPY is a pinhead without a purpose, but never without a POINT. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File upload problem
Since you have 'safe-mode' on, Register globals will be turned off, so you should test $HTTP_POST_VARS['Submit'], instead. "John M" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I have the code below. It's a simple file upload. But it doesn't work. > Before the line if(isset( $Submit )) is an echo which can I read. But after > choosing a file and press a submit nothing happens. Why is if(isset( > $Submit )) always false? Maybe my apache or php config is wrong? > > I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on , upload_tmp_dir > is "c:\tmp\" and upload_max_filesize is 2M in PHP config file. > > Thanks! > > > > > Untitled Document > > > > > > > > > echo "Before submit \n"; > if(isset( $Submit )) > { > echo "After submit \n"; > > if ($_FILES['imagefile']['type'] == "image/gif"){ > copy ($_FILES['imagefile']['tmp_name'], > "files/".$_FILES['imagefile']['name']) > or die ("Could not copy"); > echo "Name: ".$_FILES['imagefile']['name'].""; >} > else { > echo ""; > echo "Could Not Copy, Wrong Filetype > (".$_FILES['imagefile']['name'].")"; > } > } > ?> > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File upload problem
> -Original Message- > From: John M [mailto:[EMAIL PROTECTED]] > Sent: Monday, June 30, 2003 3:05 PM > To: [EMAIL PROTECTED] > Subject: [PHP] File upload problem > > > Hello, > > I have the code below. It's a simple file upload. But it doesn't work. > Before the line if(isset( $Submit )) is an echo which can I > read. But after > choosing a file and press a submit nothing happens. Why is if(isset( > $Submit )) always false? Maybe my apache or php config is wrong? Shouldn't you be looking at $_POST['Submit'] or do you have register_globals turned on? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] File upload problem
John, I have Win 98 with Apache 2 and it worked fine for me, once I commented out the file type check, didn't seem to like any file I tried, even gifs. I also had to create a folder named 'files' under my htdocs folder in apache. Eddie -Original Message- From: John M [mailto:[EMAIL PROTECTED]] Sent: Monday, June 30, 2003 3:05 PM To: [EMAIL PROTECTED] Subject: [PHP] File upload problem Hello, I have the code below. It's a simple file upload. But it doesn't work. Before the line if(isset( $Submit )) is an echo which can I read. But after choosing a file and press a submit nothing happens. Why is if(isset( $Submit )) always false? Maybe my apache or php config is wrong? I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on , upload_tmp_dir is "c:\tmp\" and upload_max_filesize is 2M in PHP config file. Thanks! Untitled Document \n"; if(isset( $Submit )) { echo "After submit \n"; if ($_FILES['imagefile']['type'] == "image/gif"){ copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']) or die ("Could not copy"); echo "Name: ".$_FILES['imagefile']['name'].""; } else { echo ""; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")"; } } ?> -- 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] File upload problem
Hello, I have the code below. It's a simple file upload. But it doesn't work. Before the line if(isset( $Submit )) is an echo which can I read. But after choosing a file and press a submit nothing happens. Why is if(isset( $Submit )) always false? Maybe my apache or php config is wrong? I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on , upload_tmp_dir is "c:\tmp\" and upload_max_filesize is 2M in PHP config file. Thanks! Untitled Document \n"; if(isset( $Submit )) { echo "After submit \n"; if ($_FILES['imagefile']['type'] == "image/gif"){ copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']) or die ("Could not copy"); echo "Name: ".$_FILES['imagefile']['name'].""; } else { echo ""; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")"; } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] create new odbc connection..please help
Can someone point me in the right direction on how to create a new odbc connection? I need to use php to actually set up the connection. I know how to use php to connect once the connection is created and know how to create on using control panel>etc, just don't know how to create one using php. Thanks, Eddie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Wrapping SQL results in 2 tables
Just goes to show there are such things as dumb questions. Thanks for pointing me in the right direction. I'm using MSSQL, but mssql-data-seek does the trick! Thanks, Mike -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 11:35 AM To: Mike Smith; [EMAIL PROTECTED] Subject: Re: [PHP] Wrapping SQL results in 2 tables --- Mike Smith <[EMAIL PROTECTED]> wrote: > I'm trying to present a phone directory in a > printable format that will make "most" people > happy. What I need to do is take the results > from our database and "break" it into two > tables. I can't really tell what you are trying to do, but it sounds like you just want to loop through a MySQL result set more than once, right? If so, check out this function: http://www.php.net/manual/en/function.mysql-data-seek.php Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] activate an external link thru crontab
--- Patrick <[EMAIL PROTECTED]> wrote: > i want my page to send a report to a url, like a > form. Is that possible thru php? Sure. For the GET method, you can just use something like fopen() to open the URL. For the POST method, you can try something like this: http://www.php.net/";> Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: [PHP-DB] Re: [PHP] build menu with mysql data
Marc, Here is the entire script... It is doing a lot of things you don't need so you will have to sift through it to see what you want. If you have any questions, just ask. Eddie Depart Location # Pass Return Return Location Craft Preference Lowest Bid Add Bid 1){ # setup SQL statement $SQL3 = "select min(amount), count(*) as count1 from bids where clientreqid=".$myrow["id"].""; #execute SQL statement $result3= mysql_db_query($db,"$SQL3",$connection); $myrow3=mysql_fetch_array($result3); $count1=$myrow3["count1"]; print ""; if ($count1>0){ print""; $minbid=$myrow3["min(amount)"]; } if ($count1==0){ print""; $minbid="No Bids"; } print"".$myrow["departdate"].""; print"".$myrow["departloc"].""; print"".$myrow["numpass"].""; print"$return"; print"".$myrow["returndate"].""; print""; print"".$myrow["craftpref"].""; print"$minbid"; print "Add Bid"; } if ($bidhist==1){ # setup SQL statement $SQL3 = "select min(amount), count(*) as count1 from bids where clientreqid=".$myrow["id"].""; #execute SQL statement $result3= mysql_db_query($db,"$SQL3",$connection); # setup SQL statement $SQL4 = "select b.amount, DATE_FORMAT(b.timestamp, '%m/%d/%y') as timestamp, o.corpname from bids b ,operators o where b.operatorid=o.id and clientreqid='$clientreqid' order by b.amount,b.timestamp asc"; #execute SQL statement $result4= mysql_db_query($db,"$SQL4",$connection); $myrow3=mysql_fetch_array($result3); $count1=$myrow3["count1"]; if($clientreqid==$myrow["id"]){ print ""; if ($count1>0){ print""; $minbid=$myrow3["min(amount)"]; } if ($count1==0){ print""; $minbid="No Bids"; } print"".$myrow["departdate"].""; print"".$myrow["departloc"].""; print"".$myrow["numpass"].""; print"$return"; print"".$myrow["returndate"].""; print""; print"".$myrow["craftpref"].""; print"$minbid"; print "Add Bid"; print" "; print""; print""; print"Bid History"; print" Operator"; print" Bid"; print" Bid Date"; print""; print""; print""; print ""; while ($myrow4 = mysql_fetch_array($result4)){ print ""; print""; print""; print""; print"".$myrow4["corpname"].""; print"".$myrow4["amount"].""; print"".$myrow4["timestamp"].""; print""; print""; print""; print ""; } } if($clientreqid<>$myrow["id"]){ print ""; if ($count1>0){ print""; $minbid=$myrow3["min(amount)"]; } if ($count1==0){ print""; $minbid="No Bids"; } print"".$myrow["departdate"].""; print"".$myrow["departloc"].""; print"".$myrow["numpass"].""; print"$return"; print"".$myrow["returndate"].""; print""; print"".$myrow["craftpref"].""; print"$minbid"; print "Add Bid"; } } } print""; ?> -Original Message- From: Marc Bleuler [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 2:11 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-DB] Re: [PHP] build menu with mysql data Hi Eddie, This is exactly what I'm looking for. I don't have some code today that's why I'm posting to the newsgroup. The only working thing I have today is the listing of the "main db" It looks a bit whired since I copy past it from the file. Could you post some of your code? - print "$html_body_in"; print "Systems"; print ""; print ""; print ""; print "Name"; print "Vendor"; print "Description"; print "\t\n
Re: [PHP] Wrapping SQL results in 2 tables
--- Mike Smith <[EMAIL PROTECTED]> wrote: > I'm trying to present a phone directory in a > printable format that will make "most" people > happy. What I need to do is take the results > from our database and "break" it into two > tables. I can't really tell what you are trying to do, but it sounds like you just want to loop through a MySQL result set more than once, right? If so, check out this function: http://www.php.net/manual/en/function.mysql-data-seek.php Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] activate an external link thru crontab
Hi, i have a crontab that runs my script every 15min to check if anything has changed since the last control, if something has changed i want my page to send a report to a url, like a form. Is that possible thru php? regards patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple way to edit textfiles?
Hi, i want to edit just one post in the middle of 100 posts, i use this code to loop thru the posts $fp = fopen($servername, "r") or die("error"); $wuser = file($servername); $num = -1; for ($i=0; $i < count($wuser); $i++) { $wtemp = explode(";;", $wuser[$i]); if ($ausername == $wtemp[0]) { $num = $i; $wserver = explode(";;", $wuser[$i]); } } fclose($fp); if ($num == -1) { die ("error 2"); } the post is $num (eg. 50) and when the uses has made his changes i want to loop thru all and update just this post? its probebly very simple, i just cant find it in the book :/ regards patrick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wrapping SQL results in 2 tables
I'm trying to present a phone directory in a printable format that will make "most" people happy. What I need to do is take the results from our database and "break" it into two tables. ie. Extension FName LName Dept. ...25x Extension FName LName Dept. ...Records 26+ This is what I have done without success: $result = mssql_query($sql); echo "\n"; echo "\n"; echo "Extension\n"; echo "\n"; echo "First Name\n"; echo "\n"; echo "Last Name\n"; echo "\n"; echo "Dept.\n"; echo "\n"; echo "\n"; while($row = mssql_fetch_array($result)) { $n++; echo "\n"; echo "$row[0]\n"; echo "\n"; echo "$row[1]\n"; echo "\n"; echo "$row[2]\n"; echo "\n"; echo "$row[3]\n"; echo "\n"; echo "\n"; If ($n==40) { echo "\n"; echo ""; echo "\n"; echo "\n"; echo "$row[0]\n"; echo "\n"; echo "$row[1]\n"; echo "\n"; echo "$row[2]\n"; echo "\n"; echo "$row[3]\n"; echo "\n"; echo "\n"; } else { } } echo "\n"; It successfully closes that table after 40 records, but the remaining records are at the bottom of the page. What I'd like to end up with is 2 columns with 40 records in each column Ext. FName LName Dept. | Ext. FName LName Dept. 1 41 ... ... 40 Any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Sessions
Ok, here's what I've found: register_globals is ON however register_argc_argv is OFF on the server with problems. The server is a Sun Cobalt server running some form of Linux. My local machine that I work on is WinXP Pro using PHP 4.3.0, on this machine I've got register_globals set to ON and register_argc_argv ON as well ... I'm not entirely sure what register_argc_argv does, but could this be the problem? At 09:41 PM 1/21/2003 +1100, Justin French wrote: on 21/01/03 9:25 PM, Tim Thorburn ([EMAIL PROTECTED]) wrote: > There is some discussion as to whether my globals are on or not ... I am > using session_register to name my sessions, and then the global command > later on on the individual pages to remember which session it is we're > looking for. No no no... check the output of phpinfo(), or check your php.ini file to see if the directive "register_globals" has a value of ON or OFF. This is more than likely the problem I think. Also check the same value on your local machine. Justin -- 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 Sessions
Ok, here's the sample code I found in one of my PHP books - it doesn't work exactly like my original script for checking passwords, but it does a close enough job to let me know that the sessions aren't staying registered. I could ask my host if anyone else has had problems, but that would mean being able to get them on the phone, find someone who speaks English, and then hope that person has any kind of experience with Linux/PHP - which I'm quickly finding does not exist. As it is a shared hosting situation, and I have no shell access (through telnet or SSH), I cannot check the php.ini file to see. authmain.php session_start(); if ($userid && $password) { // if the user has just tried to log in $db_conn = mysql_connect("localhost", "login", "passWord"); mysql_select_db("databaseName", $db_conn); $query = "SELECT * FROM userlogin WHERE user='$userid' AND passwd=password('$password')"; $result = mysql_query($query, $db_conn); if (mysql_num_rows($result) > 0) { // if they are in the database register the user id $valid_user = $userid; session_register("valid_user"); } } ?> Test Sessions if (session_is_registered("valid_user")) { echo "You are logged in as: $valid_user Log out"; } else { if (isset($userid)) { // if they've tried and failed to log in echo "Could not log you in"; } else { // they have not tried to log in yet or have logged out echo "You are not logged in."; } // provide form to log in echo ""; echo ""; echo "Userid:"; echo ""; echo "Password:"; echo ""; echo ""; echo ""; echo ""; } ?> Members section members_only.php global $userid; session_start(); echo "Members only"; // check session variable if (session_is_registered("valid_user")) { echo "You are logged in as $valid_user."; echo "Members only content goes here"; } else { echo "You are not logged in."; echo "Only logged in members may see this page."; } echo "Back to main page"; ?> At 06:29 PM 1/21/2003 +0800, Jason Wong wrote: On Tuesday 21 January 2003 17:59, Tim Thorburn wrote: > Yes, the examples from the manual do work on the server using PHP 4.2.2 - > however they do not work on the server using PHP 4.1.2. > > I've been using this same script for many sites with PHP versions 4.0.6 > thru 4.2.2 with no problems until now which leads me to believe that I must > attempt to change a PHP setting through .htaccess since it is hosted on a > shared server. > > I've tried the example from the manual on several other sites - works > everywhere but on this problem server. It's time to see some code :) Does sessions work at all for the other people on your shared server? Ask your host whether anybody else has complained. > PHP 4.1.2 (doesn't work) > '--enable-mm=shared' Would this have anything to do with it? Apparently there could be problems with storing sessions in mm: http://marc.theaimsgroup.com/?l=php-general&m=104311365417871&w=2 Check in php.ini whether sessions are file based or using mm. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Goals... Plans... they're fantasies, they're part of a dream world... -- Wally Shawn */ -- 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] Detecting posts from outside site
--- Jim Lucas <[EMAIL PROTECTED]> wrote: > what about checking the checking the remote ip > address? The common use of HTTP proxies on the Web makes this extremely unreliable. A typical HTTP proxy servicing many users will cause them all to appear to be coming from the same IP address, while round-robin HTTP proxies (like AOL's) will make a single person appear to be coming from many different IP addresses. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting posts from outside site
what about checking the checking the remote ip address? Jim - Original Message - From: "Chris Shiflett" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 10:45 AM Subject: Re: [PHP] Detecting posts from outside site > --- [EMAIL PROTECTED] wrote: > > If it's bulletproof, then I figured this could help > > some of you out. If not, I welcome comments (I'm a > > little bit hesitant of calling things 'bulletproof'). > > It's not bulletproof. :-) > > > if((count($_POST) > 0) && > > (!stristr($_SERVER["HTTP_REFERER"], > > $http_referer))) { > > unset($_POST); > > $evil = "postedfromoutsidepage"; > > } > > If this page is located at http://www.example.org/foo.php, > and you are trying to ensure that the data is being posted > from http://www.example.org/bar.php consider the following: > > > # telnet www.example.org 80 > Trying 192.0.34.166... > Connected to www.example.org (192.0.34.166). > Escape character is '^]'. > POST /foobar.php HTTP/1.1 > Host: www.example.org > Referer: http://www.example.org/bar.php > Content-Type: application/x-www-form-urlencoded > Content-Length: 26 > > varname=any_value_i_choose > > > Someone can use this method to bypass your Referer header > check and post any data they choose. > > Chris > > -- > 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] build menu with mysql data
Hi Eddie, This is exactly what I'm looking for. I don't have some code today that's why I'm posting to the newsgroup. The only working thing I have today is the listing of the "main db" It looks a bit whired since I copy past it from the file. Could you post some of your code? - print "$html_body_in"; print "Systems"; print ""; print ""; print ""; print "Name"; print "Vendor"; print "Description"; print "\t\n"; print "\n"; $query="SELECT system.*, vendor.* FROM system, vendor where system.VENDOR = vendor.ID order by system.NAME ASC"; $result=mysql_query($query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $system_id=mysql_result($result,$i,"system.ID"); $system_name=mysql_result($result,$i,"system.NAME"); $vendor_name=mysql_result($result,$i,"vendor.NAME"); $vendor_id=mysql_result($result,$i,"vendor.ID"); $system_description=mysql_result($result,$i,"system.DESCRIPTION"); print ""; print ""; print ""; print "$sy stem_name"; print " $vendor_name"; print "$system_description"; print ""; print ""; print ""; print ""; print ""; ++$i; } - br Marc print "$html_body_out"; "Edward Peloke" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Marc, > > I did something sort of along these lines with an 'auction' site I worked > on. I displayed rows from a db. If the row had bid information in the db > (or your case submenu info) then a + sign icon was displayed next to it. IF > the plus sign was clicked, the page would reload and the bid or submenu info > would be displayed and the + sign would change to a - sign to give the > appearence of a tree menu. Can you post some of your code? > > Eddie > > -Original Message- > From: Marc Bleuler [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 21, 2003 12:31 PM > To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Subject: [PHP] build menu with mysql data > > > Hi, > > I would like to bild a tree menu with mySQL data. where I have the collapsed > main menue and when I click the link the specific submenue expands (as > follow). > > (collapsed Main Menu) > + Home > + Downloads > + About me > + Search > > and for example if I click the "Download" section it will look as > follow > > (expanded Main-Sub Menu) > + Home > + Downloads > - Music > - Programm > + About me > + Search > > and the SQL Tables... > > MAINMENUE_TABLE > IDNAME > - > |1|Home| > |2|Downloads| > |3|About me | > |4|Search | > > and > > SUBMENUE_TABLE > IDMAIN_ID NAMEURL > --- > |1|2|Music| > ./somefile.php?action=music > |2|2|Programm | > ./somefile.php?action=programm > |3|3|Pictures | > ./somefile.php?action=pictures > |4|3|Address| > ./somefile.php?action=address > |5|4|My Page | > ./somefile.php?action=mypage > |6|4|The Web | > ./somefile.php?action=theweb > |7|4|Google | > ./somefile.php?action=google > > > If I'm using a while loop it won't work, so I realy don't have and more > ideas... > Please consider in your explanations I'm a PHP beginner... :-) > > thanks > Marc > > > > -- > 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] Dynamic List Using Php
So the select will be generated from values in the db? here is an example of something I did.. print" City:"; print" "; $result2=mysql_query("SELECT distinct(city) from listings where approved=1 and state='$state' and country='$country'"); while ($myrow2 = mysql_fetch_array($result2)){ print "" . $myrow2["city"]; } print ""; Eddie -Original Message- From: Pushpinder Singh Garcha [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 2:10 PM To: [EMAIL PROTECTED] Subject: [PHP] Dynamic List Using Php Hello All I am wanting a create a dynamic List using php. When a user enters a value on a form, I need the value that he entered on the form to added to a dynamic list box, which is displayed on the next page. So the List Box continues to grow whenever a user adds a value on the form (note: The values entered every time have to be stored) Thanks in advance. Pushpinder Singh Garcha _ Web Architect T. Falcon Napier and Associates, Inc. _ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic List Using Php
unless you want to submit the form to the server for each new entry (bad mojo) then I would recommend you look into using JavaScript to do this. (much easier and faster.) Once the user has entered all their entries then submit the form and update your database or storage medium of choice. IMHO, etc. =C= * * Cal Evans * Techno-Mage * http://www.calevans.com * - Original Message - From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 1:09 PM Subject: [PHP] Dynamic List Using Php > Hello All > > I am wanting a create a dynamic List using php. When a user enters a > value on a form, I need the value that he entered on the form to added > to a dynamic list box, which is displayed on the next page. So the List > Box continues to grow whenever a user adds a value on the form (note: > The values entered every time have to be stored) > > Thanks in advance. > > Pushpinder Singh Garcha > _ > Web Architect > T. Falcon Napier and Associates, Inc. > _ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dynamic List Using Php
Hello All I am wanting a create a dynamic List using php. When a user enters a value on a form, I need the value that he entered on the form to added to a dynamic list box, which is displayed on the next page. So the List Box continues to grow whenever a user adds a value on the form (note: The values entered every time have to be stored) Thanks in advance. Pushpinder Singh Garcha _ Web Architect T. Falcon Napier and Associates, Inc. _
Re: [PHP] security question regarding including files..
--- Sean Burlington <[EMAIL PROTECTED]> wrote: > is there really any site which will accept a book > order based an a sigle GET? Well, yes, but that is not the point really. The example of the tag is just one way you can forge an HTTP request from another user (the victim). Also consider that many people create sites with PHP with register_globals set to on. Even when these people go to great lengths to validate all incoming data and to identify the user, this does not defend against CSRF. The data being sent is valid data, and the user sending it is the authenticated user. That is the danger. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect problem..update
Thanks, we're going to give that a try. -Original Message- From: Tracy Finifter Rotton <[EMAIL PROTECTED]> To: Tom Ray <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> Date: Tue, 21 Jan 2003 10:25:55 -0800 Subject: Re: [PHP] mysql_connect problem..update > Talk to the other admin. If you're using RPMs, you just need to > install the > php_mysql RPM, restart apache, and you should be up and running again. > > If you're compiling PHP from scratch, you'll have to do so again with > --with-mysql in the configure command. But, as this is the default > when > compiling PHP from scratch, my hunch is the first option is what you > really > need. > > -- t > > On 1/21/03 10:01 AM, "Tom Ray" <[EMAIL PROTECTED]> wrote: > > > It turns out after some checking, the other admin on the machine ran > a > > kernel update last week. I hadn't been testing any scripts over the > last > > week myself so I didn't notice the issue until the other day. > > > > When I run a function_exists() for mysql_connect it comes back false. > When > > I run phpinfo() there is no reference to mysql at all. > > > > I'm still kind of new to all this, and I'm just wondering what I need > to > > do to get php and mysql talking again. Is there a service or command > I can > > run to get things going again? > > > > -- > Tracy F. Rotton > [EMAIL PROTECTED] > http://www.taupecat.com/ > > "... I like the 49ers because they're pure of heart, > Seattle because they've got something to prove, > and the Raiders because they always cheat." > -- Lisa Simpson, "Lisa the Greek" > > > -- > 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] security question regarding including files..
--- Sean Burlington <[EMAIL PROTECTED]> wrote: > I'm not sure what harm could be done by this though. > > if a broswer attempts to load an image reference by > an I would expect it simply to ignore it... I sent a response about this earlier, but you should research CSRF and XSS. It does not matter that the browser shows a broken image if it has already sent the HTTP request. There is no special HTTP request for checking whether the Content-Type is really an image without the receiving Web server taking any action. A GET is a GET. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: forking scripts
PHP can fork scripts. Refer to the pcntl extension. http://www.php.net/manual/en/ref.pcntl.php You'll be wanting to use pcntl_fork()... J Senn wrote: > Hi, > > Since php does not have child -> parent forking methods, can anybody > suggest a method to achieve this. > > Thanks. > > Senn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Detecting posts from outside site
--- [EMAIL PROTECTED] wrote: > If it's bulletproof, then I figured this could help > some of you out. If not, I welcome comments (I'm a > little bit hesitant of calling things 'bulletproof'). It's not bulletproof. :-) > if((count($_POST) > 0) && > (!stristr($_SERVER["HTTP_REFERER"], > $http_referer))) { > unset($_POST); > $evil = "postedfromoutsidepage"; > } If this page is located at http://www.example.org/foo.php, and you are trying to ensure that the data is being posted from http://www.example.org/bar.php consider the following: # telnet www.example.org 80 Trying 192.0.34.166... Connected to www.example.org (192.0.34.166). Escape character is '^]'. POST /foobar.php HTTP/1.1 Host: www.example.org Referer: http://www.example.org/bar.php Content-Type: application/x-www-form-urlencoded Content-Length: 26 varname=any_value_i_choose Someone can use this method to bypass your Referer header check and post any data they choose. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: str_replace an include
try: $aux = $replace->feedLinks(); $read = str_replace('
RE: [PHP] build menu with mysql data
Marc, I did something sort of along these lines with an 'auction' site I worked on. I displayed rows from a db. If the row had bid information in the db (or your case submenu info) then a + sign icon was displayed next to it. IF the plus sign was clicked, the page would reload and the bid or submenu info would be displayed and the + sign would change to a - sign to give the appearence of a tree menu. Can you post some of your code? Eddie -Original Message- From: Marc Bleuler [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 12:31 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP] build menu with mysql data Hi, I would like to bild a tree menu with mySQL data. where I have the collapsed main menue and when I click the link the specific submenue expands (as follow). (collapsed Main Menu) + Home + Downloads + About me + Search and for example if I click the "Download" section it will look as follow (expanded Main-Sub Menu) + Home + Downloads - Music - Programm + About me + Search and the SQL Tables... MAINMENUE_TABLE IDNAME - |1|Home| |2|Downloads| |3|About me | |4|Search | and SUBMENUE_TABLE IDMAIN_ID NAMEURL --- |1|2|Music| ./somefile.php?action=music |2|2|Programm | ./somefile.php?action=programm |3|3|Pictures | ./somefile.php?action=pictures |4|3|Address| ./somefile.php?action=address |5|4|My Page | ./somefile.php?action=mypage |6|4|The Web | ./somefile.php?action=theweb |7|4|Google | ./somefile.php?action=google If I'm using a while loop it won't work, so I realy don't have and more ideas... Please consider in your explanations I'm a PHP beginner... :-) thanks Marc -- 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] Form Validating Class (OOP misunderstandings...)
On 2003.01.21 15:21 Rich Gray wrote: PHP does not yet support private methods ... your problem with getValue() is most probably because register_globals is off in your php.ini try substituting $_POST[] for $HTTP_POST_VARS[] and it may start to work... Sorry... I forgot to mention that I use PhP 4.2.2 on my GNU/Linux Box but I have PhP 4.0.6 on the production machine, AFAIK $_POST is a 'feature' of PhP 4.1.x ... Thanks for your help, I'll try to be more accurate next time... Nicholas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect problem..update
Talk to the other admin. If you're using RPMs, you just need to install the php_mysql RPM, restart apache, and you should be up and running again. If you're compiling PHP from scratch, you'll have to do so again with --with-mysql in the configure command. But, as this is the default when compiling PHP from scratch, my hunch is the first option is what you really need. -- t On 1/21/03 10:01 AM, "Tom Ray" <[EMAIL PROTECTED]> wrote: > It turns out after some checking, the other admin on the machine ran a > kernel update last week. I hadn't been testing any scripts over the last > week myself so I didn't notice the issue until the other day. > > When I run a function_exists() for mysql_connect it comes back false. When > I run phpinfo() there is no reference to mysql at all. > > I'm still kind of new to all this, and I'm just wondering what I need to > do to get php and mysql talking again. Is there a service or command I can > run to get things going again? > -- Tracy F. Rotton [EMAIL PROTECTED] http://www.taupecat.com/ "... I like the 49ers because they're pure of heart, Seattle because they've got something to prove, and the Raiders because they always cheat." -- Lisa Simpson, "Lisa the Greek" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security question regarding including files..
Gibbs, Liam - SXIA wrote: I agree that there are risks - but I do think this can be done safely Couldn't you just check the submitted URL and find out if it's a gif or jpeg? I don't think even PHP-enabled servers will run a gif or jpeg. please send replies to the list ... and you cant tell what type of file will be returned by the url it is easy to set up a server to treat a file named foo.gif as a php file (or whatever) even if you tested the url by attemting to download the file it would be easy to write a script that would return an innocent gif to requests originating for the webservers ip address - and anything else to the rest of the world. I'm not sure what harm could be done by this though. if a broswer attempts to load an image reference by an but this would be worth testing. -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Finding out if a table exists
On 21-Jan-2003 Mako Shark wrote: > Is there a way of finding if a table exists with only > one command in MySQL? I've looked through the MySQL > functions, and the closest I've gotten to what I need > is mysql_list_tables or mysql_tablename (I'll have to > check into these a little more), but I was hopefully > looking for something that returns a boolean value, > and to be able to use it like: > > if(mysql_table_exists("tablename")) { > ... > } > > Any ideas, short of creating my own function? > Create your own, or borrow mine: function tableexists($tbl) { $res = @mysql_query("SELECT 1 FROM $tbl LIMIT 1"); return ($res ? true : false); } Regards, -- Don Read [EMAIL PROTECTED] -- "Beer is proof that God loves us and wants us to be happy." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_connect problem..update
It turns out after some checking, the other admin on the machine ran a kernel update last week. I hadn't been testing any scripts over the last week myself so I didn't notice the issue until the other day. When I run a function_exists() for mysql_connect it comes back false. When I run phpinfo() there is no reference to mysql at all. I'm still kind of new to all this, and I'm just wondering what I need to do to get php and mysql talking again. Is there a service or command I can run to get things going again? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding out if a table exists
Or... function mysql_table_exists($table) { mysql_query("use $table"); if(mysql_error()) { return false; } else { return true; } } ---John Holmes... - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: "Mako Shark" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 1:05 PM Subject: Re: [PHP] Finding out if a table exists > Okay what the hell I'm bored anyway... > > function mysql_table_exists($table) > { > global $db; // <- database resource handle > $result = @mysql_list_tables($db); > if (mysql_num_rows($result) > 0) > { > while ($row = mysql_fetch_row($result)) > { > if (strtolower($row[0]) == strtolower($table))) > { > return true; > } > } > } > return false; > } > > Untested but it's pretty basic stuff so I'm certain it works. Enjoy! > > -Kevin > > - Original Message - > From: "Mako Shark" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, January 21, 2003 10:05 AM > Subject: [PHP] Finding out if a table exists > > > > Is there a way of finding if a table exists with only > > one command in MySQL? I've looked through the MySQL > > functions, and the closest I've gotten to what I need > > is mysql_list_tables or mysql_tablename (I'll have to > > check into these a little more), but I was hopefully > > looking for something that returns a boolean value, > > and to be able to use it like: > > > > if(mysql_table_exists("tablename")) { > > ... > > } > > > > Any ideas, short of creating my own function? > > > > __ > > Do you Yahoo!? > > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > > http://mailplus.yahoo.com > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] security question regarding including files..
On Wednesday 22 January 2003 01:40, Sean Burlington wrote: > is there really any site which will accept a book order based an a sigle > GET ? Amazon makes a big deal of their "one-click" shopping feature. It's so good they've even patented it. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* We are drowning in information but starved for knowledge. -- John Naisbitt, Megatrends */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding out if a table exists
Okay what the hell I'm bored anyway... function mysql_table_exists($table) { global $db; // <- database resource handle $result = @mysql_list_tables($db); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_row($result)) { if (strtolower($row[0]) == strtolower($table))) { return true; } } } return false; } Untested but it's pretty basic stuff so I'm certain it works. Enjoy! -Kevin - Original Message - From: "Mako Shark" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 10:05 AM Subject: [PHP] Finding out if a table exists > Is there a way of finding if a table exists with only > one command in MySQL? I've looked through the MySQL > functions, and the closest I've gotten to what I need > is mysql_list_tables or mysql_tablename (I'll have to > check into these a little more), but I was hopefully > looking for something that returns a boolean value, > and to be able to use it like: > > if(mysql_table_exists("tablename")) { > ... > } > > Any ideas, short of creating my own function? > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.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] Re:[PHP] dreading OOP
Thank you, I'll check this book out. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Sukrit [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 12:39 PM To: [EMAIL PROTECTED] Subject: [PHP] Re:[PHP] dreading OOP > "Larry" == Larry Brown <[EMAIL PROTECTED]> writes: Larry> places. However, my mind apparently works different and I Larry> keep trying to relate the OOP structure to what I already Larry> know which equates an object to a function. I am resolving This happens a lot with me too :) Larry> to purchase a book dedicated to instruction in the inns and Larry> outs of OOP. Specifically at it relates to PHP would be Larry> great but my emphasis is towards something that teaches Larry> someone that is stubborn in his reliance on previously Larry> learned methods. I hope this makes sense and I'm not alone Larry> on this. :) Any suggestions would be greatly appreciated! i am having a hard time with OOP too. i did buy a book Object Oriented Analysis and Design Andrew Haigh. Well, it doesn't have PHP but it's otherwise very lucid and clear. It also covers UML. Haven't read much of it till now but i think it might help you. Learning to think in terms of object is really diffucult imho, for someone who is still stuck in the older procedural paradigm like us. It'll take time. Wishing us all OO enlightenment :) regards sukrit -- 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] Detecting resolution
You have to use JavaScript for this. Sorry! but i've asked the same question on here a long time ago :) - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 11:22 AM Subject: [PHP] Detecting resolution > Does anyone know how to detect the resolution of someone's computer? Or is > this possible through 'browscapping'? > > -- > 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] Detecting posts from outside site
[EMAIL PROTECTED] wrote: Also, speaking of detection, I made a small script that can protect against people downloading your site's forms, modifying their new local copy (and putting an absolute URL in the form's ACTION attribute), and then posting data using the botched form. If it's bulletproof, then I figured this could help some of you out. If not, I welcome comments (I'm a little bit hesitant of calling things 'bulletproof'). $http_referer (lowercase) is the parse_url() of $_SERVER["HTTP_REFERER"]. Some local mucking up can give you the format you want for it. if((count($_POST) > 0) && (!stristr($_SERVER["HTTP_REFERER"], $http_referer))) { unset($_POST); $evil = "postedfromoutsidepage"; } Then, you can test for $evil when you need to print an error message or decide whether or not the data is proper. HTTP_REFFERER is sent by the client and is not a secure value it is easy to write a script in eg PHP that will fetch a web page with a completely bogus referrer url... some people argue that cheching the referrer url 'raises the bar' security wise - personnaly I think this sort of illusory security leads to complacency in data checking. I think it is better to always remeber that data can be posted to your server by many means - treat all data as suspect until proven otherwise. In addition this method can make code less portable between servers. -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dreading OOP
The easiest way for me to explain and understand OOP was to think of it this way. You have an object and in that object contains functions that only pertain to that one object. See diagram below. Object1 | |_ function1 | |_ function2 . . etc Object2 | |_ function1 | |_ function2 . . etc Note: Inside an object you can have functions that have the same name as other functions inside another object. This makes life really easy if you have to share code with someone because if you are totally procedural/functions you might have some functions with the same name and then your code won't work. However, if you place your functions inside an object you can avoid this problem all together.. kind of nice isn't it? :) Anyway, that's how I explain OOP in a nutshell to people that don't understand. Just don't forget there are a TON of other things about OOP but once you get the basic idea of how it works down (like this) then the rest is pretty easy to pick up and understand. Hope this helps! - Original Message - From: "Larry Brown" <[EMAIL PROTECTED]> To: "PHP List" <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 11:31 AM Subject: RE: [PHP] dreading OOP > The only reason I feel the need to expand my understanding is that I have to > learn other concepts to produce my client's solutions. For instance I am > now being asked to use SOAP to communicate with a vendor of his. Now I am > reading about SOAP and frequently the descriptions rely on the reader's > understanding of OOP. I can individually scrutinize a description and break > it down to its elements. Then I can picture what is being said, but without > having used those methods in my code, it is frustrating reading. I don't > know that SOAP is in and of itself OOP but people that write about it use > OOP based consepts to exlain what is happening. And this is one example. > Don't let me go into the Java and Javascript world! > > Larry S. Brown > Dimension Networks, Inc. > (727) 723-8388 > > -Original Message- > From: Johnson, Kirk [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, January 21, 2003 10:40 AM > To: PHP List > Subject: RE: [PHP] dreading OOP > > > > -Original Message- > > > >However, my mind apparently works different and I keep trying to relate the > OOP structure to > > what I already know which equates an object to a function. I am resolving > > > to purchase a book dedicated to instruction in the inns and outs of OOP. > > Specifically at it relates to PHP would be great but my emphasis is > towards > > something that teaches someone that is stubborn in his reliance on > previously learned > > methods. I hope this makes sense and I'm not alone on this. :) > > My only suggestion is that you re-consider why you want to take up OOP. If a > procedural approach works for you, go with it. It's not like we're building > air traffic control systems here ;) > > Kirk > > -- > 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] download script
Instead, find out exactly what headers it is that Getright sends. Store the resume point in $resume_bytecount Then, have your script do something like this: /** Send the appropriate HTML headers **/ /** Do this instead of the fpassthru **/ $filesize = size($filename); $fp = fopen('$filename','r'); while ($byte_count < $resume_bytecount) { fread($fp,1); $byte_count = $byte_count + 1; } while(!feof($fp)) { print(read($fp, 8192)); flush(); } Simple, read the file until resume point Then, send the file with an 8k blocksize (standard I believe, change as necessary) Matt - Original Message - From: Timothy Hitchens (HiTCHO) <[EMAIL PROTECTED]> To: 'Martin' <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 10:08 AM Subject: RE: [PHP] download script > I have never done a script that supports resume but this is the logic > you need to follow to work out the protocol behaviour. > > - Create a download script as per below start downloading then stop the > web server. > - Change the script to e-mail you the headers from the script request. > - Restart the web server and tell Get Right to resume. > > You should now know what it sends and you simply need to read in the > file to that point > in the data and start the stream again. > > I hope this helps. (Trial and Error) > > > Timothy Hitchens (HiTCHO) > Open Source Consulting > e-mail: [EMAIL PROTECTED] > > > -Original Message- > > From: Martin [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, 22 January 2003 12:50 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] download script > > > > > > i need a script that make downloads from files but it must > > support resuming for getright and download acelerator pro. > > Thanks... I have this classic download script , but does not > > support resuming > >error_reporting(0); > >header("Last-Modified: " . gmdate("D, d M Y H:i:s T", > > filemtime($filename))); > >header("Accept-Ranges: bytes"); > >header("Content-Length: " . filesize($filename)); > >header("Content-Disposition: attachment; filename=" . > > $download); > > // header("Content-Type: application/octet-stream"); > >readfile($filename); > >header("Connection: close"); > > > > > > > > -- > > 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] security question regarding including files..
Chris Shiflett wrote: --- Chad Day <[EMAIL PROTECTED]> wrote: I want to give my users the ability to submit a URL to a database, then when they pull up their page, their photo is included .. what I'm worried about is them pointing the link to some malicious code or something.. Your instincts serve you well. There are two types of attacks to worry about in this situation, depending on who can see this "image". If only the user who submitted the URL can see it, then your users only risk CSRF attacks, which are not very common (yet) but are very dangerous. If everyone can see the "image", then your application is also at risk of XSS. If you realize that an embedded image is requested separately by a Web client, you can see that this basically allows an attacker the opportunity of forcing another user to visit a URL of the attacker's choice. For example, consider an image that looks like this: http://bookstore.xxx/buy.php?book=httphandbook";> I agree that there are risks - but I do think this can be done safely if you make sure the user cannot insert javascript into the page, there isn't much cross site scripting that can be done. and make sure they can't insert quotes which would end the quoted string in the html page. is there really any site which will accept a book order based an a sigle GET ? I guess stripping the query string would be safest... but its a balance betwwen security and functionality ... -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Page Rendering
Bill Arbuckle, Jr. wrote: Hi all. I am having some problems with a script which reads information from a database and creates a table. It works in IE but not Netscape. it can be usefull to test the resulting html http://validator.w3.org/ valid html is much more likely to appear consistent across browsers -- Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re:[PHP] dreading OOP
> "Larry" == Larry Brown <[EMAIL PROTECTED]> writes: Larry> places. However, my mind apparently works different and I Larry> keep trying to relate the OOP structure to what I already Larry> know which equates an object to a function. I am resolving This happens a lot with me too :) Larry> to purchase a book dedicated to instruction in the inns and Larry> outs of OOP. Specifically at it relates to PHP would be Larry> great but my emphasis is towards something that teaches Larry> someone that is stubborn in his reliance on previously Larry> learned methods. I hope this makes sense and I'm not alone Larry> on this. :) Any suggestions would be greatly appreciated! i am having a hard time with OOP too. i did buy a book Object Oriented Analysis and Design Andrew Haigh. Well, it doesn't have PHP but it's otherwise very lucid and clear. It also covers UML. Haven't read much of it till now but i think it might help you. Learning to think in terms of object is really diffucult imho, for someone who is still stuck in the older procedural paradigm like us. It'll take time. Wishing us all OO enlightenment :) regards sukrit -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] build menu with mysql data
<> What doesn't work about it? Does it not fetch the submenus? Does it exceed its number of rows somehow? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] build menu with mysql data
Hi, I would like to bild a tree menu with mySQL data. where I have the collapsed main menue and when I click the link the specific submenue expands (as follow). (collapsed Main Menu) + Home + Downloads + About me + Search and for example if I click the "Download" section it will look as follow (expanded Main-Sub Menu) + Home + Downloads - Music - Programm + About me + Search and the SQL Tables... MAINMENUE_TABLE IDNAME - |1|Home| |2|Downloads| |3|About me | |4|Search | and SUBMENUE_TABLE IDMAIN_ID NAMEURL --- |1|2|Music| ./somefile.php?action=music |2|2|Programm | ./somefile.php?action=programm |3|3|Pictures | ./somefile.php?action=pictures |4|3|Address| ./somefile.php?action=address |5|4|My Page | ./somefile.php?action=mypage |6|4|The Web | ./somefile.php?action=theweb |7|4|Google | ./somefile.php?action=google If I'm using a while loop it won't work, so I realy don't have and more ideas... Please consider in your explanations I'm a PHP beginner... :-) thanks Marc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Detecting posts from outside site
Also, speaking of detection, I made a small script that can protect against people downloading your site's forms, modifying their new local copy (and putting an absolute URL in the form's ACTION attribute), and then posting data using the botched form. If it's bulletproof, then I figured this could help some of you out. If not, I welcome comments (I'm a little bit hesitant of calling things 'bulletproof'). $http_referer (lowercase) is the parse_url() of $_SERVER["HTTP_REFERER"]. Some local mucking up can give you the format you want for it. if((count($_POST) > 0) && (!stristr($_SERVER["HTTP_REFERER"], $http_referer))) { unset($_POST); $evil = "postedfromoutsidepage"; } Then, you can test for $evil when you need to print an error message or decide whether or not the data is proper. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dreading OOP
The only reason I feel the need to expand my understanding is that I have to learn other concepts to produce my client's solutions. For instance I am now being asked to use SOAP to communicate with a vendor of his. Now I am reading about SOAP and frequently the descriptions rely on the reader's understanding of OOP. I can individually scrutinize a description and break it down to its elements. Then I can picture what is being said, but without having used those methods in my code, it is frustrating reading. I don't know that SOAP is in and of itself OOP but people that write about it use OOP based consepts to exlain what is happening. And this is one example. Don't let me go into the Java and Javascript world! Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -Original Message- From: Johnson, Kirk [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 21, 2003 10:40 AM To: PHP List Subject: RE: [PHP] dreading OOP > -Original Message- > >However, my mind apparently works different and I keep trying to relate the OOP structure to > what I already know which equates an object to a function. I am resolving > to purchase a book dedicated to instruction in the inns and outs of OOP. > Specifically at it relates to PHP would be great but my emphasis is towards > something that teaches someone that is stubborn in his reliance on previously learned > methods. I hope this makes sense and I'm not alone on this. :) My only suggestion is that you re-consider why you want to take up OOP. If a procedural approach works for you, go with it. It's not like we're building air traffic control systems here ;) Kirk -- 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] forking scripts
Hi, Since php does not have child -> parent forking methods, can anybody suggest a method to achieve this. Thanks. Senn
[PHP] Detecting resolution
Does anyone know how to detect the resolution of someone's computer? Or is this possible through 'browscapping'? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form Validating Class (OOP misunderstandings...)
Nicholas, I think I know where you found this code. I have the same code, except I modified it a little to work for me. You may need to change it for your needs. When I first used it, it didn't work. I had to modify it to make it work. My code is usually kind of sloppy, but maybe you would get better use of the following class: resetErrorList(); } function isEmpty($field, $msg) { if (trim($field) == "") { $this->_errorList[] = array("value" => $field, "msg" => $msg); return true; } else { return false; } } function isZero($field, $msg) { if($field == 0) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return true; } else { return false; } } function isUploadedFile($img, $img_type, $img_size, $msg) { $pattern = "/(pjpeg)$/"; if (is_uploaded_file($img) && preg_match($pattern, $img_type) && $img_size <= 100) { return true; } else { $this->_errorList[] = array("value" => $img, "msg" => $msg); return false; } } function isString($field, $msg) { if(!is_string($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } } function isNumber($field, $msg) { if(!is_numeric($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } } function isInteger($field, $msg) { if(!is_integer($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } } function isFloat($field, $msg) { if(!is_float($field)) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } } function isWithinRange($field, $msg, $min, $max) { if(!is_numeric($field) || $field < $min || $field > $max) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } } function isStringWithinRange($field, $msg, $min, $max) { if(strlen($field) < $min || strlen($field) > $max) { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } else { return true; } } function isAlpha($field, $msg, $special_chars="") { $pattern = "/^[a-zA-Z\s" . $special_chars . "]+$/"; if(preg_match($pattern, $field)) { return true; } else { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } } function isAlphaNum($field, $msg, $special_chars="") { $pattern = "/^[a-zA-Z0-9\s" . $special_chars . "]+$/"; if(preg_match($pattern, $field)) { return true; } else { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } } function isEmailAddress($field, $msg) { $pattern = "/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)+/"; if(preg_match($pattern, $field)) { return true; } else { $this->_errorList[] = array("value" => $field, "msg" => $msg); return false; } } function isError() { if (sizeof($this->_errorList) > 0) { return true; } else { return false; } } function getErrorList() { return $this->_errorList; } function resetErrorList() { $this->_errorList = array(); } } ?> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Validating Class (OOP misunderstandings...)
On 2003.01.21 15:42 Joseph W. Goff wrote: For the most part I found two errors The first was a scope problem. $HTTP_*_VARS hashes are not accessible inside functions unless you source them in. i.e. global The other was an extra line in an if statement that did not contain braces. I did a little formating while I checked the code. Try this to see if it works as you expected it to. snip, it's perfect > Yes, it works. I misunderstood the visibility of $HTTP_POST_VARS. Thank you Joseph ! I really appreciate your help :) I've read the paper from OWASP and now I'm a little paranoid about form validating and user input... does someone have other suggestions about improving the class ? TIA, Nicholas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't get HTTPS -- driving me mad -- please help
ah sorry, mixed some configuration files ;) Jonathan Boles wrote: Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper setting Reading from http:// using fopen works fine. It's the https:// that doesn't work. - Original Message - From: "Stephan Seidt" <[EMAIL PROTECTED]> To: "Jonathan Boles" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, January 22, 2003 3:02 AM Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help Is fopen_wrapper in php.ini set to yes ? Jonathan Boles wrote: PHP 4.3.0, Apache, Win32. I'm driving myself mad trying to work out why I can't get HTTPS pages. I understand there are two options, using fopen() with openssl installed, and using curl. I've installed openssl extension, but using fopen STILL won't work. Don't have a clue why. Using curl, I can get the page easily enough, but I can't put it into the file. If I try to set a file resource to save it to, Apache crashes. Here's the error message I get using fopen("https://[securewebsite]";, "r"); Warning: fopen(https://blahblahblah) [function.fopen]: failed to create stream: No such file or directory in blah\blah\blah.php on line 50 And when I try to use Curl to save the https file, I get this: APACHE caused an invalid page fault in module KERNEL32.DLL at 0187:bff7b9a6. Registers: EAX= CS=0187 EIP=bff7b9a6 EFLGS=0246 EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0 ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7 EDX=7803b710 ES=018f EDI=100be740 GS= Bytes at CS:EIP: ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 Stack dump: 0032 00fd5131 7803b730 00fd523b 7803b710 0032 0001 00fc1ee8 00ff48ac 0001 0032 7803b710 0032 00ff4240 00ff48ac 00ff4801 Here is the code I'm using at that section: $ch = curl_init ("https://blahblahblah";); $fp = fopen ("output.txt", "w"); curl_setopt ($ch, CURLOPT_FILE, $fp); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_exec ($ch); $ce = curl_error($ch); curl_close ($ch); fclose ($fp); This is really driving me mad, someone please help :-( -- IPv6 + TCPA + wrecked Palladium server = NO COFFE! -- IPv6 + TCPA + wrecked Palladium server = NO COFFE! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Finding out if a table exists
Is there a way of finding if a table exists with only one command in MySQL? I've looked through the MySQL functions, and the closest I've gotten to what I need is mysql_list_tables or mysql_tablename (I'll have to check into these a little more), but I was hopefully looking for something that returns a boolean value, and to be able to use it like: if(mysql_table_exists("tablename")) { ... } Any ideas, short of creating my own function? __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOWNLOAD
People often for get about a little problem that happens with the I found a bug when developing a download script a year or so ago. You can't have the 'attachment;' part in IE. It did some funky stuff and netscape 4 would die without it. Jim - Original Message - From: "Timothy Hitchens (HiTCHO)" <[EMAIL PROTECTED]> To: "'Shaun van den Berg'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, January 21, 2003 1:44 AM Subject: RE: [PHP] DOWNLOAD > Create a script that reads the contents of a file after sending headers > eg: > > header("Content-type: text/plain"); > header("Content-Disposition: attachment; filename=downloaded.txt"); > readfile("downloaded.txt"); > exit(); > > The downloaded.txt can be any file subject to sending the correct > headers and IE > and other browsers will pop up a download (save) window. > > See your mime.types file for headers for each file type. > > > Timothy Hitchens (HiTCHO) > Open Source Consulting > e-mail: [EMAIL PROTECTED] > > > -Original Message- > > From: Shaun van den Berg [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, 21 January 2003 4:39 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] DOWNLOAD > > > > > > Hi , > > > > Im not sure if this can be done in PHP , i know PHP has > > upload features ! Does it have download features , wat i mean > > is the following : i want a link - click here to download - > > when you click on it , the download dialog box must appear - > > how do i do this ? > > > > Thanks > > Shaun van den Berg > > > > -- > > Novtel Consulting > > Tel: +27 21 9822373 > > Fax: +27 21 9815846 > > Please visit our website: > > www.novtel.co.za > > > > > > > > -- > > 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] Can't get HTTPS -- driving me mad -- please help
This seems to have fixed the problem :-) But there's another error. fopen works now, but fgets won't. I'm getting this error: Warning: fgets() [function.fgets]: SSL: fatal protocol error in blah\blah\blah.php on line 51 Does anyone know what could be causing this? > PHP 4.3.0, Apache, Win32. > > Here's the error message I get using fopen("https://[securewebsite]";, "r"); > > Warning: fopen(https://blahblahblah) [function.fopen]: failed to create > stream: No such file or directory in blah\blah\blah.php on line 50 Hi Jonathan, Don't know what the problem is, but other people seem to have the same problem. Read the user note on the bottom of this page: http://uk.php.net/manual/en/wrappers.php Hope this helps; JOn =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- "Jonathan Boles" <[EMAIL PROTECTED]> wrote in message 000f01c2c16a$ea4b6920$5c8dadcb@grayw">news:000f01c2c16a$ea4b6920$5c8dadcb@grayw... > Do you mean allow_url_fopen? It is set to 'on'. There's no fopen_wrapper > setting > > Reading from http:// using fopen works fine. It's the https:// that doesn't > work. > > - Original Message - > From: "Stephan Seidt" <[EMAIL PROTECTED]> > To: "Jonathan Boles" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Wednesday, January 22, 2003 3:02 AM > Subject: Re: [PHP] Can't get HTTPS -- driving me mad -- please help > > > > Is fopen_wrapper in php.ini set to yes ? > > > > Jonathan Boles wrote: > > > PHP 4.3.0, Apache, Win32. > > > > > > I'm driving myself mad trying to work out why I can't get HTTPS pages. I > > > understand there are two options, using fopen() with openssl installed, > and > > > using curl. I've installed openssl extension, but using fopen STILL > won't > > > work. Don't have a clue why. Using curl, I can get the page easily > enough, > > > but I can't put it into the file. If I try to set a file resource to > save it > > > to, Apache crashes. > > > > > > Here's the error message I get using fopen("https://[securewebsite]";, > "r"); > > > > > > Warning: fopen(https://blahblahblah) [function.fopen]: failed to create > > > stream: No such file or directory in blah\blah\blah.php on line 50 > > > > > > > > > > > > And when I try to use Curl to save the https file, I get this: > > > > > > APACHE caused an invalid page fault in > > > module KERNEL32.DLL at 0187:bff7b9a6. > > > Registers: > > > EAX= CS=0187 EIP=bff7b9a6 EFLGS=0246 > > > EBX=02af796c SS=018f ESP=0167f398 EBP=0167f3b0 > > > ECX=00fe6770 DS=018f ESI=7803b730 FS=19a7 > > > EDX=7803b710 ES=018f EDI=100be740 GS= > > > Bytes at CS:EIP: > > > ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 > > > Stack dump: > > > 0032 00fd5131 7803b730 00fd523b 7803b710 0032 0001 00fc1ee8 > > > 00ff48ac 0001 0032 7803b710 0032 00ff4240 00ff48ac 00ff4801 > > > > > > > > > Here is the code I'm using at that section: > > > > > > $ch = curl_init ("https://blahblahblah";); > > > $fp = fopen ("output.txt", "w"); > > > curl_setopt ($ch, CURLOPT_FILE, $fp); > > > curl_setopt ($ch, CURLOPT_HEADER, 0); > > > curl_exec ($ch); > > > $ce = curl_error($ch); > > > curl_close ($ch); > > > fclose ($fp); > > > > > > > > > > > > This is really driving me mad, someone please help :-( > > > > > > > > > > > > > > > > > > > > > -- > > IPv6 + TCPA + wrecked Palladium server = NO COFFE! > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php