php-general Digest 9 Feb 2004 05:32:10 -0000 Issue 2579
Topics (messages 177147 through 177182):
Re: Question About Date Function in PHP/MySQL
177147 by: John W. Holmes
177153 by: Freedomware
Re: .html or.php extension
177148 by: John Nichel
177149 by: Jason Wong
177150 by: Chris Garaffa
177151 by: Paul Furman
177152 by: John W. Holmes
Re: Revised: RE: [PHP] Re: Can I do this?
177154 by: Adam Bregenzer
177173 by: PHP Email List
177174 by: Raditha Dissanayake
177175 by: Adam Bregenzer
$_POST trouble with html form
177155 by: Paul Furman
177157 by: Paul Furman
177158 by: Adam Bregenzer
177159 by: Paul Furman
177160 by: Paul Furman
177162 by: Adam Bregenzer
177163 by: Paul Furman
177164 by: Paul Furman
177165 by: Adam Bregenzer
Re: Can I do this?
177156 by: John Taylor-Johnston
177167 by: André Cerqueira
177168 by: André Cerqueira
Re: mcrypt don't work.
177161 by: Adam Bregenzer
Re: [SOLVED] $_POST trouble with html form
177166 by: Paul Furman
send script output to file
177169 by: Boneripper
177171 by: John Nichel
177172 by: André Cerqueira
Re: how to conver a string to float
177170 by: André Cerqueira
check for inactive sessions
177176 by: news.php.net
compiling php5 with gd-support
177177 by: Safran von Twesla
[ERR] [PHP] compiling php5 with gd-support
177178 by: postmaster.hanmir.com
Re: Use a Server or Client Socket?
177179 by: Tan Ai Leen
Re: Japanese Language
177180 by: KidLat Ngayon
Re: excel output question
177181 by: Jake McHenry
julian date
177182 by: adwinwijaya
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Freedomware wrote:
EMS lists the following:
Short Date: M/d/yyyy
Long Date: dddd, MMMM dd, yyyy
Day followed by month, followed by another day, then year???
That format means something like "Friday, May 5, 2004"
I thought it was supposed to be year first, followed by month and day,
as in the example from CSV table - 1905-09-01.
Should I change Long Date so that it reads YYYY-MM-DD, or something like
that?
Yeah, I'd try switching possibly both the long and short dates to
YYYY-MM-DD and see if it's imported correctly.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
John W. Holmes wrote:
Freedomware wrote:
EMS lists the following:
Short Date: M/d/yyyy
Long Date: dddd, MMMM dd, yyyy
Day followed by month, followed by another day, then year???
That format means something like "Friday, May 5, 2004"
I thought it was supposed to be year first, followed by month and day,
as in the example from CSV table - 1905-09-01.
Should I change Long Date so that it reads YYYY-MM-DD, or something
like that?
Yeah, I'd try switching possibly both the long and short dates to
YYYY-MM-DD and see if it's imported correctly.
OK, I'll add that to my experiments to do list. In the meantime, I
imported all the dates as VARCHAR, then went into phpMyAdmin and changed
it to DATE. It seems to work!
Thanks again for the tips.
Oh, one other thing... Do you know if dates can be sorted in various
ways, either by absolute date or by month alone, date alone, etc.? I'm
going to be making sortable columns (JavaScript or PHP), and I'm not yet
sure what all you can do with dates.
--- End Message ---
--- Begin Message ---
E.H.Terwiel wrote:
My PHP system demands that files to be interpreted by PHP MUST have
the .php extension.
If I have an .html file with <?php ....?> in it, it won't interpret
the PHP code.
Unlike JavaScript, f.i.
Is there a way to make the server do the PHP code anyway, in an HTML
file ? Or must the action yes-php/no-php be taken before looking into
the file ?
If you're using Apache, you can add .html to the list of file extensions
php will parse.
The other way around is ok: put HTML code in a .php file...
Yes. You can also seperate html from php, and just include the html
file in your php script.
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
On Friday 06 February 2004 06:15, E.H.Terwiel wrote:
> My PHP system demands that files to be interpreted by PHP MUST have
> the .php extension.
> If I have an .html file with <?php ....?> in it, it won't interpret
> the PHP code.
> Unlike JavaScript, f.i.
> Is there a way to make the server do the PHP code anyway, in an HTML
> file ? Or must the action yes-php/no-php be taken before looking into
> the file ?
If you're using Apache then you should have a line something like:
AddType application/x-httpd-php .php4 .php3 .phtml .php .inc
in httpd.conf. Simply add '.html' to the line and restart Apache.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
One man's folly is another man's wife.
-- Helen Rowland
*/
--- End Message ---
--- Begin Message ---
On Feb 5, 2004, at 5:15 PM, E.H.Terwiel wrote:
My PHP system demands that files to be interpreted by PHP MUST have
the .php extension.
If I have an .html file with <?php ....?> in it, it won't interpret
the PHP code.
Unlike JavaScript, f.i.
Right, the browser interprets the JavaScript that's sent to it; the
server has to process the PHP before sending it to the client.
Is there a way to make the server do the PHP code anyway, in an HTML
file ? Or must the action yes-php/no-php be taken before looking into
the file ?
You're spot on here. You can have your web server process other files
as PHP. Check the documentation for your web server to figure it out.
The other way around is ok: put HTML code in a .php file...
Yep, that's fine. PHP ignores anything that's not in <? ?> and just
outputs it to the browser.
HTH,
--
Chris Garaffa
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
If you start with one index.php then use that to include additional
files, it should accept any file, even with no extension. At least it
works that way for me.
E . H . Terwiel wrote:
My PHP system demands that files to be interpreted by PHP MUST have
the .php extension.
If I have an .html file with <?php ....?> in it, it won't interpret
the PHP code.
Unlike JavaScript, f.i.
Is there a way to make the server do the PHP code anyway, in an HTML
file ? Or must the action yes-php/no-php be taken before looking into
the file ?
The other way around is ok: put HTML code in a .php file...
frgr
Erik
--- End Message ---
--- Begin Message ---
Paul Furman wrote:
If you start with one index.php then use that to include additional
files, it should accept any file, even with no extension. At least it
works that way for me.
Just be careful with that. Remember that the files can be requested on
their own, also. If you have "database.inc" that you include to connect
ot your database and someone requests it by itself, they'll see your PHP
code as plain text.
Either store your includes outside of the web root, deny access to them,
or give them a .php extension. Even if you give it a .php extension to
hide the code, remember the file can be requested on it's own and run
out of context, still.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-08 at 08:27, Andrew Séguin wrote:
> A test to confirm that, is to point the browser to the address being
> included. See the source? vulnerable. See the results? not vulnerable.
If you do not see 'source' then what are you including? For example the
following script could be included remotely:
<?php
echo <<EOF
<?php
\$sql = "SELECT * FROM table WHERE id = $number";
?>
EOF;
?>
If you were able to do include the above source with:
include("http://somewhere.com/file.php?number=123");
You could include and see php code. Not the original but something that
is still useful. include() includes php code, if you can include a file
from a remote source you can view it with a browser. What you say is
true:
"See the source? vulnerable. See the results? not vulnerable."
Of course if you can not see it you also can not include it remotely.
As a side note it is safer to put includes outside the web path. An
overflow or some other bug may be found that would bypass processing of
.php files (or a different bug could be exploited to write a .htaccess
file in that directory). If you have the option to move includes to a
different directory it is more secure.
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Ok a couple of questions. I have include files that someone else is
including from there server and he is unable to view the source code that he
is utilizing in an include script. Of course this is running Apache and Unix
with PHP 4.3.4.
SO my questions are.
1> Are you testing or referring to this on a Windows server running
IIS/Apache?
2> Are you referring to an older version of PHP?
3> Have you even tested what your saying?
I am going to be running some more tests, but so far all of the testing that
I have done running a http request is parsing the include files. I have even
checked a broswser based ftp request and nothing shows for the php file.
I'd be interested in hearing about you testing one of these ideas you have
and posting a link so that we can see what you are talking about is actually
working.
-----Original Message-----
From: Adam Bregenzer [mailto:[EMAIL PROTECTED]
Sent: Sunday, February 08, 2004 11:49 AM
To: Andrew Séguin
Cc: PHP Email List; [EMAIL PROTECTED]
Subject: Re: [PHP] Revised: RE: [PHP] Re: Can I do this?
On Sun, 2004-02-08 at 08:27, Andrew Séguin wrote:
> A test to confirm that, is to point the browser to the address being
> included. See the source? vulnerable. See the results? not vulnerable.
If you do not see 'source' then what are you including? For example the
following script could be included remotely:
<?php
echo <<EOF
<?php
\$sql = "SELECT * FROM table WHERE id = $number";
?>
EOF;
?>
If you were able to do include the above source with:
include("http://somewhere.com/file.php?number=123");
You could include and see php code. Not the original but something that
is still useful. include() includes php code, if you can include a file
from a remote source you can view it with a browser. What you say is
true:
"See the source? vulnerable. See the results? not vulnerable."
Of course if you can not see it you also can not include it remotely.
As a side note it is safer to put includes outside the web path. An
overflow or some other bug may be found that would bypass processing of
.php files (or a different bug could be exploited to write a .htaccess
file in that directory). If you have the option to move includes to a
different directory it is more secure.
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Nope i see the server parsed output. Try loading the url directly in
your browser!! what you see is what you get when you include.
Adam Bregenzer wrote:
On Sun, 2004-02-08 at 08:27, Andrew Séguin wrote:
A test to confirm that, is to point the browser to the address being
included. See the source? vulnerable. See the results? not vulnerable.
If you do not see 'source' then what are you including? For example the
following script could be included remotely:
<?php
echo <<EOF
<?php
\$sql = "SELECT * FROM table WHERE id = $number";
?>
EOF;
?>
If you were able to do include the above source with:
include("http://somewhere.com/file.php?number=123");
You could include and see php code. Not the original but something that
is still useful. include() includes php code, if you can include a file
from a remote source you can view it with a browser. What you say is
true:
"See the source? vulnerable. See the results? not vulnerable."
Of course if you can not see it you also can not include it remotely.
As a side note it is safer to put includes outside the web path. An
overflow or some other bug may be found that would bypass processing of
.php files (or a different bug could be exploited to write a .htaccess
file in that directory). If you have the option to move includes to a
different directory it is more secure.
--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-08 at 18:23, PHP Email List wrote:
> I am going to be running some more tests, but so far all of the testing that
> I have done running a http request is parsing the include files. I have even
> checked a broswser based ftp request and nothing shows for the php file.
> I'd be interested in hearing about you testing one of these ideas you have
> and posting a link so that we can see what you are talking about is actually
> working.
I actually included a sample script in my last post. I think this may
all be a communication problem. The original php is not included, but
output is and there is nothing to prevent you from outputting php code
from a php script. It was my understanding that this is what this
thread was originally about:
> <?php
> echo <<EOF
> <?php
> \$sql = "SELECT * FROM table WHERE id = $number";
> ?>
> EOF;
> ?>
The bottom line is be careful with what you are including and where it
comes from.
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Why am I getting the error "Undefined index: comment"?
It's probably a typo because I had something similar that worked.
<form action="<?php include (ACTION_DIR."/jpeg-comment.php"); ?>"
method="post">
<textarea name="comment" ROWS=6 COLS=60>
<?php print $comments[$thumb_num] ?>
</textarea><br>
<input type="submit" value="update annotation">
</form>
<?php
echo $_POST["comment"]; # this is just for debugging
?>
Also perhaps related, when I call $_POST["comment"] in the action file,
it gives me "Forbidden You don't have permission to access...[error
message]" but this is my own server at home. I'm quite unfamiliar with
forms (and new to PHP for that matter).
--- End Message ---
--- Begin Message ---
OK, it's only when I call $_POST["comment"] in the included action file
that I get "Forbidden You don't have permission to access...[error
message]". I set it up with the action as an include because if I tried
to just give the location, it tried to download jpeg-comment.php. Like I
said, this is all new to me. I never used "form action=" before,
especially not with PHP. php.net assumes I know all this <g>.
Paul Furman wrote:
Why am I getting the error "Undefined index: comment"?
It's probably a typo because I had something similar that worked.
<form action="<?php include (ACTION_DIR."/jpeg-comment.php"); ?>"
method="post">
<textarea name="comment" ROWS=6 COLS=60>
<?php print $comments[$thumb_num] ?>
</textarea><br>
<input type="submit" value="update annotation">
</form>
<?php
echo $_POST["comment"]; # this is just for debugging
?>
Also perhaps related, when I call $_POST["comment"] in the action file,
it gives me "Forbidden You don't have permission to access...[error
message]" but this is my own server at home. I'm quite unfamiliar with
forms (and new to PHP for that matter).
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-08 at 13:15, Paul Furman wrote:
> Why am I getting the error "Undefined index: comment"?
>
> It's probably a typo because I had something similar that worked.
>
> <form action="<?php include (ACTION_DIR."/jpeg-comment.php"); ?>"
> method="post">
> <textarea name="comment" ROWS=6 COLS=60>
> <?php print $comments[$thumb_num] ?>
> </textarea><br>
> <input type="submit" value="update annotation">
> </form>
> <?php
> echo $_POST["comment"]; # this is just for debugging
> ?>
You will not have access to the $_POST["comment"] variable until the
form is submitted. It looks like you are trying to access this when the
form is loaded. Whatever action is echoed in the jpeg-comment.php
script is where you want to use you comment variable.
> Also perhaps related, when I call $_POST["comment"] in the action file,
> it gives me "Forbidden You don't have permission to access...[error
> message]" but this is my own server at home. I'm quite unfamiliar with
> forms (and new to PHP for that matter).
That looks like an access error from your web server. Make sure the
directory this file is in is accessible from the web.
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Adam Bregenzer wrote:
Also perhaps related, when I call $_POST["comment"] in the action file,
it gives me "Forbidden You don't have permission to access...[error
message]" but this is my own server at home. I'm quite unfamiliar with
forms (and new to PHP for that matter).
That looks like an access error from your web server. Make sure the
directory this file is in is accessible from the web.
No, it's not accessible from the web, it's in my protected php_library
outside public_html. Can't I execute a hidden script with a form? Should
I make a little php action file in public_html that includes the actual
file?
--- End Message ---
--- Begin Message ---
Paul Furman wrote:
Adam Bregenzer wrote:
>
Make sure the
directory this file is in is accessible from the web.
No, it's not accessible from the web, it's in my protected php_library
outside public_html.
It does load the protected action file as long as I don't try to call
$_POST["comment"]
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-08 at 13:32, Paul Furman wrote:
> No, it's not accessible from the web, it's in my protected php_library
> outside public_html. Can't I execute a hidden script with a form?
no
> Should
> I make a little php action file in public_html that includes the actual
> file?
yes
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Adam Bregenzer wrote:
Should I make a little php action file in public_html
that includes the actual file?
yes
OK thanks, I made this:
<?php
# jpeg-comment-public.php
include ("C:/_Paul/web/phplib/action/jpeg-comment.php");
?>
but now the hidden one isn't aware of any variables.
"Forbidden
You don't have permission to access
Notice: Undefined variable: thumb_num in
C:/_Paul/web/phplib/action/jpeg-comment.php on line 4
etc...
on this server.
--------------------------------------------------------------------------------
Apache/1.3.29 Server at 127.0.0.1 Port 80
--- End Message ---
--- Begin Message ---
Adam Bregenzer wrote:
You will not have access to the $_POST["comment"] variable until the
form is submitted.
Understood. That debug test only worked after submitting the form.
So maybe the better way is to just submit the form with the action file
simply reloading the main page to refresh it then put my code below with
an if statement checking if the form has been submitted yet and clearing
$_POST when I'm done.
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-08 at 13:58, Paul Furman wrote:
> OK thanks, I made this:
>
> <?php
> # jpeg-comment-public.php
> include ("C:/_Paul/web/phplib/action/jpeg-comment.php");
> ?>
>
> but now the hidden one isn't aware of any variables.
>
> "Forbidden
> You don't have permission to access
> Notice: Undefined variable: thumb_num in
> C:/_Paul/web/phplib/action/jpeg-comment.php on line 4
Where are these variables coming from? The action in your form should
be a url that points to the script you want to process the form. In
that script you access the form variables by $_POST['variable_name'].
IE:
form.html:
<form method="post" action="process.php">
<input type="text" name="comment" />
</form>
process.php:
<?php
echo $_POST['comment'];
?>
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
>they would be able to see your php code.
How?!?!
Adam Bregenzer wrote:
> On Sun, 2004-02-08 at 03:18, John Taylor-Johnston wrote:
> > Ah! A little experimenting ... Yes I can :) Answered my own question.
> >
> > include("http://elsewhere.com/list.php?number=$number");
>
> Careful with that. If someone were to stumble upon your list.php script
> they would be able to see your php code. You would probably be better
> off having a local copy of that file.
>
> --
> Adam Bregenzer
> [EMAIL PROTECTED]
> http://adam.bregenzer.net/
--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not Open Source, it's Murphy's Law or broken."
' ' ' Collège de Sherbrooke
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke
http://compcanlit.ca/
819-569-2064
--- End Message ---
--- Begin Message ---
John Taylor-Johnston wrote:
Can I include a script on another server doing this?
$sql = 'SELECT * FROM '.$table.' where number like '.$number.';';
http://foo.com?list.php?number=16
include("http://elsewhere.com/list.php");
My $sql is error-ing - obviously. http://elsewhere.com/list.php is not receiving $number. Can I even do this?
No, you cant.
Even if you could, if the server where the include file is located runs
PHP, the include file would run there, and you would end up including
the output of it instead of the code.
Why would you want to do that? Maybe what you really want to do dont
need that...
--- End Message ---
--- Begin Message ---
John Taylor-Johnston wrote:
Can I include a script on another server doing this?
$sql = 'SELECT * FROM '.$table.' where number like '.$number.';';
http://foo.com?list.php?number=16
include("http://elsewhere.com/list.php");
My $sql is error-ing - obviously. http://elsewhere.com/list.php is not receiving $number. Can I even do this?
No, you cant.
Even if you could, if the server where the include file is located runs
PHP, the include file would run there, and you would end up including
the output of it instead of the code.
Why would you want to do that? Maybe what you really want to do dont
need that...
--- End Message ---
--- Begin Message ---
On Sun, 2004-02-08 at 05:18, [EMAIL PROTECTED] wrote:
> Hi all,
> I have problem with mcrypt function.
> There is always an error that I don't know how to correct this.
> This is my code:
>
> $string = "Text string";
> $key= "My key";
> $encrypted = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $string, MCRYPT_ENCRYPT);
> echo"stringa cifrata= $encrypted";
> $key = "My key";
> $string = mcrypt_cfb(MCRYPT_RIJNDAEL-256, $key, $encrypted, MCRYPT_DECRYPT);
> echo"stringa decifrata= $string";
If you are using mycrypt 2.4.x you need to do something like this:
encrypt:
# initialize the encryption module
$mc_module = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '',
MCRYPT_MODE_ECB, '');
mcrypt_generic_init($mc_module, $encryption_key, $iv);
# encrypt the data
$encrypted_data = mcrypt_generic($mc_module, $data);
# de-initialize the encryption module
mcrypt_generic_deinit($mc_module);
mcrypt_module_close($mc_module);
decrypt:
# initialize the encryption module
$mc_module = mcrypt_module_open(MCRYPT_RIJNDAEL_256, '',
MCRYPT_MODE_ECB, '');
mcrypt_generic_init($mc_module, $encryption_key, $iv);
# decrypt the data
$decrypted_data = mdecrypt_generic($mc_module, $encrypted_data);
# trim any trailing \0, encrypted data is automatically padded to a
32byte boundary with \0
$decrypted_data = rtrim($decrypted_data);
# de-initialize the encryption module
mcrypt_generic_deinit($mc_module);
mcrypt_module_close($mc_module);
Check the documentation[1] for more information on encryption keys and
initialization vectors.
[1] http://www.php.net/mcrypt
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
OK, this is what I've done and it seems to work:
Paul Furman wrote:
So maybe the better way is to just submit the form with the action file
simply reloading the main page to refresh it then put my code below with
an if statement checking if the form has been submitted yet and clearing
$_POST when I'm done.
--- End Message ---
--- Begin Message ---
hi,
i would like to send the output of a PHP script, to a file, and not to the
browser.
any ideas on how i can do this?
tkx in advance,
--
Herberto Graça.
_________________________________
E-mail : [EMAIL PROTECTED]
MSN : [EMAIL PROTECTED]
HomePage : http://herbertograca.no-ip.org
É devido à velocidade da luz ser mais rápida que a do som que
certas pessoas parecem inteligentes antes de abrirem a boca!
It's because the speed of light is greater than the speed of sound that
some people look intelligent before they open their mouth!
isik hizi ses hizindan fazla oldugundan, bazi insanlar
agizlarini acmadan once zekiymis gibi gorunuyorlar!
--- End Message ---
--- Begin Message ---
Boneripper wrote:
hi,
i would like to send the output of a PHP script, to a file, and not to the
browser.
any ideas on how i can do this?
tkx in advance,
Use the manual, Luke.
http://www.php.net/manual/en/ref.filesystem.php
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--- End Message ---
--- Begin Message ---
John Nichel wrote:
Boneripper wrote:
hi,
i would like to send the output of a PHP script, to a file, and not to
the
browser.
any ideas on how i can do this?
tkx in advance,
Use the manual, Luke.
http://www.php.net/manual/en/ref.filesystem.php
and:
http://www.php.net/manual/en/ref.outcontrol.php
--- End Message ---
--- Begin Message ---
Sebastian wrote:
Is there a possibility to convert a string like "10*500" (parsed from a
XML-File) to a float?
When i try to store this String in a float variable it only coverts the "10"
but nothing after the "*"-sign, but i need the result of this expresison...
Is there a function to calculate such string expressions?
Thanx...
Using eval() can be dangerous
If the source of the xml data is not trustworthy, validate the string
with regex before eval()'ing it
/^[^a-zA-Z]*$/ should be enough...
That would refuse letters (simple (and maybe dumb) way to prevent
function execution (but wouldnt prevent expression errors! just prevent
people from breaking in through your eval!))
Note: you would also need to put 'return ' before and ';' after the
string expression to eval
ex:
<?
$expression = '10*500';
$expressionOK = preg_match ('/^[^A-Za-z]*$/', $expression);
$result = ($expressionOK) ? eval('return '. $expression .';') : NULL;
var_dump($result);
?>
Another more complex/slower, but maybe safer/elegant way, would be to
parse the expression, piece by piece into a stack, and do the operations
yourself
--- End Message ---
--- Begin Message ---
Ok, I've developed a system that allows N number of users to log-in to my
site under the same username/password combo. When a user logs-in, a flag is
set marking that they have logged-in, their session id is stored and the
current # of user's logged-in is iterated by one. If a user account has a
maximum of 5 possible simultaneous user log-ins, the user stack will be full
unless those users logout (which will reduce the stack by one), or their
session
expires. The problem being that I do not know how to check if a session is
active, other than checking the current user session of course (not all
session's
currently associated with an account). I am storing all sessions associated
with an account. Any ideas? Thanks in advance
Christian
--- End Message ---
--- Begin Message ---
Hi php-general,
I have continusously following error compiling php5 with gd-support:
ext/gd/gd.lo: In function `zm_deactivate_gd':
/usr/local/src/php-5.0.0b3/ext/gd/gd.c:445: undefined reference to `gdFreeFontCache'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Fehler 1
Here is my config.nice:
'./configure' \
'--disable-libxml' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-magic-quotes' \
'--with-bcmath' \
'--enable-exif' \
'--enable-shared=max' \
'--enable-rule=SHARED_CORE' \
'--with-mysql=/usr/local/mysql' \
'--with-gd=/usr/local/include' \
'--enable-gd-native-ttf' \
'--with-jpeg-dir=/usr/lib' \
'--with-png-dir=/usr/lib' \
'--with-zlib-dir=/usr/include' \
without gd, I can compile, and it works.
What I am also wondering is how I can disable freetype?
I tried --without-freetype or --disable-freetype but that doesn't
help. I have no freetype installed.
Other thing, is that I have set --with-gd=/usr/local/include, but I
had to put symbolic links to /usr/local/lib where the libgd.so and
libgd.a are (from install). There is no way to enter both directories...
And at last, why is the error related to
/usr/local/src/php-5.0.0b3/ext/gd/gd.c:445? I entered
/usr/local/include for gd and not the ext/gd/ directory?
I just newly installed gd, newest release.
I have Mandrake Linux 8.2.
I would really appreciate help ;-)
SvT
--
Who is the ennemy?
--- End Message ---
--- Begin Message ---
Transmit Report:
To: [EMAIL PROTECTED], 402 Local User Inbox Full ([EMAIL PROTECTED])
--- Begin Message ---
Hi php-general,
I have continusously following error compiling php5 with gd-support:
ext/gd/gd.lo: In function `zm_deactivate_gd':
/usr/local/src/php-5.0.0b3/ext/gd/gd.c:445: undefined reference to `gdFreeFontCache'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Fehler 1
Here is my config.nice:
'./configure' \
'--disable-libxml' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-config-file-path=/usr/local/etc' \
'--enable-magic-quotes' \
'--with-bcmath' \
'--enable-exif' \
'--enable-shared=max' \
'--enable-rule=SHARED_CORE' \
'--with-mysql=/usr/local/mysql' \
'--with-gd=/usr/local/include' \
'--enable-gd-native-ttf' \
'--with-jpeg-dir=/usr/lib' \
'--with-png-dir=/usr/lib' \
'--with-zlib-dir=/usr/include' \
without gd, I can compile, and it works.
What I am also wondering is how I can disable freetype?
I tried --without-freetype or --disable-freetype but that doesn't
help. I have no freetype installed.
Other thing, is that I have set --with-gd=/usr/local/include, but I
had to put symbolic links to /usr/local/lib where the libgd.so and
libgd.a are (from install). There is no way to enter both directories...
And at last, why is the error related to
/usr/local/src/php-5.0.0b3/ext/gd/gd.c:445? I entered
/usr/local/include for gd and not the ext/gd/ directory?
I just newly installed gd, newest release.
I have Mandrake Linux 8.2.
I would really appreciate help ;-)
SvT
--
Who is the ennemy?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- End Message ---
--- Begin Message ---
Hi,
I need to be polling the connection constantly for new messages as well
as have a check that the connection is on. These need to be done in one
connection. That's where the headache comes in. In order to poll
constantly, I placed the socket read in a while loop. Since the script
is looping constantly there, I can't place the checking in the while
loop. And I can't make a need connection to check if I am still login
because the external server only allows one connection.
Raditha Dissanayake wrote:
Hi,
If you only need to make a connection to the server every ten minutes
you will be saving a lot of resources if you use a cron job to connect
at intervals instead of keeping a permanently open connections. Creating
a cron job is quite simple, if you type
man 5 crontab
you will be able to read more about it (at least in linux - a poor
substitute exists in windows called scheduled tasks)
With this approach you just need to call fsockopen to do connect to your
server and do the needful.
Tan Ai Leen wrote:
Hi Raditha,
Thanks, I have a better idea of how to write the codes. But I wonder,
to check that the connection to the external server is on, where
should I place the code? I need to do this every 10 minutes. If the
connection is dropped, I have to reconnect. Where should I place this
check? If I place it in the while(true) loop, I will be checking every
few miliseconds rite? That will be too frequent. What about in another
script? Will I be able to check that the connection is on?
Regards,
Ai Leen
Raditha Dissanayake wrote:
Hi Tan,
If you are connecting to another server you are using a client socket
you do not need to make a server socket. If you need to listen for
connections make use of a server socket. To give you an example your
browser makes use of client sockets while apache makes use of server
sockets. That is an over simplified view of things but hope it helps
you understand things better.
Generally working with client sockets is easier.
best regards
--- End Message ---
--- Begin Message ---
Dear Mr. Ray,
Before anything else, I would like to thank you for
your repsonse. Anyway, as far as the MSWindows is
concern, all the language, system and specification
are all in Japanese System. And for the Database,
here's the variables from the MySQL:
|
| language |
/mysql/share/mysql/japanese/
|
|
| character_sets | latin1 big5 czech
euc_kr gb2312 gbk sjis tis620 ujis dec8 dos german1
hp8 koi8_ru latin2 swe7 usa7 cp1251 danish hebrew
win1251 estonia hungarian koi8_ukr win1251ukr greek
win1250 croat cp1257 latin5
|
Hope to hear from you again Mr. Hunter....
regards,
erwin
--- Ray Hunter <[EMAIL PROTECTED]> wrote:
> On Thu, 2004-02-05 at 19:39, KidLat Ngayon wrote:
> > my problem is the language from my database, they
> > inputted some english and japanese language....
> >
> > whenever i've open the file in staroffice, it can
> read
> > the nihongo, however when i open it in microsoft
> > office, it turns out that the nihongo are
> something
> > like a garbage character.....
> >
> > any suggestions would highly appreciated....
> thanks
> > and best regards....
>
> Is your database set up to handle the lang type? Is
> excel set up with
> the lang type as well?
>
> --
> Ray
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html
--- End Message ---
--- Begin Message ---
----- Original Message -----
From: "Phillip Jackson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 07, 2004 4:37 AM
Subject: Re: [PHP] Re: excel output question
> I would do it like this:
>
> $build = " '%s','%s','%s','%s'\n";
> $build = sprintf($build,$field1,$field2,$field3,$fieldN);
>
> you could also try escaping the comma. if this doesn't work you can always
> just dump to html tables and save the file as *.xls (excel spreadsheet);
> excel understands html tables and simple markup as spreadsheet data.
>
> ie:
>
> <html>
> <table>
> <tr>
> <td>field1</td><td>field2</td><td>field3</td><td>field4</td>
> </tr>
> <tr>
> <td>value1</td><td>value2</td><td>value3</td><td>value4</td>
> </tr>
> </table>
> </html>
>
>
> ~phillip
> "Jake McHenry" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > ----- Original Message -----
> > From: "Paul Furman" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, February 07, 2004 1:56 AM
> > Subject: [PHP] Re: excel output question
> >
> >
> > > Single quote everything should work.
> > >
> > > Jake McHenry wrote:
> > >
> > > > Hi everyone. I'm outputing payroll information to an excel csv file,
> and
> > when anyone get's paid over 1k, the amount is split into two fields
> because
> > of the comma in the amount. Is there anyway I can tell excel that this
> > particular comma is not a deliminator?
> > > >
> > > > Thanks,
> > > > Jake
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> > like this?
> >
> > output =
> >
>
"'$fullname',,'$location',,'$regularhours','$vachours','$sickhours','$compho
> >
>
urs','$mischours','$wopyhours','$sefahours','$biweekly[0]','$adjustedtime',,
> > ,,,'$sub401k
> > ','$payrate','$gross5'\n";
> >
> > That just filled my spreadshit with quotes around everything... still
the
> > amounts larger than 1k are in 2 columns......
> >
> > did I do something wrong?
> >
> > Thanks,
> > Jake
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
This is in a simple while loop, data is coming from a mysql database.
Creating a seperate function would too time consuming changing all of the
existing code for what this page is doing. It orignally was in html form in
an xls file, but when the file was opened, there were no cell borders
anymore. If anyone can tell me how to turn on the cell boarders in an xls
html outputted file, that would also work. This is the only reason I went
back to a csv file.
Thanks,
Jake
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hello php-general,
I wonder is there any class/function in php to convert from dates
(dd/mm/yyyy hh:mm:ss) to Julian date ?
(I also wonder why there is no Julian date function in php function
libraries ... i think it is nice to have Julian date )
thx
--
Best regards,
adwinwijaya mailto:[EMAIL PROTECTED]
--- End Message ---