|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Fri Jan 17 2003 - 20:46:45 CST
php-general Digest 18 Jan 2003 02:46:45 -0000 Issue 1829
Topics (messages 132007 through 132073):
Re: global variables
132007 by: Marek Kilimajer
Re: Making alternate rows of different colour
132008 by: Marek Kilimajer
132067 by: Daevid Vincent
PHP and SQL
132009 by: Kelvin Poon
132010 by: Adam Voigt
132032 by: John W. Holmes
Acessing $DOCUMENT_ROOT
132011 by: Don
132014 by: Philip Hallstrom
132015 by: Chris Hewitt
Problems reading e-mail body when having attachements .....
132012 by: Samuel Costa
Re: What's the PHP-equivalent of Perl's AUTOLOAD feature?
132013 by: Chip Castle
132036 by: John W. Holmes
Re: Changing page orientaion for printing
132016 by: Joshua Pierre
Re: Meta Refresh
132017 by: Edson Waite
Sessions or Cookies?
132018 by: Cesar Aracena
132020 by: Chris Shiflett
132068 by: Daevid Vincent
DB replicated on RAM disk?
132019 by: typea.l-i-e.com
Question about using session and "logging out"
132021 by: Don
132046 by: Bobby Patel
132049 by: Kevin Stone
132056 by: Stanislav Skrypnik
132058 by: Vladislav Kulchitski
132060 by: Stanislav Skrypnik
Header sent polem
132022 by: Cesar Aracena
132023 by: Matt Schroebel
Random string (was Header sent problem)
132024 by: Cesar Aracena
132025 by: Marek Kilimajer
132028 by: John W. Holmes
Something difference betwen php-4.0.3 and php-4.2.3
132026 by: andre.lagadec.education.gouv.fr
Re: [PHP-WIN] PDF
132027 by: Dash McElroy
mail () error
132029 by: Stephen Goehler
132030 by: John W. Holmes
132038 by: Stephen Goehler
132041 by: Thomas Seifert
Converting accented characters or numeric equivalents to non-accented
132031 by: Ian M. Evans
Re: Session Length
132033 by: John W. Holmes
Re: OOP
132034 by: John W. Holmes
Re: Images : Store in dB or disk?
132035 by: John W. Holmes
132044 by: Bobby Patel
Re: occasional mcrypt problems
132037 by: Steve Yates
Is it safe to enable unused extensions?
132039 by: Mohanaraj
Number Sign in String Variables
132040 by: Joab Ben Stieglitz
132048 by: Rick Emery
132062 by: John W. Holmes
Curl-functions + socket send and receive... where is the documenation ?
132042 by: Stefan Vetter
Curl Problem
132043 by: Jeff Hatcher
$HTTP_GET_VARS
132045 by: Mike Tuller
132047 by: Rick Emery
132050 by: Mike Tuller
132051 by: Matt
132052 by: Jim Lucas
frame problem
132053 by: Kiswa
132061 by: John W. Holmes
132073 by: Justin French
sending sms messages from the webpages
132054 by: Denis L. Menezes
PUT uploads
132055 by: Chris Jarecki
Gridwidget - javascript
132057 by: Nico Jansen - NiRo IT Consultants B.V.
PHP Encoders and GPL License
132059 by: [-^-!-%-
132064 by: Rick Widmer
132070 by: Sean Malloy
Meta Refresh Question (PHP)
132063 by: Edson Waite
132065 by: Timothy Hitchens \(HiTCHO\)
132066 by: John W. Holmes
132072 by: Edson Waite
PHP Review Site
132069 by: Stephen
132071 by: Timothy Hitchens \(HiTCHO\)
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
For this use globals, it would be painfull to pass everything. But you
can also use some class that would keep track of such things.
Dara Dowd wrote:
>Is it "better" to pass variables through functions or to simply declare them as global within the function's scope?
>The variables in this particular case are things like MySQL database connections and tablenames.
>Thanks,Dara
>
>
attached mail follows:
while($row=mysql...) {
$color=($color=='red' ? 'blue' : 'red');
echo ...
}
Denis L. Menezes wrote:
>Hello friends.
>
>I put the output of the database query in a table. It works fine. Now I have a need to make the alternate rows of a different color.
>
>Can someone please help me with the code?
>
>Thanks
>Denis
>
>
>
attached mail follows:
<?php
$bgcolor = ($i % 2 == 0) ? " BGCOLOR='#E3E3E3'" : "";
?>
<TR<?=$bgcolor?>>
> > Can someone please help me with the code?
>
> $cols = array('#ff0000','#00ff00');
> $i = 0;
> while(your_loop_to_output_each_row) {
> echo '<tr bgcolor="'.$cols[$i%2].'"><td>$row_data</td></tr>';
> }
attached mail follows:
Hi all,
My company had just ordered a SQL 2000 Server. I need to make a webpage
that collects data from the Server's database. I guess I need to use PHP
with SQL. My question is what is the difference between SQL and mySQL? I
brought a book that teaches you how to use PHP with MymySQL, I am just
wondering if this book will give me a good enough idea of how to do my job,
since I know a little bit of SQL already. Please advise, thanks.
Kelvin
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
attached mail follows:
SQL Server 2000 has a book's online sort of thing, it's a help manual
that is installed
while your installing the SQL Server client (Enterprise Manager) or
server, it's been
invaluable in figuring out functions specific to MSSQL. I highly
recommend just using
that.
On Fri, 2003-01-17 at 09:19, Kelvin Poon wrote:
Hi all,
My company had just ordered a SQL 2000 Server. I need to make a
webpage
that collects data from the Server's database. I guess I need to
use PHP
with SQL. My question is what is the difference between SQL and
mySQL? I
brought a book that teaches you how to use PHP with MymySQL, I am
just
wondering if this book will give me a good enough idea of how to do
my job,
since I know a little bit of SQL already. Please advise, thanks.
Kelvin
_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-- Adam Voigt (adamcryptocomm.com) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQA+KBMCF9k9BmZXCWYRAgb0AJ478Vxq//VfvBQclp0Xo4lhZtok7ACfXlFy +iAs5NsbC/Gh+fviucXkEoYr8 -----END PGP SIGNATURE-----
attached mail follows:
> My company had just ordered a SQL 2000 Server. I need to make a webpage > that collects data from the Server's database. I guess I need to use PHP > with SQL. My question is what is the difference between SQL and mySQL? I > brought a book that teaches you how to use PHP with MymySQL, I am just > wondering if this book will give me a good enough idea of how to do my > job, > since I know a little bit of SQL already. Please advise, thanks.
You'd want a book that's specific to MSSQL. Yes, the underlying SQL is the same in each one, but each has a list of functions and features that are specific to it. Having a book on what you're actually using is going to be most useful.
Don't chuck the MySQL book, though. Read it in conjunction with the other and you'll get the best of both worlds...
---John Holmes...
attached mail follows:
Hi,
How do I access $DOCUMENT_ROOT when register_gobals is set off? I think there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't find it in the documentation.
Thanks, Don
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
$_SERVER[DOCUMENT_ROOT]
On Fri, 17 Jan 2003, Don wrote:
> Hi, > > How do I access $DOCUMENT_ROOT when register_gobals is set off? I think > there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't > find it in the documentation. > > Thanks, > Don > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Don wrote:
>How do I access $DOCUMENT_ROOT when register_gobals is set off? I think >there's an array, something like $HTTP_ENV_VARS['DOCUMENT_ROOT'] but I can't >find it in the documentation. > $_SERVER['DOCUMENT_ROOT']
HTH Chris
attached mail follows:
I'm using the following code to parse the structure of the mail messages, function parse($structure) { global $type; global $encoding;
// create an array to hold message sections $ret = array();
// split structure into parts $parts = $structure->parts;
/* iterate through parts and create an array whose every element represents one part each element is itself an associative array with keys representing the - part number - part type - encoding - disposition - size - filename */ for($x=0; $x<sizeof($parts); $x++) { $ret[$x]["pid"] = ($x+1);
$this = $parts[$x]; // default to text
if ($this->type == "") { $this->type = 0; } $ret[$x]["type"] = $type[$this->type] . "/" . strtolower($this->subtype);
// default to 7bit if ($this->encoding == "") { $this->encoding = 0; }
$ret[$x]["encoding"] = $encoding[$this->encoding];
$ret[$x]["size"] = strtolower($this->bytes);
$ret[$x]["disposition"] = strtolower($this->disposition);
if (strtolower($this->disposition) == "attachment") { $params = $this->dparameters; foreach ($params as $p) { if($p->attribute == "FILENAME") { $ret[$x]["name"] = $p->value; break; } } } }
return $ret; }
and when i use to show the the contents with the following code
if(is_array($sections)) { echo sizeof($sections); for($x=0; $x<sizeof($sections); $x++) { if(($sections[$x]["type"] == "text/plain" || $sections[$x]["type"] == "message/rfc822") && ($sections[$x]["disposition"] != "attachment")) {
$text.= htmlspecialchars(stripslashes(trim(imap_fetchbody($inbox, $id, $sections[$x]["pid"])))); $text.= "<br>"; } } } else { $text.= htmlspecialchars(stripslashes(trim(imap_body($inbox, $id)))); }
$headers = imap_header($inbox, $id); $structure = imap_fetchstructure($inbox, $id);
// if multipart, parse if(sizeof($structure->parts) > 1) { $sections = parse($structure); $attachments = get_attachments($sections); }
if i only have text it works fine, but if i have attachements it only shows the attachements and not the body text.
Any thought on why does this happens?
<g>
Thanks in advance,
Sam da Costa
attached mail follows:
Hi Chris,
Thanks for the info. I probably need to make myself more clear, as I'm not referring to a database abstraction layer in terms of drivers (e.g., "dbx" in PHP, DBI in Perl).
I think the best example of what I'm talking about is in Tim Kientzle's "Perl and Rapid Database Prototyping" article of December's TPJ: http://www.chipcastle.com/tpj/TPJDecember2002.pdf
The first few paragraphs should give you the basic idea, so let me know if you have any suggestions.
Thanks!
Chip Castle / Open Source Web Developer http://www.chipcastle.com
Chris Hayes wrote: > At 02:06 17-1-2003, you wrote: > >> I just read an interesting article in The Perl Journal (TPJ) about using >> AUTOLOAD as a layer of abstraction for accessing database columns and I >> would like to write something similar in PHP. Is this possible? > > > If you mean some sort of database abstraction so one script would work > on MySQL as well as Oracle; there is not such a thing within PHP itself. > The google search term would 'database abstraction layer' and a popular > one is ADODB (not to be confused with the other adoDB), at > http://php.weblogs.com/ADODB. > > If that's not what you mean please try to explain it again.... > > Chris Hayes > > > > >
attached mail follows:
> I just read an interesting article in The Perl Journal (TPJ) about using > AUTOLOAD as a layer of abstraction for accessing database columns and I > would like to write something similar in PHP. Is this possible? > > I have written a number of PHP/MySQL applications, but do not consider > myself an expert. I cannot find anything on various PHP-related > websites and was hoping someone with more in depth knowledge would be > able to make a few suggestions.
Okay, so if I understand it correctly, you'd try to call a method such as $class->method() where method() doesn't actually exist. You'd want to catch that error, look for a column named 'method' in a table, and either set, return, or do both for the value in the column?
If you call an unknown function, it produces a fatal error, so I don't think that can be trapped by set_error_handler and acted on.
In order to do this, I think you'd have to do something like $class->method("phone","555-1212");
method() will look for a "phone" function and call it if it exists. Otherwise, look for a "phone" column and set/retrieve the value...
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
On Fri, Jan 17, 2003 at 05:07:30PM +1100, Stanislav Skrypnik wrote: > Hi everybody, > Is it possible using PHP change page orientation in browser so that when > user clicks > on "Print" button page automatically rotated to "landscape" orientation. > I've heard that it is possible to do with ActiveX but due to security reason > ActiveX might be disabled. > Thanks for any help in advance, > Stas.
I am fairly sure this can be done with cascading style sheets (CSS) automatically.
Have a look here:- http://www.w3.org/TR/REC-CSS2/media.html
Cheers,
Josh
attached mail follows:
Thanks for the assistance, It now works.
I have to figure out how to stop it at the end of the tale and force it it to another page but I will mess with that for a while before asking for help.
Thanks again to all who helped, Ed Waite
"Edson Waite" <ewaite
thewaitegroup.com> wrote in message
news:20030117032707.59989.qmail
pb1.pair.com...
> Hi All,
>
> I am trying to make an automated tour as a section of my site, using the
> following.
>
> <?php
> $NewID = $colname_earlytour + 1;
> ?>
> <META HTTP-EQUIV="refresh" CONTENT="15" URL=early-tour.php?ID= <?php echo
> "$NewID";?>>
>
> This works great going from early-tour?ID=1 to early-tour?ID=2 but I can't
> get it to continue on to ID=3, ID=4 etc. It just keeps reloading the data
> from ID=2
>
> The data for each page is in a row identified by a unique ID# I just want
> the page to reload with the data from the next ID# after a givin time 15
> seconds.
>
> Thanks in advance for any ideas,
> Edson Waite III
> http://www.sportsvideooutlet.com
>
>
>
>
attached mail follows:
Hi all,
I'm about to create a site where visitors will be able to search, view, surf and add items to a shopping cart without logging in to the site, but will need to do that in order to complete the transaction of course. What I wonder, is what to use to collect information about the items the visitor has chosen in order to show them in the cart section... Should I use the no-so-secure old cookies method or should I start a new session every time a client drops in and handle each cart by session name or ID?
Of course I would rather store every visitor's temporary cart in a long MySQL DB and not in their Hard Disks because of those 4 Kb of limit cookies have.
Any suggestions? Thanks in advance,
Cesar L. Aracena
icaam
icaam.com.ar
caracena
infovia.com.ar
(0299) 156-356688
Neuquén (8300) Capital
Argentina
attached mail follows:
--- Cesar Aracena <icaam
icaam.com.ar> wrote:
> Should I use the no-so-secure old cookies method
> or should I start a new session every time a client
> drops in and handle each cart by session name or ID?
My advice is to only use cookies to identify a Web client. Any data you want to associate with that Web client (user data, for example) should be stored on the server - database, session store, etc.
Chris
attached mail follows:
Agreed. Sessions are much more secure and convienient to use too. Since it's not reliant on the client to have cookies enabled, that's another benefit. Plus it's MUCH harder for a client to spoof/alter a session variable if you use the $_SESSION['myvar']
> -----Original Message-----
> From: Chris Shiflett [mailto:shiflett
php.net]
> Sent: Friday, January 17, 2003 9:29 AM
> To: Cesar Aracena; php-general
lists.php.net
> Subject: Re: [PHP] Sessions or Cookies?
>
>
> --- Cesar Aracena <icaam
icaam.com.ar> wrote:
> > Should I use the no-so-secure old cookies method
> > or should I start a new session every time a client
> > drops in and handle each cart by session name or ID?
>
> My advice is to only use cookies to identify a Web client.
> Any data you want to associate with that Web client (user
> data, for example) should be stored on the server -
> database, session store, etc.
>
attached mail follows:
This got long, but I structured it so one can stop reading when one gets bored or mired in minutia, and constructively answer based on what was read so far.
So feel free to stop reading after only a couple paragraphs and fire off a response :-)
"+++" marks good stopping-points for this cumulative post/response deal.
I'll take any other random suggestions for how to drasticly improve full-text index/search performance, of course! I examined the PostgreSQL contrib/ directory solutions -- fulltextindex didn't help, and the other option required software/processes we're not able to maintain at this time.
THANKS!!!
---------------------------------------- Under what real-world conditions does a read-only replication of a DB on a RAM disk make sense?
Any quick tips for what NOT to do if I just want to run a quick crude benchmark trial sort of thing using PostgreSQL and PHP?
+++
A Google for "PostgreSQL RAMdisk" turned up only one brief article that seemed geared toward a very small dataset for a hobbyist type site where performance was more about principle than real-world need. (Though it was a VERY nice article with very concise directions and great warnings about "what if")
Perhaps I should have Googled for "MySQL RAMdisk" and hoped the parallels were accurate? I'll give it a shot, but am leery of invalid information from that cross-db assumption. Any comment on the likelihood of non-PostgreSQL info being applicable?
Mailing List archives turned up some interesting discussions, but were generally not conclusive.
+++
Or, to make this easier to answer, if somewhat less useful generally in the archive, do you predict it would significantly boost performance (and why or why not) for:
Intel Pentium III, 1.4 G MHz RAM 1G PostgreSQL 7.3 currently *NEEDS* shared_buffers = 256M, has 512M as safety also set sort_mem = 16384 - not sure it helped/hurt also tried to turn query/perofrmance logging on, but never did find the darn log files to view anything useful (Help!) PHP 4.2.3 The database itself is sucking down 2.6 Gig of hard drive space: du -hc . 3.6M ./base/1 3.6M ./base/16975 4.0k ./base/16976/pgsql_tmp 2.3G ./base/16976 4.0k ./base/3087869/pgsql_tmp 120M ./base/3087869 2.5G ./base 140k ./global 113M ./pg_xlog 720k ./pg_clog 2.6G . 2.6G total
+++
Obviously I cannot currently replicate that whole thing in RAM.
However, a large chunk (1 Gig-ish) of that is a 12 million row table of (int4+int4+int4) == 96 byte records that I was hoping would allow a self-join of word position (concordance) which would be faster than the RegEx across 18000 articles of 0 to 270K in length.
Another large chunk (750 Meg-ish) is a 10 million (int4+int4+smallint) = 80 byte records which are currently being used (and probably must remain) to cross index a dictionary with each article and its frequency in the article.
This 750 Meg table took queries ranging from two minutes to an unknown time down to the 10 second magnitude. I doubt that the RAM disk is going to be enough boon to beat that, right?
I believe that before I added these tables, we were looking at ~200 Meg of data, which makes a little more sense on a RAM disk.
+++
An answer that involves paying for more RAM and making it 40X as fast would be fine, of course.
So if I trade the 1.8 Gig concordance[s] for a RAM disk will the RAM disk give 4X to ??X performance improvement to "make up" for the concordance gains I've already achieved?
+++
Big Picture: It's a custom search engine of texts from over 50 years' worth of a magazine using some specific meta-data to provide searching.
Full-text index searching has been the biggest challenge. No surprise there -- But I had hoped for more definitive solutions "out there" in algorithms and such-like. There were off-the-shelf projects (eg ht://dig), but they didn't "fit in" with some of the meta-data and design constraints.
I've managed to create a concordance of article/word/frequency that has sped up most queries from minutes to ~10 seconds.
Alas, the support for "a NEAR b" is at risk, because the RegEx on 18000 rows of text from 0 to 270K takes too long. (We can drop NEAR if we have to, maybe, but would rather not.)
Only now am I realizing I probably underestimated that 12 million number -- It probably is closer to 20 million or even 40 million. Hard to say for sure until the actual text is indexed or I run a random sampling at least.
I don't even have real data in that table yet -- Just used semi-random numbers to populate it for benchmarking to see what sort of gains I might get. (Answer: 4X is great, but it's not enough.)
And the concordance with full positional information (eg word "foo" appears in article 57 at offset 42) requires an [under-]estimated 12 million row self-join.
A sample table of that magnitude clocks in at 30 seconds just for two words "a NEAR b" without even trying (yet) to correlate those with the actual articles via the dictionary/concordance lookup. And while 30 seconds sure beats two minutes, it's not good enough, particularly when I haven't even factored in the actual article lookup in that crude benchmark.
I think I've just about exhausted the query-munging solutions and am now casting farther afield (EG this RAM disk idea) for solutions.
As a long-time Open Source advocate, I am hoping to publish some of my experience, pending (A) successful resolution and (B) client->client approval. They've been pretty good on that sort of thing so far, but you never know. I'll post here if that works out.
+++
Excruciating hardware detail:
cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 11 model name : Intel(R) Pentium(R) III CPU family 1400MHz stepping : 1 cpu MHz : 1406.020 cache size : 512 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse bogomips : 2804.94
cat /proc/meminfo total: used: free: shared: buffers: cached: Mem: 921235456 916316160 4919296 4612096 87429120 706134016 Swap: 2097143808 786432 2096357376 MemTotal: 899644 kB MemFree: 4804 kB MemShared: 4504 kB Buffers: 85380 kB Cached: 688816 kB SwapCached: 768 kB Active: 319436 kB Inact_dirty: 33096 kB Inact_clean: 426936 kB Inact_target: 229376 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 899644 kB LowFree: 4804 kB SwapTotal: 2047992 kB SwapFree: 2047224 kB
free -m total used free shared buffers cached Mem: 878 872 5 4 83 670 -/+ buffers/cache: 119 759 Swap: 1999 0 1999
If you've read this far, you deserve a Cookie or something! :-)
THANK YOU!!!
attached mail follows:
Hi,
I have an application that uses sessions to allow customers to access a restricted area. That is, they are prompted for a user login and password. I then use sessions to track each customer. At the top of each page, I have placed the following PHP code:
session_cache_limiter('Cache-control: private'); session_start();
Everything works fine. However, I have a logout link that when clicked, runs the following PHP code (where userid is the login name):
session_cache_limiter('nocache'); if (isset($HTTP_SESSION_VARS['userid'])) { $HTTP_SESSION_VARS['userid'] = ''; session_unregister($HTTP_SESSION_VARS['userid']); } session_unset(); session_destroy(); Header('Location: ' . 'http://www.lclnav.com' . $globals->relative_path . 'customerlogin_standard.html');
I think the above is all that is needed to end the session. I use the Header() function to take the user back to the login page.
Here is my question: Once I click on the "logout" link and am taken back to the main login page, I can click on the browser BACK button and still get my previous page 'as if I was still logged in'. Please note that clicking on REFRESH tells me that I am not really logged in.
I know that browsers cache pages and there may not be anything I can do, however, I have seen sites that seem to work around this; i.e.., clicking on the back button loads a pages telling the user that they are no longer logged in. This is what I want to emulate. Is there a PHP method to always force a reload the first time a page is called?
Thanks, Don
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
I believe there something (a meta tag?) called meta-refresh or just refresh.
But I believe you have to set the refresh interval. and if you set the interval to small it might eat your server's resources.
OR I just thought of this, sometimes when you get to a page (usually with forms?) it says that the page is expired and must be refreshed. Maybe you can get that behaviour, so that when someone hits back, they have to refresh.
Bobby
"Don" <donpro
lclcan.com> wrote in message
news:020401c2be4f$c5420fd0$c889cdcd
enterprise...
Hi,
I have an application that uses sessions to allow customers to access a restricted area. That is, they are prompted for a user login and password. I then use sessions to track each customer. At the top of each page, I have placed the following PHP code:
session_cache_limiter('Cache-control: private'); session_start();
Everything works fine. However, I have a logout link that when clicked, runs the following PHP code (where userid is the login name):
session_cache_limiter('nocache'); if (isset($HTTP_SESSION_VARS['userid'])) { $HTTP_SESSION_VARS['userid'] = ''; session_unregister($HTTP_SESSION_VARS['userid']); } session_unset(); session_destroy(); Header('Location: ' . 'http://www.lclnav.com' . $globals->relative_path . 'customerlogin_standard.html');
I think the above is all that is needed to end the session. I use the Header() function to take the user back to the login page.
Here is my question: Once I click on the "logout" link and am taken back to the main login page, I can click on the browser BACK button and still get my previous page 'as if I was still logged in'. Please note that clicking on REFRESH tells me that I am not really logged in.
I know that browsers cache pages and there may not be anything I can do, however, I have seen sites that seem to work around this; i.e.., clicking on the back button loads a pages telling the user that they are no longer logged in. This is what I want to emulate. Is there a PHP method to always force a reload the first time a page is called?
Thanks, Don
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
attached mail follows:
Don,
The only method that I have discovered to protect the login against the back-button is to validate the session at the top of each and every protected page. Forgive the psuedo code..
<? if active session { // validate privs for this page // session start }else{ // logout } ?>
When the back button is pressed it goes through this process, sees that there is no active session, goes to else and shunts back to the login screen.
Hope that helps, Kevin
----- Original Message -----
From: "Bobby Patel" <anup_patel
rogers.com>
To: <php-general
lists.php.net>
Sent: Friday, January 17, 2003 3:26 PM
Subject: [PHP] Re: Question about using session and "logging out"
> I believe there something (a meta tag?) called meta-refresh or just
> refresh.
>
> But I believe you have to set the refresh interval. and if you set the
> interval to small it might eat your server's resources.
>
> OR I just thought of this, sometimes when you get to a page (usually with
> forms?) it says that the page is expired and must be refreshed. Maybe you
> can get that behaviour, so that when someone hits back, they have to
> refresh.
>
> Bobby
>
> "Don" <donpro
lclcan.com> wrote in message
> news:020401c2be4f$c5420fd0$c889cdcd
enterprise...
> Hi,
>
> I have an application that uses sessions to allow customers to access a
> restricted area. That is, they are prompted for a user login and
password.
> I then use sessions to track each customer. At the top of each page, I
have
> placed the following PHP code:
>
> session_cache_limiter('Cache-control: private');
> session_start();
>
> Everything works fine. However, I have a logout link that when clicked,
> runs the following PHP code (where userid is the login name):
>
> session_cache_limiter('nocache');
> if (isset($HTTP_SESSION_VARS['userid'])) {
> $HTTP_SESSION_VARS['userid'] = '';
> session_unregister($HTTP_SESSION_VARS['userid']);
> }
> session_unset();
> session_destroy();
> Header('Location: ' . 'http://www.lclnav.com' . $globals->relative_path .
> 'customerlogin_standard.html');
>
> I think the above is all that is needed to end the session. I use the
> Header() function to take the user back to the login page.
>
> Here is my question: Once I click on the "logout" link and am taken back
to
> the main login page, I can click on the browser BACK button and still get
my
> previous page 'as if I was still logged in'. Please note that clicking on
> REFRESH tells me that I am not really logged in.
>
> I know that browsers cache pages and there may not be anything I can do,
> however, I have seen sites that seem to work around this; i.e.., clicking
on
> the back button loads a pages telling the user that they are no longer
> logged in. This is what I want to emulate. Is there a PHP method to
always
> force a reload the first time a page is called?
>
> Thanks,
> Don
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Hi Kevin, I don't well understand this part: > if active session { > // validate privs for this page Can you give small example? TIA, Stas
"Kevin Stone" <kevin
helpelf.com> wrote in message
news:019501c2be78$4ad0dc30$6601a8c0
kevin...
> Don,
>
> The only method that I have discovered to protect the login against the
> back-button is to validate the session at the top of each and every
> protected page. Forgive the psuedo code..
>
> <?
> if active session {
> // validate privs for this page
> // session start
> }else{
> // logout
> }
> ?>
>
> When the back button is pressed it goes through this process, sees that
> there is no active session, goes to else and shunts back to the login
> screen.
>
> Hope that helps,
> Kevin
>
> ----- Original Message -----
> From: "Bobby Patel" <anup_patel
rogers.com>
> To: <php-general
lists.php.net>
> Sent: Friday, January 17, 2003 3:26 PM
> Subject: [PHP] Re: Question about using session and "logging out"
>
>
> > I believe there something (a meta tag?) called meta-refresh or just
> > refresh.
> >
> > But I believe you have to set the refresh interval. and if you set the
> > interval to small it might eat your server's resources.
> >
> > OR I just thought of this, sometimes when you get to a page (usually
with
> > forms?) it says that the page is expired and must be refreshed. Maybe
you
> > can get that behaviour, so that when someone hits back, they have to
> > refresh.
> >
> > Bobby
> >
> > "Don" <donpro
lclcan.com> wrote in message
> > news:020401c2be4f$c5420fd0$c889cdcd
enterprise...
> > Hi,
> >
> > I have an application that uses sessions to allow customers to access a
> > restricted area. That is, they are prompted for a user login and
> password.
> > I then use sessions to track each customer. At the top of each page, I
> have
> > placed the following PHP code:
> >
> > session_cache_limiter('Cache-control: private');
> > session_start();
> >
> > Everything works fine. However, I have a logout link that when clicked,
> > runs the following PHP code (where userid is the login name):
> >
> > session_cache_limiter('nocache');
> > if (isset($HTTP_SESSION_VARS['userid'])) {
> > $HTTP_SESSION_VARS['userid'] = '';
> > session_unregister($HTTP_SESSION_VARS['userid']);
> > }
> > session_unset();
> > session_destroy();
> > Header('Location: ' . 'http://www.lclnav.com' . $globals->relative_path
.
> > 'customerlogin_standard.html');
> >
> > I think the above is all that is needed to end the session. I use the
> > Header() function to take the user back to the login page.
> >
> > Here is my question: Once I click on the "logout" link and am taken
back
> to
> > the main login page, I can click on the browser BACK button and still
get
> my
> > previous page 'as if I was still logged in'. Please note that clicking
on
> > REFRESH tells me that I am not really logged in.
> >
> > I know that browsers cache pages and there may not be anything I can do,
> > however, I have seen sites that seem to work around this; i.e..,
clicking
> on
> > the back button loads a pages telling the user that they are no longer
> > logged in. This is what I want to emulate. Is there a PHP method to
> always
> > force a reload the first time a page is called?
> >
> > Thanks,
> > Don
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
attached mail follows:
I think the method Kevin mentioned is the best.
In other words, on every secure page you have a script that checks is a session registered. IF it is, it lets you go through and execute the rest of the script if not, simply tells you to login that's it. Very simple, if interested I can show example.
Vlad
-----Original Message-----
From: Stanislav Skrypnik [mailto:sysadmin
cambridgecollege.com.au]
Sent: Friday, January 17, 2003 7:30 PM
To: php-general
lists.php.net
Subject: Re: [PHP] Re: Question about using session and "logging out"
Hi Kevin, I don't well understand this part: > if active session { > // validate privs for this page Can you give small example? TIA, Stas
"Kevin Stone" <kevin
helpelf.com> wrote in message
news:019501c2be78$4ad0dc30$6601a8c0
kevin...
> Don,
>
> The only method that I have discovered to protect the login against the
> back-button is to validate the session at the top of each and every
> protected page. Forgive the psuedo code..
>
> <?
> if active session {
> // validate privs for this page
> // session start
> }else{
> // logout
> }
> ?>
>
> When the back button is pressed it goes through this process, sees that
> there is no active session, goes to else and shunts back to the login
> screen.
>
> Hope that helps,
> Kevin
>
> ----- Original Message -----
> From: "Bobby Patel" <anup_patel
rogers.com>
> To: <php-general
lists.php.net>
> Sent: Friday, January 17, 2003 3:26 PM
> Subject: [PHP] Re: Question about using session and "logging out"
>
>
> > I believe there something (a meta tag?) called meta-refresh or just
> > refresh.
> >
> > But I believe you have to set the refresh interval. and if you set the
> > interval to small it might eat your server's resources.
> >
> > OR I just thought of this, sometimes when you get to a page (usually
with
> > forms?) it says that the page is expired and must be refreshed. Maybe
you
> > can get that behaviour, so that when someone hits back, they have to
> > refresh.
> >
> > Bobby
> >
> > "Don" <donpro
lclcan.com> wrote in message
> > news:020401c2be4f$c5420fd0$c889cdcd
enterprise...
> > Hi,
> >
> > I have an application that uses sessions to allow customers to access a
> > restricted area. That is, they are prompted for a user login and
> password.
> > I then use sessions to track each customer. At the top of each page, I
> have
> > placed the following PHP code:
> >
> > session_cache_limiter('Cache-control: private');
> > session_start();
> >
> > Everything works fine. However, I have a logout link that when clicked,
> > runs the following PHP code (where userid is the login name):
> >
> > session_cache_limiter('nocache');
> > if (isset($HTTP_SESSION_VARS['userid'])) {
> > $HTTP_SESSION_VARS['userid'] = '';
> > session_unregister($HTTP_SESSION_VARS['userid']);
> > }
> > session_unset();
> > session_destroy();
> > Header('Location: ' . 'http://www.lclnav.com' . $globals->relative_path
.
> > 'customerlogin_standard.html');
> >
> > I think the above is all that is needed to end the session. I use the
> > Header() function to take the user back to the login page.
> >
> > Here is my question: Once I click on the "logout" link and am taken
back
> to
> > the main login page, I can click on the browser BACK button and still
get
> my
> > previous page 'as if I was still logged in'. Please note that clicking
on
> > REFRESH tells me that I am not really logged in.
> >
> > I know that browsers cache pages and there may not be anything I can do,
> > however, I have seen sites that seem to work around this; i.e..,
clicking
> on
> > the back button loads a pages telling the user that they are no longer
> > logged in. This is what I want to emulate. Is there a PHP method to
> always
> > force a reload the first time a page is called?
> >
> > Thanks,
> > Don
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> >
> >
> >
> > --
> > 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
attached mail follows:
Well then pseudo-code a bit not correct; I think it should be like: <? // session start if session registerred { // Do whatever you need } else{ // logout } ?>
But what about such case: Let we have 3 pages: 1) login page(user enters credentials and redirected to page2) 2) secure page (where we validate user, register sess. vars. etc). Than user clicks "logout" and redirected to page3. 3) logout page. We destroy session and logout user.
If at this point user clicks Back button he/she will get message "Warning: page expired" (this is secure page). Because browser still has credentials entered on page 1(login page) pressing refresh button starts new session and secure page is accesible. How this problem can be fixed? Stas
"Vladislav Kulchitski" <vlad
alidaconnection.com> wrote in message
news:0D192E12994BF64B84EB7BE6D960E3901C4DEF
alidamail.alidaconnection.com...
I think the method Kevin mentioned is the best.
In other words, on every secure page you have a script that checks is a session registered. IF it is, it lets you go through and execute the rest of the script if not, simply tells you to login that's it. Very simple, if interested I can show example.
Vlad
-----Original Message-----
From: Stanislav Skrypnik [mailto:sysadmin
cambridgecollege.com.au]
Sent: Friday, January 17, 2003 7:30 PM
To: php-general
lists.php.net
Subject: Re: [PHP] Re: Question about using session and "logging out"
Hi Kevin, I don't well understand this part: > if active session { > // validate privs for this page Can you give small example? TIA, Stas
"Kevin Stone" <kevin
helpelf.com> wrote in message
news:019501c2be78$4ad0dc30$6601a8c0
kevin...
> Don,
>
> The only method that I have discovered to protect the login against the
> back-button is to validate the session at the top of each and every
> protected page. Forgive the psuedo code..
>
> <?
> if active session {
> // validate privs for this page
> // session start
> }else{
> // logout
> }
> ?>
>
> When the back button is pressed it goes through this process, sees that
> there is no active session, goes to else and shunts back to the login
> screen.
>
> Hope that helps,
> Kevin
>
> ----- Original Message -----
> From: "Bobby Patel" <anup_patel
rogers.com>
> To: <php-general
lists.php.net>
> Sent: Friday, January 17, 2003 3:26 PM
> Subject: [PHP] Re: Question about using session and "logging out"
>
>
> > I believe there something (a meta tag?) called meta-refresh or just
> > refresh.
> >
> > But I believe you have to set the refresh interval. and if you set the
> > interval to small it might eat your server's resources.
> >
> > OR I just thought of this, sometimes when you get to a page (usually
with
> > forms?) it says that the page is expired and must be refreshed. Maybe
you
> > can get that behaviour, so that when someone hits back, they have to
> > refresh.
> >
> > Bobby
> >
> > "Don" <donpro
lclcan.com> wrote in message
> > news:020401c2be4f$c5420fd0$c889cdcd
enterprise...
> > Hi,
> >
> > I have an application that uses sessions to allow customers to access a
> > restricted area. That is, they are prompted for a user login and
> password.
> > I then use sessions to track each customer. At the top of each page, I
> have
> > placed the following PHP code:
> >
> > session_cache_limiter('Cache-control: private');
> > session_start();
> >
> > Everything works fine. However, I have a logout link that when clicked,
> > runs the following PHP code (where userid is the login name):
> >
> > session_cache_limiter('nocache');
> > if (isset($HTTP_SESSION_VARS['userid'])) {
> > $HTTP_SESSION_VARS['userid'] = '';
> > session_unregister($HTTP_SESSION_VARS['userid']);
> > }
> > session_unset();
> > session_destroy();
> > Header('Location: ' . 'http://www.lclnav.com' . $globals->relative_path
.
> > 'customerlogin_standard.html');
> >
> > I think the above is all that is needed to end the session. I use the
> > Header() function to take the user back to the login page.
> >
> > Here is my question: Once I click on the "logout" link and am taken
back
> to
> > the main login page, I can click on the browser BACK button and still
get
> my
> > previous page 'as if I was still logged in'. Please note that clicking
on
> > REFRESH tells me that I am not really logged in.
> >
> > I know that browsers cache pages and there may not be anything I can do,
> > however, I have seen sites that seem to work around this; i.e..,
clicking
> on
> > the back button loads a pages telling the user that they are no longer
> > logged in. This is what I want to emulate. Is there a PHP method to
> always
> > force a reload the first time a page is called?
> >
> > Thanks,
> > Don
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003
> >
> >
> >
> > --
> > 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
attached mail follows:
Hi all,
Following Chris's idea on how to handle visitors sessions, I'm trying to setup a cookie with a randomly generated session ID but it throws me the "headers already sent" notice but there's nothing above the setcookie function. Here's part of my code:
<? if (!isset($sessid)) { require_once("PasswordGenerator.php"); $Password = new PasswordGenerator(10, 10); $RandPassword = $Password->getHTMLPassword(); setcookie("sessid", "".print($RandPassword)."", time()+3600); } else if (isset($sessid)) { echo "$sessid"; } [---snip---]
and after all this is then called the header and main files... What is getting outputted to the browser?
Thanks in advance,
Cesar L. Aracena
icaam
icaam.com.ar
caracena
infovia.com.ar
(0299) 156-356688
Neuquén (8300) Capital
Argentina
attached mail follows:
> -----Original Message-----
> From: Cesar Aracena [mailto:icaam
icaam.com.ar]
> Sent: Friday, January 17, 2003 12:56 PM
> Subject: [PHP] Header sent polem
>
>
> Hi all,
>
> Following Chris's idea on how to handle visitors sessions,
> I'm trying to
> setup a cookie with a randomly generated session ID but it
> throws me the
> "headers already sent" notice but there's nothing above the setcookie
> function. Here's part of my code:
>
> <?
> if (!isset($sessid))
> {
> require_once("PasswordGenerator.php");
Look for white space in the include file ...
attached mail follows:
I found that the Header already sent problem was caused by the Random Password Generator I'm using, even if I place this function on the bottom of the same file I'm trying to open an just call for the result.
So, to avoid this issue, I need another method of generating a random number or string of some sort like using the actual time which I can place inside the setcookie function directly... anyone knows what can I use?
Thanks in advance,
Cesar L. Aracena
icaam
icaam.com.ar
caracena
infovia.com.ar
(0299) 156-356688
Neuquén (8300) Capital
Argentina
attached mail follows:
The function is not the real problem, you just need to find any characters (even white) outside <?php ?>
Cesar Aracena wrote:
>I found that the Header already sent problem was caused by the Random
>Password Generator I'm using, even if I place this function on the
>bottom of the same file I'm trying to open an just call for the result.
>
>So, to avoid this issue, I need another method of generating a random
>number or string of some sort like using the actual time which I can
>place inside the setcookie function directly... anyone knows what can I
>use?
>
>Thanks in advance,
>
>Cesar L. Aracena
>icaam
icaam.com.ar
>caracena
infovia.com.ar
>(0299) 156-356688
>Neuquén (8300) Capital
>Argentina
>
>
>
>
>
>
attached mail follows:
> I found that the Header already sent problem was caused by the Random > Password Generator I'm using, even if I place this function on the > bottom of the same file I'm trying to open an just call for the result. > > So, to avoid this issue, I need another method of generating a random > number or string of some sort like using the actual time which I can > place inside the setcookie function directly... anyone knows what can I > use?
If the function is the problem, then stop echoing or printing anything in the function, before it, or after it. Make sure there is nothing outside of the <? And ?> tags, especially an extra line break after the closing ?> of the file if it's an include file.
And, you can use uniqid() to create a random string.
---John Holmes...
attached mail follows:
Hello,
I try to move an Web application in Php-4.0.3 to php-4.2.3, and some programs don't work well on some pages. I make search in the code, and after tests, I find that the following code doesn't work in php-4.2.3, but works in php-4.0.3pl1 ------------------------------------------------------------------------------------
<html> <body> <form> <? $i = 0; while ($i<=3) { $selected = ""; $selectTab[$i] = "<option value='".$i."' ".$selected."> bla bla </option>\n"; $i++; } printf("<select name='filiere' multiple size='%d' class='textNoir'>\n", ($i-1) ); $j = 0; while ( $j <= $i ) { printf($selectTab[$j]); $j++; } printf("</select>"); ?> </body> </html> ------------------------------------------------------------------------------------
It's because there is an error in the code : this instruction is wrong while ( $j <= $i ), there is an "out of range" in the array selectTab[] when $j=$i=4 the good instruction is while ( $j < $i )
Is there something changed in the gestion of the error "out of range" in an array betwen php-4.0.3pl1 and php-4.2.4 ?
Thanks for your help ?
AL
attached mail follows:
If the PDF forms you "print on top of" are forms, you can use FDF (Forms Data Format) to fill out the form. There are several FDF options. One is to use Adobe's FDF program thingie. Others are listed in the comments on this page (http://www.php.net/manual/en/ref.fdf.php). I used one of the ones listed in the comments with no problems, but it was for a super simple form. (i.e., your mileage may vary)
Another option is to have the suppliers form to be turned into an image and placed in the background (via pdf_place_image() if you're using PDFlib). This works well enough, but could be extremely troublesome for large forms. It also heavily increases the size of the PDF document.
PDFlib is really powerful, but to edit existing PDF documents, you may need to use their PDI (Pdf Import Library). That is an added cost module.
Otherwise, you could create a function (or possibly class) to basically redo the suppliers' form, and then pass over it (at the same time) with the data you need to put on the form.
Good Luck!
-Dash
The scum also rises. -- Dr. Hunter S. Thompson
On Fri, 17 Jan 2003, Brian McGarvie wrote:
> I'm looking to find out if PHP has the ability to do this... > > OK I'm looking for a solution that could do the following. > > We require to generate PDF files that can then be emailed or printed & > posted to clients. > > I can create PDF Files from scratch using PDFLib. > > What we will require to do though is, we presently have paper copies of > forms from various parties we deal with, our present Access-based system > simply prints on top of these, I am presently developing in PHP a system to > replace the Access database, we will want it to create these as PDF files > (we can get the printed forms in PDF format) based on supplied PDF files... > for example, generate a PDF for Customer X based on Supplier Z's PDF file. > > Any solutions in PHP (open source, free, commercial etc etc.) would be very > much appreciated, or if we need to look at another Language to perform this > part of the solution (i.e. ASP). > > The solution I'm developing is PHP, running on a Windows 2000 Server as we > require use of some windows-only software too. So if *cough* ASP is what's > needed to do the above then so be it :\ - really hope not though!!! > > Thanks in advance! > > > --- > Outgoing mail is certified Virus Free. > Checked by AVG anti-virus system (http://www.grisoft.com). > Version: 6.0.438 / Virus Database: 246 - Release Date: 07/01/03 > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Anyone know what causes this error?
Warning: mail ()[function.mail]: Failed to receive
Can it not find the mail server?
On a side note, is there a PHP resource on the net that will listed error messages and their possible causes?
Thanks,
Steve
attached mail follows:
> Anyone know what causes this error? > > Warning: mail ()[function.mail]: Failed to receive > > Can it not find the mail server?
When I got this error it was because the server was rejecting the email, saying it wouldn't relay the message. Maybe check your relay setting in your SMTP server?
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Thanks, the server was relaying, but it turned out to be the firewall that was rejecting the request.
Now I have a new problem thought, my mail () command will send the mail (and I receive it) but it will just hang there and eventually return this:
Fatal error: Maximum execution time of 30 seconds exceeded
The email goes through, but it won't process any of the code after it. Is it waiting for a response from the mail server? Can I disable that?
Steve
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:004901c2be5a$a384f910$7c02a8c0
coconut...
> > Anyone know what causes this error?
> >
> > Warning: mail ()[function.mail]: Failed to receive
> >
> > Can it not find the mail server?
>
> When I got this error it was because the server was rejecting the email,
> saying it wouldn't relay the message. Maybe check your relay setting in
> your SMTP server?
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
attached mail follows:
The mail-server has to respond that it received the mail. Maybe you've set the firewall only one-way open?
Thomas
On Fri, 17 Jan 2003 15:29:32 -0500 steve
briartek.com (Stephen Goehler) wrote:
> Thanks, the server was relaying, but it turned out to be the firewall that
> was rejecting the request.
>
> Now I have a new problem thought, my mail () command will send the mail (and
> I receive it) but it will just hang there and eventually return this:
>
> Fatal error: Maximum execution time of 30 seconds exceeded
>
> The email goes through, but it won't process any of the code after it. Is
> it waiting for a response from the mail server? Can I disable that?
>
> Steve
>
> "John W. Holmes" <holmes072000
charter.net> wrote in message
> news:004901c2be5a$a384f910$7c02a8c0
coconut...
> > > Anyone know what causes this error?
> > >
> > > Warning: mail ()[function.mail]: Failed to receive
> > >
> > > Can it not find the mail server?
> >
> > When I got this error it was because the server was rejecting the email,
> > saying it wouldn't relay the message. Maybe check your relay setting in
> > your SMTP server?
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/
> >
> >
>
>
attached mail follows:
Does anyone have a quick PHP function for converting accented characters to their non-accented forms? It would really help a lot with Amazon searches, etc.
For example something that can turn:
Renée Zellweger into Renee Zellweger
Along that same vein, turning
Renée Zellweger into Renee Zellweger
Thanks!
-- Ian Evans Digital Hit Entertainment http://www.digitalhit.com
attached mail follows:
> I am using Sessions to secure parts of my website. I need to know if > there is a way to set a lifetime for these sessions , so that they are > automatically destroyed when say the user is inactive for 30 minutes.
It's already there, the session.gc_maxlifetime setting (default is 1440 seconds).
Actually, this will only work if garbage_collection works on your server. It's all explained on the session page.
If gc doesn't work on your system, then register a timestamp in the session that get's updated with each action. Then just look for timestamps over 30 minutes old and make them log in again.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
> Nice work on php archittect by the way :) > Thanks again, > Jordan
Thank you.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
> With regards to Marek, > I don't see how there would be two queries, because there row conisists of > image properties and image data. So when i select the required row(s), I > will have properties and images. So it will be 1 query, of course it is a > big (size-wise) query.
Hopefully you've gotten the point that this isn't true. If you store your images in the database, it's going to make your main script execute one query to output something like <img src="file.php?id=xxx" ...properties...> for each image. Each one of those <img> tags will be a separate request where file.php would pull the data for _one_ image, send the headers and then send the data.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
That makes sense. When Marek explained it I didn't realise that IMG tags can't use the raw data, and needs to make a seperate HTTP request for the Headers.
Now, I understand. Unfortunately the desicion has been made to go with the database.
Oh well, I can always code the scripts to store and grab from the filesystem, after if need be.
Thank you everyone, who has responded.
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:004d01c2be5c$631f4ea0$7c02a8c0
coconut...
> > With regards to Marek,
> > I don't see how there would be two queries, because there row
> conisists of
> > image properties and image data. So when i select the required row(s),
> I
> > will have properties and images. So it will be 1 query, of course it
> is a
> > big (size-wise) query.
>
> Hopefully you've gotten the point that this isn't true. If you store
> your images in the database, it's going to make your main script execute
> one query to output something like <img src="file.php?id=xxx"
> ...properties...> for each image. Each one of those <img> tags will be a
> separate request where file.php would pull the data for _one_ image,
> send the headers and then send the data.
>
> ---John W. Holmes...
>
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
>
>
attached mail follows:
After much testing, I think I may have it. It appears that MySQL is dropping a trailing space from the value being inserted into the database! For example if the encrypted string is "(.A®¢m¸"¼'À " MySQL stores the value without the trailing space (and it is a space). Why is that? I can duplicate this by entering "test " as the field value too.
- Steve Yates - Life would be easy if we had the source code.
~ Taglines by Taglinator - www.srtware.com ~
attached mail follows:
Hi,
I might need to enable several extension - out of which only a single one is used. Do these extra extensions that are enabled but not used eat up appreciable amounts of memory or in any way slow down PHP?
Thank you and best regards, Mohanaraj
attached mail follows:
I have a MySQL database that includes data with the # sign in some data fields. My PHP script pulls the data out of the database fine, but when I got to write back to the database, I get errors because the string gets truncated at the # sign. For example:
$query = "INSERT INTO order_detail SET customer_id = -1, order_id = $order_no, item_id = $item_id, item_num = \"$item_num\", unit = \"$unit\", short_desc = \"$short_desc\", quantity = $quantity, wholesaler = \"$wholesaler\", cost = $cost, sale_price = $sale_price";
This statement fails if $short_desc contains a # sign. The string stops at the # sign, and all the subsequent fields are empty or garbage.
None of the various resources I have looked at indicate that the # sign is a special character. Any suggestions?
-- Joab Ben Stieglitz jstieglitzst-i-e-g.org
attached mail follows:
I have data that have #, so that is not the problem.
Show us more code AND your database structure.
----- Original Message -----
From: "Joab Ben Stieglitz" <jstieglitz
st-i-e-g.org>
To: <>
Sent: Friday, January 17, 2003 2:25 PM
Subject: [PHP] Number Sign in String Variables
I have a MySQL database that includes data with the # sign in some data fields. My PHP script pulls the data out of the database fine, but when I got to write back to the database, I get errors because the string gets truncated at the # sign. For example:
$query = "INSERT INTO order_detail SET customer_id = -1, order_id = $order_no, item_id = $item_id, item_num = \"$item_num\", unit = \"$unit\", short_desc = \"$short_desc\", quantity = $quantity, wholesaler = \"$wholesaler\", cost = $cost, sale_price = $sale_price";
This statement fails if $short_desc contains a # sign. The string stops at the # sign, and all the subsequent fields are empty or garbage.
None of the various resources I have looked at indicate that the # sign is a special character. Any suggestions?
-- Joab Ben Stieglitz jstieglitzst-i-e-g.org
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
> I have a MySQL database that includes data with the # sign in some data > fields. My PHP script pulls the data out of the database fine, but when I > got to write back to the database, I get errors because the string gets > truncated at the # sign. For example: > > $query = "INSERT INTO order_detail > SET customer_id = -1, > order_id = $order_no, > item_id = $item_id, > item_num = \"$item_num\", > unit = \"$unit\", > short_desc = \"$short_desc\", > quantity = $quantity, > wholesaler = \"$wholesaler\", > cost = $cost, > sale_price = $sale_price"; > > This statement fails if $short_desc contains a # sign. The string stops > at > the # sign, and all the subsequent fields are empty or garbage. > > None of the various resources I have looked at indicate that the # sign is > a > special character. Any suggestions?
# is used to start a comment in MySQL.
Show your actual code around this statement where you make your query. The only reason the data would be cut off is if MySQL is interpreting the # as the beginning of a comment. But, if that was the case, you'd have an invalid query, so it must be a combination of things.
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
I just need some documentation on how to get curl to send to and receive from a socket. Since there is no such information on www.php.net/curl.
Anyone, who can help me with that ?
Stefan
attached mail follows:
How do you retrieve a session cookie with curl? How do you trick a page to make it think that it was submit from within the domain? www.domainname.com/index.php -> www.domainname.com/logincheck.php (validates the from address)
Any help would be greatly appreciate.
attached mail follows:
I am following an example in a book and have run into a problem with a script that I am trying to run under PHP 4.3.0. What I have is a page that you click on an id number that is from a listing in a database, and it is supposed to take you to a page to edit that item. I have the id sent in the url (http://127.0.0.1/asset/editasset.php?id=3) and the book says to use $HTTP_GET_VARS to take that id and display the record for editing on a separate page. When I use $HTTP_GET_VARS nothing is returned, and I am thinking that I can't use $HTTP_GET_VARS in PHP 4.3.0, so what do I need to use?
Thanks, Mike
attached mail follows:
Show us your code
----- Original Message -----
From: "Mike Tuller" <php
ce.anoka.k12.mn.us>
To: "php mailing list" <php-general
lists.php.net>
Sent: Friday, January 17, 2003 4:05 PM
Subject: [PHP] $HTTP_GET_VARS
I am following an example in a book and have run into a problem with a script that I am trying to run under PHP 4.3.0. What I have is a page that you click on an id number that is from a listing in a database, and it is supposed to take you to a page to edit that item. I have the id sent in the url (http://127.0.0.1/asset/editasset.php?id=3) and the book says to use $HTTP_GET_VARS to take that id and display the record for editing on a separate page. When I use $HTTP_GET_VARS nothing is returned, and I am thinking that I can't use $HTTP_GET_VARS in PHP 4.3.0, so what do I need to use?
Thanks, Mike
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Nevermind. When copying my code to show you I noticed I have HTTP_GET_VARS, instead of $HTTP_GET_VARS, and now everything works.
Time to go home I guess.
On Friday, January 17, 2003, at 04:22 PM, Rick Emery wrote:
>
> Show us your code
> ----- Original Message -----
> From: "Mike Tuller" <php
ce.anoka.k12.mn.us>
> To: "php mailing list" <php-general
lists.php.net>
> Sent: Friday, January 17, 2003 4:05 PM
> Subject: [PHP] $HTTP_GET_VARS
>
>
> I am following an example in a book and have run into a problem with a
> script that I am trying to run under PHP 4.3.0. What I have is a page
> that you click on an id number that is from a listing in a database,
> and it is supposed to take you to a page to edit that item. I have the
> id sent in the url (http://127.0.0.1/asset/editasset.php?id=3) and the
> book says to use $HTTP_GET_VARS to take that id and display the record
> for editing on a separate page. When I use $HTTP_GET_VARS nothing is
> returned, and I am thinking that I can't use $HTTP_GET_VARS in PHP
> 4.3.0, so what do I need to use?
>
> Thanks,
> Mike
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
----- Original Message -----
From: "Mike Tuller" <php
ce.anoka.k12.mn.us>
To: "php mailing list" <php-general
lists.php.net>
Sent: Friday, January 17, 2003 5:05 PM
Subject: [PHP] $HTTP_GET_VARS
> I am following an example in a book and have run into a problem with a > script that I am trying to run under PHP 4.3.0. What I have is a page > that you click on an id number that is from a listing in a database, > and it is supposed to take you to a page to edit that item. I have the > id sent in the url (http://127.0.0.1/asset/editasset.php?id=3) and the > book says to use $HTTP_GET_VARS to take that id
Are you using $HTTP_GET_VARS['id']? If it's in a function, then php scopes $HTTP_GET_VARS as a local variable, and thus there's nothing in it. While that's different then most other programming languages, it's how it is in php. If you want to reference the global $HTTP_GET_VARS in a function, then you must 'global' it:
function foo() { global $HTTP_GET_VARS; echo "Id is {$HTTP_GET_VARS['id']}<br>\n"; }
Now the php developers added a new set of arrays to help with that in 4.1.2 (I think), so use $_GET['id'] which always references the builtin global $_GET array. It's better.
i.e. Learn the new way and not the old way ...
attached mail follows:
checkout the most recent version of the help documents from php.net. it will tell you.
something to do with $_GET, i think...
Jim
----- Original Message -----
From: "Mike Tuller" <php
ce.anoka.k12.mn.us>
To: "php mailing list" <php-general
lists.php.net>
Sent: Friday, January 17, 2003 2:05 PM
Subject: [PHP] $HTTP_GET_VARS
> I am following an example in a book and have run into a problem with a > script that I am trying to run under PHP 4.3.0. What I have is a page > that you click on an id number that is from a listing in a database, > and it is supposed to take you to a page to edit that item. I have the > id sent in the url (http://127.0.0.1/asset/editasset.php?id=3) and the > book says to use $HTTP_GET_VARS to take that id and display the record > for editing on a separate page. When I use $HTTP_GET_VARS nothing is > returned, and I am thinking that I can't use $HTTP_GET_VARS in PHP > 4.3.0, so what do I need to use? > > Thanks, > Mike > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
What da fuck. Been trying like forever to get a script to automaticly update the framespage from inside one of the frames. My goal is to reset all the frames to their original state
Can anybody help me!
attached mail follows:
> What da fuck. > Been trying like forever to get a script to automaticly update the > framespage from inside one of the frames. > My goal is to reset all the frames to their original state > > Can anybody help me!
Wash your mouth out with soap and go learn Javascript...
---John Holmes...
attached mail follows:
1. this has nothing to do with PHP
2. this has nothing to do with PHP
3. you could call a frameset html page with <a href="frameset.html" target="_top">
4. you could set individual frames to different sources from one link with javascript -- but you'd have to consult a JS list :P
Justin
on 18/01/03 9:30 AM, Kiswa (Kiswa
telia.com) wrote:
> What da fuck. > Been trying like forever to get a script to automaticly update the > framespage from inside one of the frames. > My goal is to reset all the frames to their original state > > Can anybody help me! > >
attached mail follows:
Hello friends.
Any idea which is the best way to send many sms messages from a web page? Any good gateways or service providers?
Thanks Denis
attached mail follows:
Hi everyone.
I'm trying to get my PUT method upload to work. I tried the using the script from the manual, but it creates an empty file. <?php /* PUT data comes in on the stdin stream */ $putdata = fopen("php://stdin","r");
/* Open a file for writting */ $fp = fopen("myputfile.ext","w");
/* Read the data 1kb at a time and write to the file */ while ($data = fread($putdata,1024)) fwrite($fp,$data);
/* Close the streams */ fclose($fp); fclose($putdata); ?>
then i tried to sniff on the bugs.php.net (http://bugs.php.net/bug.php?id\20298) site and i found this:
$in = fopen("php://input","rb"); $out = fopen($outfile,"wb"); while(!feof($in)) { fwrite($out, fread($in, $bufsize)); } fclose($in); fclose($out); but that doens't work too...the headers i get are correct: Accept: www/source, text/html, video/mpeg, image/jpeg, image/x-tiff, image/x-rgb, image/x-xbm, image/gif, */*, application/postscript Content-Length: 21504 Content-type: application/x-www-form-urlencodedHost: zenderx
the length of my file is ok.
My question is that... Is this new method of handling uploads already working? How can I handle this kind of upload?
Regards
-- Chris Jarecki Web Developer Prograf Net Partners http://www.pnp.pl/ICQ: 47650101
attached mail follows:
Hi all,
I'm trying to write a grid widget in php. When the user changes the value of a cell the totals must be recalculated at the client side. I can write a javascript when I use simple variables like A1, B1.
<td><input type=text name='A1' SIZE=5 MAXLENGTH=5 onChange="njrecalculate()"></td> <td><input type=text name='B1' SIZE=5 MAXLENGTH=5 onChange="njrecalculate()"></td>
This javascript will do the trick:
function njrecalculate() { document.forms[0].mytot.value = Math.round(document.forms[0].A1.value) + Math.round(document.forms[0].B1.value) ;
}
But now I want to create a dynamice grid by using the array variable e.g. mycell[]: <?php echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5 onChange='njrecalculate()' value=$mycel[0]></td></tr>"; echo "<tr><td><input type=text NAME='mycel[]' SIZE=5 MAXLENGTH=5 onChange='njrecalculate()' value=$mycel[1]></td></tr>"; echo "<tr><td><input type=text NAME='mytotals' SIZE=5 MAXLENGTH=5 onChange='njrecalculate()' value=$mytot></td></tr>"; ?>
Does anybody know how to access these mycell form fields on the client side using javascript.
Nico Jansen
attached mail follows:
Food for thought:
As I look through the Zend website, and applaud their efforts to create 'protected' php applications, I can't help but wonder about the impact (or lagality) or their efforts. Doesn't the use of the Zend Encoder (or any other PHP Encoders out there) violate the GPL License or the whole Open Source Concept?
As far as I understand it, the GPL License states that the source code of any product created from an open source solutions, or is derived from the work of an open solutions, must be made availabe to all users.
Since PHP itself is open source, then wouldn't that prohibit a developer from encoding any PHP product?
Please correct me, if I'm wrong. I'm just curious.
-john
=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.
attached mail follows:
At 04:45 PM 1/17/03 -0800, [-^-!-%- wrote:
>Since PHP itself is open source, then wouldn't that prohibit a developer >from encoding any PHP product? > >Please correct me, if I'm wrong. I'm just curious.
GPL isn't the only way to license open source. PHP is not GPL for just that reason. See the LICENSE file in your PHP source directory.
Rick
attached mail follows:
> As far as I understand it, the GPL License states that the source > code of any product created from an open source solutions, or is > derived from the work of an open solutions, must be made availabe > to all users.
no.
Any modifications made to the PHP source code must be made available to anyone who wants it.
It does not cover programs, applications, websites, created with the programming language. They are covered under their own license (of the authors choosing).
If you created an application, enocoded it, but had made modifications to existing PHP engine code, or even PHP scripting code from other sources, you would have to include unencoded versions of said scripts, and also provide the PHP source (or just your modifications, imported via patch or whatever) to anyone who wants it.
I'm not sure what the deal is with your own custom PHP extensions. I think once again, extensions are separate "programs", and up to the individual to specify the licensing terms.
There are thousands of programs written in C and compiled by GCC. GCC is GPL software. Do you go around saying "You compiled your commercial application with an Open Source tool, therefore you must release all source code to the community"? No. Same principle applies to PHP
attached mail follows:
Hi All,
Can anyone see a problem with this?
<?php $TrialID = $colname_earlytour + 1; if ($TrialID <= 5) { $NewID = $TrialID; $Page = test } else { $NewID = 1; $Page = newpage } ?>
<html> <head> <title>Aviation Hall of Fame</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <META HTTP-EQUIV="refresh" CONTENT="15; URL=<?php echo $Page;?>.php?ID=<?php echo NewID;?>">
Thanks, Edson Waite III http://www.airforcemuseum.com http://www.sportsvideooutlet.com
attached mail follows:
It runs when you fix your (removed URL's and line endings) what is it not doing?
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Edson Waite [mailto:ewaite
thewaitegroup.com]
> Sent: Saturday, 18 January 2003 11:09 AM
> To: php-general
lists.php.net
> Subject: [PHP] Meta Refresh Question (PHP)
>
>
> Hi All,
>
> Can anyone see a problem with this?
>
> <?php
> $TrialID = $colname_earlytour + 1;
> if ($TrialID <= 5)
> {
> $NewID = $TrialID;
> $Page = test
> }
> else
> {
> $NewID = 1;
> $Page = newpage
> }
> ?>
>
> <html>
> <head>
> <title>Aviation Hall of Fame</title>
> <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1"> <META HTTP-EQUIV="refresh" CONTENT="15;
> URL=<?php echo $Page;?>.php?ID=<?php echo NewID;?>">
>
> Thanks,
> Edson Waite III
> http://www.airforcemuseum.com
> http://www.sportsvideooutlet.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
> Can anyone see a problem with this?
Yes. > <?php > $TrialID = $colname_earlytour + 1; > if ($TrialID <= 5) > { > $NewID = $TrialID; > $Page = test
Here...
> } > else > { > $NewID = 1; > $Page = newpage
and here...
> } > ?> > > <html> > <head> > <title>Aviation Hall of Fame</title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > <META HTTP-EQUIV="refresh" CONTENT="15; URL=<?php echo > $Page;?>.php?ID=<?php > echo NewID;?>">
http://www.php.net/manual/en/language.types.string.php
---John W. Holmes...
PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/
attached mail follows:
Thanks Guys,
That took care of it. I was also missing "$" in the meta tag line before NewID.
Thanks again, Ed Waite
"Timothy Hitchens )" <hitcho
php.net> wrote in message
news:004b01c2be8e$f2d42ca0$0500a8c0
bambino...
> It runs when you fix your (removed URL's and line endings) what is it
> not doing?
>
>
>
> Timothy Hitchens (HiTCHO)
> Open Source Consulting
> e-mail: tim
hitcho.com.au
>
> > -----Original Message-----
> > From: Edson Waite [mailto:ewaite
thewaitegroup.com]
> > Sent: Saturday, 18 January 2003 11:09 AM
> > To: php-general
lists.php.net
> > Subject: [PHP] Meta Refresh Question (PHP)
> >
> >
> > Hi All,
> >
> > Can anyone see a problem with this?
> >
> > <?php
> > $TrialID = $colname_earlytour + 1;
> > if ($TrialID <= 5)
> > {
> > $NewID = $TrialID;
> > $Page = test
> > }
> > else
> > {
> > $NewID = 1;
> > $Page = newpage
> > }
> > ?>
> >
> > <html>
> > <head>
> > <title>Aviation Hall of Fame</title>
> > <meta http-equiv="Content-Type" content="text/html;
> > charset=iso-8859-1"> <META HTTP-EQUIV="refresh" CONTENT="15;
> > URL=<?php echo $Page;?>.php?ID=<?php echo NewID;?>">
> >
> > Thanks,
> > Edson Waite III
> > http://www.airforcemuseum.com
> > http://www.sportsvideooutlet.com
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
attached mail follows:
Hello,
I was just wondering if there were any PHP review sites that review free and paid scripts? If so, where?
Thanks, Stephen Craton http://www.melchior.us
"What's the point in appearance if your true love, doesn't care about it?" -- http://www.melchior.us
attached mail follows:
Please send plain text to e-mail lists NOT html:
Hmm now let me think:
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
-----Original Message-----
From: Stephen [mailto:webmaster
melchior.us]
Sent: Saturday, 18 January 2003 11:40 AM
To: PHP List
Subject: [PHP] PHP Review Site
Hello,
I was just wondering if there were any PHP review sites that review free and paid scripts? If so, where?
Thanks, Stephen Craton http://www.melchior.us
"What's the point in appearance if your true love, doesn't care about it?" -- http://www.melchior.us
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]