[PHP] sort by date

2005-05-05 Thread William Stokes
Hello,

I made a mistake and stored date information to DB as varchar values 
(dd.mm.yyy). When I read the DB is it still possible to sort the data by 
date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the 
date information to be stored as a date in the DB? Will it work or is the 
output going to be sorted randomly?

Thanks
-Will 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multi dimensional array

2005-05-05 Thread Richard Lynch
On Thu, May 5, 2005 2:08 am, Angelo Zanetti said:

[sorry for the double-post...]

> the other server. Its running Apache 1 and the server that works is
> running Apache 2.

Are you sure it's not the broken server running Apache 2?...
And possibly PHP 5?
And MySQL 4.1?

Which means you need mysqli instead of mysql?

mysqli and mysql are different.

I guess it could be Apache 1 with the PHP5/MySQL 4.1 needing mysqli, but
that seems less likely than having Apahce2/PHP5/MySQL4.1

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Function shall receive Pointer to Array

2005-05-05 Thread Richard Lynch
On Wed, May 4, 2005 3:29 pm, Fred Rathke said:
> how can a function get a pointer to an array? This does not work. I use
> PHP4.

Technically, in PHP, they are references, not pointers.

There are no pointers in PHP.

The difference is too subtle for me to understand it, but there is
apparently some meaningful difference.

> $t = array("test" => "unchanged");
> echo "testarray unchanged:\"".$t['test']."\"";
> changearray($t);
> echo "testarray hopefully changed:\"".$t['test']."\"";
>
> function changearray(&$myarray) {
> $myarray['test'] = "changed";
> }

-bash-2.05b$ php -a
Interactive mode enabled

 "unchanged");
echo "testarray unchanged:\"".$t['test']."\"";
changearray($t);
echo "testarray hopefully changed:\"".$t['test']."\"";

function changearray(&$myarray) {
$myarray['test'] = "changed";
}
?>
Content-type: text/html
X-Powered-By: PHP/4.3.11

testarray unchanged:"unchanged"testarray hopefully changed:"changed"
-bash-2.05b$

So it works in 4.3.11

Exactly which version of PHP are you one -- minor version numbers included.

The behaviour of & changed several times over the course of PHP's history,
which makes meaningful discussion difficult without precision in version
information.

> Before I tried it on my own I read this page:
> http://de2.php.net/manual/en/language.references.whatdo.php
>
> Be so nice to search for this string: "The second thing references do
> is to pass variables  by-reference. This is done by making a local
> variable in a function and  a variable in the calling scope reference
> to the same content. Example:"
>
> The following example I used. I only tried to do it with an array
> instead of a variable.

Actually, I would expect arrays to *ALWAYS* have worked in PHP...

But maybe that's just my shoddy memory.

Plus I rarely send arrays around in functions and try to alter their
contents.  Just a question of programming style, I guess.

> What I need to read again to find my own mistake? I know some of php's
> commands work with an internal copy of a content.

foreach() does that for sure.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Socket connection reset by pear

2005-05-05 Thread Richard Lynch
On Thu, May 5, 2005 5:20 am, Martín Marqués said:
> I'm trying to build some communication aside of the server thin client
> stuff,
> with a socket daemon and a socket client.
>
> The daemon is the same that everybody can find in the PHP docs (example
> 1).
> The client simply opens a connection to the daemon and writes data using
> the
> socket Object from PEAR (last stable version). The problem is that it
> fails
> to make a socket_read() with this message (on the daemon side):
>
> Warning: socket_read() unable to read from socket [54]: Connection reset
> by
> peer
> in
> /space/home/martin/programacion/siprebi-1.2/ext/impresion/printSocket.php
> on line 42
> socket_read() failed: reason: Operation not permitted
>
>
> If I open a telnet conection to the daemon, everything works like a
> charme. It
> writes and quits OK.
>
> What can be going wrong?

Operation not permitted would make me guess you've got a user read/write
permissions problem.

When you open that telnet connection, are you logged in as the same user
as the PHP user that is running the client script?

I'm guessing not...

You have to clarify, for yourself, which user is doing what when to which
files/devices/sockets, and what chown permissions are in effect.

That generally makes you go "Duh" and fix the problem pretty quick.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multi dimensional arraySOLVED

2005-05-05 Thread Richard Lynch
On Thu, May 5, 2005 3:37 am, Angelo Zanetti said:
> this is quite weird but apparently on the one server if you user $user
> as a variable name thats what causes the problem.
> I simply renamed my variable to something else and it worked, I find it
> strange that it worked on 1 server and not the other, is it possible
> that the different apache versions are responsible for this situation??

This would indicate to me that you've got register_globals "ON" and that
your EGPCS settings are clobbering your $user variable with data from, say
the environment $_ENV

I'm betting that if you do:
echo "ENV $_ENV[user]\n";
echo "GET $_GET[user]\n";
echo "POST $_POST[user]\n";
echo "SESSION $_SESSION[user]\n";
echo "COOKIE $_COOKIE[user]\n";

in the script that was giving you trouble, you'll find that one of those
is set.

Actually, since they could be set to the empty string, you should be
echo-in isset($_XXX['user']) in the above test.

The correct solution, then, is to turn register_globals OFF.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How do I link to the root directory of the server?

2005-05-05 Thread Richard Lynch
You could just use relative links, or use a full path link, without the
http://www.mydomain.com part.

Or, you could change application.php to use data from $_SERVER to figure
out what URL you should be using.



and pick through that data.

Somewhere in there you will find what you need to set up $CFG->wwwrot and
$CFG->dirroot so that they always work, no matter what server you are on.


On Thu, May 5, 2005 5:01 am, Shaun said:
> Hi,
>
> I have a file called application.php and in this file I define all of the
> directories in my site:
>
> class object {};
> $CFG = new object;
>
> $CFG->wwwroot = http://www.mydomain.com;
> $CFG->dirroot  = "/usr/home/myaccount/public_html";
>
> $CFG->admindir = "$CFG->wwwroot/admin";
> $CFG->claimsdir_adm = "$CFG->admindir/claims";
> $CFG->clientsdir   = "$CFG->admindir/clients";
> $CFG->cssdir = "$CFG->wwwroot/css";
> $CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
> $CFG->projectsdir   = "$CFG->admindir/projects";
> $CFG->shoppingdir  = "$CFG->wwwroot/shopping";
> ...
>
> This works very well and means if I change a directory name or move a
> directory I only have to update this file. application.php is included on
> every page so all I have to do to link to another directory would be
> something like:
>
> Click here to add a category
>
> The problem with this is that the URL's include the
> http://www.mydomain.com/
> and are therefore not relative links. Is there a way to link to the root
> directory from wherever I am within the directory structure?
>
> Thanks for your advice
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP based project management

2005-05-05 Thread bala chandar
hi

On 5/6/05, Zareef Ahmed <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> Look for phpcollab.

along with this also look for dotproject!

> 
> zareef ahmed
> 
> On 5/4/05, Neal Carmine <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > There are a lot of open source project management packages. .Project,
> > netoffice and others. Does anyone have a recommendation on the best overall
> > project management software for tracking billable software projects?
> >
> > Thanks,
> >
> > Neal
> >
> >
> 

-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html hyperlink and PHP

2005-05-05 Thread bala chandar
Hi,

On 5/6/05, Oscar Andersson <[EMAIL PROTECTED]> wrote:
> If i do like this.
> 

if u do like above u might have to use  $_GET['action']

> How does the webbrowser send this? With post or get or ..?
> Shall i get the action with $_POST or $_GET?
> ex.
>   @$action = $_POST['action'];
>   if(!$action)
> @$action = $_GET['action'];
> processRequest($action);
> 
> If i do like this
> 
> 

if u use like above use $_POST['action']

> 
> How do i get the action in my php page. I think it is with $action =
> $_POST['action'];

if u r not sure what to use,

use  $_REQUEST['action'];

> but it doesent work.
> 
> Tnx for any help mates


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] downloading files

2005-05-05 Thread Greg Donald
On 5/5/05, Cima <[EMAIL PROTECTED]> wrote:
> i've uploaded some files into my postgresql db, via a php script,  and now
> id like to give a user the posibility to download these files via a php
> script. what would be the best way to do this bearing in mind that the files
> are 'integrated' into the db and are referenced by an oid. the table that
> contains the files has the original filename in one column and the oid of
> the file in another column besides  other info on the table.
> any sugestion would be highly apreciated!

Send the correct file type header() based on the file name's
extension, then send the data.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html hyperlink and PHP

2005-05-05 Thread Greg Donald
On 5/5/05, Oscar Andersson <[EMAIL PROTECTED]> wrote:
> If i do like this.
> 
> 
> How does the webbrowser send this? With post or get or ..?

get

> Shall i get the action with $_POST or $_GET?

$_GET or $_REQUEST

> ex.
>   @$action = $_POST['action'];
>   if(!$action)
> @$action = $_GET['action'];
> processRequest($action);
> 
> If i do like this
> 
> 
> 
> How do i get the action in my php page. I think it is with $action =
> $_POST['action'];
> but it doesent work.
> 
> Tnx for any help mates

You can add something like this to see what is coming through when you
post the form:

echo '';
print_r( $_REQUEST );
echo '';


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] file uploads and sizes

2005-05-05 Thread Greg Donald
On 5/5/05, Cima <[EMAIL PROTECTED]> wrote:
> i have the following code that works except when the file i'm trying to
> upload excedes the upload_max _filesize and post_max_size defined in the
> php.ini file.
> what happens when the file is smaller than the max sizes mentioned
> previously, the if (isset .) part of the code is executed yet when the
> file exceeds both max sizes, i just get a blank page.
> what id like is to be able to give the user a message saying the file wasnt
> uploaded because  the file was too big.so, how do i verify the size of the
> file the user is trying to upload? ive already tried
> $_FILES['archivo']['size'], but that doesnt work if the variable isnt set,
> which aparently happens when the file isnt uploaded because of the
> post_max_size.
> 
> any help will be greatly appreciated!!

You need to evaluate each of the possible return values for
$_FILES[ 'archivo' ][ 'error' ]

http://php.net/manual/en/features.file-upload.errors.php


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] html hyperlink and PHP

2005-05-05 Thread Richard Lynch

You could have tried it in the time it took you to post...

It's GET.


On Thu, May 5, 2005 7:28 pm, Oscar Andersson said:
> If i do like this.
> 
>
> How does the webbrowser send this? With post or get or ..?
> Shall i get the action with $_POST or $_GET?
> ex.
>   @$action = $_POST['action'];
>   if(!$action)
> @$action = $_GET['action'];
> processRequest($action);
>
> If i do like this
> 
> 
> 
> How do i get the action in my php page. I think it is with $action =
> $_POST['action'];
> but it doesent work.
>
> Tnx for any help mates
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP based project management

2005-05-05 Thread Zareef Ahmed
Hi, 

Look for phpcollab.

zareef ahmed 



On 5/4/05, Neal Carmine <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> There are a lot of open source project management packages. .Project,
> netoffice and others. Does anyone have a recommendation on the best overall
> project management software for tracking billable software projects?
> 
> Thanks,
> 
> Neal
> 
> 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Flash&PHP Issue

2005-05-05 Thread disguised.jedi
> How I can get the width and height of a swf file with php?
http://www.php.net/ming

-- 
[EMAIL PROTECTED]

PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored. 
However, I must say that the ENTIRE contents of this message are
subject to other's criticism, corrections, and speculations.

This message is Certified Virus Free

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] html hyperlink and PHP

2005-05-05 Thread Oscar Andersson
If i do like this.


How does the webbrowser send this? With post or get or ..?
Shall i get the action with $_POST or $_GET?
ex.
  @$action = $_POST['action'];
  if(!$action)
@$action = $_GET['action'];
processRequest($action);

If i do like this



How do i get the action in my php page. I think it is with $action = 
$_POST['action'];
but it doesent work.

Tnx for any help mates

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] file uploads and sizes

2005-05-05 Thread Cima
i have the following code that works except when the file i'm trying to
upload excedes the upload_max _filesize and post_max_size defined in the
php.ini file.
what happens when the file is smaller than the max sizes mentioned
previously, the if (isset .) part of the code is executed yet when the
file exceeds both max sizes, i just get a blank page.
what id like is to be able to give the user a message saying the file wasnt
uploaded because  the file was too big.so, how do i verify the size of the
file the user is trying to upload? ive already tried
$_FILES['archivo']['size'], but that doesnt work if the variable isnt set,
which aparently happens when the file isnt uploaded because of the
post_max_size.

any help will be greatly appreciated!!

thanx.

";
 print "of type {$_FILES['archivo']['type']} that is ";
 print "{$_FILES['archivo']['size']} bytes long.";
 $safe_filename = str_replace('/', '', $_FILES['archivo']['name']);
 $safe_filename = str_replace('..', '', $safe_filename);


$dbh = pg_connect("host=localhost dbname=test user=postgres");
 if (!$dbh)
 {
  echo "cannot open connection to the database";
  exit;
 }

 else {
   chmod($archivo,0777);
  pg_exec($dbh,"BEGIN");
  $sql = "INSERT INTO pic_db (name, picoid) VALUES ";
  $sql .= "('$safe_filename', lo_import('$archivo'))";
  $stat = pg_exec($dbh, $sql);
  pg_exec($dbh,"COMMIT");
  pg_close($dbh);
  echo "The file was saved succesfully.";
}

  unlink($archivo); */
}


?>











[PHP] one-time password (OTP) authentication

2005-05-05 Thread james
Two-factor authentication (authenticating user with something they know AND 
something they possess) is becoming more and more popular due to increasing 
security requirements and the prevalence of spyware software.  However, in open 
source projects, solutions such as RSA securID, smartcards, etc. are not always 
feasible because of funding, licensing, or other constraints.  Here is a 
complete, standards-based, open source, no-hardware solution.  Here is a PHP 
implementation for generating, challenging, and authenticating one-time 
passwords according to RFC 2289.  I have attached a uuencoded file (or go to 
http://www.dcphp.com/Developers/files/otp_pub.zip 
 to download)  Below are two scenarious for OTP use.

Scenario A: 
Users across an organization need access to corporate resources at home, on the 
road, in airplanes, etc.  Users are many (>1000) and geographically 
distributed.  A user applies for access and is approved.  The administrator 
prints off a list of one-time passwords and delivers a hard-copy via physical 
medium (fax, phone, snail-mail, person-to-person handoff). 

Scenario B: 
Users self-register for a commercial (or other) website.  Once successfully 
registered, the user is given the option to generate a list of one-time 
passwords and use them for authentication in addition to their 
username/password (of course, user can ignore OTP from certain trusted 
computers, such as the one they registered from, if they trust it).  The user 
can generate new OTP's at any time once authenticated. 



When the user logs in, they use their username,password, and a 
one-time-password (which one depends on which one they are prompted for by the 
server).  The OTP expires immediately upon authentication.  Now, if a hacker 
intercepts all three tokens, they are still unable to perform a replay attack 
because the third token is already invalidated.  Their is a race condition if 
they are watching real-time, but this can be accounted for via transaction 
locking in the session handling code.


--
the brown cow
--
begin 755 /dev/stdout
M'XL("&ERCC8"`V]T<%]P=6(N=&%R`.Q[<(2\
MN=R;=\N;6.\W?]D<+NO?_(Z_1J/5Z+;;YO\O/_S_Z[\[G=9QJWMTU#3OF?^V
M&[EMAIL PROTECTED]>N;[7J]_WOO_:.__Y/^UA_Y/UINYJ/5X7;W?C/?_-;\
M/VK\/?ZW6\?M5_X?MX];QTWS_G&W;?C?^,K_W_WWTY\-OVOU'ZP??I=?S;)^
ML%PEI/7%[]^M7TG;RSN1G>56D0H[E^+UG:.N%8^VX[G5-")B73Y:UZ/;Z>[]
MY6A[LYP^_L?5Y,?18O=^O+Y]:1_+/%#BRSX6J_'R,)G6M].[PV([K2]6R\5J
M:CV__=)"R,S589J'*OG8(I\O=M9F,1U/K?7,&J\G4VLRG9E&.VNTLM;;R70[
MG5BC[7;T:(U'R^7SPZ>)6/OY:/]"_-MO7T[^9?$FAUK.=WOOVCZ
M]H7O$_#3Z])??Y6?]4*]]_WDI_O._
MK)^M[T;?_8FPRPIL7(%-*K!I!3:KP*XJL'D%MJC`KBNPFPIL68'=5F"K"FQ=
[EMAIL PROTECTED];%>![2NP0P5V7X$]5&`?*K#'"NRI`K,K,*<"W'YY\C_3"Q
M4C\U]B7+;%^^H+6!T=>+]EWH_V3'D7>3Y($4K77FZ:`;#ONG
M3Q\"I[]>J-,[>[EMAIL PROTECTED]>'168O[N!/,:N^.\LVCK8[#HT;?;S?JVTDY
MB,[+:)2,[EMAIL PROTECTED]'G=DDZ)ZF1[)^T;W:7M^?K&OK]#)9
M>8TTVQZR<:MYD=^T5K-U'(1MI7OM.WN?-)[EMAIL PROTECTED]>%%_FB2E>!S6
MN]?;7IG4EN-F.6UO!U[+ZZCHMG]>E&489LWUC;W>AOKV8G]Z/JY/NQ=7L]-@
M'U],>W;O*EA'^FIP&@:'A]IIL>S,[VZ:G>-6L1F'"_TPBXMZ8[]^<$[N?'U[
MVYF=7$C_\<3;#>\G2]7MW>K%:I`/V_JPG*>BID^B,JD/.S?%I"U667,RF:VZ
M[7);',)5[NSO&E%_$Z47^\[D8G$[N5.MW8W[P6W>W3P,[EMAIL PROTECTED]
M5V>I."EO-LW^S>2-_Z2:H_OP^C`]:=S:C%C%NR;A1[Z^NIE?)=>8E^G!8)>U%KS%L
MC>_U[N1R7M^OH]EX>[:H=<4'L3MUSN)Q.KX\S\IU.1P^7);O'L][3_,BN]C)E1L-Y:Y?7-7N]_T+^[(=A`\G<3G)LO+)N;]]
M&@CGO)NOSODQU
M[YUXW*XNQB?M>OM^N[&'B3SRH^%HGUTVKV\>F^.6O;PZW)STKY^&]\N+O;A<
MK4[FNUIT)>Z5W7KRGD:#B7Q8WO6&3Q-MM\=2B%BD93$ZO_*'XUFQ'HTWK:-9
ME-Z?'[EMAIL PROTECTED](]WJ'VKV=KKI^?O3I%V_V(^/%[6?A\%\^KK'92)XAQN'QBB#
M;_[U?Y_BOZOIZB_/_S:.Y_ZW#@'_0?S7['8[?XO_VBWS?JO5[GZ-__ZX^,\R
MD8N)`3^%#<(J$B&U92S&<^SP[-[7?^7O[T:WF^7T-42:K;>6D9[I=K1?K*Z>
M(Z7Y_G9I[4>7RY^WGS__/P^F_C+.7WY3E\+Z?_7[ZN!\=7"^.CC_
M_`[.)_N_V*U_[+0Z[Q?WX]T?:O^;[:-&ZXO\;_^VO]_W?PO2ML?
[EMAIL PROTECTED];3/`SU-X3?Y^3/CN?I4%;C9:)]9NOM[NK5??9[3[2-(T75EAIEX6PGKM
M>K3[7B]<$\'B]VR\?7X?UE]WT><7>O+5F
MA]5X;UR*YV[,$O^?YH:?%^F+%.$7CXX$P"[EMAIL PROTECTED]@,](4^(:O``CQC3!&0`,0
M10BD`"")>[EMAIL PROTECTED]'E5`37(P$.TEQ_=(,`:2A7020ANXC@)/52!1[S0($
MD"92R'[EMAIL PROTECTED](`;%(B7TM<\W-X'@)[EMAIL PROTECTED]($-`(Y`L!Z
MW$J.Q'%)>@,'*G$8$GN5V&OH((#=AMA+B+V$V(M"[EMAIL PROTECTED](I`B4".)<"
MNRUP+BB#3H&<+'[EMAIL PROTECTED];`<=`S,,ZU'00B!&([EMAIL PROTECTED]"[EMAIL 
PROTECTED]:R(^`C
[EMAIL PROTECTED](.!<9YRH"J
M"]S7`K>MD!$"2%1F","*"=RE(L1><-L*W+8BA!43"I^1)HJ'0&D0R&N!O!;(
M6H&L%;AK!?):X#86N&LELD7B9D#M*I$KTO<1@/6148A`'X$8`9B]Q!?0B9`9
M#CP'>R\'[EMAIL PROTECTED]'D>RCH'JZHAROJH>1[N,8>;@4/Y=I#<^2A&'LH
MQA[Z>AZ:(R]2".!(4=(]E'1/82\HQQZ:[EMAIL PROTECTED],"\I$-/OHB/EH*'U64
MCX;!1V?.1T;YR!XS"$*,PQ(JZQ:%C
M\!8C[V.TCYAH35!5)*@([EMAIL PROTECTED],),C*1^"P0H#>0)O(MP>@E01\XP3V<
M(",3A<]($QF;H.5.,%9)%'4R0`"G4N`S=H*6!\:M;`^!/@(:`22)1P%*`$\4
M=N([EMAIL PROTECTED]/((H7#C'`0"3[CH'!>VD&`6F`3V'@[EMAIL PROTECTED]('[EMAIL 
PROTECTED]
M3*8K3*8K2*:G-CX+!"([EMAIL PROTECTED]($-`(Y`B4"L-M3-/LIZNT4U70J<1P8.Z6H
M$%)4""D&3RD]2P1P&*@@4DQ>I`J?D0FH^5-4]"DJB!2%)=78"^8_4HR=4M3\
M*>J0%'.V*0KQ60'=:K0%&@5*HT!I%"B-\J-1?C3*CY8.`@(![`6E

[PHP] file uploads and sizes

2005-05-05 Thread Cima
i have the following code that works except when the file i'm trying to
upload excedes the upload_max _filesize and post_max_size defined in the
php.ini file.
what happens when the file is smaller than the max sizes mentioned
previously, the if (isset .) part of the code is executed yet when the
file exceeds both max sizes, i just get a blank page.
what id like is to be able to give the user a message saying the file wasnt
uploaded because  the file was too big.so, how do i verify the size of the
file the user is trying to upload? ive already tried
$_FILES['archivo']['size'], but that doesnt work if the variable isnt set,
which aparently happens when the file isnt uploaded because of the
post_max_size.

any help will be greatly appreciated!!

thanx.

";
 print "of type {$_FILES['archivo']['type']} that is ";
 print "{$_FILES['archivo']['size']} bytes long.";
 $safe_filename = str_replace('/', '', $_FILES['archivo']['name']);
 $safe_filename = str_replace('..', '', $safe_filename);


$dbh = pg_connect("host=localhost dbname=test user=postgres");
 if (!$dbh)
 {
  echo "cannot open connection to the database";
  exit;
 }

 else {
   chmod($archivo,0777);
  pg_exec($dbh,"BEGIN");
  $sql = "INSERT INTO pic_db (name, picoid) VALUES ";
  $sql .= "('$safe_filename', lo_import('$archivo'))";
  $stat = pg_exec($dbh, $sql);
  pg_exec($dbh,"COMMIT");
  pg_close($dbh);
  echo "The file was saved succesfully.";
}

  unlink($archivo); */
}


?>









-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] downloading files

2005-05-05 Thread Cima
hi all,

i've uploaded some files into my postgresql db, via a php script,  and now
id like to give a user the posibility to download these files via a php
script. what would be the best way to do this bearing in mind that the files
are 'integrated' into the db and are referenced by an oid. the table that
contains the files has the original filename in one column and the oid of
the file in another column besides  other info on the table.
any sugestion would be highly apreciated!

thanx.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] to pass session from one websever to another webserver

2005-05-05 Thread Rory Browne
In that case you're probably best to have a single source for the
session data, and simply pass the SessionID as a $_GET variable in the
URL.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php/osx and firebird

2005-05-05 Thread Lester Caine
James wrote:
"To enable InterBase support configure PHP --with-interbase[=DIR], where 
DIR is the InterBase base install directory, which defaults to 
/usr/interbase."
I've tried to add:
--with-interbase=/Library/Frameworks/Firebird.framework/Resources
to my php.ini and it didn't work.
That does not sound like a program directory.
Check the Firebird installation guide - /opt/firebird is the most likely 
location, but does depend on which version of Linux and how it was 
installed.

Am I pointing to the wrong directory?  What other configuration/setup do 
I have to do to enable php's interbase functions?
Once you have installed with the right directory, phpinfo() will show 
the module details.

--
Lester Caine
-
L.S.Caine Electronic Services
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php/osx and firebird

2005-05-05 Thread Gabriel Guzman
James wrote:
I've attempted to access a firebird database living on an osx/apache/php 
machine.

How do I enable those functions?  I've looked at the php documentation 
(http://uk2.php.net/manual/en/ref.ibase.php )

"To enable InterBase support configure PHP --with-interbase[=DIR], where 
DIR is the InterBase base install directory, which defaults to 
/usr/interbase."
I've tried to add:
--with-interbase=/Library/Frameworks/Firebird.framework/Resources
to my php.ini and it didn't work.
James... this is talking about configuring the php compile, not a 
setting in php.ini

so, for example if you just downloaded php-4.3.11.tar.bz2 from the 
php.net website, and un zip/tarred it, you would run the configure script:

./configure --with-interbase[=DIR] (plus any other compile time options 
you need)

then compile and install php (make, make install)
Am I pointing to the wrong directory?  What other configuration/setup do 
I have to do to enable php's interbase functions?
this is a "compile time" option, and not a php.ini one.
hth,
gabe.
p.s. you can see what current compile time options are by looking at the 
output of phpinfo()

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Flash&PHP Issue

2005-05-05 Thread Chris
Khorosh Irani wrote:
Hello
How I can get the width and height of a swf file with php?
Thanks
 

http://www.php.net/getimagesize
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] control-M

2005-05-05 Thread David Christensen
Oh, you just clued me in...  I wonder if [EMAIL PROTECTED] might be
able to shed some like on this.  I'm using TBS as my template engine for
this site.  And yes, it does use nl2br in the "meth_Html_Conv" function.
I'll probably need to add the "htmlconv=no" option to all of the
"textarea" fields.  I think I can be pretty sure the user won't need to
enter any HTML into this fields.

Thanks Marek!  You pointed me in the right direction!


On Thu, 2005-05-05 at 20:08 +0200, Marek Kilimajer wrote:
> David Christensen wrote:
> > I am?  That news to me???  I just did a 'grep nl2br form.php' and I
> > don't any output with nl2br.  I'm not sure this is what's going on.
> > 
> > I did see that function in the "Strings" section of the manual, but it
> > didn't do anything for me.
> > 
> 
> Well, php isn't making it up, it has to be somewhere. Or are you using 
> any htmlarea kind of input? We need to see your form.php to help you.
> 
> > On Thu, 2005-05-05 at 16:11 +0200, Marek Kilimajer wrote:
> > 
> >>David Christensen wrote:
> >>
> >>>Actually, I forgot to also mention that the browser is changing the
> >>>control-M (^M) from the query when it sets the default value for the
> >>>textarea to "".  I guess that is the HTML representation of the
> >>>^M.
> >>
> >>you are using nl2br() on the input, that funcion adds '' before 
> >>all newline characters.
> >>
> >>
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] form variables

2005-05-05 Thread Ryan Faricy
A hidden INPUT would be better...



...


"Bala Chandar" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
hi

On 5/5/05, Anasta <[EMAIL PROTECTED]> wrote:
> Can anyone tell me how a submit button can be used to send set a variable 
> so
> there is only a button --no textfield.
use value="" in the button html component


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] OO toturial

2005-05-05 Thread Brent Baisley
I've been looking and reading for a while now. What I've discovered is 
that you really should learn the concepts rather than how php 
implements the concepts. PHP4 lacks the capability to do (at least do 
well) a lot of object stuff (i.e. multiple inheritance), PHP5 has far 
better support for object oriented concepts.

I would look into and read about Design Patterns. I slowly came across 
design patterns in my searches and they have really helped a ton in my 
programming. MVC (Model, View, Controller) is probably the most widely 
used design pattern, I would look into that first. Then you may move 
onto the concepts "discovered" by the gang of four. Design patterns and 
related concepts are independent from any programming language. You are 
probably already using some design patterns and don't even realize it. 
Everything else kind of falls into place "under" design patterns.

You may look at phppatterns.com, devshed.com or the O'Reilly web site 
for articles.

Some design patterns:
Factory, Adaptor, Bridge, Facade, Singleton,...
On May 5, 2005, at 12:38 PM, Khorosh Irani wrote:
hello
Can anyone tell me the url of a good toturial about object and php 
that contain:
polymorphism,Delegation,...?
Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if then else statement not working

2005-05-05 Thread Rasmus Lerdorf
Anasta wrote:
> What am i doing wrong here, the output is always 'empty'
> 
>   $result = mysql_query("SELECT username FROM users
> WHERE seatnum='seat1'") or die(mysql_error());
> 
>   if (seatnum == seat1) {
> echo username;
> } else {
> echo 'empty';
> }
> ?>

That doesn't even look like PHP code.  In PHP variables have $ in front
of them, and you are only sending a query, you aren't assignining
anything to the variables.  And further, your actual SQL query is
already applying that restriction, so any usernames returned by the
query will by definition have their seatnums be set to 'seat1' in the
database.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] if then else statement not working

2005-05-05 Thread Philip Hallstrom
What am i doing wrong here, the output is always 'empty'

 if (seatnum == seat1) {
echo username;
} else {
echo 'empty';
}
?>
Just guessing since I'm not sure what you're trying to do, but...

$result = mysql_query("SELECT username FROM users WHERE seatnum='seat1'")
  or die(mysql_error());
list($username) = mysql_fetch_array($result, MYSQL_NUM);
if ($seatnum == "seat1") {
echo $username;
}else {
echo 'empty';
}
?>
What I'm not seeing is where you set $seatnum in the first place and why 
you're doing the if/else at all since your mysql query will only return a 
username *if* seatnum='seat1' already so the above code I'm guessing will 
always print out $username (or blank if the query returns no results).

Anyway, the above should get you going in the right direction...
-philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] control-M

2005-05-05 Thread Marek Kilimajer
David Christensen wrote:
I am?  That news to me???  I just did a 'grep nl2br form.php' and I
don't any output with nl2br.  I'm not sure this is what's going on.
I did see that function in the "Strings" section of the manual, but it
didn't do anything for me.
Well, php isn't making it up, it has to be somewhere. Or are you using 
any htmlarea kind of input? We need to see your form.php to help you.

On Thu, 2005-05-05 at 16:11 +0200, Marek Kilimajer wrote:
David Christensen wrote:
Actually, I forgot to also mention that the browser is changing the
control-M (^M) from the query when it sets the default value for the
textarea to "".  I guess that is the HTML representation of the
^M.
you are using nl2br() on the input, that funcion adds '' before 
all newline characters.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if then else statement not working

2005-05-05 Thread Gabriel Guzman
Anasta wrote:
What am i doing wrong here, the output is always 'empty'


  if (seatnum == seat1) {
echo username;
} else {
echo 'empty';
}
?>
mysql_query() returns a resource, not the results themselves.
read: http://us3.php.net/manual/en/function.mysql-query.php especially 
the 2nd example to see what else you need to do to get to your results.

hint:  mysql_fetch_assoc()
have fun,
gabe.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: if then else statement not working

2005-05-05 Thread Matthew Weier O'Phinney
* Anasta <[EMAIL PROTECTED]>:
> What am i doing wrong here, the output is always 'empty'
>
>   $result = mysql_query("SELECT username FROM users
> WHERE seatnum='seat1'") or die(mysql_error());
>
>   if (seatnum == seat1) {

What are you comparing? is seatnum a constant? is seat1 a constant? or
is one of these a variable? is one a string?

I'm suspecting that what you're trying to compare is more like this:

if ($seatnum == 'seat1') {

but I don't know for sure if you've defined a $seatnum variable
previously.

-- 
Matthew Weier O'Phinney   | WEBSITES:
Webmaster and IT Specialist   | http://www.garden.org
National Gardening Association| http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Tracking what has been changed

2005-05-05 Thread Jason Barnett
Mark Rees wrote:
-Original Message-
From: Robb Kerr [mailto:[EMAIL PROTECTED] 
Sent: 05 May 2005 00:29
To: php-general@lists.php.net
Subject: [PHP] Tracking what has been changed

Here's the scenario...
I am building a site in which users will be able to create and then
later edit personal information. When they edit their information, I
need to keep track of what was changed so that I can inform via email a
person to approve the changes. Here's the flow I'm considering...
When an UPDATE page is loaded, I build an array like...
$fields = array("table.field1" => value, "table.field2" => value,
"table.field3" => value)
I then plan to save this array to a SESSION variable. Then, when the
form is posted I save the new form contents to another SESSION variable.
Then I compare the two arrays and save the names of the fields changed
to an array saved in a third SESSION variable. Finally, when I build the
email, I can parse the changed fields array to inform the person who
must approve the changes.
First, does anyone have a suggestion of a better way to do this? 
cron job a script for the emails... just in case you have some fool(s) 
trying to make 100's of updates per minute.

store the potential changes to an "UPDATE" table or something similar. 
admin can then commit the change by updating these proposed changes or 
just dump them from the table.

[EDIT] I see that you're doing this below.  Nice.
--
How long do you expect people to take to approve the changes? What
happens if they don't approve them? What if they are on holiday? What if
someone changes the data, then someone else makes another change, then
the person who approves them approves the first change?
Your problem, not mine.  ;)  Seriously those are good questions, but I'm 
not going to make policy decisions for you / your company.  Your 
question about transactions is interesting though... do you mean you 
have multiple users that can change the same information?

I would recommend storing the change information in a db. 
Say you have a table t_personal_info

Id
firstName
surName
Telephonenumber
dateUpdated
You can then have another table 
t_personal_info_pending
With an additional field changeid (to handle multiple changes to the
same record)

With the same fields. When someone approves a change, update
t_personal_info with the change and delete the record from
t_personal_info_pending

Second, I can't seem to save an array to a SESSION variable. I build the
array in a local variable and then set the SESSION variable equal to it.
When I recall the SESSION varialbe, it's contents is "Array". Then, when
I print_r() the SESSION variable, I still get "Array" as the contents.
What's up?
I doubt that references are the issue, but if they are you can do this:
$_SESSION['local'] = &$local;
Are you possibly emptying out the $local array some place?  Or are you 
emptying out the $_SESSION anywhere?  Heck, are you even sure that 
you're using the same session from request to request?  Or perhaps the 
process you use to build the $local and / or $_SESSION['local'] is 
flawed and not really building anything.

Thanx in advance for any help.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] if then else statement not working

2005-05-05 Thread bala chandar
On 5/5/05, Anasta <[EMAIL PROTECTED]> wrote:
> What am i doing wrong here, the output is always 'empty'
> 
>   $result = mysql_query("SELECT username FROM users
> WHERE seatnum='seat1'") or die(mysql_error());
> 
>   if (seatnum == seat1) {

you must use 

  if (seatnum == "seat1") {

> echo username;
> } else {
> echo 'empty';
> }
> ?>
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] joining in php development

2005-05-05 Thread Jason Barnett
Bala Chandar wrote:
Hey
On 5/5/05, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
well your statement doesnt make any sense
bala chandar wrote:

hi,
how to join in php development???

i want to develop some functions that is built in to the php. how to
contribute or join in its development/?



Fix some bugs and send the diff to php.internals newsgroup.
http://bugs.php.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: pear - make install fails (php5)

2005-05-05 Thread Jason Barnett
Gerold Kathan wrote:
...
Installing PHP CLI binary:/usr/local/php5/bin/
Installing PHP CLI man page:  /usr/local/php5/man/man1/
Installing PEAR environment:  /usr/local/php5/lib/php/
make[1]: *** [install-pear-installer] Segmentation fault
make: *** [install-pear] Error 2

=> it seams there is a problem with 2 pear installations ?
any hints appreciated,
greetings from vienna,
No answers, but some sympathy.  I have also had problems compiling PEAR 
for php5... I get a segfault when trying to build with cygwin environment.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: OO toturial

2005-05-05 Thread Jason Barnett
Khorosh Irani wrote:
hello
Can anyone tell me the url of a good toturial about object and php that contain:
polymorphism,Delegation,...?
Thanks
Google for "Gang of Four Programming"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] calling a derived static method from a base class

2005-05-05 Thread Mike Johnson
From: news [mailto:[EMAIL PROTECTED] On Behalf Of 

> 
>class Base  {
>   
>   static function f()   {
>  self::g();
>   }
> 
>   static function g()   {
>  print("Base\n");
>   }
>}
> 
>class Derived extends Base {
>   static function g()   {
>  print("Derived\n");
>   }
>}
> 
>Derived::f();
> 
> 
> I want that to print "Derived", but it prints "Base" instead. 
>  How can I get
> it to do what I want?
> 
> Thank for the help.

If you know the name of the extension class, you'd want to do this:


class Base {

static function f() {
Derived::g();
}

static function g() {
print("Base\n");
}
}

class Derived extends Base {
static function g() {
print("Derived\n");
}
}

Derived::f();


If you don't know if, though, you could possibly call it as a variable.
Perhaps something like this:


class Base {

static function f($classname) {
$classname::g();
}

static function g() {
print("Base\n");
}
}

class Derived extends Base {
static function g() {
print("Derived\n");
}
}

Derived::f('Derived');


Not sure if this is what you're looking for, but if not let us know.


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smartertravel.com
[EMAIL PROTECTED]   (617) 886-5539

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: if then else statement not working

2005-05-05 Thread Jason Barnett
Anasta wrote:
What am i doing wrong here, the output is always 'empty'


  if (seatnum == seat1) {
I think maybe you mean this:
if ($seatnum == 'seat1') {
Heck from the code above you won't even have a $seatnum variable, you'll 
have a $result variable with some MySQL information in it.  Read this:

http://php.net/manual/en/function.mysql-result.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP mail

2005-05-05 Thread bala chandar
Hi 

On 5/5/05, Aaron Gould <[EMAIL PROTECTED]> wrote:
> Eustace wrote:
> > I am relatively new to PHP and could use some help. I have a form, which is
> > basically in an email format, from, subject, and message. How do I then send
> > this to an email? I know a bit about the mail function, somebody show me the
> > ropes please!
> >
> > Eustace
> >
> 
> Everything you need to know should be gleamed from the following page:
> 
>  http://ca3.php.net/manual/en/function.mail.php

check this too
http://zend.com/codex.php?CID=11
> 
> Check the examples, and you'll be well on your way.
> 
> --
> Aaron Gould
> Programmer/Systems Administrator
> PARTS CANADA
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] form variables

2005-05-05 Thread bala chandar
hi

On 5/5/05, Anasta <[EMAIL PROTECTED]> wrote:
> Can anyone tell me how a submit button can be used to send set a variable so
> there is only a button --no textfield.
use value="" in the button html component 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] form variables

2005-05-05 Thread Petar Nedyalkov
On Thursday 05 May 2005 17:46, Anasta wrote:
> Can anyone tell me how a submit button can be used to send set a variable
> so there is only a button --no textfield.


Use hidden input fields.

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436


pgpwgBwu3MgP6.pgp
Description: PGP signature


[PHP] Flash&PHP Issue

2005-05-05 Thread Khorosh Irani
Hello
How I can get the width and height of a swf file with php?
Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Objects in Arrays (without the READ prompt)

2005-05-05 Thread Jason Petersen
Hi, 

I think you need to serialize your objects.

http://us3.php.net/manual/en/language.oop.serialization.php

Jason


On 5/5/05, Stuart Nielson <[EMAIL PROTECTED]> wrote:
> Sorry to everyone about the stupid READ notification on the posting.  I
> completely forgot that it was enabled.  This one shouldn't have that
> problem.
> 
> I am using PHP version 4.3.4.
> 
> I'm creating an authorization module that uses a users object, that
> includes the username, usertype, etc.  I want to store this in a session
> variable (i.e. $_SESSION['objects']['auth'] = new Authorization();) so
> that I can keep the information from page to page.  However, I get an
> error that it is an incomplete class everytime I try to access a
> function from the object like this:
> "$_SESSION['objects']['auth']->Login();".  It works fine when it's not
> stored in the array.  Is this a PHP 4 issue?  Or is there something I'm
> doing wrong?
> 
> Any pointers would be helpful.  If this doesn't work, I'll have to
> rework
> things to just store in arrays.
> 
> Stuart
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] OO toturial

2005-05-05 Thread Khorosh Irani
hello
Can anyone tell me the url of a good toturial about object and php that contain:
polymorphism,Delegation,...?
Thanks

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] control-M

2005-05-05 Thread David Christensen
I am?  That news to me???  I just did a 'grep nl2br form.php' and I
don't any output with nl2br.  I'm not sure this is what's going on.

I did see that function in the "Strings" section of the manual, but it
didn't do anything for me.

Thanks for your help,

Dave


On Thu, 2005-05-05 at 16:11 +0200, Marek Kilimajer wrote:
> David Christensen wrote:
> > Actually, I forgot to also mention that the browser is changing the
> > control-M (^M) from the query when it sets the default value for the
> > textarea to "".  I guess that is the HTML representation of the
> > ^M.
> 
> you are using nl2br() on the input, that funcion adds '' before 
> all newline characters.
> 
> > 
> > I'm currently using:
> > 
> > $_POST[$field] = str_replace("\r\n", "\n", $_POST[$field]);
> > $_POST[$field] = strip_tags($_POST[$field], '');
> > 
> > in a foreach loop for all the $_POST vars, but it's still not removing
> > it.
> > 
> > Dave
> > 
> > On Thu, 2005-05-05 at 10:12 +0200, Marek Kilimajer wrote:
> > 
> >>David Christensen wrote:
> >>
> >>>I know I'm missing something, but I can't seem to find it or figure it
> >>>out.  I've done the google search, and I've done a quick scan of the
> >>>list archives, but I can't seem to find the right way to remove
> >>>control-M from a form submission page with textarea fields.
> >>>
> >>>I have a series of "textarea" fields that can/and do contain the dreaded
> >>>^M characters.  For the life of me, I can't figure out how to remove
> >>>them before I save them to the database, and how to remove the ones that
> >>>are all ready stored there when I query them back to the browser from a
> >>>web page.  Also, if I do remove them, how do I make sure I format the
> >>>text correctly when I push it back to the browser as the default values
> >>>of these fields?
> >>>
> >>>Point me to the elixir of knowledge and let me bath in the fortitude of
> >>>a master regex expression to rid me once and for all of the dreaded
> >>>^M!!!
> >>>
> >>>Thank you, and good night!
> >>
> >>... = str_replace("\r\n", "\n", ...);
> >>
> >>But I don't see how this would infuence the default values of form 
> >>inputs, plain htmlspecialchars() should be enough.
> >>
> > 
> > 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Objects in Arrays (without the READ prompt)

2005-05-05 Thread Mathieu Dumoulin
Stuart Nielson wrote:
Sorry to everyone about the stupid READ notification on the posting.  I
completely forgot that it was enabled.  This one shouldn't have that
problem.
I am using PHP version 4.3.4.
I'm creating an authorization module that uses a users object, that
includes the username, usertype, etc.  I want to store this in a session
variable (i.e. $_SESSION['objects']['auth'] = new Authorization();) so
that I can keep the information from page to page.  However, I get an
error that it is an incomplete class everytime I try to access a
function from the object like this:
"$_SESSION['objects']['auth']->Login();".  It works fine when it's not
stored in the array.  Is this a PHP 4 issue?  Or is there something I'm
doing wrong?
Any pointers would be helpful.  If this doesn't work, I'll have to
rework 
things to just store in arrays.

Stuart
Objects can't be stored in sessions, what you could do is register a 
shutdown function using register_shutdown_function() and 
create a custom function that would use serialize() to serialize your 
object.

When the system starts a new you could unserialize() this session 
variable back into an array.

Mathieu
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PHP mail

2005-05-05 Thread Philip Hallstrom
I am relatively new to PHP and could use some help. I have a form, which is
basically in an email format, from, subject, and message. How do I then send
this to an email? I know a bit about the mail function, somebody show me the
ropes please!
See the example here:
http://us2.php.net/manual/en/function.mail.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] if then else statement not working

2005-05-05 Thread Anasta
What am i doing wrong here, the output is always 'empty'






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Objects in Arrays (without the READ prompt)

2005-05-05 Thread Stuart Nielson
Sorry to everyone about the stupid READ notification on the posting.  I
completely forgot that it was enabled.  This one shouldn't have that
problem.


I am using PHP version 4.3.4.

I'm creating an authorization module that uses a users object, that
includes the username, usertype, etc.  I want to store this in a session
variable (i.e. $_SESSION['objects']['auth'] = new Authorization();) so
that I can keep the information from page to page.  However, I get an
error that it is an incomplete class everytime I try to access a
function from the object like this:
"$_SESSION['objects']['auth']->Login();".  It works fine when it's not
stored in the array.  Is this a PHP 4 issue?  Or is there something I'm
doing wrong?

Any pointers would be helpful.  If this doesn't work, I'll have to
rework 
things to just store in arrays.

Stuart


Re: [PHP] PHP mail

2005-05-05 Thread Aaron Gould
Eustace wrote:
I am relatively new to PHP and could use some help. I have a form, which is
basically in an email format, from, subject, and message. How do I then send
this to an email? I know a bit about the mail function, somebody show me the
ropes please!
Eustace
Everything you need to know should be gleamed from the following page:
http://ca3.php.net/manual/en/function.mail.php
Check the examples, and you'll be well on your way.
--
Aaron Gould
Programmer/Systems Administrator
PARTS CANADA
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] calling a derived static method from a base class

2005-05-05 Thread Christopher J. Bottaro

   class Base  {
  
  static function f()   {
 self::g();
  }

  static function g()   {
 print("Base\n");
  }
   }

   class Derived extends Base {
  static function g()   {
 print("Derived\n");
  }
   }

   Derived::f();


I want that to print "Derived", but it prints "Base" instead.  How can I get
it to do what I want?

Thank for the help.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] php/osx and firebird

2005-05-05 Thread James
I've attempted to access a firebird database living on an 
osx/apache/php machine.

When I'm running the following script,

ini_set("magic_quotes_sybase", "On");
	$host = 
'localhost:/Library/Frameworks/Firebird.framework/Resources/examples/employee.fdb';
	$username = "sysdba";
	$password = "masterkey";


$dbh = ibase_connect($host, $username, $password);
	if (!($dbh=ibase_connect($host, 'sysdba', 'yourpass', 
'ISO8859_1', 0, 1)))
  		die('Could not connect: ' .  ibase_errmsg());

	$stmt = 'SELECT * FROM employee';
	$sth = ibase_query($dbh, $stmt);
	while ($row = ibase_fetch_object($sth)) {
	 echo $row->full_name, "\n";
	}
	ibase_free_result($sth);
	ibase_close($dbh);
	  
?>

I get the following error:
"Call to undefined function ibase_connect()"
How do I enable those functions?  I've looked at the php 
documentation (http://uk2.php.net/manual/en/ref.ibase.php )

"To enable InterBase support configure PHP --with-interbase[=DIR], 
where DIR is the InterBase base install directory, which defaults to 
/usr/interbase."
I've tried to add:
--with-interbase=/Library/Frameworks/Firebird.framework/Resources
to my php.ini and it didn't work.

Am I pointing to the wrong directory?  What other configuration/setup 
do I have to do to enable php's interbase functions?

Thanks.
--
-James

Re: [PHP] control-M

2005-05-05 Thread Marek Kilimajer
David Christensen wrote:
Actually, I forgot to also mention that the browser is changing the
control-M (^M) from the query when it sets the default value for the
textarea to "".  I guess that is the HTML representation of the
^M.
you are using nl2br() on the input, that funcion adds '' before 
all newline characters.

I'm currently using:
$_POST[$field] = str_replace("\r\n", "\n", $_POST[$field]);
$_POST[$field] = strip_tags($_POST[$field], '');
in a foreach loop for all the $_POST vars, but it's still not removing
it.
Dave
On Thu, 2005-05-05 at 10:12 +0200, Marek Kilimajer wrote:
David Christensen wrote:
I know I'm missing something, but I can't seem to find it or figure it
out.  I've done the google search, and I've done a quick scan of the
list archives, but I can't seem to find the right way to remove
control-M from a form submission page with textarea fields.
I have a series of "textarea" fields that can/and do contain the dreaded
^M characters.  For the life of me, I can't figure out how to remove
them before I save them to the database, and how to remove the ones that
are all ready stored there when I query them back to the browser from a
web page.  Also, if I do remove them, how do I make sure I format the
text correctly when I push it back to the browser as the default values
of these fields?
Point me to the elixir of knowledge and let me bath in the fortitude of
a master regex expression to rid me once and for all of the dreaded
^M!!!
Thank you, and good night!
... = str_replace("\r\n", "\n", ...);
But I don't see how this would infuence the default values of form 
inputs, plain htmlspecialchars() should be enough.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] form variables

2005-05-05 Thread Anasta
Can anyone tell me how a submit button can be used to send set a variable so
there is only a button --no textfield.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP mail

2005-05-05 Thread Mathieu Dumoulin
Eustace wrote:
I am relatively new to PHP and could use some help. I have a form, which is
basically in an email format, from, subject, and message. How do I then send
this to an email? I know a bit about the mail function, somebody show me the
ropes please!
Eustace
I'll show you how we do it here at work, its quite simple:
//Target message setup
$target_receptemail = 'insert email here';
$target_receptname = 'insert the targets name here';
$target_senderemail = 'insert your email here';
$target_sendername = 'insert your name here';
//Message body setup
//Target setup
$target_bodymsg = 'Insert content here';
$target_subjectmsg = 'Insert subject here';
//Build the headers
$headers = array(
'From: '.$target_sendername.' <'.$target_senderemail.'>',
'Content-Type: text/html'
);
//Send the mail
mail(
$target_receptemail,
$target_subjectmsg,
$target_bodymsg,
implode("\r\n", $headers)
);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] joining in php development

2005-05-05 Thread Angelo Zanetti
best is to get hold of the guys at www.php.net

bala chandar wrote:

>Hey
>
>On 5/5/05, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
>  
>
>>well your statement doesnt make any sense
>>
>>bala chandar wrote:
>>
>>
>>
>>>hi,
>>>
>>>how to join in php development???
>>>  
>>>
>
>i want to develop some functions that is built in to the php. how to
>contribute or join in its development/?
>
>  
>
>>>  
>>>
>
>
>  
>


[PHP] PHP mail

2005-05-05 Thread Eustace
I am relatively new to PHP and could use some help. I have a form, which is
basically in an email format, from, subject, and message. How do I then send
this to an email? I know a bit about the mail function, somebody show me the
ropes please!

Eustace


Re: [PHP] joining in php development

2005-05-05 Thread bala chandar
Hey

On 5/5/05, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
> well your statement doesnt make any sense
> 
> bala chandar wrote:
> 
> >hi,
> >
> >how to join in php development???

i want to develop some functions that is built in to the php. how to
contribute or join in its development/?

> >
> >
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5, mySQL and Win XP. I NEED HELP

2005-05-05 Thread bala chandar
hey

On 5/5/05, Oscar Andersson <[EMAIL PROTECTED]> wrote:
> I have made a instal of the latest mySQL and PHP 5 on my computer.
> I have made the following changes to my php.ini file
> 
> extension=php_mysql.dll
> extension_dir = "c:\php\"
> 
> and i have put the php_mysql. and libmysql.dll in c:\php\ and in c:\windows
> to
> 
> Now i try this in my php-file
> $con = mysql_connect("localhost:3306", "buddy", "bestbuddy");

stop the mysql server and restart and again run your php script. there
might be some disk space constraint all be there

> 
> I cant connect to mySQL. I dont know what is wrong. mySQL listen to port
> 3306. I have tried with my IP to. I get this warning
> Warning: mysql_connect() [function.mysql-connect]: Too many open links (0)
> in myfilename.php.
> 
> I hope for help
> Oscar Andersson
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] is this the correct syntax

2005-05-05 Thread Mathieu Dumoulin
Prathaban look carefully, we are here to give acurate info and you are 
giving mistaken information. The "$id" thing is wrong, you'll actually 
create a parse error X|

...
Prathaban Mookiah wrote:
It should be "$id".
Note that missing "
Prathap
-- Original Message ---
From: "Ross" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 12:09:18 +0100
Subject: [PHP] is this the correct syntax

Am trying to do an update of a record...
Is this the correct syntax..
$query= "UPDATE $table_name SET fname='$fname', sname='$sname' 
WHERE id= $id";

R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] need help on .htaccess

2005-05-05 Thread Greg Donald
On 5/5/05, Mathieu Dumoulin <[EMAIL PROTECTED]> wrote:
> We have here at work a simple .htaccess that redirects all requests to
> an index page which works fine so far. I'll show you the code of the
> .htaccess you can use it if you can't to, it works perfectly fine.
> 
> AddType application/x-httpd-php .html
> RewriteEngine on
> RewriteBase /
> RewriteRule ^$ - [QSA,L]
> RewriteRule ^.*\.gif$ - [L]
> RewriteRule ^.*\.jpg$ - [L]
> RewriteRule ^.*\.css$ - [L]
> RewriteRule ^.*\.png$ - [L]
> RewriteRule ^.*\.exe$ - [L]
> RewriteRule ^(.*)/$ index.html?virtual_path=$1 [QSA,L]
> RewriteRule ^(.*)$ index.html?virtual_path=$1 [QSA,L]
> RewriteRule ^(.*)/index.html$ index.html?virtual_path=$1 [QSA,L]
> 
> The major problem i have with this, is that we have a folder called
> /media and i want everything inside this folder to be [L] left alone.
> Right you can see we managed to do this using different extension but i
> got a dynamic module that allows people to upload/download pretty much
> anything from the media folder, so eventually some files are not of
> correcte extension and i get problems regarding a page that doesn't
> really exist in my engine or i just open the DB connection for nothing
> for instance.
> 
> I really suck a Regexp so i was wondering if people could help me find
> the exact regexp that will make everything in the /media dir completly
> [L] appart. I tried several things but doesn't work.


Put an .htaccess file in the media/ directory that says RewriteEngine off.


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] control-M

2005-05-05 Thread David Christensen
Joe, not sure you "str_replace" will work.  I think I need a way to
represent the ^M with an ASCII code.  The ^M character is a single
character.  If you type ^M that is 2 characters, caret + M.  They are
not equal ASCII-wise.

Dave


On Thu, 2005-05-05 at 03:11 -0400, Joe Wollard wrote:
> David,
> 
> Well, I've never seen this issue on a form submission before, but I
> have seen it (and other oddities) when editing text files in vi that
> we created on M$.  You might try something simple first such as:
>  $text = str_replace("^M\n\r", "\n\r", $_POST['textarea_name']);
> ?>
> 
> I haven't tested that but I'd give that a shot. If you're always
> getting the ^M before a line break this should work but I haven't
> tested it to be sure. Even if you have to modify it I would still use
> str_replace instead of a regular expression since you'll know exactly
> what/ where the string is that you want to get rid of.
> 
> If ^M isn't actually being detected as a literal string you would just
> replace it with the ASCii value inside of the chr() function.I
> think ;-)
> 
> Cheers!
> -Joe
> www.joewollard.com
> 
> 
> David Christensen wrote: 
> > I know I'm missing something, but I can't seem to find it or figure it
> > out.  I've done the google search, and I've done a quick scan of the
> > list archives, but I can't seem to find the right way to remove
> > control-M from a form submission page with textarea fields.
> > 
> > I have a series of "textarea" fields that can/and do contain the dreaded
> > ^M characters.  For the life of me, I can't figure out how to remove
> > them before I save them to the database, and how to remove the ones that
> > are all ready stored there when I query them back to the browser from a
> > web page.  Also, if I do remove them, how do I make sure I format the
> > text correctly when I push it back to the browser as the default values
> > of these fields?
> > 
> > Point me to the elixir of knowledge and let me bath in the fortitude of
> > a master regex expression to rid me once and for all of the dreaded
> > ^M!!!
> > 
> > Thank you, and good night!
> > 
> > "That's why I won't do 2 shows!  I won't do it!"
> > 
> >   

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Linking to the Root Dir - LAMP

2005-05-05 Thread Mathieu Dumoulin
Shaun wrote:
Hi,
I have a file called application.php and this file I define all of the 
directories in my site:

class object {};
$CFG = new object;
$CFG->wwwroot = http://www.mydomain.com;
$CFG->dirroot  = "/usr/home/myaccount/public_html";
$CFG->admindir = "$CFG->wwwroot/admin";
$CFG->claimsdir_adm = "$CFG->admindir/claims";
$CFG->clientsdir   = "$CFG->admindir/clients";
$CFG->cssdir = "$CFG->wwwroot/css";
$CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
$CFG->projectsdir   = "$CFG->admindir/projects";
$CFG->shoppingdir  = "$CFG->wwwroot/shopping";
...
This works very well and means if I change a directory name or move a 
directory I only have to update this file. application.php is included on 
every page so all I have to do to link to another directory would be 
something like:

Click here to add a category

The problem with this is that the URL's include the http://www.mydomain.com/ 
and are therefore not relative links. Is there a way to link to the root 
directory from wherever I am within the directory structure?

Thanks for your advice 
Just put a / in front of your folders. Instead of putting the whole 
domain name the slash in front of anything will refer to the root of the 
site while not statically putting the domain name.

Mathieu Dumoulin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How do I link to the root directory of the server?

2005-05-05 Thread Shaun
Sorry for double posting, these took an hour to appear in my newsreader and 
I thought there was a problem with the first one I sent

"Shaun" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi,
>
> I have a file called application.php and in this file I define all of the 
> directories in my site:
>
> class object {};
> $CFG = new object;
>
> $CFG->wwwroot = http://www.mydomain.com;
> $CFG->dirroot  = "/usr/home/myaccount/public_html";
>
> $CFG->admindir = "$CFG->wwwroot/admin";
> $CFG->claimsdir_adm = "$CFG->admindir/claims";
> $CFG->clientsdir   = "$CFG->admindir/clients";
> $CFG->cssdir = "$CFG->wwwroot/css";
> $CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
> $CFG->projectsdir   = "$CFG->admindir/projects";
> $CFG->shoppingdir  = "$CFG->wwwroot/shopping";
> ...
>
> This works very well and means if I change a directory name or move a 
> directory I only have to update this file. application.php is included on 
> every page so all I have to do to link to another directory would be 
> something like:
>
> Click here to add a category
>
> The problem with this is that the URL's include the 
> http://www.mydomain.com/ and are therefore not relative links. Is there a 
> way to link to the root directory from wherever I am within the directory 
> structure?
>
> Thanks for your advice 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] control-M

2005-05-05 Thread David Christensen
These aren't text files, there form fields from a browser and fields
from query.  I don't think dos2unix will be of much help with this.

Dave


On Thu, 2005-05-05 at 09:07 +0300, Petar Nedyalkov wrote:
> On Thursday 05 May 2005 06:13, David Christensen wrote:
> > I know I'm missing something, but I can't seem to find it or figure it
> > out.  I've done the google search, and I've done a quick scan of the
> > list archives, but I can't seem to find the right way to remove
> > control-M from a form submission page with textarea fields.
> >
> > I have a series of "textarea" fields that can/and do contain the dreaded
> > ^M characters.  For the life of me, I can't figure out how to remove
> > them before I save them to the database, and how to remove the ones that
> > are all ready stored there when I query them back to the browser from a
> > web page.  Also, if I do remove them, how do I make sure I format the
> > text correctly when I push it back to the browser as the default values
> > of these fields?
> 
> There's a tool called dos2unix - use it.
> 
> >
> > Point me to the elixir of knowledge and let me bath in the fortitude of
> > a master regex expression to rid me once and for all of the dreaded
> > ^M!!!
> >
> > Thank you, and good night!
> >
> > "That's why I won't do 2 shows!  I won't do it!"
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] joining in php development

2005-05-05 Thread Angelo Zanetti
well your statement doesnt make any sense

bala chandar wrote:

>hi,
>
>how to join in php development???
>  
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] control-M

2005-05-05 Thread David Christensen
Actually, I forgot to also mention that the browser is changing the
control-M (^M) from the query when it sets the default value for the
textarea to "".  I guess that is the HTML representation of the
^M.

I'm currently using:

$_POST[$field] = str_replace("\r\n", "\n", $_POST[$field]);
$_POST[$field] = strip_tags($_POST[$field], '');

in a foreach loop for all the $_POST vars, but it's still not removing
it.

Dave

On Thu, 2005-05-05 at 10:12 +0200, Marek Kilimajer wrote:
> David Christensen wrote:
> > I know I'm missing something, but I can't seem to find it or figure it
> > out.  I've done the google search, and I've done a quick scan of the
> > list archives, but I can't seem to find the right way to remove
> > control-M from a form submission page with textarea fields.
> > 
> > I have a series of "textarea" fields that can/and do contain the dreaded
> > ^M characters.  For the life of me, I can't figure out how to remove
> > them before I save them to the database, and how to remove the ones that
> > are all ready stored there when I query them back to the browser from a
> > web page.  Also, if I do remove them, how do I make sure I format the
> > text correctly when I push it back to the browser as the default values
> > of these fields?
> > 
> > Point me to the elixir of knowledge and let me bath in the fortitude of
> > a master regex expression to rid me once and for all of the dreaded
> > ^M!!!
> > 
> > Thank you, and good night!
> 
> ... = str_replace("\r\n", "\n", ...);
> 
> But I don't see how this would infuence the default values of form 
> inputs, plain htmlspecialchars() should be enough.
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: is this the correct syntax

2005-05-05 Thread Mathieu Dumoulin
Ross wrote:
Am trying to do an update of a record...
Is this the correct syntax..
 $query= "UPDATE $table_name SET fname='$fname', sname='$sname' WHERE id= 
$id";

R. 
Technically this is right as long as your variables are giving out the 
real intented values.

For extra knowledge, your $query should look something like this to make 
it secure:

$query = 'Update `'.mysql_escape_string($table_name).'` SET fname = 
"'.mysql_escape_string($fname).'", sname = 
"'.mysql_escape_string($sname).'" WHERE id = 
"'.mysql_escape_string($id).'"';

Now the mysql_escape_string is used to escape ' and " characters in your 
string in case they are not already escape which may cause a security 
hole in your code. Also note that you should place "" around all values 
in your SQL string even for numeric values in case your data was sent an 
incorrect text value (Which you should filter beforehand but that's up 
to you)

Finally, for even more security, you should use $_POST[] or $_GET[] 
arrays if the above values come from a form, if they are calculated or 
extracted from something else don't mind this.

PS: i forgot about the `` around table and field names, this prevents 
mysql of interpreting a word in your SQL as a keyword, for example, 
using `` you can easily use `date` as a table or field name (not 
recommended) but it will allow to bypass the keyword DATE.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Socket connection reset by pear

2005-05-05 Thread =?iso-8859-1?q?Mart=EDn_Marqu=E9s?=
I'm trying to build some communication aside of the server thin client stuff, 
with a socket daemon and a socket client.

The daemon is the same that everybody can find in the PHP docs (example 1). 
The client simply opens a connection to the daemon and writes data using the 
socket Object from PEAR (last stable version). The problem is that it fails 
to make a socket_read() with this message (on the daemon side):

Warning: socket_read() unable to read from socket [54]: Connection reset by 
peer 
in /space/home/martin/programacion/siprebi-1.2/ext/impresion/printSocket.php 
on line 42
socket_read() failed: reason: Operation not permitted


If I open a telnet conection to the daemon, everything works like a charme. It 
writes and quits OK.

What can be going wrong?

-- 
 09:11:45 up 33 days, 17:40,  1 user,  load average: 0.64, 0.79, 0.68
-
Martín Marqués| select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica  |  DBA, Programador, Administrador
 Universidad Nacional
  del Litoral
-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] is this the correct syntax

2005-05-05 Thread Prathaban Mookiah
It should be "$id".

Note that missing "


Prathap


-- Original Message ---
From: "Ross" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 12:09:18 +0100
Subject: [PHP] is this the correct syntax

> Am trying to do an update of a record...
> 
> Is this the correct syntax..
> 
>  $query= "UPDATE $table_name SET fname='$fname', sname='$sname' 
> WHERE id= $id";
> 
> R.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5, mySQL and Win XP. I NEED HELP

2005-05-05 Thread Oscar Andersson
I have made a instal of the latest mySQL and PHP 5 on my computer.
I have made the following changes to my php.ini file

extension=php_mysql.dll
extension_dir = "c:\php\"

and i have put the php_mysql. and libmysql.dll in c:\php\ and in c:\windows 
to

Now i try this in my php-file
$con = mysql_connect("localhost:3306", "buddy", "bestbuddy");

I cant connect to mySQL. I dont know what is wrong. mySQL listen to port 
3306. I have tried with my IP to. I get this warning
Warning: mysql_connect() [function.mysql-connect]: Too many open links (0) 
in myfilename.php.


I hope for help
Oscar Andersson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Linking to the Root Dir - LAMP

2005-05-05 Thread Shaun
Hi,

I have a file called application.php and this file I define all of the 
directories in my site:

class object {};
$CFG = new object;

$CFG->wwwroot = http://www.mydomain.com;
$CFG->dirroot  = "/usr/home/myaccount/public_html";

$CFG->admindir = "$CFG->wwwroot/admin";
$CFG->claimsdir_adm = "$CFG->admindir/claims";
$CFG->clientsdir   = "$CFG->admindir/clients";
$CFG->cssdir = "$CFG->wwwroot/css";
$CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
$CFG->projectsdir   = "$CFG->admindir/projects";
$CFG->shoppingdir  = "$CFG->wwwroot/shopping";
...

This works very well and means if I change a directory name or move a 
directory I only have to update this file. application.php is included on 
every page so all I have to do to link to another directory would be 
something like:

Click here to add a category

The problem with this is that the URL's include the http://www.mydomain.com/ 
and are therefore not relative links. Is there a way to link to the root 
directory from wherever I am within the directory structure?

Thanks for your advice 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] How do I link to the root directory of the server?

2005-05-05 Thread Shaun
Hi,

I have a file called application.php and in this file I define all of the 
directories in my site:

class object {};
$CFG = new object;

$CFG->wwwroot = http://www.mydomain.com;
$CFG->dirroot  = "/usr/home/myaccount/public_html";

$CFG->admindir = "$CFG->wwwroot/admin";
$CFG->claimsdir_adm = "$CFG->admindir/claims";
$CFG->clientsdir   = "$CFG->admindir/clients";
$CFG->cssdir = "$CFG->wwwroot/css";
$CFG->expense_categoriesdir = "$CFG->admindir/expense_categories";
$CFG->projectsdir   = "$CFG->admindir/projects";
$CFG->shoppingdir  = "$CFG->wwwroot/shopping";
...

This works very well and means if I change a directory name or move a 
directory I only have to update this file. application.php is included on 
every page so all I have to do to link to another directory would be 
something like:

Click here to add a category

The problem with this is that the URL's include the http://www.mydomain.com/ 
and are therefore not relative links. Is there a way to link to the root 
directory from wherever I am within the directory structure?

Thanks for your advice

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Question about acessing databases and formatting output

2005-05-05 Thread The Doctor
On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote:
> hi,
> 
> On 5/5/05, The Doctor <[EMAIL PROTECTED]> wrote:
> > This is probably easy, but how does
> > one access a database, mysql or oracle or postgresql,
> > and
> > present the data in a tabular format?
> > 
> > --
> > Member - Liberal International
> > This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
> > God Queen and country! Beware Anti-Christ rising!
> > UK as 5 May 2005 approaches, vote LDem!!
> > 
> 
> check out http://in2.php.net/mysql
>

Looks good to me.
 
> -- 
> bala> balachandar muruganantham
> blog> lynx http://chandar.blogspot.com
> web> http://www.chennaishopping.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
Member - Liberal International  
This is [EMAIL PROTECTED]   Ici [EMAIL PROTECTED]
God Queen and country! Beware Anti-Christ rising!
UK as 5 May 2005 approaches, vote LDem!!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Error suppression operator (@)

2005-05-05 Thread Rory Browne
ditto everyone who said use it if you don't care about errors, but
don't use it in places where you expect errors.

Also don't use it in places where it can be avoided with minimal cost.

For example if you have an optional field, and people usually fill it
in, and rarely leave it empty, then you could use the @ operator then.
Otherwise, if people rarely fill it in and it's causing E_NOTICE
errors frequently then, I'd do some standard error checking instead.

I don't have benchmarks to support this theory(which will probably be
discredited soon), but I've read somewhere that errors(even
E_NOTICES), seriously slow a script down.

Sorry Colin for your receiving this twice.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] joining in php development

2005-05-05 Thread bala chandar
hi,

how to join in php development???
-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] need help on .htaccess

2005-05-05 Thread Mathieu Dumoulin
We have here at work a simple .htaccess that redirects all requests to 
an index page which works fine so far. I'll show you the code of the 
.htaccess you can use it if you can't to, it works perfectly fine.

AddType application/x-httpd-php .html
RewriteEngine on
RewriteBase /
RewriteRule ^$ - [QSA,L]
RewriteRule ^.*\.gif$ - [L]
RewriteRule ^.*\.jpg$ - [L]
RewriteRule ^.*\.css$ - [L]
RewriteRule ^.*\.png$ - [L]
RewriteRule ^.*\.exe$ - [L]
RewriteRule ^(.*)/$ index.html?virtual_path=$1 [QSA,L]
RewriteRule ^(.*)$ index.html?virtual_path=$1 [QSA,L]
RewriteRule ^(.*)/index.html$ index.html?virtual_path=$1 [QSA,L]
The major problem i have with this, is that we have a folder called 
/media and i want everything inside this folder to be [L] left alone. 
Right you can see we managed to do this using different extension but i 
got a dynamic module that allows people to upload/download pretty much 
anything from the media folder, so eventually some files are not of 
correcte extension and i get problems regarding a page that doesn't 
really exist in my engine or i just open the DB connection for nothing 
for instance.

I really suck a Regexp so i was wondering if people could help me find 
the exact regexp that will make everything in the /media dir completly 
[L] appart. I tried several things but doesn't work.

Thanks in advance.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] insert not working

2005-05-05 Thread Mark Rees
-Original Message-
From: Ross [mailto:[EMAIL PROTECTED] 
Sent: 05 May 2005 10:16
To: php-general@lists.php.net
Subject: [PHP] insert not working


 $query = "INSERT INTO sheet1 (title, fname, sname, job_title,
organisation, 
street, postcode, city, telephone, mobile, fax, email, web, add_info)
VALUES 
('$title', '$fname', '$sname', '$job_title', '$organisation', '$street',

'$postcode', '$city', '$telephone', '$mobile', '$fax', '$email', '$web',

'$add_info')";

   $result= mysql_query($query);
  if($result){
  echo "sucess";
  }

why yould this not work? I can retrievethe data but not write any data
to 
the database??

http://uk2.php.net/manual/en/function.mysql-query.php

Does the account you are using have INSERT permission on the database?
Does the insert statement work in mySQL's query window?

R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: How to declare Vars in PHP?

2005-05-05 Thread Rory Browne
Next time you double post(I'm assuming by accident), could you reply
to one, of the posts declaring it void, and point people to the other,
so that you don't have two people answering the same question in two
different threads.

On 5/5/05, Ryan Faricy <[EMAIL PROTECTED]> wrote:
> 
> "Jon M." <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >I know it's not necessary, but I still want to know how.
> >
> >
> > I know in JavaScript, that you declare vars like so:
> >
> > var = variableName;
> >
> > So I'm assuming that in PHP you do it like this:
> >
> > var = $variableName;
> >
> > But there doesn't seem to be a single shred of documentation on PHP.net
> > (or in ANY book) that covers this. All they say is that it's good
> > practice, but not necessary. Then they always skip telling you how.
> >
> > I always like to declare vars since it helps me keep track of the vars I
> > will be using, and I just like to do things right.
> >
> > So am I right about how you do it? "Yes", "No", example please??
> >
> >
> > -Jon
> 
> It is good practice to define your variables (i.e., set them to 0, or empty,
> etc) at the beginning of a script, for security and reliability reasons.
> 
> With PHP however, there technically is no definition of variables as in
> other languages such as Java or BASIC. To define a variable in PHP simply
> requires a $variableName = ''; or $variableName = 0; or $variableName =
> empty; etc etc. A variable is defined as soon as a value is set for it,
> therefore to define a variable, simply give it a value.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] insert not working

2005-05-05 Thread bala chandar
Hi,

On 5/5/05, Ross <[EMAIL PROTECTED]> wrote:
>  $query = "INSERT INTO sheet1 (title, fname, sname, job_title, organisation,
> street, postcode, city, telephone, mobile, fax, email, web, add_info) VALUES
> ('$title', '$fname', '$sname', '$job_title', '$organisation', '$street',
> '$postcode', '$city', '$telephone', '$mobile', '$fax', '$email', '$web',
> '$add_info')";
> 
>$result= mysql_query($query);
>   if($result){
>   echo "sucess";
>   }
> 
> why yould this not work? I can retrievethe data but not write any data to
> the database??

Please mention the error message clearly. what error are you getting. 

I think there might be some data type mismatch between ur php code and
mysql data type


> R.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Fwd: [PHP] Re: How do you declare Vars in PHP? -I know it's not necessary, but I still want to know

2005-05-05 Thread Rory Browne
Otherwise you can 'declare' them by assigning them a null/zero/empty value.

$my_number = 0;
$my_string = ""
$my_array = array();

The main reason for 'declaring' variables in PHP, is so that you can
use them in functions without raising an E_NOTICE.


On 5/5/05, Ryan Faricy <[EMAIL PROTECTED]> wrote:
>
> "Jon M." <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> >I just found a place here:
> >
> > http://us2.php.net/manual/en/language.oop.php
> >
> > That has this example:
> >
> > /* This is how it should be done. */
> > class Cart {
> >   var $todays_date;
> >   var $name;
> >   var $owner;
> >   var $items = array("VCR", "TV");
> >
> >   function Cart() {
> >   $this->todays_date = date("Y-m-d");
> >   $this->name = $GLOBALS['firstname'];
> >   /* etc. . . */
> >   }
> > }
> >
> > It appears that they are declaring vars like this:
> >
> > var $todays_date;
> >
> >
> > Is this something you can only do inside a class???
>
> Yes, as has been said within this thread several times.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multi dimensional array

2005-05-05 Thread bala chandar
hi,

On 5/5/05, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
> Hi guys,
> 
> I have a problem where I use a multi dimensional array on one server and
> now have moved it to another server and it just doesnt work:
> 
> $result2 = $userdb->listUsers($clubID);
> $i=0;
> 
> while ( $row2 = mysql_fetch_array($result2) )
> {
> //echo $row2['firstname'];
> $user[$i]['firstname']=$row2['firstname'];
> $user[$i]['lastname']=$row2['lastname'];
> $user[$i]['userid']=$row2['userid'];
> $i++;
>}
> 
> the loop is definitely getting the values from the database as i can see
> them when I echo out the recordset variables ($row[)
> 

try explicityly declaring the array variables

$user[] = array();

> I'm thinking that there is some sort of configuration issue here with
> the other server. Its running Apache 1 and the server that works is
> running Apache 2.
> I've tried single and double quotes and neither work, does anybody else
> know what can be causing this not to assign the value to the
> multidimensional array?
> 
> AFAIK both servers have register_globals OFF
> 
> TIA
> 
> --
> 
> Angelo Zanetti
> Z Logic
> www.zlogic.co.za
> [c] +27 72 441 3355
> [t] +27 21 469 1052
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] re: insert not working

2005-05-05 Thread Ross
Just a type error

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] is this the correct syntax

2005-05-05 Thread Ross
Am trying to do an update of a record...

Is this the correct syntax..

 $query= "UPDATE $table_name SET fname='$fname', sname='$sname' WHERE id= 
$id";

R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] insert not working

2005-05-05 Thread Prathaban Mookiah
Did you check for proper permissions in the user and db tables in the user 
database?

Prathap


-- Original Message ---
From: "Ross" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 10:15:52 +0100
Subject: [PHP] insert not working

> $query = "INSERT INTO sheet1 (title, fname, sname, job_title, 
> organisation, street, postcode, city, telephone, mobile, fax, email, 
> web, add_info) VALUES 
> ('$title', '$fname', '$sname', '$job_title', '$organisation',
>  '$street', '$postcode', '$city', '$telephone', '$mobile', '$fax', 
> '$email', '$web', '$add_info')";
> 
>$result= mysql_query($query);
>   if($result){
>   echo "sucess";
>   }
> 
> why yould this not work? I can retrievethe data but not write any 
> data to the database??
> 
> R.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [SOLVED] Function shall receive Pointer to Array

2005-05-05 Thread Fred Rathke
Thanks, Chris. You have been right. It worked already. I still remove 
all my typing errors in the original version. For this list I wrote a 
new version of it. Should have tried it first.

Sorry.
Greatings
*I should not work after midnight*
Liebe Grüße
Fred Rathke
[EMAIL PROTECTED]
http://communicationrational.de/kontakt/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] insert not working

2005-05-05 Thread Marek Kilimajer
Ross wrote:
 $query = "INSERT INTO sheet1 (title, fname, sname, job_title, organisation, 
street, postcode, city, telephone, mobile, fax, email, web, add_info) VALUES 
('$title', '$fname', '$sname', '$job_title', '$organisation', '$street', 
'$postcode', '$city', '$telephone', '$mobile', '$fax', '$email', '$web', 
'$add_info')";

   $result= mysql_query($query);
  if($result){
  echo "sucess";
  }
else {
echo mysql_error() . "\n$query";
}
why yould this not work? I can retrievethe data but not write any data to 
the database??

R. 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] select statement

2005-05-05 Thread Prathaban Mookiah
Maybe the query should be

select user_balance FROM users WHERE user_id="$uname";

Prathap

-- Original Message ---
From: "Anasta" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Sent: Thu, 5 May 2005 16:10:35 +0800
Subject: [PHP] select statement

> Why doesnt this work, it shows the username but not the balance of 
> the users money.here is the mysql table:
> 
> CREATE TABLE `users` (
>   `user_id` int(11) NOT NULL auto_increment,
>   `username` varchar(15) NOT NULL default '',
>   `password` varchar(15) NOT NULL default '',
>   `status` varchar(10) NOT NULL default '',
>   `user_balance` bigint(5) NOT NULL default '0',
>   PRIMARY KEY  (`user_id`)
> ) TYPE=MyISAM AUTO_INCREMENT=3 ;
> 
> /
>  include("connect.php");
> $uname=$_SESSION['username'];
> $user_balance=mysql_query($sql);
> $sql = "Select  FROM users ,user_balance WHERE user_id =$uname";
> $result = mysql_query();
> 
> ?>
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End of Original Message ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] multi dimensional arraySOLVED

2005-05-05 Thread Angelo Zanetti
this is quite weird but apparently on the one server if you user $user
as a variable name thats what causes the problem.
I simply renamed my variable to something else and it worked, I find it
strange that it worked on 1 server and not the other, is it possible
that the different apache versions are responsible for this situation??

TIA


Angelo Zanetti wrote:

>Hi guys,
>
>I have a problem where I use a multi dimensional array on one server and
>now have moved it to another server and it just doesnt work:
>
>$result2 = $userdb->listUsers($clubID);
>$i=0;
>
>while ( $row2 = mysql_fetch_array($result2) )
>{
>//echo $row2['firstname'];
>$user[$i]['firstname']=$row2['firstname'];
>$user[$i]['lastname']=$row2['lastname'];
>$user[$i]['userid']=$row2['userid'];   
>$i++;
>   }
>
>the loop is definitely getting the values from the database as i can see
>them when I echo out the recordset variables ($row[)
>
>I'm thinking that there is some sort of configuration issue here with
>the other server. Its running Apache 1 and the server that works is
>running Apache 2.
>I've tried single and double quotes and neither work, does anybody else
>know what can be causing this not to assign the value to the
>multidimensional array?
>
>AFAIK both servers have register_globals OFF
>
>TIA
>
>  
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How to declare Vars in PHP?

2005-05-05 Thread Jon M.
OK, thanks everyone.



(BTW -I actually meant to say 'var $varName;' in PHP and 'var varName;' in 
JavaScript -doh!)



Anyway, my question has been thoroughly answered, and I completely 
understand now.



I did try the "var $varName;" outside a class, just to see what happened, 
and found out it does indeed throw a parse error, so I'll just use a comment 
as Mr. Rasmus suggested. I wonder why "Beginning PHP 5 and MySQL from Novice 
to Professional by W. Jason Gilmore" says to declare them? I guess he just 
meant by assigning a value like: $varName = Null or something. I just have 
to get used to this new way of "declaring" -lol.



And thanks especially Ryan. That is a very informational answer, and gives 
me a much deeper insight into why PHP doesn't allow an actual definition, 
than any other resource/explanation I have ever seen! Thank you VERY much 
for taking the time to write that, I am the kind of person who wants to 
completely understand a subject (not just "how", but, "why" as well), and 
now I completely understand this particular part of PHP.



-Jon






"Ryan Faricy" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> "Jon M." <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>>I know it's not necessary, but I still want to know how.
>>
>>
>> I know in JavaScript, that you declare vars like so:
>>
>> var = variableName;
>>
>> So I'm assuming that in PHP you do it like this:
>>
>> var = $variableName;
>>
>> But there doesn't seem to be a single shred of documentation on PHP.net 
>> (or in ANY book) that covers this. All they say is that it's good 
>> practice, but not necessary. Then they always skip telling you how.
>>
>> I always like to declare vars since it helps me keep track of the vars I 
>> will be using, and I just like to do things right.
>>
>> So am I right about how you do it? "Yes", "No", example please??
>>
>>
>> -Jon
>
> It is good practice to define your variables (i.e., set them to 0, or 
> empty, etc) at the beginning of a script, for security and reliability 
> reasons.
>
> With PHP however, there technically is no definition of variables as in 
> other languages such as Java or BASIC. To define a variable in PHP simply 
> requires a $variableName = ''; or $variableName = 0; or $variableName = 
> empty; etc etc. A variable is defined as soon as a value is set for it, 
> therefore to define a variable, simply give it a value. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XSL:FO + PHP

2005-05-05 Thread rouvas
On Wednesday 04 May 2005 22:30, Dan Rossi wrote:
> On 05/05/2005, at 1:47 AM, Kristen G. Thorson wrote:
> > Dan,
> >
> > I have done this before, but it was only a proof-of concept excercise
> > for me, so my procedure may not work for you.  My test was against an
> > Amazon web service and generating a PDF from the XML returned to me.
> >
> > This method used Apache's FOP.  Before executing the following code, I
> > saved the XML returned from Amazon as a temp file ($xmlfile).
> >
> >  $PDFfile = "$xmlfile.pdf";
> >  $callstring = "$FOPpath/fop.sh -xsl $xslforoot/$xslfofile -xml
> > $xmlfile -pdf $PDFfile";
> >  $answer = shell_exec( $callstring );
> >  header( "Content-type: $ctype" );
> >  $pieces = explode( "/", $xmlfile );
> >  header( "Content-Disposition: attachment; filename=".$pieces[ count(
> > $pieces )-1 ] );
> >  readfile( "$xmlfile.pdf" );
> >
> >
> > I hope this is helpful to you,
> > kgt
>
> Hi yes this is exactly what i may have to do. I have  tried all the
> usual outlets in terms of subclasses of FPDF , all are limited and
> crappy, it just cant do tables properly. The closest I got was with
> PDML however it was still tedious to build a table with ! Now I think
> processing for such a command line would take forever this is what I
> need to do, a print button displays on the header of a form entry. What
> i need to do is collect the data from that database entry and display
> it as a view with the data rather than the form and make it printable
> in a pdf. This ideally means generate xml from the db entry, save it as
> a file, execute commandline with temp xml file, readfile the pdf. I
> dont think it should take too long to output to the browser right ? I
> think a step i'd like to skip is the readfile, and work out how to send
> to standard output and use passthru ?
>
> In the past I have used an app called HTMLDoc, its the bomb for making
> pdf manuals with chapters and table of contents. It also requires
> saving a temp html file and then sends the pdf as standard output.
> However HTMLDoc is not free anymore, I only have one licence for that
> to make docs only.

Have you tried this? It seems HTMLDoc is still free... I've used that tool 
also... pretty satisfied.

http://www.htmldoc.org/software.php

-Stathis

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Thanks, I understand now

2005-05-05 Thread Jon M.
OK, thanks everyone.



My question has been thoroughly answered, and I completely understand now.



I did try the "var $varName;" outside a class, just to see what happened, 
and found out it does indeed throw a parse error, so I'll just use a comment 
as suggested. I wonder why "Beginning PHP 5 and MySQL from Novice to 
Professional by W. Jason Gilmore" says to declare them? I guess he just 
meant by assigning a value like: $varName = "Null" or something. I just have 
to get used to this new way of "declaring" -lol.



-Jon



"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Jon M. wrote:
>> So, are you saying that it is absolutely "PHP-illegal" to do:
>
> Yes, it is illegal.  Inside a class definition you can define properties
> like this, but for regular variables it is simply not supported.  And it
> makes no sense.  If you can't stop your hands from typing this stuff, do
> this:
>
> #var $varName;
>
> -Rasmus 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] select statement

2005-05-05 Thread bala chandar
On 5/5/05, Anasta <[EMAIL PROTECTED]> wrote:
> Why doesnt this work, it shows the username but not the balance of the users
> money.here is the mysql table:
> 
> CREATE TABLE `users` (
>   `user_id` int(11) NOT NULL auto_increment,
>   `username` varchar(15) NOT NULL default '',
>   `password` varchar(15) NOT NULL default '',
>   `status` varchar(10) NOT NULL default '',
>   `user_balance` bigint(5) NOT NULL default '0',
>   PRIMARY KEY  (`user_id`)
> ) TYPE=MyISAM AUTO_INCREMENT=3 ;
> 
> /
>  include("connect.php");
> $uname=$_SESSION['username'];
> $user_balance=mysql_query($sql);
> $sql = "Select  FROM users ,user_balance WHERE user_id =$uname";

you should write

$sql = "Select user_balance  FROM users  WHERE user_id =$uname";

> $result = mysql_query();
> 
> ?>
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
bala> balachandar muruganantham
blog> lynx http://chandar.blogspot.com
web> http://www.chennaishopping.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] insert not working

2005-05-05 Thread Ross
 $query = "INSERT INTO sheet1 (title, fname, sname, job_title, organisation, 
street, postcode, city, telephone, mobile, fax, email, web, add_info) VALUES 
('$title', '$fname', '$sname', '$job_title', '$organisation', '$street', 
'$postcode', '$city', '$telephone', '$mobile', '$fax', '$email', '$web', 
'$add_info')";

   $result= mysql_query($query);
  if($result){
  echo "sucess";
  }

why yould this not work? I can retrievethe data but not write any data to 
the database??

R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: php5-mysqli

2005-05-05 Thread Ryan Faricy
"Nsk" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

> which config files are responsible for loading mysqli in apache/php5 ?

php.ini

;; Old MySQL support
extension=mysql.so
;; New MySQL support.
extension=mysqli.so

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] multi dimensional array

2005-05-05 Thread Angelo Zanetti
Hi guys,

I have a problem where I use a multi dimensional array on one server and
now have moved it to another server and it just doesnt work:

$result2 = $userdb->listUsers($clubID);
$i=0;

while ( $row2 = mysql_fetch_array($result2) )
{
//echo $row2['firstname'];
$user[$i]['firstname']=$row2['firstname'];
$user[$i]['lastname']=$row2['lastname'];
$user[$i]['userid']=$row2['userid'];   
$i++;
   }

the loop is definitely getting the values from the database as i can see
them when I echo out the recordset variables ($row[)

I'm thinking that there is some sort of configuration issue here with
the other server. Its running Apache 1 and the server that works is
running Apache 2.
I've tried single and double quotes and neither work, does anybody else
know what can be causing this not to assign the value to the
multidimensional array?

AFAIK both servers have register_globals OFF

TIA

-- 

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How do you declare Vars in PHP? -I know it's not necessary, but I still want to know

2005-05-05 Thread Ryan Faricy

"Jon M." <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I just found a place here:
>
> http://us2.php.net/manual/en/language.oop.php
>
> That has this example:
>
> /* This is how it should be done. */
> class Cart {
>   var $todays_date;
>   var $name;
>   var $owner;
>   var $items = array("VCR", "TV");
>
>   function Cart() {
>   $this->todays_date = date("Y-m-d");
>   $this->name = $GLOBALS['firstname'];
>   /* etc. . . */
>   }
> }
>
> It appears that they are declaring vars like this:
>
> var $todays_date;
>
>
> Is this something you can only do inside a class???

Yes, as has been said within this thread several times. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: How to declare Vars in PHP?

2005-05-05 Thread Ryan Faricy

"Jon M." <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I know it's not necessary, but I still want to know how.
>
>
> I know in JavaScript, that you declare vars like so:
>
> var = variableName;
>
> So I'm assuming that in PHP you do it like this:
>
> var = $variableName;
>
> But there doesn't seem to be a single shred of documentation on PHP.net 
> (or in ANY book) that covers this. All they say is that it's good 
> practice, but not necessary. Then they always skip telling you how.
>
> I always like to declare vars since it helps me keep track of the vars I 
> will be using, and I just like to do things right.
>
> So am I right about how you do it? "Yes", "No", example please??
>
>
> -Jon

It is good practice to define your variables (i.e., set them to 0, or empty, 
etc) at the beginning of a script, for security and reliability reasons.

With PHP however, there technically is no definition of variables as in 
other languages such as Java or BASIC. To define a variable in PHP simply 
requires a $variableName = ''; or $variableName = 0; or $variableName = 
empty; etc etc. A variable is defined as soon as a value is set for it, 
therefore to define a variable, simply give it a value. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Tracking what has been changed

2005-05-05 Thread Mark Rees
-Original Message-
From: Robb Kerr [mailto:[EMAIL PROTECTED] 
Sent: 05 May 2005 00:29
To: php-general@lists.php.net
Subject: [PHP] Tracking what has been changed


Here's the scenario...

I am building a site in which users will be able to create and then
later edit personal information. When they edit their information, I
need to keep track of what was changed so that I can inform via email a
person to approve the changes. Here's the flow I'm considering...

When an UPDATE page is loaded, I build an array like...

$fields = array("table.field1" => value, "table.field2" => value,
"table.field3" => value)

I then plan to save this array to a SESSION variable. Then, when the
form is posted I save the new form contents to another SESSION variable.
Then I compare the two arrays and save the names of the fields changed
to an array saved in a third SESSION variable. Finally, when I build the
email, I can parse the changed fields array to inform the person who
must approve the changes.

First, does anyone have a suggestion of a better way to do this? 
--
How long do you expect people to take to approve the changes? What
happens if they don't approve them? What if they are on holiday? What if
someone changes the data, then someone else makes another change, then
the person who approves them approves the first change?

I would recommend storing the change information in a db. 
Say you have a table t_personal_info

Id
firstName
surName
Telephonenumber
dateUpdated

You can then have another table 
t_personal_info_pending
With an additional field changeid (to handle multiple changes to the
same record)

With the same fields. When someone approves a change, update
t_personal_info with the change and delete the record from
t_personal_info_pending


Second, I can't seem to save an array to a SESSION variable. I build the
array in a local variable and then set the SESSION variable equal to it.
When I recall the SESSION varialbe, it's contents is "Array". Then, when
I print_r() the SESSION variable, I still get "Array" as the contents.
What's up?

Thanx in advance for any help.
-- 
Robb Kerr
Digital IGUANA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, 
Cisco, Sun Microsystems, 3Com

GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 
2000' REGISTERED COMPANY

**

CONFIDENTIALITY NOTICE:

This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.

GENERAL STATEMENT:

Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no 
content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order,  subject to our Terms and Conditions available from 
http://www.gammaglobal.com

E&OE

**
**

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] pear - make install fails (php5)

2005-05-05 Thread gerold kathan
hi - i am running into troubles:
i have a linux (Redhat ES3) system running php4.3.11

* trying to build apache2/php5.0.4 (= run php4 OR php5)
  = PREFIX : /usr/local/php5

i can do it as long i compile php5 with option "--without-pear" if i try to
build with pear it compiles fine but when doing "make install" it tells me
the following error message:

make install
Installing PHP SAPI module:   apache2handler
/usr/local/apache2/build/instdso.sh
SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la
/usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp libphp5.la
/usr/local/apache2/modules/
cp .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
cp .libs/libphp5.a /usr/local/apache2/modules/libphp5.a
ranlib /usr/local/apache2/modules/libphp5.a
chmod 644 /usr/local/apache2/modules/libphp5.a
libtool: install: warning: remember to run `libtool --finish
/home/kaktus/_install.NEW/php-5.0.4/libs'
Warning!  dlname not found in /usr/local/apache2/modules/libphp5.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /usr/local/apache2/modules/libphp5.so
[activating module `php5' in /usr/local/apache2/conf/httpd.conf]
Installing PHP CLI binary:/usr/local/php5/bin/
Installing PHP CLI man page:  /usr/local/php5/man/man1/
Installing PEAR environment:  /usr/local/php5/lib/php/
make[1]: *** [install-pear-installer] Segmentation fault
make: *** [install-pear] Error 2



=> it seams there is a problem with 2 pear installations ?

any hints appreciated,
greetings from vienna,

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   >