php-general Digest 29 Jul 2004 10:41:54 -0000 Issue 2905
Topics (messages 192133 through 192169):
Re: php5 and object
192133 by: holmes072000.charter.net
192138 by: raditha dissanayake
Re: Problem with $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']
192134 by: holmes072000.charter.net
Re: Showing all users who are logged in
192135 by: Jason Giangrande
Re: How do I return the error
192136 by: Tom Rogers
strpos mystery
192137 by: Jon Drukman
192139 by: Justin Patrin
192151 by: Jason Barnett
192152 by: Jason Barnett
192167 by: Ford, Mike [LSS]
Re: Retrieving Stored Values for Dropdown Menu
192140 by: David Robley
Java Script or PHP
192141 by: Karl-Heinz Schulz
192143 by: zareef ahmed
192144 by: Karl-Heinz Schulz
192146 by: zareef ahmed
192147 by: Curt Zirzow
192148 by: Karl-Heinz Schulz
192156 by: Skippy
Re: reading txt file - certain lines
192142 by: Dustin Krysak
Browser reload problem
192145 by: Ashley M. Kirchner
192150 by: Curt Zirzow
192157 by: Skippy
list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth) fails.
192149 by: Daevid Vincent
192153 by: Justin Patrin
192154 by: Jason Davidson
Graphing Webstats using MRTG/PHP/MYSQL?
192155 by: Louie Miranda
192158 by: Skippy
192161 by: Louie Miranda
Re: php.net bug tracking tool?
192159 by: Andreas Goetz
apache1 + php or apache2 + php
192160 by: Ni Shurong
VB-->PHP
192162 by: Jay
192163 by: Jason Wong
192164 by: Ni Shurong
192166 by: Ford, Mike [LSS]
192169 by: Jay
Paul Kain
192165 by: Shahed, Raja
Re: unset($_COOKIE['foo']) and $_COOKIE['foo'] = '' both do n't do anything.
192168 by: Ford, Mike [LSS]
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
> From: Stephen Sadowski <[EMAIL PROTECTED]>
> Subject: Re: [PHP] php5 and object
>
> http://us4.php.net/manual/en/language.oop5.abstract.php
>
> The short is that you can't do anything more than define a function in
> an abstract class.
>
> IIRC, change abstract to interface, and you'll probably be okay.
Switch that around. Interfaces cannot contain anything but function definitions.
Abstract classes can contain functions that'll be inherited.
---John Holmes...
--- End Message ---
--- Begin Message ---
Curt Zirzow wrote:
* Thus wrote Stephen Sadowski:
http://us4.php.net/manual/en/language.oop5.abstract.php
The short is that you can't do anything more than define a function in
an abstract class.
Negative. It is perfectly fine to have code within an abstract
class. The documentation needs to get expanded a little bit to
define exactly how an for what use an abstract class can be used.
indeed.
Abstract classes can contain code - but abstract methods cannot.
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--- End Message ---
--- Begin Message ---
> From: "Mark Collin" <[EMAIL PROTECTED]>
>
> Does anybody have any ideas on how I can prevent caching of
> $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'], or clear them?
You can't clear them; they're sent by the browser. It'll keep resending the same
values and you're script will authenticate. Only way to get rid of it is to close the
browser.
You could attempt to force the user to log with a known bad username and password by
using a link or header redirect.
header('Location: http://username:[EMAIL PROTECTED]');
Your login script should check for these known values and can react accordingly. You
know they are bad, so you can either present them with another dialog to log back in
or you can just not send any authentication headers and show them a "successfully
logged out" page.
---John Holmes...
--- End Message ---
--- Begin Message ---
Vail, Warren wrote:
I did one application where I used the PHP session table to tell who was
logged on, and which area of the application they were most recently in.
One of several flaws, was that I used Kill session to logoff, and that
caused them to disappear from any count of users logged on. Course, if they
had logged off, then they weren't logged on, but on the other side, users
were counted for every session they created, and closing and opening new
browser sessions caused them to be counted multiple times, and continue to
be counted until session "garbage cleanup" removed their session entries,
unless I used the session timestamp in my count algorithm. Session was
nice, because if a user was causing a problem, I could kill his session
entry, effectively logging him off, forcing him to logon again.
Warren Vail
Thanks guys. Between your suggestions, I managed to come up with a
solution.
--
Jason Giangrande <[EMAIL PROTECTED]>
http://www.giangrande.org
http://www.dogsiview.com
--- End Message ---
--- Begin Message ---
Hi,
Wednesday, July 28, 2004, 11:56:16 PM, you wrote:
MO> Hi I have this function below - if it reurns false I want to
MO> also return the error so I can print it in my calling function.
MO> Can I do this?
MO> Cheers
MO> Matt
MO> function fileUpload($file) {
MO> if ($file['type'] == "image/gif" || $file['type'] == "image/pjpeg"){
MO> if (@copy ($file['tmp_name'], "images/" . $file['name']))
MO> return true;
MO> }else {
MO> return false;
MO> }
MO> }
You can always return an array() something like this:
function fileUpload($file) {
$r = array(false,'');
switch($file['error']){
case UPLOAD_ERR_INI_SIZE:
$r[1] = 'The uploaded file exceeds the upload_max_filesize
directive in php.ini.';
break;
case UPLOAD_ERR_FORM_SIZE:
$r[1] = 'The uploaded file exceeds the MAX_FILE_SIZE directive
that was specified in the HTML form.';
break;
case UPLOAD_ERR_PARTIAL:
$r[1] = 'The uploaded file was only partially uploaded.';
break;
case UPLOAD_ERR_NO_FILE:
$r[1] = 'No file was uploaded';
break;
default:
if ($file['type'] == "image/gif" || $file['type'] ==
"image/pjpeg"){
if (@copy ($file['tmp_name'], "images/" .
$file['name']))
$r[0] = true;
else
$r[1] = 'Could not copy the file.';
}else {
$r[1] = 'The uploaded file is not the right type.';
}
break;
}
return $r;
}
list ($status, $error) = fileUpload($file);
if(!$status) echo $error;
--
regards,
Tom
--- End Message ---
--- Begin Message ---
with this code fragment:
<?
$string='/mobile/phone.html';
if (strpos($string,'/mobile/')!==false) { print "one: yes\n"; }
if (strpos($string,'/mobile/')===true) { print "two: yes\n"; }
?>
only the first if statement prints anything. why is !== false not the
same as === true ?
-jsd-
--- End Message ---
--- Begin Message ---
On Wed, 28 Jul 2004 17:50:01 -0700, Jon Drukman <[EMAIL PROTECTED]> wrote:
> with this code fragment:
>
> <?
>
> $string='/mobile/phone.html';
> if (strpos($string,'/mobile/')!==false) { print "one: yes\n"; }
> if (strpos($string,'/mobile/')===true) { print "two: yes\n"; }
>
> ?>
>
> only the first if statement prints anything. why is !== false not the
> same as === true ?
Because === and !== check the type as well. Of you set $string =
'blah' you'll still get the same result.
If you were using != and == both would print.
strpos() returns an int, so comparing it to false with === is always
false. The same would be true for true.
>
> -jsd-
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:410846c1241919501214933!
>
>
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--- End Message ---
--- Begin Message ---
Because === and !== check the type as well. Of you set $string =
'blah' you'll still get the same result.
If you were using != and == both would print.
strpos() returns an int, so comparing it to false with === is always
false. The same would be true for true.
That's half right. strpos actually *can* return false as opposed to 0, so
checking doing the === check might be necessary for your application.
<?php
$string = 'blah';
if (strpos($string, 'not in the original $string') === false){
echo 'False check succeeded - not in $string.';
}
if (strpos($string, $string) === true) {
echo 'True check succeeded - in string';
} else {
echo 'True check failed - because strpos was at offset 0.';
}
?>
--- End Message ---
--- Begin Message ---
Heck, even I got it wrong ;) True check below should always fail...
Jason Barnett wrote:
Because === and !== check the type as well. Of you set $string =
'blah' you'll still get the same result.
If you were using != and == both would print.
strpos() returns an int, so comparing it to false with === is always
false. The same would be true for true.
That's half right. strpos actually *can* return false as opposed to 0,
so checking doing the === check might be necessary for your application.
<?php
$string = 'blah';
if (strpos($string, 'not in the original $string') === false){
echo 'False check succeeded - not in $string.';
}
if (strpos($string, $string) === true) {
echo 'True check succeeded - in string';
} else {
echo 'True check failed - because strpos was at offset 0.';
}
?>
--- End Message ---
--- Begin Message ---
On 29 July 2004 01:50, Jon Drukman wrote:
> with this code fragment:
>
> <?
>
> $string='/mobile/phone.html';
> if (strpos($string,'/mobile/')!==false) { print "one: yes\n"; }
> if (strpos($string,'/mobile/')===true) { print "two: yes\n"; }
>
> >
>
>
> only the first if statement prints anything. why is !==
> false not the
> same as === true ?
Because strpos returns the integer offset of the found substring, or FALSE
if not found; it *never* returns TRUE. (You need the !== test because
strpos() can return an offset of zero, which would be ==FALSE but not
===FALSE.)
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--- End Message ---
--- Begin Message ---
On Wed, 28 Jul 2004 21:19, Harlequin wrote:
> OK David.
>
> But here's the conundrum:
>
> a User has already selected a value which is stored in the database. Can I
> Display a range of <option> tags but make the one the user selected
> previously as the default...?
>
> ???
>
Yes you can.
I'm not going to give you the code, but a pointer to solving problems
yourself.
Just break the problem down to its component parts, and resolve each one as
you go. For instance, you need to define an option as selected - first
figure out how to do that (it's a HTML problem).
Then you only want to define an option as selected if certain conditions are
met, so test for the conditions and act accordingly.
--
David Robley
Q: Why do blondes hate M&Ms? A: They're too hard to peel.
--- End Message ---
--- Begin Message ---
I have a database generated page and I want to show a "Print Version" in a
new window when somebody selects the print option.
http://www.test.com/docs/view_record.php?id=1
http://www.test.com/docs/print_record.php?id=1
What is the "correct" way to open the page from the print link to a new
page?
TIA
Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1
--- End Message ---
--- Begin Message ---
--- Karl-Heinz Schulz <[EMAIL PROTECTED]> wrote:
> I have a database generated page and I want to show
> a "Print Version" in a
> new window when somebody selects the print option.
>
> http://www.test.com/docs/view_record.php?id=1
>
> http://www.test.com/docs/print_record.php?id=1
>
> What is the "correct" way to open the page from the
> print link to a new
> page?
To Open a New Window you can use javascript
window.open or just set target="_blank" in your anchor
tag (<a>).
But you may need to adjust the properties of new
windows like status bar, toolbar, width, height; for
this you can use java script.
PHP Can not do client side programming...
zareef ahmed
>
> TIA
>
>
>
> Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
Zareef,
Thank you for the reply but I may was not very clear.
I don't know how to pass the record id from the view_record?id=1 to
print_record?=whateverTheViewRecordId was.
Karl-Heinz
-----Original Message-----
From: zareef ahmed [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 28, 2004 11:03 PM
To: Karl-Heinz Schulz; [EMAIL PROTECTED]
Subject: Re: [PHP] Java Script or PHP
--- Karl-Heinz Schulz <[EMAIL PROTECTED]> wrote:
> I have a database generated page and I want to show
> a "Print Version" in a
> new window when somebody selects the print option.
>
> http://www.test.com/docs/view_record.php?id=1
>
> http://www.test.com/docs/print_record.php?id=1
>
> What is the "correct" way to open the page from the
> print link to a new
> page?
To Open a New Window you can use javascript
window.open or just set target="_blank" in your anchor
tag (<a>).
But you may need to adjust the properties of new
windows like status bar, toolbar, width, height; for
this you can use java script.
PHP Can not do client side programming...
zareef ahmed
>
> TIA
>
>
>
> Tracking #: BF4D827C022BDF46A46EC4E1BF3527362158E8A1
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--- End Message ---
--- Begin Message ---
--- Karl-Heinz Schulz <[EMAIL PROTECTED]> wrote:
> Zareef,
>
> Thank you for the reply but I may was not very
> clear.
>
> I don't know how to pass the record id from the
> view_record?id=1 to
> print_record?=whateverTheViewRecordId was.
>
Consider it
$id="select id from database"
<?php
print "<a
href='http://www.test.com/docs/view_record.php?id=".$id."'
target='_blank'> click tio print </a>";
?>
or you may write javasctipt function too.
zareef ahmed
> Karl-Heinz
>
> -----Original Message-----
> From: zareef ahmed [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 28, 2004 11:03 PM
> To: Karl-Heinz Schulz; [EMAIL PROTECTED]
> Subject: Re: [PHP] Java Script or PHP
>
>
> --- Karl-Heinz Schulz <[EMAIL PROTECTED]>
> wrote:
>
> > I have a database generated page and I want to
> show
> > a "Print Version" in a
> > new window when somebody selects the print option.
> >
> > http://www.test.com/docs/view_record.php?id=1
> >
> > http://www.test.com/docs/print_record.php?id=1
> >
> > What is the "correct" way to open the page from
> the
> > print link to a new
> > page?
>
> To Open a New Window you can use javascript
> window.open or just set target="_blank" in your
> anchor
> tag (<a>).
>
> But you may need to adjust the properties of new
> windows like status bar, toolbar, width, height; for
> this you can use java script.
>
> PHP Can not do client side programming...
>
>
> zareef ahmed
>
>
> >
> > TIA
> >
> >
> >
> > Tracking #:
> BF4D827C022BDF46A46EC4E1BF3527362158E8A1
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> >
>
>
> =====
> Zareef Ahmed :: A PHP Developer in Delhi(India).
> Homepage :: http://www.zasaifi.com
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
>
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.
http://messenger.yahoo.com
--- End Message ---
--- Begin Message ---
* Thus wrote Karl-Heinz Schulz:
> I have a database generated page and I want to show a "Print Version" in a
> new window when somebody selects the print option.
>
> http://www.test.com/docs/view_record.php?id=1
>
> http://www.test.com/docs/print_record.php?id=1
>
> What is the "correct" way to open the page from the print link to a new
> page?
@media print {
.css {
its: all here;
}
}
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
Thank you for your help.
-----Original Message-----
From: zareef ahmed [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 28, 2004 11:25 PM
To: Karl-Heinz Schulz
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] Java Script or PHP
--- Karl-Heinz Schulz <[EMAIL PROTECTED]> wrote:
> Zareef,
>
> Thank you for the reply but I may was not very
> clear.
>
> I don't know how to pass the record id from the
> view_record?id=1 to
> print_record?=whateverTheViewRecordId was.
>
Consider it
$id="select id from database"
<?php
print "<a
href='http://www.test.com/docs/view_record.php?id=".$id."'
target='_blank'> click tio print </a>";
?>
or you may write javasctipt function too.
zareef ahmed
> Karl-Heinz
>
> -----Original Message-----
> From: zareef ahmed [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 28, 2004 11:03 PM
> To: Karl-Heinz Schulz; [EMAIL PROTECTED]
> Subject: Re: [PHP] Java Script or PHP
>
>
> --- Karl-Heinz Schulz <[EMAIL PROTECTED]>
> wrote:
>
> > I have a database generated page and I want to
> show
> > a "Print Version" in a
> > new window when somebody selects the print option.
> >
> > http://www.test.com/docs/view_record.php?id=1
> >
> > http://www.test.com/docs/print_record.php?id=1
> >
> > What is the "correct" way to open the page from
> the
> > print link to a new
> > page?
>
> To Open a New Window you can use javascript
> window.open or just set target="_blank" in your
> anchor
> tag (<a>).
>
> But you may need to adjust the properties of new
> windows like status bar, toolbar, width, height; for
> this you can use java script.
>
> PHP Can not do client side programming...
>
>
> zareef ahmed
>
>
> >
> > TIA
> >
> >
> >
> > Tracking #:
> BF4D827C022BDF46A46EC4E1BF3527362158E8A1
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit:
> http://www.php.net/unsub.php
> >
> >
>
>
> =====
> Zareef Ahmed :: A PHP Developer in Delhi(India).
> Homepage :: http://www.zasaifi.com
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail
>
>
>
=====
Zareef Ahmed :: A PHP Developer in Delhi(India).
Homepage :: http://www.zasaifi.com
__________________________________
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now.
http://messenger.yahoo.com
Tracking #: 0A7561E8C74AB546BCE0A89F73ECA4D2A3FDFA95
--- End Message ---
--- Begin Message ---
Quoting Curt Zirzow <[EMAIL PROTECTED]>:
> > What is the "correct" way to open the page from the print link to a new
> > page?
>
> @media print {
> .css {
> its: all here;
> }
> }
Yeah, but sometimes you want the print version to be more nifty, like
have all the pages in an article instead of just the current page.
That calls for some server-side work AND a specific print-only CSS.
--
Romanian Web Developers - http://ROWD.ORG
--- End Message ---
--- Begin Message ---
Yeah I do not really have the option to use a database here since the
way the data is output is limited to a text file...... the files are
populated by a program that takes the currently playing tracks out of
Itunes (mp3 player) on my mac.
d
On 28-Jul-04, at 3:26 PM, [EMAIL PROTECTED] wrote:
From: John Nichel <[EMAIL PROTECTED]>
Date: July 28, 2004 2:05:51 PM PDT
To: PHP <[EMAIL PROTECTED]>
Subject: Re: [PHP] reading txt file - certain lines
Dustin Krysak wrote:
Hi there.. .I am displaying info (on music) from a text file with the
following code...
<?php
//open the file handler
$fp02=fopen("assets/lib/php/itunes/recent.txt","r");
//Read the track info
$recent=fgets($fp02);
//close the file.
echo "$recent";
fclose($fp02);
?>
Now the contents of said text file would read something like the
following:
<b>Liar</b><br>by <i><b>Sex Pistols</b><i><br><i>"Never Mind The
Bollocks"</i><br>Played: 2004/07/28, 1:48:29
PM<br>----------<br><b>Let's Rave On</b><br>by <i><b>The
Raveonettes</b><i><br><i>"Chain Gang Of Love"</i><br>Played:
2004/07/28, 1:46:37 PM<br>----------<br><b>No Remorse</b><br>by
<i><b>Metallica</b><i><br><i>"Kill 'Em All"</i><br>Played:
2004/07/28, 1:40:17 PM<br>----------<br><b>This Is Our
Emergency</b><br>by <i><b>Pretty Girls Make Graves</b><i><br><i>"The
New Romance"</i><br>Played: 2004/07/28, 1:36:37
PM<br>----------<br><b>Freestylin'</b><br>by
<i><b>Greyboy</b><i><br><i>"Freestylin'"</i><br>Played: 2004/07/28,
1:30:25 PM<br>----------<br><b>In My Head</b><br>by <i><b>Naked
Raygun</b><i><br><i>"Raygun...Naked Raygun (Reissue)"</i><br>Played:
2004/07/28, 1:26:37 PM<br>----------<br><b>Lust To Love</b><br>by
<i><b>The Go-Go's</b><i><br><i>"Return To The Valley Of The
Go-Go's"</i><br>Played: 2004/07/28, 1:23:13
PM<br>----------<br><b>Kim You Bore Me To Death</b><br>by
<i><b>Grandaddy</b><i><br><i>"Concrete Dunes"</i><br>Played:
2004/07/28, 1:18:37 PM<br>----------<br><b>Sonderkommando</b><br>by
<i><b>Gwar</b><i><br><i>"This Toilet Earth"</i><br>Played:
2004/07/28, 1:13:49 PM<br>----------<br>
Now what I want to do is read this file, but only say read 5 songs
worth, then I would place the PHP code in (another table) and display
the next 5 songs and so on.... This just allows for a more flexible
layout in the final presentation. the way I am having the text files
written, there is no way to get it to produce seperate text files -
otherwise this would be easy to do....
Is this possible?
Yes, possible. Worth the time? No. Can you put all that info in a
database?
--
John C. Nichel
�berGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
PayPal passes a ton of data back to us when someone's done
purchasing something. I use some of that information and shove it all
into a database. Problem is, if someone hits reload on their browser, I
get the same data re-inserted again. Reload the page four times, and I
will get four records with the same data inserted. How can I avoid
this? I'd like to silently either discard the information after it's
been inserted, or silently prevent it from being re-inserted again.
--
W | I haven't lost my mind; it's backed up on tape somewhere.
+--------------------------------------------------------------------
Ashley M. Kirchner <mailto:[EMAIL PROTECTED]> . 303.442.6410 x130
IT Director / SysAdmin / WebSmith . 800.441.3873 x130
Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave. #6
http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.
--- End Message ---
--- Begin Message ---
* Thus wrote Ashley M. Kirchner:
>
> PayPal passes a ton of data back to us when someone's done
> purchasing something. I use some of that information and shove it all
> into a database. Problem is, if someone hits reload on their browser, I
> get the same data re-inserted again. Reload the page four times, and I
> will get four records with the same data inserted. How can I avoid
> this? I'd like to silently either discard the information after it's
> been inserted, or silently prevent it from being re-inserted again.
This is what I call the BRS (Browser Reload Syndrome: the tendency
of idiodity users insisting on reloading a page unnecessarily.)
The basic solution with this problem is:
1. generate some sort unique id on original form
2. ensure unique id has not been entered when posted.
In your case, paypal should be returing to you some sort of
transaction Id, 'txn_id' iirc. So step 1 isn't needed.
What you need to do is before you insert the data that has been
posted to your script, is to ensure that that 'txn_id' has not been
entered already into the database.
> --
> W | I haven't lost my mind; it's backed up on tape somewhere.
tar xf /dev/somewhere /your/mind; :)
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
Quoting "Ashley M. Kirchner" <[EMAIL PROTECTED]>:
> PayPal passes a ton of data back to us when someone's done
> purchasing something. I use some of that information and shove it all
> into a database. Problem is, if someone hits reload on their browser, I
> get the same data re-inserted again. Reload the page four times, and I
> will get four records with the same data inserted. How can I avoid
> this? I'd like to silently either discard the information after it's
> been inserted, or silently prevent it from being re-inserted again.
1. Receive PayPal data in your script.
2. Process it (stick into database).
3. Redirect to another script and forward any data you want displayed.
4. Have the 2nd script show whatever confirmation message you want.
The user can now reload all he wants, he gets just the 2nd script
which doesn't do anything but display the same message over and over.
ATTENTION: if you receive the PayPal data by POST be sure to redirect
using "303 See Other", which will "deactivate" the POST and force the
redirect to use GET. Of course, forwarding any data to the 2nd script
should be done as GET parameters.
Or, even better, just forward the 2nd script the database ID of the
data you just recorded and if it needs to display anything it can get
it from there.
--
Romanian Web Developers - http://ROWD.ORG
--- End Message ---
--- Begin Message ---
Linux. PHP5.
Why does this fail when using an array element, but using a variable will
work? Why should PHP care what the variable is I'm trying to store into?
list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth);
But this works:
list($foo, $CompanyDB) = SQL_ROW($sth);
And of course I'd have the extra...
$foo = $bar['CompanyCode'];
--- End Message ---
--- Begin Message ---
On Wed, 28 Jul 2004 20:47:37 -0700, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> Linux. PHP5.
>
> Why does this fail when using an array element, but using a variable will
> work? Why should PHP care what the variable is I'm trying to store into?
>
> list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth);
>
> But this works:
>
> list($foo, $CompanyDB) = SQL_ROW($sth);
>
> And of course I'd have the extra...
> $foo = $bar['CompanyCode'];
>
Because list() is a language construct, not a function. It assumes
what you give it is a normal variable, it doesn't understand arrays.
Better IMHO to use $row = mysql_fetch_assoc() and access the array it
returns directly.
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--
--- End Message ---
--- Begin Message ---
check the manual for list. It mentions using only numerical array
indices for list. There is a warning on it even i beleive.
Jason
On Wed, 28 Jul 2004 20:47:37 -0700, Daevid Vincent <[EMAIL PROTECTED]> wrote:
> Linux. PHP5.
>
> Why does this fail when using an array element, but using a variable will
> work? Why should PHP care what the variable is I'm trying to store into?
>
> list($bar['CompanyCode'], $CompanyDB) = mysql_fetch_row($sth);
>
> But this works:
>
> list($foo, $CompanyDB) = SQL_ROW($sth);
>
> And of course I'd have the extra...
> $foo = $bar['CompanyCode'];
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
has anyone know any tools related to this?
Graphing Webstats using MRTG/PHP/MYSQL?
--
Louie Miranda
http://www.axishift.com
--- End Message ---
--- Begin Message ---
Quoting Louie Miranda <[EMAIL PROTECTED]>:
> has anyone know any tools related to this?
> Graphing Webstats using MRTG/PHP/MYSQL?
Why MRTG _and_ PHP? AFAIK MRTG produces its own HTML and images.
You can either use MRTG with whatever data (webstats) you collected
or you can use PHP+MySQL for that and generate graphs from PHP.
There must be PHP solutions to generating graphs out there, or you
can write your own.
--
Romanian Web Developers - http://ROWD.ORG
--- End Message ---
--- Begin Message ---
i was thingking more of php+mysql, then mrtg will get all the data
from the sql or the php. something like that
On Thu, 29 Jul 2004 10:50:09 +0300, Skippy <[EMAIL PROTECTED]> wrote:
> Quoting Louie Miranda <[EMAIL PROTECTED]>:
> > has anyone know any tools related to this?
> > Graphing Webstats using MRTG/PHP/MYSQL?
>
> Why MRTG _and_ PHP? AFAIK MRTG produces its own HTML and images.
> You can either use MRTG with whatever data (webstats) you collected
> or you can use PHP+MySQL for that and generate graphs from PHP.
>
> There must be PHP solutions to generating graphs out there, or you
> can write your own.
>
> --
> Romanian Web Developers - http://ROWD.ORG
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Louie Miranda
http://www.axishift.com
--- End Message ---
--- Begin Message ---
Curt, thank you. I like Mantis, too but wanted to check the php thing. I was
confused there is no reference to it anywhere, as it's used by e.g. MySQL,
too.
Thanks,
Andreas
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Andreas Goetz:
> > Which bug tracking tool is php.net using? I know it sounds stupid, but
even
> > as I can look at the source on php.net, I can't find any documentation-
is
> > this package available for download somewhere?
>
>
> you can checkout the code from cvs:
> cvs -d :pserver:[EMAIL PROTECTED]:/repository checkout php-bugs-web
>
> see:
> http://cvs.php.net/php-bugs-web
> http://www.php.net/anoncvs.php
>
> you might be better off finding a more generic bug tracking system.
>
> Curt
> --
> First, let me assure you that this is not one of those shady pyramid
schemes
> you've been hearing about. No, sir. Our model is the trapezoid!
--- End Message ---
--- Begin Message ---
Hi,
I am a newer of this list, nice to meet every body here:)
I am wandering about using apache1 or apache2 with php, and i hope i can
get some advics here ;)
I use ./configure --help and it says:
--with-apxs2[=FILE] EXPERIMENTAL: Build shared Apache 2.0 module.
FILE is the optional
pathname to the Apache apxs tool; defaults to apxs.
and I read these from php manual:
http://www.php.net/manual/en/install.apache2.php
it says:
Warning
Do not use Apache 2.0 and PHP in a production environment neither on Unix nor on
Windows.
I don't konw which version of apache works with php better:)
----
Ni Shurong <[EMAIL PROTECTED]>
MAIL : [EMAIL PROTECTED]
QQ : 412844
MSN : [EMAIL PROTECTED]
BLOG : http://blog.njmars.com/myhan/
--- End Message ---
--- Begin Message ---
Hi!
Can someone pelase help me to convert the following Vbscript code to
PHP, i am really sucky at Regular Expression:
---------CODE VBSCRIPT---------------------
Function IsValid(strData,blIncludeAlpha,blIncludeNumeric)
Dim regEx, retVal,strPtrn
Set regEx = New RegExp
If blIncludeAlpha Then
strPtrn="a-zA-Z"
End If
If blIncludeNumeric Then
strPtrn="0-9"
End If
if blIncludeAlpha and blIncludeNumeric Then
strPtrn="a-zA-Z0-9"
End if
regEx.Pattern = "^[" & strPtrn & "]+$"
IsValid= regEx.Test(strData)
End Function
--- End Message ---
--- Begin Message ---
On Thursday 29 July 2004 17:00, Jay wrote:
> Can someone pelase help me to convert the following Vbscript code to
> PHP, i am really sucky at Regular Expression:
Why don't you state your problem in English so that even those people not
familiar with VB will understand and thus may be able to help?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Fat Liberation: because a waist is a terrible thing to mind.
*/
--- End Message ---
--- Begin Message ---
I did not test it:)
function isValid($strData, $bIncludeAlpha=false, $bIncludeNumber=false)
{
switch(true) {
case $bIncludeAlpha && !$bIncludeNumber:
$ptr = "/^[a-zA-Z]+/";
break;
case !$bIncludeAlpha && $bIncludeNumber:
$ptr = "/^[0-9]+/";
break;
case $bIncludeAlpha && $bIncludeNumber:
$ptr = "/^[a-zA-Z0-9]+/";
break;
}
return preg_match($ptr, $strData);
}
----
Ni Shurong <[EMAIL PROTECTED]>
MAIL : [EMAIL PROTECTED]
QQ : 412844
MSN : [EMAIL PROTECTED]
BLOG : http://blog.njmars.com/myhan/
--- End Message ---
--- Begin Message ---
On 29 July 2004 10:00, Jay wrote:
> Hi!
>
> Can someone pelase help me to convert the following Vbscript code to
> PHP, i am really sucky at Regular Expression:
> ---------CODE VBSCRIPT---------------------
> Function IsValid(strData,blIncludeAlpha,blIncludeNumeric)
> Dim regEx, retVal,strPtrn
> Set regEx = New RegExp
> If blIncludeAlpha Then
> strPtrn="a-zA-Z"
> End If
> If blIncludeNumeric Then
> strPtrn="0-9"
> End If
> if blIncludeAlpha and blIncludeNumeric Then
> strPtrn="a-zA-Z0-9"
> End if
> regEx.Pattern = "^[" & strPtrn & "]+$"
> IsValid= regEx.Test(strData)
> End Function
Something like:
function isValid($strData, $blIncludeAlpha, $blIncludeNumeric)
{
$strPattern = "/^[;
if ($blIncludeAlpha):
$strPattern .= "a-zA-Z";
endif;
if ($blIncludeNumeric):
$strPattern .= "0-9";
endif;
$strPattern .= "]$/";
return preg_match($strPattern, $strData);
}
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--- End Message ---
--- Begin Message ---
Jason Wong wrote:
On Thursday 29 July 2004 17:00, Jay wrote:
Can someone pelase help me to convert the following Vbscript code to
PHP, i am really sucky at Regular Expression:
Why don't you state your problem in English so that even those people not
familiar with VB will understand and thus may be able to help?
What?!
I thought i wrote in English!
aha....you mean, "i need a function that will validate input data".
I thought it was pretty obvious what i was trying to do.
Regards,
J
--- End Message ---
--- Begin Message ---
Paul Kain wrote:
Start it from webmonkey.com . They have tutorial for very beginner , that of Tim
Zoegler (?). And also db tutorial of
Graeme Morel (php and mysql db- Wundersch�ne Tutorial).
I am sure You learn the basic---
Good luck and welcome to PHP
Best regards
Raja shahed
>-----Urspr�ngliche Nachricht-----
>Von: Bruno Santos [mailto:[EMAIL PROTECTED]
>Gesendet: Dienstag, 27. Juli 2004 10:47
>An: Paul Kain
>Cc: [EMAIL PROTECTED]
>Betreff: Re: [PHP] totally new to PHP
>
>
>Paul Kain wrote:
>
>>I have never programmed anything
>>
>>I know html and really want to know php
>>
>>where is the best place to go for some really basic tutorials
>to start with ?
>>
>>Thank in advance
>>
>>
>>
>Hello.
>
>There are a lots of tutorials around the net.
>
>www.phpbuilder.com <--- Very nice site for developers
>www.php.net <--- PHP official site. Look in the manual, every function
>(or almost any) has a description and comments from people around the
>globe with improvements and tips.
>
>Since you never programmed before, i recomend you to buy some PHP
>beginner books, cause always cover programing from the
>begining. but, if
>you can affort it, buy some programing books, with no relation to any
>programing language. It would be best for you to understande
>the basics
>without knowing any programing language... almost of them
>starts with C
>language, witch is very nice to start !
>
>by the way, its nice for you to start programming with PHP. you will
>love it !!
>
>
>--
>[EMAIL PROTECTED]
>--
>Divisao de Informatica
>[EMAIL PROTECTED]
>Tel: +351 272 000 155
>Fax: +351 272 000 257
>
>--
>Hospital Amato Lusitano
>Av. Pedro Alvares Cabral
>6000-085 Castelo Branco
>[EMAIL PROTECTED]
>Tel: +351 272 000 272
>Fax: +351 272 000 257
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On 28 July 2004 20:17, Daevid Vincent wrote:
> No. I'm trying to delete it from PHP memory, but keep the cookie on
> their client in the cookie.txt file or wherever it's stored.
Where are you doing the test for it -- in the same script, or in a
subsequent one? If the former, then I'm confused; if the latter, then this
is expected behaviour (explanation on request ;).
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS, LS6 3QS, United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--- End Message ---