|
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 5 Aug 2005 18:50:57 -0000 Issue 3608
php-general-digest-help
lists.php.net
Date: Fri Aug 05 2005 - 13:50:57 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 5 Aug 2005 18:50:57 -0000 Issue 3608
Topics (messages 220046 through 220093):
Re: login check
220046 by: Jochem Maas
Re: overwrite private class members in php5?
220047 by: Norbert Wenzel
Re: Do I need to use --with-pic with configure?
220048 by: Denis Solovyov
Cannot pass data between forms when 'enctype' attribute is present
220049 by: MisterJingosSmile
Re: To count number of vists of one particular Website
220050 by: Dotan Cohen
220064 by: Dotan Cohen
diplaying code in pages and forums ??
220051 by: Gregory Machin
220053 by: Jochem Maas
220056 by: Gregory Machin
220061 by: Miles Thompson
220065 by: John Nichel
220066 by: Gregory Machin
220068 by: Jay Blanchard
220070 by: John Nichel
carriage return
220052 by: Diana Castillo
220054 by: Jochem Maas
220055 by: Frank de Bot
Exceptions: function x throws Exception
220057 by: Norbert Wenzel
220058 by: Torgny Bjers
220059 by: Norbert Wenzel
220063 by: Jochem Maas
To count number of visits to a particular wesite using login-id and password
220060 by: suma parakala
220062 by: Miles Thompson
PHP 4.0.6 documentation
220067 by: Sabine
220069 by: Paul Waring
Re: [NEWBIE GUIDE] For the benefit of new members
220071 by: Jay Blanchard
220078 by: Alan Milnes
Average time spent on a page
220072 by: virtualsoftware.gmail.com
Average time spent on page
220073 by: virtualsoftware.gmail.com
220074 by: virtualsoftware.gmail.com
220075 by: Jay Blanchard
220076 by: John Nichel
need help finding parsing error please
220077 by: Bruce Gilbert
220079 by: Matthew Weier O'Phinney
Re: Everything works...Unless they hit the "back" button...
220080 by: Jack Jackson
220088 by: Kristen G. Thorson
how to check http:// or https:// ?
220081 by: afan.afan.net
220082 by: Marco Tabini
220092 by: afan.afan.net
220093 by: Marco Tabini
Magic Quotes or Curley Quotes or Something
220083 by: Lance Earl
220085 by: Marco Tabini
String to Stream
220084 by: Eric Gorr
220086 by: Jay Blanchard
220087 by: Eric Gorr
220089 by: Jay Blanchard
220090 by: Eric Gorr
220091 by: Jay Blanchard
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:
sub
pudlz.com wrote:
>
> I think this is the way I need to write my if statement.
>
> if ( $min && $user[ "min" ] == $min && $user[ "pin" ] == $pin || $pin == 'allow')
try a couple paretheses to make your intension explicit. your if statement might
work the way you want it but I have no idea - and I'm way to lazy to go and look
up the operator precedence to work it out....
if ($min && $user[ "min" ] == $min && ($user[ "pin" ] == $pin || $pin == 'allow')) {
// you are okay to login
}
>
> $min login name entered by the customer at the form.
> $user[min] is the login name from my sql db that matches $min
> $user[pin] is the password from mysql db that matches $min
> $pin is the password that is entered by the user
>
> There's 4 checks
> 1) $min must have a value
> 2) $user[ "min" ] must equal $min
> 3) $user[ "pin" ] must equal $pin
> 4) $pin == 'allow'
check 4 seems a little absurd - anyone who knows it will be able to login
as anyone on your app. also checking whether $user['min'] is equal to $min
_seems_ pointless because I assume that you had to extract the data from the
database somehow - usually this means using the login (i.e. $min) entered by
the user to do the look up.
lots of good reading here on security: http://www.phpsec.org/
>
> I want it so that both 1 and 2 must be true and either 3 or 4 must be true. Will this if statement work?
>
>
> Andrew Darrow
> Kronos1 Productions
> www.pudlz.com
>
>
attached mail follows:
Matthew Weier O'Phinney wrote:
> * Norbert Wenzel <mail
brain4art.at>:
>
>>Hi, I've done something like this:
>>
>>class MyClass {
>>
>> private $var;
>>
>> function __construct($value) {
>> $this->var = $value;
>> }
>>
>> public function printVar() {
>> echo($this->var);
>> }
>>
>>}
>>
>>$object = new MyClass('1');
>>$object->printVar(); // prints 1
>>$object->var = 3; // Fatal Error as expected
>>$object->$var = 2; // no error msg
>
>
> $var is empty, so this is setting a non-existent class property to 2.
>
>
>>$object->printVar(); // prints 2
>
>
> I got 1 when running this -- just as I would expect. Are you sure it
> printed 2?
>
> Basically, if a property is undeclared, it is assumed public, so you can
> set undefined properties without issue. If defined private or protected,
> the calling script will not be able to alter the value.
>
i did write the script out of my mind, and didn't paste it. not the best
idea, i know.
thanks for your help, i see my mistakes very clearly. forgive a noob for
such question.
thanks,
norbert
attached mail follows:
>> I have a question I can't answer by myself. :)
>> Do I need to use "--with-pic" option when configuring php 4?
>> I'm going to build it as an Apache 1.3 DSO module and going to
>> run multiple instances of Apache (under different users). I
>> use Linux (kernel 2.4.30).
>> Generally, when one may need to use "--with-pic"?
RL> --with-pic is the default, so you don't need to add it.
When I at first confugured without "--with-pic" and then immediately
with "--with-pic" I got two different libphp4.so by filesize. If you say
there is no difference, what is nevertheless the difference?
The question apperead since I heard somewhere that "--with-pic" is
important when one is going to use PHP module with multiple Apache
instances...
RL> -Rasmus
Denis Solovyov
attached mail follows:
Hi and thanx for taking the time to read . . .
The issue I'm experiencing appears to be that I cannot pass data (values)
between forms when
the enctype="multipart/form-data" attribute is present in the form.
Commenting it out allows data
to pass but prevents uploading of files through the form.
As I am no expert at what I am doing (Apache/PHP/MySQL) I would really
appreciate any
pointers you would care to give.
I've been googling around and found an old post from someone who appears to
have the same
issue. It is here:
http://archives.neohapsis.com/archi...03-q4/0771.html
I have also made another post describing my issue in more detail here:
http://www.justlinux.com/forum/showthread.php?t=141885
Cheers.
begin 666 edit.gif
M1TE&.#EA1
`6`/?_`'B8T'J5Q/___RHS>(*.H9.=L^GI[;2VN9&KV:*KNW2+
MLV=\H+W RG:#H:FSR%QLB>3F\
T:DKR^PEQQE4QAA861JIFFO6EUA%EDRX*=
MRXVLX6R"IJRMLXNIW6E]H>3EZV1YG?CX^CU2=765S)JAK<[1VTE9F+S VM_A
MY3I.<.GJ]8R:LPH4:&!UF8F5JX.
TGF.LD5:?C1);2LXLIVZZYZJPEYYJ'F6
MR>'BYW&&JB<SCI2BO(:=Q\/$S':+KWV*HW6.NG22Q<G)T<7)S'.2RG%VDH6C
MV%EMD9>RY(FDT\S/U(*)EM7:Y(B0F<W0UMS=X:.GK$%6>GJ2NX:1I=C9WGN%
MFB8US]'3V4E>
A<IT'J1N6EZF1
FK'R1ME]TF&^$J+"XRE)A>U5NEU1D
AHO
M]ZNQNM'2UO;V]V6"LVN&MH">TN?I],'!QE%EBE5ICIVDL'R:S3A#B+>ZO\O-
MVALD;PD3>?'R](B1HI:DO7. G\C*U65_JM+6WNWN^(J8L/?X^5IJG&-TE)"N
MXM35W&1XF4==A*&HM6Z%OOS\_/3U]\G,S^WM[YBSY7N2N*"EM8BFVG>4QLK-
MTKF]R5EH
Q0>>/#Q\H:
S?KZ^X26M'B&HVV,PW&(L7&/PEAG
I69H_/S_1 ?
MKQ(;:6:$N&6 K5]VG5IBCU9HA6R$KF]]EFZ#IVZ!HP8/6EEQFF9XE_'Q^^?H
MZ8^6GW^7P'V4NG61OWZ)FT-6=P4/9FN I/3T_F-XG.OL]\[2X)2BNW2(JYRH
MP,W.TDI1
UITGF9LF*NMNK_'UX",I]?8WI.?MB8X\Z"][V%^L'^8PTU<HTQ<
MBK.VP)B
K'6!CDA9>D5,>TU:;
X=P(V<N+? SW=_BLS,U&=^J,S+TNGI\G>,
ML.SL]M[
ZZ2NP$)0BEUPD$5?B^_P^DA0B%9FF5UCEEUEFVATD'J4P)2PWWN3
MO!4A
C-"N6I_H]'2W-74VI*ANY&AO4QAE(R7K_/T]?3S]E-EN%Y[KW*'JT-/
MA8^5J9"9K6B"KEAQG?7U_R'Y! $``/\`+ ````!&`!8`0 C_`/\)A'# C!E%
M0X:PD2!!SH$#<B2\<R6P(JZ*&#-JW,BQHT!<I$:A"5;F$KPKVG[U$,(&T:LX
M=>KDFC7KB*TZ
-+I#, SG99J?ORL6"$OG25+23(X8&)M*3$>4!&H8X1$'8*D
M`8"D&64CV#QK:\+E`K' %)5$<]Z5F#/H%XI$`N(*T(=L
0X3J;[HU9O*706Y
M<CM)BEO/B0`G;P24,%5&;H()7B9,.'+$31L*,:+(X%>Q#Q1$BYY\,&# $0L6
MMLBA$ "K0(W7-7S)]F6AMFT+>'#CV<T;SX[?O(#_'M[;
J]O8.;HJOAXP08/
M%Q(-6'4Z%)T!`^(`*V4N`B
N)L(#_^K5I7QY;G\!\R$0E\"#QDH2.PD3EU:K
M'##,=X'!S4>J!4?$,(9 NVS11BW7`/:*!+!<,$T**8A02PQ88&$"!1AFJ&&%
M'')82 P
A
AB%"26:"*)(J28`BJ?8 0!% (<P $'GM AC"1G`,;!-AE=Y-&/
M0/[(!#ZBB/%$""SU8,Q*P]!1!PL#/),&''"H8:4:1ACQR)8==*G!EV *(H
&
M8I8IYI==;OF($2^H`<<(07"BR2&BX'/,/\20DLTI(#1Q6 \K&?.$,?;$58D.
M[/3R102;K)/=.NM(`:D"+L3U!
%3K)##%WY\DX <AZ$RQ0]5Q&6('YBL$\NJ
MD0*AP"G9L/]2""I
3 ""!QY,
H
!>NPS0!T1!!LL*(?
, DHS/B
[+++?C%%
M?8%L$8
AAX73"K5*D' 8?0(0H$H.X&Z:RBT>
.#%$12(\, _%K202RZF< #8
MO("5D<4]$U!3C
?NN'/+!
!OD,K >?%%[K_N>+ `""U$9EF&6(P8A8H01M.B
M0!_(:\<E?W1,KP!R=--CD"27G%$W\K(QXQ!%V&++`%5<$A<'WO1ALRZZJ*#S
MSBJLT?,:0$,0- 1$%VWTT44#K0M%&UF3C1N5R'4)(F=(0LEI=#SA0AH`=.WU
MUV!W/0(`(Y1MMME$I$W$"&JWW;:<:6!2405HH,'*$$AJ(P$V;.#_
(TSO]91
MRAY!0 ()$$#<0&65:KS
> 89O)!$$AT(H
X2C#!R%0*<JT-#,LG0(#H-C CR
MR LW<)*&*,K8(,8XW
0SRBFD/(,(-F9<X8005S"
P"+P-2,J[;,`T
$^>BD
M/! KT+M)+%(`\<4W`EQA`1_6>!!7/+'P<)0E&2R3#A";]&.#/^*XX( 7V?P'
MS1]Z&(/"!XO4$T((!D3]Q"K741('.*$8
!0:T85&-((;E1+ I:90
2TP8%Y.
MH-85K
`8,,! %A
T( P4D ,/3* 0#_C&!!9 K
<(`!O2L,5I5KC"",R "^V
M
0QG2,->/$N!4W#!#ZCEA%:H(
$"R)9B_SH1ERGT
H;]Z44^4N$!+[
A"F,H
MP1%RL8!<+<(>:=$#"<XQ
QE8`0,GB$LGL
`*$_0B!_E(HQI5P1X!.,,1AD
`
M*BQ%"R4((!+/V%9<2&"*3%1182#(Q;G<
)D5_6,+8P&!*8;PAT'
8!$A^)
`
MT$&&6VPA`EZXA28WZ0Y"A.,!H'Q .
1"%2XYY/A0.6YT%&%*CS #9:Y# 4J
ME!D1R$ /_U!!.!HV!EA(4
!V4$2#.M$&,I#!"HE<
#*7"<A OJL%#8O,9& I
MRXAE9F(IHI
,MEF C$" `9[X!12:L(0EW&$?_"A `8[!3G6N
![P=($\*T#/
D"A3CGOC\P0\RP1?/!OC3GWD(J$ 'F
=_9J(8]$C +CX2$ `[
`
end
attached mail follows:
On 8/5/05, Tom Chubb <tomchubb
gmail.com> wrote:
> On 04/08/05, Dotan Cohen <dotancohen
gmail.com> wrote:
> > On 8/4/05, suma parakala <sumaparkala
hotmail.com> wrote:
> > > Hi
> > > Can anyone tell me how can I count how many times my website has been viewed
> > > using php
> > > Thanks
> > > Suma
> >
> > Suma,
> > I am working on that now. I will soon have a script ready under GPL.
> > There are two versions, one with mysql and one with flat files. Do you
> > have mysql?
> >
> > Dotan Cohen
> Dotan,
> I'd be interested in seeing that.
> Please can you post a message here when it's ready?
> Thanks,
> Tom
>
> Tom Chubb
> tom
ps-promo.co.uk
> 07915 053312
>
Sure. If you have any features that you'd like to request, now's the
time! What stats, in particular, are you interested in? Do you have
mysql? What stats programs are you currently using, and how often do
you check them?
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/327/martin_ricky.php
Martin, Ricky Song Lyrics
attached mail follows:
On 8/5/05, Tom Chubb <tomchubb
gmail.com> wrote:
> I have AWstats on one of my servers which comes with cPanel, but my
> main site uses another system for which I can only see upto the end of
> the previous day.
> I send out a lot of emails to my subscriber database and sometimes I
> charge people to use my list. I like to be able to see how many times
> a certain image within the newsletter has been hit so I can tell how
> many emails have been opened.
> I'm writing a link tracker script at the moment for it, but I'd like
> to be able to let the public view the stats on my site.
> Hope that's enough info for you.
>
> I am using MySQL, but can't remember what version?!?!
>
With this you shouldn't have any limit on how far back you can check,
unless I run into the limits of mysql. We'll see. Certainly more than
a day though, unless you are Google's webmaster!
As fot the image, that won't be a problem, but you will need to pass
the image through a script. That is no problem at all, I intend to
include instructions on how to do so as part of the documentation. Or,
you will need to parse your apache logs (or whatever server you are
on).
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/100/c_melanie.php
C, Melanie Song Lyrics
attached mail follows:
HI
Please advise.
I'm using exponent cms and I creating a technical site,
I want to display code examples , how do I do this and with syntax highlighting,
--
Gregory Machin
greg
linuxpro.co.za
gregory.machin
gmail.com
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096
attached mail follows:
Gregory Machin wrote:
> HI
>
> Please advise.
> I'm using exponent cms and I creating a technical site,
this is not the 'exponent cms' (whatever that is) user group.
> I want to display code examples , how do I do this and with syntax highlighting,
shouldn't we be writing the necessary code for you? for nothing?
did you f***ing google for 'syntax highlighting php' or something similar?
and/or do you bother to read any of the posts made by other people of this list?
let me answer those last 2 questions for you - no you bloody well didn't - this topic
was covered not more than 3 days ago on the list - PHP has at least 2 functions made for the
very purpose (try using the like textbox at the top right hand corner of EVERY page on
www.php.net to find them) AND, now get this, php.net has a show source function (also on
every page) which allows you to see how they do stuff - the really 'crazy' thing is
you can even viwe the source of the script that is used to view the source .. right
there in your goddam browser.
with regard to displaying code - you'ree not the first to do - plenty of code out there,
in fact it took me 2 seconds to find a WordPress plugin that does exactly that -- you might
need to hack that code to make it work in your cms but heh, that's what its all about.
my 2 year old son say 'I want' less than a lot of people on this list, make an effort.
PS - any one guess I just started having a bad day?
attached mail follows:
For anyone who would like a clear answer to the question i politely
asked, here is a good artical ..
http://www.sitepoint.com/article/highlight-source-code-php
Gregory Machin
greg
linuxpro.co.za
gregory.machin
gmail.com
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096
attached mail follows:
Well, it took about 5 min - checking the PHP site for "display" and then
for "source".
That lead to the display_source() function, an alias for highlight_file(),
which itself had a link for highlight_string(). These functions display PHP
source with syntax highlighting.
It is a fine manual; please Read The Fine Manual.
Side note: Use of other's code, such as Exponent CMS, does not absolve one
of the responsibility to understand the language, nor of the need to
wrestle with these things on one's own. Did you know there was a whole
thread within the last week on this v. issue?
Regards - Miles Thompson
At 06:49 AM 8/5/2005, Gregory Machin wrote:
>HI
>
>Please advise.
>I'm using exponent cms and I creating a technical site,
>I want to display code examples , how do I do this and with syntax
>highlighting,
>--
>Gregory Machin
>greg
linuxpro.co.za
>gregory.machin
gmail.com
>www.linuxpro.co.za
>Web Hosting Solutions
>Scalable Linux Solutions
>www.iberry.info (support and admin)
>www.goeducation (support and admin)
>+27 72 524 8096
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Gregory Machin wrote:
> For anyone who would like a clear answer to the question i politely
> asked, here is a good artical ..
A husband will more than likely be pissed at me if I ask him to have his
wife sleep with me...no matter how polite I ask.
Politely asked or not, your question demonstrated that you broke one of
the major 'rules' of a mailing list such as this...RTMF/STFW/STFA.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
Let the flaw wares begin ..
sorry guys who have limited bandwith and limited email boxes ..
Bla Bla BLA..
On 8/5/05, John Nichel <john
kegworks.com> wrote:
> Gregory Machin wrote:
> > For anyone who would like a clear answer to the question i politely
> > asked, here is a good artical ..
>
> A husband will more than likely be pissed at me if I ask him to have his
> wife sleep with me...no matter how polite I ask.
>
> Politely asked or not, your question demonstrated that you broke one of
> the major 'rules' of a mailing list such as this...RTMF/STFW/STFA.
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> john
kegworks.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Gregory Machin
greg
linuxpro.co.za
gregory.machin
gmail.com
www.linuxpro.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)
www.goeducation (support and admin)
+27 72 524 8096
attached mail follows:
[snip]
Let the flaw wares begin ..
sorry guys who have limited bandwith and limited email boxes ..
Bla Bla BLA..
[/snip]
There will be no flame war over this. You got called out. You got owned.
I am supposing that you are familiar with /dev/null ? You found the
answer on your own didn't you? Good job.
attached mail follows:
Gregory Machin wrote:
> Let the flaw wares begin ..
Flame war for what?
> sorry guys who have limited bandwith and limited email boxes ..
>
> Bla Bla BLA..
Now you're just breaking netiquette 'rules'.
You made a mistake, got called out for it. The only person who will
lose here is you. The more you continue to whine about it, more and
more members of this list will *PLONK* you. Then, the next time you
need help with something, nobody will be listening.
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
How can I with php detect when there is a carriage return at the end of the
text field in a mysql table?
--
Diana Castillo
Destinia.com
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 Ext 216
Fax : 00-34-915228673
email: diana
hotelkey.com
Web : http://www.hotelkey.com
http://www.destinia.com
attached mail follows:
Diana Castillo wrote:
> How can I with php detect when there is a carriage return at the end of the
> text field in a mysql table?
get the data out of the DB first. stick it in $myString
$myString = "wtf I fond a carriage return - horsedrawn even.\n";
if (preg_match("#[\n|\r|\r\n]$#", $myString)) {
echo "wtf I fond a carriage return - horsedrawn even.";
}
tip: using trim() on $myString will strip a trailing CR.
tip: want to allow blank spaces after the CR, use this regexp instead.
"#[\n|\r|\r\n][ ]*$#" e.g:
$myString = "wtf I fond a carriage return - horsedrawn even.\r\n ";
if (preg_match("#[\n|\r|\r\n][ ]*$#", $myString)) {
echo "wtf I fond a carriage return - horsedrawn even.";
}
now can I have your roomkey? :-P
also if you want to know what \n and \r and \r\n are about then you might
start by searching for posts by Marco Tabini 3 days back on this list
>
>
attached mail follows:
Diana Castillo wrote:
>How can I with php detect when there is a carriage return at the end of the
>text field in a mysql table?
>
>
>
Something like this perhaps:
$res = mysql_query($query);
$row = mysql_fetch_object($row)
if (preg_match("/\r$/",$row->textfield) {
echo "Got CR";
} else {
echo "No CR at end";
}
Just an example to help you on the way.
attached mail follows:
If there is a class with a function, that might throw exceptions and
does NOT catch them, may I write that like in Java?
class FooClass {
public function foo() throws Exception {
}
}
Or is there another possibility to tell a function throws an exception
and to force the caller to handle that exception?
thanks in advance,
Norbert
attached mail follows:
Norbert Wenzel wrote:
> If there is a class with a function, that might throw exceptions and
> does NOT catch them, may I write that like in Java?
>
> class FooClass {
>
> public function foo() throws Exception {
>
> }
>
> }
>
> Or is there another possibility to tell a function throws an exception
> and to force the caller to handle that exception?
>
> thanks in advance,
>
> Norbert
>
Hello Norbert,
The Java way doesn't work here. The best approach would be to simply run
a try/catch/finally around the call to your function/method, and inside
the function itself you do the following:
if (...) { throw new Exception("My message."); } }
Regards,
Torgny
attached mail follows:
Torgny Bjers wrote:
> The Java way doesn't work here. The best approach would be to simply run
> a try/catch/finally around the call to your function/method, and inside
> the function itself you do the following:
>
> if (...) { throw new Exception("My message."); } }
Hello Torgny,
Thanky you for your fast help.
Greetings,
Norbert
attached mail follows:
Dear Internals,
class FooBar { public function foo() throws Exception {} }
function fooFoo() throws Exception {}
this came up on php-generals and I wondered if anyone had time/cared
to comment if it (as it does to me) seems like a good idea and/or whether it is
technically feasable. My thinking was that one could then use the reflection API
to determine whether functions/methods are capable of throwing exceptions and or
what kind - might be quite handy when using third party apps/classes
(PEAR springs to mind.)
thanks and regards,
Jochem
<the rest is blabla aimed at php-generals>
Torgny Bjers wrote:
> Norbert Wenzel wrote:
>
>>If there is a class with a function, that might throw exceptions and
>>does NOT catch them, may I write that like in Java?
>>
>>class FooClass {
>>
>> public function foo() throws Exception {
think about this, especially in terms of the Reflection API, it sounds
like a really good idea (at least to me)
>>
>> }
>>
>>}
>>
>>Or is there another possibility to tell a function throws an exception
>>and to force the caller to handle that exception?
>>
>>thanks in advance,
>>
>>Norbert
>>
>
>
> Hello Norbert,
>
> The Java way doesn't work here. The best approach would be to simply run
> a try/catch/finally around the call to your function/method, and inside
> the function itself you do the following:
>
> if (...) { throw new Exception("My message."); } }
>
indeed - bottom line is you have to know that a function/method/extension may
throw. mostly you do know because:
1. you wrote the code,
2. or it's documented in the extension manual pages
3. and/ro you hit an unacaught exception whilst developing.
my approach to cover any oversights is to wrap every thing in a main try/catch block
just in case - keeping in mind that the idea is that this 'main' catch block is never run
is al goes well.
> Regards,
> Torgny
>
attached mail follows:
Hi
I am new web application development. Can anyone tell me how can I trace how
many times mywebsite has been viewed by one particular login and password
using postgresql database and php
Thanks
Suma
_________________________________________________________________
Post FREE Classifieds.
http://www.sulekha.com/classifieds/cllist.aspx?nma=IN&ref=msn Reach out to
over a million NRIs.
attached mail follows:
At 08:41 AM 8/5/2005, suma parakala wrote:
>Hi
>I am new web application development. Can anyone tell me how can I trace
>how many times mywebsite has been viewed by one particular login and
>password using postgresql database and php
>Thanks
>Suma
Since you are presumably authenticating against a user table in the
database, add a login_count field and increment it when the user logs in.
That will track all your users. Then execute a query to fetch the data for
a particular user. Hint SELECT COUNT() ...
If you want a profile of activity, add a separate table with timestamp, and
user_id fields, the user_id having user.user_id as its foreign key. For
each login, insert a record in this table, and as it's PostgreSQL you can
set a trigger to automatically write the timestamp. Now you can track your
usage profile by users, time of day, user and time of day .... fun isn't it?
Regards - Miles Thompson
attached mail follows:
Hello to all,
may anybody give me a tip where to find a documentation for 4.0.6?
Perhaps I'm a little bit blind, but I don't find it.
Unfortunatedly I have to develop an application on this release.
Thanks for your help
Sabine
attached mail follows:
On Fri, Aug 05, 2005 at 03:53:41PM +0200, Sabine wrote:
> may anybody give me a tip where to find a documentation for 4.0.6?
> Perhaps I'm a little bit blind, but I don't find it.
> Unfortunatedly I have to develop an application on this release.
Does the documentation at php.net not suffice? It usually says when
particular functions were introduced/changed, e.g.:
http://www.php.net/pg_escape_string
pg_escape_string
(PHP 4 >= 4.2.0, PHP 5)
Paul
--
Rogue Tory
http://www.roguetory.org.uk
attached mail follows:
=========================================================
Please feel free to add more points and send to the list.
20050322jb - Note the new location of PHP Editors list.
=========================================================
1. If you have any queries/problems about PHP try
http://www.php.net/manual/en first. You can download a copy and use it
offline also.
Please also try http://www.php.net/manual/faq.php for answers to
frequently answered questions
about PHP (added by Christophe Chisogne).
2. Try http://www.google.com next. Searching for "php YOUR QUERY" may
fetch you relevant
information within the first 10 results.
3. There is a searchable archive of the mailing list discussion at
http://phparch.com/mailinglists. Many of the common topics are discussed
repeatedly, and you may get answer to your query from the
earlier discussions.
For example: One of the repeatedly discussed question in the list is
"Best PHP editor". Everyone has his/her favourite editor. You can get
all the opinions by going through the list archives. If you want a
chosen list try this link :
http://www.thelinuxconsultancy.co.uk/phpeditors.php
(contributed by Christophe Chisogne).
4. Not sure if PHP is working or you want find out what extensions are
available to
you?
Just put the following code into a file with a .php extension and access
it through your
webserver:
<?php
phpinfo();
?>
If PHP is installed you will see a page with a lot of information on it.
If PHP is not installed (or not working correctly) your browser will try
to download the file.
(contributed by Teren and reworded by Chris W Parker)
5. If you are stuck with a script and do not understand what is wrong,
instead of posting
the whole script, try doing some research yourself. One useful trick is
to print the variable/sql query using print or echo command and check
whether you get what you expected.
After diagnosing the problem, send the details of your efforts
(following steps 1, 2 & 3) and ask for help.
6. PHP is a server side scripting language. Whatever processing PHP does
takes place BEFORE the output reaches the client. Therefore, it is not
possible to access users' computer related information (OS, screen size
etc) using PHP. Nor can you modify any the user side settings. You need
to go for JavaScript and ask the question in a JavaScript list.
On the other hand, you can access the information that is SENT by the
user's browser when a client requests a page from your server. You can
find details about browser, OS etc as reported by
this request.
(contributed by Wouter van Vliet and reworded by Chris W Parker.)
7. Provide a clear descriptive subject line. Avoid general subjects like
"Help!!", "A Question" etc. Especially avoid blank subjects.
8. When you want to start a new topic, open a new mail composer and
enter the mailing list address php-general
lists.php.net instead of
replying to an existing thread and replacing the subject and body with
your message.
9. It's always a good idea to post back to the list once you've solved
your problem. People usually add [SOLVED] to the subject line of their
email when posting solutions. By posting your solution you're helping
the next person with the same question.
[contribued by Chris W Parker]
10. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)
11. Do not send your email to the list with attachments. If you don't
have a place to upload your code, try the many pastebin websites (such
as www.pastebin.com).
(contributed by Burhan Khalid)
Following these guidelines will ensure that you get effective responses
from the list members. Otherwise, your questions might not be answered.
===============================================
Hope you have a good time programming with PHP.
===============================================
attached mail follows:
Jay Blanchard wrote:
>6. PHP is a server side scripting language. Whatever processing PHP does
>takes place BEFORE the output reaches the client. Therefore, it is not
>possible to access users' computer related information (OS, screen size
>etc) using PHP. Nor can you modify any the user side settings. You need
>to go for JavaScript and ask the question in a JavaScript list.
>
>On the other hand, you can access the information that is SENT by the
>user's browser when a client requests a page from your server. You can
>find details about browser, OS etc as reported by
>this request.
>(contributed by Wouter van Vliet and reworded by Chris W Parker.)
>
>
>
You might want to add to this:-
"To see what information PHP can provide look in the manual for $_SERVER."
That way you give people a pointer along the way ....
Alan
attached mail follows:
Hi,
How can i found out the average time users spent on a page. Anyone know a tutorial?
Thanks in advance for your help !!!
attached mail follows:
Hi,
How can i found out the average time users spent on a page. Anyone know a tutorial?
Thanks in advance for your help !!!
attached mail follows:
Hi,
How can i found out the average time users spent on a page. Anyone
know a tutorial?
Thanks in advance for your help !!!
attached mail follows:
[snip]
How can i found out the average time users spent on a page. Anyone
know a tutorial?
[/snip]
How much time spent creating a page?
How much time spent viewing a page?
How much time the page was left open on the desktop?
http://www.google.com/search?hl=en&q=average+time+spent+on+web+page has
a list of thousands, which is nearly how many times you sent the same
e-mail to the list in 3 minutes.
attached mail follows:
Jay Blanchard wrote:
> [snip]
> How can i found out the average time users spent on a page. Anyone
> know a tutorial?
> [/snip]
>
> How much time spent creating a page?
> How much time spent viewing a page?
> How much time the page was left open on the desktop?
>
> http://www.google.com/search?hl=en&q=average+time+spent+on+web+page has
> a list of thousands, which is nearly how many times you sent the same
> e-mail to the list in 3 minutes.
>
*slaps forehead*
Well lookie there...that Google thing *IS* your friend. ;)
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john
kegworks.com
attached mail follows:
Hello,
I am getting this on the following code, and I am not sure what is
causing the error and need some pros to take a look at it for me.
the error is:
Parse error: parse error, unexpected '{' in
/hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on
line 161
here is the ENTIRE page code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"
lang="en-US" dir="ltr">
<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
<title>Inspired Evolution :: Contact</title>
<meta http-equiv="pragma" content="no-cache" />
<meta name="revisit-after" content="7" />
<meta name="keywords" content="web design, communications, graphic
design, North Carolina, Morrisville, Cary, Raleigh, Durham, creative,
freelance, business, small business, creative services, web
development, XHTML. CSS, accessibility, web standards, SEO, search
engine optimization" />
<meta name="description" content="freelance web site design and
development company specializing in creating unique, interesting,
cross-browser friendly websites that conform to web standards,
usability and accessibility and are SEO (search engine optimization)
ready." />
<meta name="author" content="Bruce Gilbert" />
<meta name="robots" content="ALL" />
<meta name="classification" content="web site development" />
<meta name="copyright" content="2005 - Inspired-Evolution " />
<link rel="stylesheet" href="Gilbert.css" type="text/css"
media="screen, handheld" />
</head>
<body>
<!-- begin outer wrapper div -->
<div id="wrapper_outer"> <a class="skiplink" href="#startcontent">Skip
over navigation</a>
<!-- begin header div -->
<div id="header">
<?php require('images/Rotating_Banner/rotating_banner.php'); ?>
</div>
<!-- top nav list -->
<div id="navcontainer">
<ul id="navlist">
<li ><a href="About_Me.php" title="you know you want to learn
more about me">About
Me</a></li>
<li><a href="Skillset.php" title="I've got skillz">Skill set</a></li>
<li><a href="Hireme.php" title="I can do wonders for your web
presence">Hire
Me</a></li>
<li><a href="Portfolio.php" title="web sites, graphics,
newsletters">Portfolio</a></li>
<li><a href="Contact.php" title="how to get in touch with
me">Contact</a></li>
<li><a href="Resume.php" title="my beautiful
resume">Résumé</a></li>
<li><a href="Blog.php" title="My musings on everyday life" >Blog</a></li>
<li><a href="RSS.php" title="Syndication that is really simple"
>RSS</a></li>
</ul>
</div>
<!-- inner content wrapper div -->
<div id="wrapper_inner">
<!-- breadcrumbs div -->
<div id="breadcrumbs"><a href="index.php" title="home link"
accesskey="1">Home</a>
> > Contact</div>
<!-- text div -->
<div id="main_content"> <a name="startcontent" id="startcontent"></a>
<h1 title="Contact">Contact</h1>
<?php
$form_block=<<<END_FORM
<form method="POST" action="{$_SERVER['PHP_SELF']}" class="info_request">
<fieldset>
<legend title="additional information request">Additional Information
Request</legend>
<table>
<tr>
<td>
<label for="firstname"><span class="red">*</span> First Name: </label></td>
<td>
<input id="firstname" name="firstname" type="text"
value="{$_POST['firstname']}" />
</td>
</tr>
<tr>
<td>
<label for="lastname"><span class="red">*</span> Last Name:</label></td>
<td>
<input id="lastname" name="lastname" type="text" value="{$_POST['lastname']}" />
</td>
</tr>
<tr>
<td>
<label for="company"><span class="red">*</span> Company: </label></td>
<td>
<input id="company" name="company" type="text"
value="{$_POST['company']}" /></td>
</tr>
<tr>
<td>
<label for="phone"><span class="red">*</span> Phone: </label></td>
<td>
<input id="phone" name="phone" type="text" value="{$_POST['phone']}" /></td>
</tr>
<tr>
<td>
<label for="email"><span class="red">*</span> e-mail: </label></td>
<td>
<input id="email" name="email" type="text" value="{$_POST['email']}" /></td>
</tr>
<tr>
<td>
<label for="email2"><span class="red">*</span> re-enter e-mail: </label></td>
<td>
<input id="email2" name="email2" type="text" value="{$_POST['email2']}" />
</td>
</tr>
<tr>
<td>
<label for="URL"> URL:</label></td>
<td>
<input id="URL" type="text" name="URL" /> </td>
</tr>
<tr>
<td>
<label for="Contact_Preference"> Best way to reach:</label></td>
<td>
<input id="Contact_Preference" name="Contact_Preference" type="text"
value="{$_POST['Contact_Preference']}" /></td>
</tr>
<tr>
<td>
<label for="Contact_Time"> Best time to contact:</label></td>
<td>
<input id="Contact_Time" name="Contact_Time" type="text"
value="{$_POST['Contact_Time']}" />
</td>
</tr>
<tr>
<td>
<input type="hidden" name="op" value="ds" />
</td>
</tr>
<tr>
<td>
<textarea name="message" rows="25" cols="50">Send me a detailed
message specifying what you wish to accomplish with your web
site.</textarea>
<input class="submit" src="/images/submit.gif" alt="Submit"
type="image" name="submit" />
</td>
</tr>
</table>
</fieldset>
</form>
<p><span class="red">*</span> indicates a required field.</p>
END_FORM;
if ($_POST['op']!='ds') {
// they need to see the form
echo "$form_block";
} else if ($_POST["op"] == "ds") {
//Function saves time and space by eliminating unneccesary code
function check($fieldname)
{
global $err_msg;
if($_POST[$fieldname] == "")
{
if ( !isset($err_msg)) { $err_msg = "<span class='red'>Please
re-enter your ".$fieldname."</span>"; }
elseif ( isset($err_msg)) { $err_msg .="\n<span class='red'>Please
re-enter your ".$fieldname."</span>"; }
}
return $err_msg;
}
//////////////////////////
///Function execution/////
//////////////////////////
check('firstname');
check('lastname');
check('company');
check('phone');
check('email');
check('email2');
check('URL');
check('Contact_Preference');
check('Contact_Time');
check('message');
//Validating Email Address
if ($_POST['email'] != $_POST['email2']) { $email_err = "\n<span
class='red'>Email address fields do not match</span>"; }
if (isset($err_msg) || isset($email_err) { echo
$err_msg.$email_err."\n\n".$form_block; }
else {
//it's ok to send, so build the mail
$msg = "E-mail sent from www site\n";
$msg .="Sender's first name: {$_POST['firstname']}\n";
$msg .="Sender's last name: {$_POST['lastname']}\n";
$msg .="Company name: {$_POST['company']}\n";
$msg .="Senders Phone number: {$_POST['phone']}\n";
$msg .="Senders email address: {$_POST['email']}\n";
$msg .="Senders email address (re-typed): {$_POST['email2']}\n";
$msg .="URL : {$_POST['URL']}\n";
$msg .="Contact_Preference: {$_POST['Contact_Preference']}\n";
$msg .="Contact_Time {$_POST['Contact_Time']}\n";
$msg .="Message: {$_POST['message']}\n\n";
$to ="webguync
gmail.com";
$subject ="There has been a disturbance in the force";
$mailheaders ="From: Inspired-Evolution.com
<http://www.inspired-evolution.com>\n";
$mailheaders .="Reply-To: {$_POST['email']}\n";
//send the mail
mail ($to, $subject, $msg, $mailheaders);
//display information to user
echo "<p>Hola, <strong>$firstname</strong>!.<br /><br />
We have received your request for additional information, and will
respond shortly.<br />
Thanks for visiting inspired-evolution.com and have a wonderful day!<br /><br />
Regards,<br /><br />
<strong>Inspired Evolution</strong></p>";
}
?>
<p></p>
<p></p>
<?php require('includes/bottom_links.inc'); ?>
</div>
<!-- begin footer -->
<div id="footer">
<p class="footertag">Inspired-Evolution - Web Site: Design, Development,
Marketing for Raleigh/Durham, Chapel Hill, Cary North Carolina.</p>
<?php require('includes/footer.inc'); ?>
<span class="date">
<?
$last_modified = filemtime("index.php");
print("Last Modified ");
print(date("m/j/y h:i", $last_modified));
?>
</span> </div>
</div>
</div>
</body>
</html>
and if this helps, here is the PHP info.
:
http://www.inspired-evolution.com/info.php
TIA!
--
::Bruce::
attached mail follows:
* Bruce Gilbert <webguync
gmail.com>:
> Hello,
>
> I am getting this on the following code, and I am not sure what is
> causing the error and need some pros to take a look at it for me.
>
> the error is:
>
> Parse error: parse error, unexpected '{' in
> /hsphere/local/home/bruceg/inspired-evolution.com/Contact_Form2.php on
> line 161
<snip>
> if ($_POST['op']!='ds') {
> // they need to see the form
> echo "$form_block";
> } else if ($_POST["op"] == "ds") {
Where's the end to this elseif? You follow it immediately with the
following lines, which simply won't work (can't define functions inside
if() blocks).
> //Function saves time and space by eliminating unneccesary code
> function check($fieldname)
> {
--
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/
attached mail follows:
Kristen G. Thorson wrote:
> You said "If the user makes changes, those changes get error checked but
> do not become part of the sql query." Where in your code is it failing
> to become part of the query? Put a check at each level and see where
> *exactly* it fails to get deep enough to become one with the query.
> Also, I'm confused. I asked if the query was what you're expecting, and
> you answered yes, which implies the data becomes part of the query.
Thanks for this; yes I was confused before and thank you for the
clarification.
Now I am confused by how to check the logic: I echo out the sql as it is
built, and if I'm going forward in the questionnaire it shows clearly but
$qidlist_sql="DELETE FROM teresa WHERE q_id IN (" .
(implode(",",$qidlist)) . ");";
echo "<br /><br />";
echo "<br />\$ cqidlist_sql:" . $qidlist_sql . "<br />";
$q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
VALUES " . (implode(",",$qanda)) . ";";
mysql_query($qidlist_sql);
echo "<br /><br />";
echo "<br />\$ q_a_sql:" . $q_a_sql . "<br />";
if($q_a_result = mysql_query($q_a_sql))
{
unset($_SESSION['required_fields']);
$cat = $_POST['cat']+1;
include_once(QUESTIONS . 'q.inc');
}
shows NOTHING if I hit the BACK button. I'm still not seeing where the
logic error is which makes it so that when I hit the BACK button it
loses the plot.
Sorry for my misunderstanding
JJ
>
>
> kgt
>
>
>
>
>
>
> Jack Jackson wrote:
>
>> I've tried playing with the $_SERVER['HTTP_REFERER'] and that's no
>> good because it's all coming from the same page - index.php!!
>>
>> What am I missing. . . ?
>>
>>
>> Jack Jackson wrote:
>>
>>> Hi Kristen, there's a misunderstanding:
>>>
>>> Kristen G. Thorson wrote:
>>>
>>>> The code below isn't much help to debug. Do some checking to figure
>>>> out how far into your IF statement you're getting. Is the query
>>>> running?
>>>
>>>
>>>
>>>
>>> Yes it runs successfully
>>>
>>>> Is it the query you expect?
>>>
>>>
>>>
>>>
>>> Yes it is perfect, and provided this is a new session and we're going
>>> forward page by page, it properly deletes from and inserts to the db
>>> as expected
>>>
>>> (Step #1 when inserting or creating dynamic
>>>
>>>> queries that aren't working: print them out to make sure they are
>>>> what you think they are.) Is the category being incremented?
>>>
>>>
>>>
>>>
>>> Yes, absolutely
>>>
>>>> You say you can go back, but you can't go forward.
>>>
>>>
>>>
>>>
>>> Actually no. In a new session, I can start and go forward page by
>>> page to the end of the questionnaire, advancing each stage perfectly,
>>> storing all values exactly as I'd expect.
>>>
>>> The trouble starts if, during the process, the user hits the BACK
>>> button. At that point, user can reload the last page of questions,
>>> displaying the answers they gave. If the user makes changes, those
>>> changes get error checked but do not become part of the sql query.
>>> Also, user can not move forwards any more. So it's as the subject
>>> says - everything works...until they hit the back button, from which
>>> point the whole thing goes gablooey.
>>>
>>> Look at the page source, is the
>>>
>>>> form action what it should be?
>>>
>>>
>>>
>>>
>>> Yes
>>>
>>> Look at the form hidden variables (if
>>>
>>>> any) are they what you expect?
>>>
>>>
>>>
>>> No. $cat remains what it was BEFORE the user hit the BACK button.
>>> However the questions dispayed are from the $cat which is in fact $cat-1
>>>
>>> ??!!
>>>
>>
>
>
>
attached mail follows:
Jack Jackson wrote:
> Kristen G. Thorson wrote:
>
>> You said "If the user makes changes, those changes get error checked
>> but do not become part of the sql query." Where in your code is it
>> failing to become part of the query? Put a check at each level and
>> see where *exactly* it fails to get deep enough to become one with
>> the query. Also, I'm confused. I asked if the query was what you're
>> expecting, and you answered yes, which implies the data becomes part
>> of the query.
>
>
> Thanks for this; yes I was confused before and thank you for the
> clarification.
>
> Now I am confused by how to check the logic: I echo out the sql as it
> is built, and if I'm going forward in the questionnaire it shows
> clearly but
>
>
> $qidlist_sql="DELETE FROM teresa WHERE q_id IN (" .
> (implode(",",$qidlist)) . ");";
> echo "<br /><br />";
> echo "<br />\$ cqidlist_sql:" . $qidlist_sql . "<br />";
>
> $q_a_sql="INSERT INTO teresa (u_id, q_id, a_id )
> VALUES " . (implode(",",$qanda)) . ";";
>
> mysql_query($qidlist_sql);
>
> echo "<br /><br />";
> echo "<br />\$ q_a_sql:" . $q_a_sql . "<br />";
>
> if($q_a_result = mysql_query($q_a_sql))
> {
> unset($_SESSION['required_fields']);
> $cat = $_POST['cat']+1;
> include_once(QUESTIONS . 'q.inc');
> }
>
>
> shows NOTHING if I hit the BACK button. I'm still not seeing where
> the logic error is which makes it so that when I hit the BACK button
> it loses the plot.
>
> Sorry for my misunderstanding
> JJ
>
Keep going backwards. It looks like maybe you've got an IF statement
that you're not getting past. Find where that is, and why it's
evaluating to false. If it's outputting *nothing*, then you're not
evening reaching those echo statements. Make a note after every IF
statement, something like
echo "Inside if( this == that )";
So you know which blocks of code are being processed.
kgt
attached mail follows:
Hi,
I need to check does URL use http or https?
Right now I use this code:
if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
{
header('location: [URL]https://www.test.com/test.php[/URL]');
exit;
}
but I am sure there is much better solution.
:)
attached mail follows:
IIRC, if you're using Apache you can check
If (isset ($_SERVER['HTTPS']))
You can also check this thread:
http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
S%27%5D
--
BeebleX - The PHP Search Engine
http://beeblex.com
On 8/5/05 2:05 PM, "afan
afan.net" <afan
afan.net> wrote:
> Hi,
> I need to check does URL use http or https?
>
> Right now I use this code:
>
> if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
> {
> header('location: [URL]https://www.test.com/test.php[/URL]');
> exit;
> }
>
> but I am sure there is much better solution.
> :)
attached mail follows:
Thanks Marco!
:)
I was looking for something like this on phpinfo() but didn't found?
-afan
Marco Tabini wrote:
>IIRC, if you're using Apache you can check
>
>If (isset ($_SERVER['HTTPS']))
>
>You can also check this thread:
>
>http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
>S%27%5D
>
>--
>BeebleX - The PHP Search Engine
>http://beeblex.com
>
>On 8/5/05 2:05 PM, "afan
afan.net" <afan
afan.net> wrote:
>
>
>
>>Hi,
>>I need to check does URL use http or https?
>>
>>Right now I use this code:
>>
>>if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
>>{
>> header('location: [URL]https://www.test.com/test.php[/URL]');
>> exit;
>>}
>>
>>but I am sure there is much better solution.
>>:)
>>
>>
>
>
>
>
>
>
>
attached mail follows:
On 8/5/05 2:43 PM, "afan
afan.net" <afan
afan.net> wrote:
> Thanks Marco!
> :)
>
> I was looking for something like this on phpinfo() but didn't found?
That's because it shows up only if you are under HTTPS! :-)
Marco
>
>
> -afan
>
> Marco Tabini wrote:
>
>> IIRC, if you're using Apache you can check
>>
>> If (isset ($_SERVER['HTTPS']))
>>
>> You can also check this thread:
>>
>> http://beeblex.com/lists/index.php/php.general/190410?h=%24_SERVER%5B%27HTTP
>> S%27%5D
>>
>> --
>> BeebleX - The PHP Search Engine
>> http://beeblex.com
>>
>> On 8/5/05 2:05 PM, "afan
afan.net" <afan
afan.net> wrote:
>>
>>
>>
>>> Hi,
>>> I need to check does URL use http or https?
>>>
>>> Right now I use this code:
>>>
>>> if(preg_match('/https:/', $_SERVER['SCRIPT_URI']) == false)
>>> {
>>> header('location: [URL]https://www.test.com/test.php[/URL]');
>>> exit;
>>> }
>>>
>>> but I am sure there is much better solution.
>>> :)
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
--
Marco Tabini
President & CEO
Marco Tabini & Associates, Inc.
28 Bombay Ave.
Toronto, ON M3H 1B7
Canada
Phone: +1 (416) 630-6202
Fax: +1 (416) 630-5057
attached mail follows:
I recently upgraded my server. It is running Ubuntu Linux with PHP and
MySQL. My site allows people to post content to their own web oages
through a web interface. Many of my customers compose their content on a
word processer and then cust and paste it to the web interface for
insertion to the database and later retrevial and display on a web page.
The problem I am having is that content which includes quotes is is not
being seen correctly. Rather than inserting a slashed quote (/"), it
inserts a bunch of strange formatted gunk. A sample of the problem anc be
seen at www.dallypost.com/ranch/page5688.php
Thanks
--
Lance Earl, President
DallyPost, Inc. - Equine Marketing/Training/Shows
Rockland, Idaho 208-548-2721 or 208-604-2721
lance
dallypost.com
http://www.dallypost.com http://www.dallypost.com/ranch
Horse Marketing - Clinics - Shows
attached mail follows:
Hello Lance--
On 8/5/05 2:18 PM, "Lance Earl" <lance
dallypost.com> wrote:
> I recently upgraded my server. It is running Ubuntu Linux with PHP and
> MySQL. My site allows people to post content to their own web oages
> through a web interface. Many of my customers compose their content on a
> word processer and then cust and paste it to the web interface for
> insertion to the database and later retrevial and display on a web page.
>
> The problem I am having is that content which includes quotes is is not
> being seen correctly. Rather than inserting a slashed quote (/"), it
> inserts a bunch of strange formatted gunk. A sample of the problem anc be
> seen at www.dallypost.com/ranch/page5688.php
>
You have an encoding problem--the content is being uploaded to your site
using a different encoding mechanism (most likely utf-8) than the one you
use to display it.
I'm not much of an expert in this area, but a couple of suggestions:
1. You're already outputting UTF-8 code from the looks of it, so a simple
Header ("Content-type: text/html; charset=utf-8");
Or even adding this to your HTML code in the <HEAD>:
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
Should do it. Remember to also use htmlentities ($data, null, "utf-8"); to
properly encode the entities in your content.
2. Convert the text over from UTF-8 to ISO-8859-1. I think you can use
utf8_decode, or you may have to go with the mbstring extension (not too sure
here, I'd just go ahead and convert everything over to UTF-8).
I'm sure some other people who have more experience with this stuff can give
you even more pointers, but this should get you started.
Cheers,
Marco
--
BeebleX - The PHP Search Engine
http://beeblex.com
attached mail follows:
This should be a fairly easy question for someone who already knows the
answer...
What I would like to be able to do is take a string and place it into a
'resource' so I can use functons like fscanf, fseek to process the string.
Is this possible? If so, how?
p.s. While I would be interested in possible alternative solutions, I
would like to know how to accomplish this task even if it does not end
up being the solution I use.
--
== Eric Gorr =============================== http://www.ericgorr.net ===
"Those who would sacrifice a little freedom for temporal safety
deserve neither to be safe or free." - Benjamin Franklin
== Insults, like violence, are the last refuge of the incompetent... ===
attached mail follows:
[snip]
What I would like to be able to do is take a string and place it into a
'resource' so I can use functons like fscanf, fseek to process the
string.
Is this possible? If so, how?
p.s. While I would be interested in possible alternative solutions, I
would like to know how to accomplish this task even if it does not end
up being the solution I use.
[/snip]
If you place the string into a variable then you would be able to work
with it that way. There are probably better functions for dealing with a
string than the ones you have mentioned (fseek is a file pointer).
attached mail follows:
Jay Blanchard wrote:
> [snip]
> What I would like to be able to do is take a string and place it into a
> 'resource' so I can use functons like fscanf, fseek to process the
> string.
>
> Is this possible? If so, how?
>
> p.s. While I would be interested in possible alternative solutions, I
> would like to know how to accomplish this task even if it does not end
> up being the solution I use.
> [/snip]
>
> If you place the string into a variable then you would be able to work
> with it that way.
Using what functions?
Part of the point was not to need to keep track of the current location
in the string, etc...basically things that streams tend to handle well.
> There are probably better functions for dealing with a
> string than the ones you have mentioned (fseek is a file pointer).
'like fscanf, fseek'
--
== Eric Gorr =============================== http://www.ericgorr.net ===
"Those who would sacrifice a little freedom for temporal safety
deserve neither to be safe or free." - Benjamin Franklin
== Insults, like violence, are the last refuge of the incompetent... ===
attached mail follows:
[snip]
Jay Blanchard wrote:
> If you place the string into a variable then you would be able to work
> with it that way.
Using what functions?
Part of the point was not to need to keep track of the current location
in the string, etc...basically things that streams tend to handle well.
> There are probably better functions for dealing with a
> string than the ones you have mentioned (fseek is a file pointer).
'like fscanf, fseek'
[/snip]
You have been a little vague about your desired usage but here is one
idea; Explode the string into an array and then use array functions to
navigate the string.
Here is a whole list of methods for handling strings....
http://us2.php.net/manual/en/ref.strings.php
--
== Eric Gorr =============================== http://www.ericgorr.net ===
"Those who would sacrifice a little freedom for temporal safety
deserve neither to be safe or free." - Benjamin Franklin
== Insults, like violence, are the last refuge of the incompetent... ===
attached mail follows:
Jay Blanchard wrote:
> [snip]
> Jay Blanchard wrote:
>
>>If you place the string into a variable then you would be able to work
>>with it that way.
>
>
> Using what functions?
>
> Part of the point was not to need to keep track of the current location
> in the string, etc...basically things that streams tend to handle well.
>
>
>>There are probably better functions for dealing with a
>>string than the ones you have mentioned (fseek is a file pointer).
>
>
> 'like fscanf, fseek'
> [/snip]
>
> You have been a little vague about your desired usage but here is one
> idea; Explode the string into an array and then use array functions to
> navigate the string.
>
> Here is a whole list of methods for handling strings....
>
> http://us2.php.net/manual/en/ref.strings.php
Again, I would like to treat the string as a stream.
One possible way to accomplish this would be to simply write the string
to a temporary file, open the file with fopen and then use fscanf,
fseek, etc. to process the text.
However, I am assuming there is an easier way (i.e. a method without the
file io overhead) to be able to treat the string as a stream.
--
== Eric Gorr =============================== http://www.ericgorr.net ===
"Therefore the considerations of the intelligent always include both
benefit and harm." - Sun Tzu
== Insults, like violence, are the last refuge of the incompetent... ===
attached mail follows:
[snip]
Again, I would like to treat the string as a stream.
One possible way to accomplish this would be to simply write the string
to a temporary file, open the file with fopen and then use fscanf,
fseek, etc. to process the text.
However, I am assuming there is an easier way (i.e. a method without the
file io overhead) to be able to treat the string as a stream.
[/snip]
Treating a string as a stream (the most common thing is to convert a
stream to a string and work with the string using the string functions I
showed you or writing custom functions) is going to incur additioanl
overhead. What, exactly, do you want to accomplish? Can you give an
example?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]