[PHP] php and caching

2002-11-24 Thread Alex
Hi,

I have a few pages on my site that contains dynamical content that must be
"processed" each time the page is loaded. But I'd also want to allow the
users to be able to use the back button of their browser to go back to forms
and that these forms still contain the information they entered (instead of
being cleared).

Can someone give me a hint on how to accomplish this if there's a way to do
it?

Thanks,

Alexandre Soares



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




[PHP] Re: php and caching

2002-11-24 Thread Alex
But my  main page, for instance mail.php, includes top.php and bottom.php.
But top.php must be processed each time because it prints on every page on
my site if the user has new messages. But if all pages are cached, then it's
always the cached version that's printed to the user, so even if he has new
mail, it doesn't show (because the page is directly taken from the cache
instead of being re-requested).
So I don't want this situation to happen, but i'd want users to be able to
make use of their back button without clearing the forms. Is there a
solution around this problem?

Thanks alot!


"Alex" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I have a few pages on my site that contains dynamical content that must be
> "processed" each time the page is loaded. But I'd also want to allow the
> users to be able to use the back button of their browser to go back to
forms
> and that these forms still contain the information they entered (instead
of
> being cleared).
>
> Can someone give me a hint on how to accomplish this if there's a way to
do
> it?
>
> Thanks,
>
> Alexandre Soares
>
>



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




[PHP] Re: php and caching

2002-11-24 Thread Alex
If the page itself is never cached to force dynamic php pages to always be
"fresh", is there a way to cache only images to reduce bandwidth usage?

Thanks, (and thanks for all your good advices!)

"Alex" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I have a few pages on my site that contains dynamical content that must be
> "processed" each time the page is loaded. But I'd also want to allow the
> users to be able to use the back button of their browser to go back to
forms
> and that these forms still contain the information they entered (instead
of
> being cleared).
>
> Can someone give me a hint on how to accomplish this if there's a way to
do
> it?
>
> Thanks,
>
> Alexandre Soares
>
>



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




[PHP] Re: $object->function($parameter)->function();

2003-01-25 Thread Alex
If I am not mistaken, this feature is coming in php5, but is not yet in php4

"Chris McCluskey" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]..
.
Hi there, I've been using PHP for about 2 years now and absolutely love
it!  Our company uses it as our main development language, so far
though, there is one thing that has been annoying me for a while now..
the following line of code will not work:

$object->function1($parameter)->function2();

I receive a parse error when i try to call another function off of the
object that function1 returns.  I know this is possible in java:

object.function1(parameter).function2();

VB:

object.function1(paremeter).function2

and i'm sure C++, although i'm not too familiar with that language.

My question is, will or is there any support for this kind of call in
PHP?  or is there another way that i should be doing it?  as for now,
here is my work around:

$tmp =& $object->function1($parameter);
$tmp->function2();

Thank you in advance!

-Chris

---
_  _  _  _
   |'|(_)|_)(_)|_(_)`-,
  * * *

Chris McCluskeyWeb Applications Engineer
Modulus, LLC
1720 Willow Creek Circle, Suite 520
Eugene, OR 97402
Email: [EMAIL PROTECTED]
Voice: +1 (541) 434-1024
Web..: http://www.modulusgroup.com 

The contents of this transmission may be
confidential in nature and should be
directed only to the person to whom it is
addressed. Do not read, copy, or disseminate
this material unless you are the intended
recipient.  If this transmission reached you
in error, please forward the e-mail to the
sender to advise, then destroy the
transmission you received.  Thank you.





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




[PHP] Re: CRON?

2003-01-25 Thread Alex
Well, if you really wanted to, you could create a php script, and then have
a meta refresh tag set to refresh the page whenever you want, and then just
leave the page open in your browser :p

"Nicole" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does anyone have a PHP script to enter cron jobs? I have a limited control
> panel (ensim) that doesn't have anyway to do cron, and I don't know how to
> do it at the command line yet. Anyone have a good tutorial or a PHP script
> to do this?
>
> Thanks!
>
>
>



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




[PHP] Re: PHP vs Perl for system scripts (non-web)

2003-01-27 Thread Alex
If you like php better, i'd stick with it; however, for almost all of my
un-web-related stuff, i use perl.

i'm pretty sure they would run at about the same speeds/efficency.

"Paul Chvostek" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I have to write a swath of code to manage system-related stuff based on
> database content.  Scripts will be run as root by cron, and determine
> what they have to do via user interaction and SQL lookups.  Functions
> will include manipulation of system configuration files, legacy text
> file configs, and some signalling with posix_kill.  On some of the
> machines in question, there won't even be an httpd installed, so I'd be
> building a php as a standalone binary, and running it with shell magic
> and a -q option.  I've done this kind of stuff in the past in smaller
> environments, and it seems to work nicely.
>
> I'm more comfortable writing stuff in PHP.  I use PHP alot more, and I
> find the resultant code more readable and easier to maintain.  Aside
> from Perl's ubiquity and the dubious advantage of future flexibility by
> using Perl's DBI interface to talk to different SQL servers (I'm using
> MySQL at the moment), are there any compelling reasons I should write
> system stuff in Perl rather than PHP?
>
> Thanks.
>
> --
>   Paul Chvostek <[EMAIL PROTECTED]>
>   Operations / Abuse / Whatever
>   it.canada, hosting and development   http://www.it.ca/
>



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




[PHP] perl regex help

2003-02-01 Thread Alex
I will be quick.

if
. matches any character except newline (by default)
then
what can i use to match any character INCLUDING newline?



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




[PHP] open_basedir

2003-03-12 Thread Alex
My host currently has open_basedir() enabled, and unfortunately, they don't
know how to disable it :p

I'd like open_basedir() disabled because it would make my life easier, I can
hide certain files underneath the web root.

So I've done some quick research. I'm looking at the ini_set() function:
http://www.php.net/manual/en/function.ini-set.php

If i have my host insert this line into php.ini, and restart the apache
server, then everything should work just dandy, right?

ini_set(open_basedir, FALSE);
?



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



Re: [PHP] open_basedir

2003-03-12 Thread Alex
the php.ini file is also not user configurable.
I think i found the place in my own php.ini file though where the
open_basedir value would be changed though :/

"Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > My host currently has open_basedir() enabled, and unfortunately, they
don't
> > know how to disable it :p
> >
> > I'd like open_basedir() disabled because it would make my life easier, I
can
> > hide certain files underneath the web root.
> >
> > So I've done some quick research. I'm looking at the ini_set() function:
> > http://www.php.net/manual/en/function.ini-set.php
> >
> > If i have my host insert this line into php.ini, and restart the apache
> > server, then everything should work just dandy, right?
> >
> > ini_set(open_basedir, FALSE);
>
> No, open_basedir is not user-configurable.  That would sort of defeat its
> purpose.
>
> -Rasmus
>



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



Re: [PHP] Threading objects

2003-03-13 Thread alex
As i rember apache can not handle a threading php ... if you whant threads
you need to run php from command prompt in a linux/unix enviroment(windows
dosen't support threads i I'm not wrong).Look for a threads project in 
PEAR(http://pear.php.net/).
Hope it helps,
Best regards,
Alex.
> Is it possible to some how thread a php script threw apache. There has
> to be something you can do, it seems there is always something you can
> do :) What I want is the following.
> I administer a mailing list that has a few hundred thousand subscribed
> recipients.
> I've written a script that runs threw the DB and validates the email
> address.
> First by format then by connecting to the mail server.
> This script takes way to long to run as it has to do one at a time. I
> want to some how thread this so it can be validating multiple emails at
> a time.
> Please excuse my ignorance on the subject my web programming experience
> is rather limited.
>
> Thanks
>
> Kris
>
>
>
> - Original Message -
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Kris" <[EMAIL PROTECTED]>
> Cc: "W. Enserink" <[EMAIL PROTECTED]>; "PHP List"
> <[EMAIL PROTECTED]> Sent: Thursday, March 13, 2003 1:04 AM
> Subject: Re: [PHP] Threading objects
>
>
>> > All I'm really asking is how do you initiate threading with PHP? A
>> > small example would be nice
>>
>> You don't.  This is a web scripting language, not Java.
>>
>> -Rasmus
>>
>> --
>> 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




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



[PHP] fsockopen/curl failure, ipv6 warning??

2003-07-06 Thread alex
Hello.

I'll try wording my question more succinctly in the hopes of getting a response from 
some kind soul.

I'm trying to do a SSL post to a particular secure server, but all methods are failing 
to connect.
curl gives an error 6 = "Couldn't resolve host", and fsockopen (using the 
OpenSSL-dependent ssl://
method) fails with the following warnings in the error log:

   "PHP Warning:  fsockopen(): unable to connect to [secure.host.name]:443
PHP Warning:  fsockopen(): php_network_getaddresses: getaddrinfo failed: no 
address associated
with name (is your IPV6 configuration correct? If this error happens all the time, try 
reconfiguring
PHP using --disable-ipv6 option to configure)"

(I've tried reconfiguring php with "--disable-ipv6" and reinstalling, but I continue 
to get the same
message).

What could be causing this?  Any and all insights welcome!

(Platform Info, btw...
OpenBSD 2.9, PHP 4.3.2, Apache 1.3.27, ModSSL 2.8.14, OpenSSL 0.9.6, curl 7.9.8 -- 
I've installed
curl 7.10.5, but PHP configure refuses to see it even when I specify the path,
"--with-curl=/usr/local/curl" -- it uses the default 7.9.8 install in /usr/local no 
matter what I
do.)

Thanks in advance...
Alex
- - - - - - - - - -
af at ax-im dot com

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



Re[3]: [PHP] print vs heredoc

2003-07-08 Thread alex
Hi.  I'm surprised you haven't been jumped on already for this one.  Variables in
double-quoted and heredoc-style strings are expanded; variables in single-quoted 
strings
aren't.  I refer you to the excellent PHP manual -- one of the first pages you should
absorb...

http://www.php.net/manual/en/language.types.string.php



>Hi,
>
>Tuesday, July 8, 2003, 5:22:04 PM, you wrote:
>TR> Hi,
>
 btw what would be nice is a print_raw command that does no
 parsing just sends the stuff :)
 (Would be good for template systems where you know there is no php
 hidden in there.) ... might gain a couple of micro seconds
>
>PO>> I believe this is called "breaking out of PHP mode
>PO>> and into HTML mode", which can be done anywhere, at
>PO>> any time.
>
>PO>> Regards,
>PO>> Philip
>
>TR> No .. what I was talking about is echoing a variable that contains no
>TR> php
>
>TR> $test = 'Hi there';
>TR> echo $test;
>
>TR> $test will get parsed (i believe) looking for stuff to interpolate.
>TR> Could be a waste of time in some cases where $test is large.
>TR> But again probably insignificant with regard to actual time to get it
>TR> to the client.
>
>TR> -- 
>TR> regards,
>TR> Tom
>
>
>Ok I think I have succeeded in confusing myself :)
>It seems the interpolation is done at the time of assignment and not
>the actual echo..
>
>-- 
>regards,
>Tom

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



[PHP] ftp_rawlist problems

2002-11-01 Thread Alex
I'm writing a script which crawls through ftp servers, retrieving file
listings and saving them to a DB so they may be searched.

What happens, is the script connects to the ftp server, and asks for a
listing of a directory. The ftp server apparentally sends the script the
file listing, but then the script hangs. I have absolutely no idea what
causes the problem.
To combat this problem, I have a loop which keeps looping until ftp_rawlist
actually returns something valid.
 $files = false;
 while (! is_array($files))
 {
  $files = ftp_rawlist($conn, $dir);
 }
That, along with
ftp_set_option($conn, FTP_TIMEOUT_SEC, 3);
Seems to fix the problem for now, but I would still like to know what's
going on.

Please note...
I'm running PHP 4.2.1 as a module with apache 1.3.x on a win2k machine. The
server I am using for testing, if it should make any difference, is
Filezilla 0.7.2.
Also, this problem does not occur every time a directory listing is
requested, but perhaps every 15-20 directories. In any case, which directory
php stalls on is random.

If anyone else has ever encountered this problem, or has any idea what is
going on, I would be very interested in hearing what you have to say :).

- Alex



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




[PHP] about @ in php

2002-11-04 Thread Alex
this day ,I read somebody else's program in php,found that in that one's
page ,with such as "if (!($recordnum=@pg_numrows($rs))){
  echo 'ÃüÁî´¦ÀíÍê±Ï£¡';  "  using,I don't know how the @ refer
to.somebody help me?thanks.



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




[PHP] Re: Php search results

2002-11-22 Thread Alex
you could also use regular expressions, but php isn't perl, so good luck on
that one :p.


"Philip Hallstrom" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You could use strstr() to find the index location of the
> string searched for in FIELD.  Then use substr() to return say 50
> characters on either side...
>
> -philip
>
> On Thu, 21 Nov 2002, Daniel Masson wrote:
>
> > Hello everyone ...
> >
> > Im working on some kind of search engine for two little tables on text
> > fields on mssql, and the text fields can be very large fields, im doing
> > the search with SELECT FIELD FROM TABLE WHERE FIELD LIKE '%SOMTHING%' ..
> > My question is:
> >
> > When displaying the search results i dont want to display the entire
> > field, only the specific parts where the keyword was found , and bold
> > for the keyword and i just dony know  how to to do that, i mean
> > displaying the keyword in bold is no problem .. I need to know how to
> > display only the parts where this keyword is.
> >
> > Any help will be very helpful
> >
> > Thanks every1
> >
> >
> >
> > --
> > 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




[PHP] LWP::Parallel in PHP

2003-08-28 Thread Alex
Hello all!
I am looking for PHP analog of Perl LWP::Parallel.
I need to fetch several URL(pages) from PHP at the same time.
I have a script which fetch 5-10 URL, each URL fetched 0.5 - 2 sec.
Totally it's about 10 seconds in average.
I suppose if I fetched them parallel I would speed up the script 5 times.
I am looking mostly for PHP solutions.
(Hope they exist :)

Have anybody faced with such problem?
Any ideas/suggestions will be appreciated.

Alex.

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



[PHP] dl() problem

2003-09-05 Thread Alex
Hello..

Is there a way of setting the extension_dir by not modifying php.ini ?

i've tried with 

ini_set("extension_dir","/home/alexcos/www/phps");
dl("first_module.so");
Warning: Unable to load dynamic library '/usr/lib/php4/first_module.so' 



then , i've tried setting the extension_dir in a .htaccess file..
still , the same result..


i have developed a small module , but I can't use it..
my site is hosted on an service provider , and they don't allow me to copy the module 
to extension_dir or to change the php.ini..


what should I do ?

Thanks 

Alex

[PHP] download queue

2003-09-29 Thread Alex
I'm considering start up a small download site with the large amount of 
excess bandwith I have on my site, however I thought it would be cool to 
put some sort of download queue up (you know, so all my bandwith doesn't 
get eaten up when 500 random people suddenly decide to download a 500meg 
 file i've put up.

In any case, I'm once again to the point where I know what I want, but 
the logic of it escapes me. If anyone has ever done this before, seen 
the code behind this before, or knows basically how this would be done, 
I'd be more than happy if you would share your wisdom with me.

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


[PHP] Re: Random Numbers..

2003-12-06 Thread Alex
Theheadsage wrote:
Hey,

I've got a script which used to generate a random quote. It worked fine
untill this problem occurred..
Say we have 4 quotes with QuoteID's of 1 through to 4
The script would grab a number of rows, and generate a random number
between 1 and this value (being 4 in this case) This worked fine untill,
one of the quotes was removed and another added, leaving 4 quotes once
again, but the last one had an ID of 5. The problem is the Random number
generated is between 1 and 4, so the final quote is never shown..
I tried using the RAND() function in the MySQL statement it's self, but
it's not random enough...
Then I thought of doing this:

Select all the Quote ID's from the DB.
Store them in an Array.
Generate a random number between 1 and the last ID.
If the Random Number matches a Quote ID, then display the quote,
otherwise Generate another
But I couldn't get the code to work. Any suggestions on either how to
write the above, or made the MySQL RAND() function, more random?
how about if ($randnumber == 4) $randnumber++; ?

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


[PHP] Re: Export MySQL

2003-12-31 Thread Alex
Sheawh wrote:
it may be a bit out of topic,
but can anyone teach me how to export a MySQL database?
phpmyadmin does a very nice job of dumping a mySQL database. in 
phpmyadmin, go to the database you want to dump and click on Export 
(that's what it's called in 2.5.4 anyway)

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


[PHP] Re: PHP New Year

2004-01-01 Thread Alex
Larry Brown wrote:

Happy New year all!

Looking forward to bigger better things this year.

Larry
yep, like php5 :)

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


[PHP] Extended characters passed in URL

2004-01-20 Thread Alex
Hi people,
I've installed Apache2, php 3.0.17 on Windows 2000 machine.

Everything works fine except when I call my script with some extended
characters (from Central European charset - ones with diacritics which
should be encoded) in variable values in URL, I get "Internal Server Error"
message. If there are no extended characters in URL, there's no problem.

Can't encode them, can't avoid them.

Any ideas?

Thank you.

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



[PHP] Re: Extended characters passed in URL

2004-01-21 Thread Alex
One more note - the script is called from a classic hyperlink 
cannot change that.

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



[PHP] I want this magic directory

2001-03-14 Thread Alex

I just want every customer on my site get his own unique id as his directory
name but the pages requested are all processed by the root.
Such as: customer1's url is http://www.mysite.com/2000123/
 customer2's url is http://www.mysite.com/2000124/
  ^^^UID
and the pages requested are actually processed by http://www.mysite.com/

I want it to implement security and personalization. I don't want to use
.php?uid=XXX because of lazy. :)
thanks.







-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] session & obect : session_start and require_once - Incomplete object

2002-01-08 Thread Alex

Hi,

I have problem accessing object stored in session with PHP.

SUMMARY
*

The doc says I must put the object definition
(require_once("MyObject.php");) before the session starts (with a
session_start() ). If I do that
- OK I can get my object from session
- OK my object is "casted" in MyObject object type

SAMPLE / the problem
***

But my code is organised in several sub-scripts (Object oriented, simplified
dor the explanation) :
The request.php is performed through part_1.php and part_2.php with 2
include calls
- request.php starts the session and do some initialization stuff.
- include("part_1.php")
do some business things here
call some object and try to read them from session
- include("part_2.php")
do some other logic here
end the response sent to the browser

As you already understand, the session starts BEFORE PHP enters part_1.php
and it is too late in part_1.php to put the object definition with the
require_once.
I cannot re organise my php files, since part_1.php is as its own business
logic and I want to use it elsewhere.

The object which is thus restored from session is not "finished". If I do a
var_dump on it I have something like :
object(__PHP_Incomplete_Class)(3) {
  ["__PHP_Incomplete_Class_Name"]=>
  string(6) "classe"
  ["n"]=>
  int(1)
  ["sub"]=>
  object(__PHP_Incomplete_Class)(2) {
["__PHP_Incomplete_Class_Name"]=>
string(9) "subclasse"
["i"]=>
int(1)
  }
}

instead of
object(classe)(2) {
  ["n"]=>
  int(1)
  ["sub"]=>
  object(subclasse)(1) {
["i"]=>
int(1)
  }
}

It looks like there is a special intermediate object of type
__PHP_Incomplete_Class.
 If another object is an attribut of the session stored object, it is also
incomplete.
If I try to call some methods on it it throws an error saying the object is
incomplete and I cannot call methods or attributs on it.

TEMPORARY SOLUTION
**
What I do actually is making a kind of copy of this object trough
introspection and explicit casting :
$myObject =& convert("MyObjet", $IncompleteClassInstance) ;

But :
- this is not very convenient
- the MyObject must support a constructor with no arguments since the
process of conversion is :
* create a new instance of MyObject with no arguments (new
MyObject( ); )
* copy the attributes of the incomplete instance in this new Instance
  recurse if an attribute is itself another object
* return the new instance

QUESTIONS
***

Any idea about standard object casting in PHP ?
The process between class def and session starting if my session is auto
started (change in my php.ini) results in an error.
Thus I can affirm there is a bug in the session handling of PHP :"It is not
possible to store object in session if we use auto started sessions"


Alex






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] format date

2002-04-16 Thread Alex

I just started with php and am  trying to display a query result for a date
field as mm/dd/ instead of  mysql's  -mm-dd. I looked through some
books and found the use of DATE_FORMAT to covert the dates. Is there any
other way to format the date?

Thanks

My script looks like this:

  $month_1 = ($date_month_1);
  $day_1 = ($date_day_1);
  $year_1 = ($date_year_1);
  $month_2 = ($date_month_2);
  $day_2 = ($date_day_2);
  $year_2 = ($date_year_2);

  $query = "SELECT * FROM tablename where date >= '$year_1-month_1-$day_1-'
AND
date <= '$year_2-$month_2-$day_2'";

  $result = mysql_query($query);

  $num_results = mysql_num_rows($result);


echo "Number of records found: ".$num_results."";

  for ($i=0; $i <$num_results; $i++)
  {
 $row = mysql_fetch_array($result);

 echo "".($i+1).". ID: ";
 echo ($row["id"]);
 echo "First name: ";
 echo ($row["fname"]);
 echo "Last name: ";
 echo ($row["lname"]);
 echo "Date: ";
 echo ($row["date"]);



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




[PHP] can't get it to work

2002-04-03 Thread Alex

I'm trying to write code that will return all records found between certain
dates(e.g. 2001-01-30 through 2002-01-30). I created a html form with pull
down menus for both dates but when I try to run it I get a parse error and
can't figure out what's wrong.

Thanks,

Alex

Here is the php code:

$month_1 = addslashes($date_month_1);
$day_1 = addslashes($date_day_1);
$year_1 = addslashes($date_year_1);
$month_2 = addslashes($date_month_2);
$day_2 = addslashes($date_day_2);
$year_2 = addslashes($date_year_2);


$query = SELECT * FROM table where date  >= '$month_1/$day_1/$year_1' AND
date <= '$month_2/$day_2/$year_2';

$result = mysql_query($query);

$num_results = mysql_num_rows($result);

echo "Number of records found: ".$num_results."";

for ($i=0; $i <$num_results; $i++)
  {
 $row = mysql_fetch_array($result);
 echo "".($i+1).". ID: ";
 echo stripslashes($row["id"]);
 echo "First name: ";
 echo stripslashes($row["fname"]);
 echo "Last name: ";
 echo stripslashes($row["lname"]);
   }

?>



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




Re: [PHP] can't get it to work

2002-04-03 Thread Alex

That did the trick.

Thank you

"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Wed, 3 Apr 2002, Alex wrote:
> > I'm trying to write code that will return all records found between
certain
> > dates(e.g. 2001-01-30 through 2002-01-30). I created a html form with
pull
> > down menus for both dates but when I try to run it I get a parse error
and
> > can't figure out what's wrong.
> >
> > $query = SELECT * FROM table where date  >= '$month_1/$day_1/$year_1'
AND
> > date <= '$month_2/$day_2/$year_2';
>
> By the way, here's your parse error. You need to quote strings.
>
> $query = "SELECT ... ";
>
> miguel
>
>



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




Re: [PHP] Formatting timestamp date in MySQL

2002-04-09 Thread Alex

Hello,

I just started with php and I'm also trying to format mysql date -mm-dd
into mm/dd/. I looked through some books and they describe the use of
DATE_FORMAT to covert the dates. Is there any other way to format the date?
Thanks Alex

My script looks like this:

  $month_1 = ($date_month_1);
  $day_1 = ($date_day_1);
  $year_1 = ($date_year_1);
  $month_2 = ($date_month_2);
  $day_2 = ($date_day_2);
  $year_2 = ($date_year_2);

  $query = "SELECT * FROM tablename where date >= '$year_1-month_1-$day_1-'
AND
date <= '$year_2-$month_2-$day_2'";

  $result = mysql_query($query);

  $num_results = mysql_num_rows($result);


echo "Number of records found: ".$num_results."";

  for ($i=0; $i <$num_results; $i++)
  {
 $row = mysql_fetch_array($result);

 echo "".($i+1).". ID: ";
 echo ($row["id"]);
 echo "First name: ";
 echo ($row["fname"]);
 echo "Last name: ";
 echo ($row["lname"]);
 echo "Date: ";
 echo ($row["date"]);




"Justin French" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> There is a difference between MySQL's timestamp, and a UNIX timestamp.
>
> strtotime(); is a really valuable tool -- converting almost any English
date
> description -- check out the manual for more info.
>
> Anyway, in this case, it is able to convert your MySQL date of 20020409
into
> a unix timestamp, which is the required format for date() formatting.
>
>
> In clear code:
>
> 
> $date = "20020409";
> $date_unix = strtotime($date);
> $date_f = date('jS M Y',$date_unix);
> echo $date_f."";
>
> ?>
>
> Although this can be condensed to:
>
>  $date = "20020409";
> $date_f = date('jS M Y',strtotime($date));
> echo $date_f."";
> ?>
>
> or even just
>
>  $date = "19770417";
> echo date('jS M Y',strtotime($date));
> ?>
>
>
> Check out:
> http://www.php.net/manual/en/function.date.php
> http://www.php.net/manual/en/function.strtotime.php
>
> for more info and date() formats.
>
>
> Note: I haven't done a heap of testing with strtodate() to ensure it's
going
> to return what you expect, but I randomly tested 10 dates in your format
> between 1977 and 2002 without any problems.
>
>
> Justin French
> 
> Creative Director
> http://Indent.com.au
> 
>
>
>
>
> on 09/04/02 9:53 PM, nyon ([EMAIL PROTECTED]) wrote:
>
> > Hi,
> >
> > I need to recall a date data in a MySQL database.
> > The column is set as "date timestamp(8)".
> > A sample of date is "20020409"
> >
> > I use the PHP Date function to format it back to say "9th April 2002".
> > $date_formated = date($date, 'S M Y' );
> > However, it's still doesn't appear as formatted.
> >
> > Anyone mind sharing their code to do this?
> >
> > Nyon
> >
>



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




[PHP] Patch: Specify temp directory

2013-01-18 Thread ALeX
Hi,

some time ago I created a small patch to make it possible to specify
the temp dir by the php.ini.

It can be found here:
https://bugs.php.net/bug.php?id=60524
(my latest patch (against 5.4.3) also works for 5.4.11 and 5.5.0a3)

Now I do wonder if anything will happen or if that's it?

I would really appreciate if the patch would be included and hopefully
also some other people.

Regards,
ALeX.

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



Re: [PHP] Re: Sorting an array

2011-03-01 Thread Alex
That or do it in mysql before you get the data back, its also pretty good at 
sorting, you know ;)
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

FeIn  wrote:

Also check http://www.php.net/manual/en/function.natsort.php On Tue, Mar 1, 
2011 at 1:39 PM, David Robley  wrote: > Ron Piggott wrote: 
> > > > > I need help to know how to sort the words / phrases in my array. > > 
> > Variable name: $words_used > > print_r( $words_used ); Current output: 
Array ( [187] => Sin [249] => > > Punished [98] => Sanctuary [596] => Sing 
[362] => Anointing Oil ) Desired > > result: Alphabetical sort: Array ( [362] 
=> Anointing Oil [249] => > > Punished [98] => Sanctuary [187] => Sin [596] => 
Sing ) > > > > The #?s are the auto_increment value of the word in the mySQL 
database. > > The number is not representative of alphabetical order, but the 
order it > > was added to the database. > > > > Thank you for your assistance. 
> > > > Ron > > Like the man said - asort. May I recommend you to 
http://php.net where you > will find the answer to most of your queries, simply 
by looking under a > generic area, such as array (http://php.net/array) for
this particular > problem. Surely you have been around here long enough to be 
able to find > things in the documentation, or at least try there first, by 
now? > > > > > Cheers > -- > David Robley > > Do fish get thirsty? > Today is 
Setting Orange, the 60th day of Chaos in the YOLD 3177. > > > -- > PHP General 
Mailing List (http://www.php.net/) > To unsubscribe, visit: 
http://www.php.net/unsub.php > > 



Re: [PHP] executing external php script

2011-03-02 Thread Alex
The exec function should help you there
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

"ƒAƒ‹ƒxƒ‹ƒg"  wrote:

hi! what I want to do is execute php script and don't wait for output. found 
something like this_
> /dev/null 2>&1 &`; ?>   text 
 _
it works but I 'm curious about php syntax ,is it correct way to do that? or 
maybe there is better solution. Thanks for any advice. Best regards, Albert -- 
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
http://www.php.net/unsub.php 



Re: [PHP] Help needed with mysql import

2011-03-02 Thread Alex
You shouldn't have a default value in an auto increment field. You can set 
AUTO_INCREMENT to 0 and start with 1, but as auto increment is a unique field 
and its automagically incremented, you should not set a default value on it...
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Thijs Lensselink  wrote:

-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/02/2011 07:56 AM, Ashim 
Kapoor wrote: > Dear all, > > I am trying to make a website with php and I 
found the following code in a > book and I am trying to import it. The 
following are the beginning of the > file i am trying to import with the 
command > > mysql -u root -pmypassword certainty < dump > > I get the following 
error : ERROR 1067 (42000) at line 9: Invalid default > value for 'id' > > but 
when I see line 9 i see the value '0' for id which seems ok to me, I > also 
tried removing the quotes but same error. > > Can someone guide me ? > > Thank 
you, > Ashim > > # MySQL dump 7.1 > # > # Host: [host deleted] Database: 
certainty > #_
> # Server version 3.22.32 > # > # Table structure for table 'high_scores' > # 
> > CREATE TABLE high_scores ( > id int(11) DEFAULT '0' NOT NULL 
> auto_increment, > name varchar(30), > answer_count int(11), > credit 
> double(16,4), > PRIMARY KEY (id) > ); > It's not really a PHP question. But 
> here goes. Your first field "id" is an auto_increment field this means the 
> counter goes up by every insert. Normally this will start at 1 not 0. So 
> either change the 0 to a higher number or remove the auto_increment part 
> before you import change the 0 after and alter the table to put back 
> auto_increment -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 
> (GNU/Linux) iQIcBAEBAgAGBQJNbfOvAAoJEMffsHAOnubXC7UP/1k5qA4TDxDnUKrYZLV/rl9s 
> bLRPTQ21riFMIzt0ne14No4+MTwjNtfVAdSnjpCWEZP+Y2MEixaiz8gIcOt9GIOD 
> f9QPJZFEIcVADs3lqeS88eqdgRBNiYy3x2PHyslR3jtuaeFrRvxOLBTgBISq6Ih4 
> Dd5nRCbo6WObQ5e26HhbDeMJDAnOw4iQMjpoxc6UD9syxkJrORYw6XFvEmJA/QNF 
> RDTNIO7P62ROamGor8urmPdfIemFLyqjD5YAQ64O6aWVHp0ehjO4l1xPWCeI84sV
2g8C3yqi06UjYOE8NHrf64VYcQtvLFkJbzGT6mmPwEP0gBdqX6o2YDwnudv7+APN 
F5zoVBv/7wygFaP+P0zgJ+EWVML35VfJFuq5VCH3CUk1hROS4X/JtsNXdVkAbaFA 
BpEhQ4jN0x/34HrI1cWjEUwaUuU6m9XoMIuO+1tQRLFatEW9I5z1c3hrJsPUNImX 
qSxEGLAZyA7tex++4YFn8DZXWz4mdllI7yejRe0nl1vl4Nn1+t2se/vF0TfZAGdB 
HgDeUWTdY/N2KeT4z9gPjGEDlRp8Wqo13Sv1yVhzWDdAJQdWaH8+Kk0GCI0jBrgT 
Pthmjr0e4bKCW19SJtL7/mTRU12qX/kbjMG5JqIh1ixn72qgqcvkTjgvEeQ1Y0DM 
xBBFUUedwoKevRJI05/2 =mdri -END PGP SIGNATURE- -- PHP General Mailing 
List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 



Re: [PHP] something about dates in mysql

2011-03-03 Thread Alex
Just a correction, dates in mysql are not strings by any means, they are stored 
in 3 bytes (date and time or 8 bytes for datetime) and that's nowhere enough 
for a string, however the representation of the date is a formatted string, so 
for all intents and purposes any comparison to a date field should be using 
quotes like mentioned already. 
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Nathan Rixham  wrote:

Richard Quadling wrote: > On 3 March 2011 10:09, Webforlaget.dk 
 wrote: >> I need help to know Why this dont work ? >> 
>>_
>> >> $thisdate =date("Y-m-d",mktime(0,0,0,$mth, $day, $year)); >> >> $sql = 
>> >> "SELECT id,case,startdate,enddate FROM table WHERE startdate<=$thisdate 
>> >> AND enddate>=$thisdate ORDER BY startdate"; >> 
>> >> >>_
>> >> The result should be an array whith open cases at $thisdate, but nothing 
>> >> appear. >> >> Is it something about dates in mysql ? >> >> Thanks for any 
>> >> advice. >> >> Best regards, >> >> Venlige hilsner >> >> Rolf Brejner > > 
>> >> I think that dates in SQL statements need to be in the quotes as they > 
>> >> are strings and not integers. > > So, try ... > > $sql = "SELECT 
>> >> id,case,startdate,enddate FROM table WHERE > startdate<='$thisdate' AND 
>> >> enddate>='$thisdate' ORDER BY startdate"; > > I'm surprised you don't get 
>> >> an error > > Ah. As it stands, the SQL is something like ... > > 
>> >> WHERE startdate <= 2010 - 3 - 3 > > So, probably the actual test that is 
>> >> being executed is  > > WHERE startdate <= 2004 > > Which, for a date 
>> >> stamp will never return anything sensible. yes, and remember the DATE and 
>> >> FROM_UNIXTIME mysql functions too. -- PHP General Mailing List 
>> >> (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 



Re: [PHP] Double method access (Hi everyone! :))

2011-03-04 Thread alex

On 03/04/2011 09:25 PM, Paola Alvarez wrote:

Hi there!,
I have been reading this list before but this is my first post.
Reading some code from Symfony I got this: $this->getTable()->getColumns()
...when you can use this double method access?, I used before the
regular $this->getTable(), but two?. I mean I have been trying but I got an
error*

* Fatal error: Call to a member function ... on a non-object in ...
   


I think the problem is $this->getTable() returns non-object.

There is nothing wrong with using multiply  "->" as long as return-value 
from previous call is an object.


Alex

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



Re: [PHP] imap_search ?

2011-03-07 Thread Alex
Imap remains open after you search and doesn't close until you call imap_close. 
Firstly the code shouldn't be written like that, while should not operate on a 
fail condition of a function exec, that's just bad coding practice and that's 
what causes a loop here. If there are no messages in the email box, imap search 
will return false, and you will have a loop until it gets a message... 

Here is what your scrip does:

First run:
Get all messages
Gets array of messages
Fails while condition
Fetch
Print
Delete all
Exit

Next time:
Get messages 
Gets false (no messages)
Hits while loop where by it will continue to send imap requests until a message 
hits the mail box (your almost infinite loop)
.




-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Tontonq Tontonq  wrote:

hi ! it works if there is / are emails in the box before script run (i use cli 
not web based) but after it works 1 time it doesnt work again it enters to 
infinite loop , at that line while(!$emails) { $emails = 
imap_search($inbox,'ALL'); echo "email yok\n"; print_r($emails); } 
imap_search($inbox,'ALL'); it doesn't try to research emails in $inbox, doesn't 
it stay as connected or it's just for 1 time use :S ? should i reuse imap_open 
everytime when i need to use imap_search ? $inbox = 
imap_open($hostname,$usernamex,$password) or die('Cannot connect to domain:' . 
imap_last_error()); function onayla() { global $inbox; $emails = 
imap_search($inbox,'ALL'); while(!$emails) { $emails = 
imap_search($inbox,'ALL'); echo "email yok\n"; print_r($emails); } echo 
"\nyeaah"; print_r($emails); if($emails) { rsort($emails); echo "Number of 
email:".imap_num_msg($inbox); foreach($emails as $email_number) { $overview = 
imap_fetch_overview($inbox,$email_number,0);
if(stristr($overview[0]->subject,"Test")) { $message = 
imap_fetchbody($inbox,$email_number,1); echo "$message\n\r"; 
//$link=arasi('activate:','-- The',$message); //echo "\n\r".$link; 
#fwrite(fopen("deneme.txt",w),file_get_contents($link)); 
//imap_delete($inbox,'1:*'); //imap_expunge($inbox); } } } 
imap_delete($inbox,'1:*'); imap_expunge($inbox); } 



Re: [PHP] String eval assistance

2011-03-16 Thread Alex
I'm not sure as to why strpos does what it does here, at least its not 
immediately obvious, but, a solution to this would be to use a regular 
expression search, it would be more exact, it has never failed me, and it will 
be faster; I recall reading that preg functions were faster at then str ones, 
though I can't recall where...
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Richard Quadling  wrote:

On 16 March 2011 00:25, Jack  wrote: >> Here you're 
trying to access it as an array, which it's not, so the > 'response' >> key 
doesn't exist.  In addition, you're looking for UPPER-CASE, whereas > that's >> 
not the case in your example variable. >> Finally, you're checking to make sure 
that the string IS INDEED found, but >> then printing that it was declined (!== 
false).  Instead, you may >> want: >> >> > >> $results['response'] = 
'3434approd34'; >> >> if (stripos($results['response'],'APPROVED') !== false) { 
>> // It's been found >> } else { >> // Oh, crap. >> } >> >> ?> > > 
maybe I should do this some other way because I'm getting false positives. > > 
I was using if(strpos($results['response'], 'APPROVED') !== false) { > And its 
found if the value of $results = "3434APPROVED34" and it also is > found if its 
$results = "3434APPOVED34", so this may not be the best way to > accomplish 
this. > > > -- > PHP General Mailing List
(http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > 
Can you create a small list of actual values and their results. What version of 
PHP are you using? -- Richard Quadling Twitter : EE : Zend @RQuadling : 
e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List 
(http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 



Re: [PHP] A Review Request

2011-05-21 Thread Alex
Yep, and it comes in handy, especially in school, lol, in advanced algorithms 
and datastructures, I once submitted a project assignment that was 5 lines 
long, and instead of figuring out anagrams, strcmp was very helpful :)

Sent from my Verizon Wireless 4GLTE smartphone

- Reply message -
From: "tedd" 
To: "Joshua Kehn" , "PHP General" 

Subject: [PHP] A Review Request
Date: Sat, May 21, 2011 9:26 am


At 2:49 PM -0400 5/19/11, Joshua Kehn wrote:
>On May 19, 2011, at 2:44 PM, Andre Polykanine wrote:
>
>>  Hello Alex,
>>
>>  Two (stupid?) questions:
>>  1. Why PHP_SELF is better than SCRIPT_NAME?
>>  2. Why strcmp() is better than just comparing?
>>
>>  --
>>  With best regards from Ukraine,
>>  Andre
>>  Skype: Francophile
>>  My blog: http://oire.org/menelion (mostly in Russian)
>>  Twitter: http://twitter.com/m_elensule
>>  Facebook: http://facebook.com/menelion
>
>No idea about the first, and I've never used strcmp() before for an 
>equality check. If there is something I'm missing I would love to 
>know.
>
>Regards,
>
>-Josh

-Josh:

The function strcmp() simply evaluates two strings and reports back 
-1, 0, or 1 depending upon their  alphabetical relationship.


Cheers,

tedd


-- 
---
http://sperling.com/

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



Re: [PHP] mysqli_query() returns NULL?

2011-06-18 Thread Alex
If you were to use the proper object form of it, you'd spot the mistake, as it 
will tell you that you are trying to perform an action on a non-object. 

It might be a bug, or the developers might not have cared figuring that if you 
threw it in an if(!...) it would validate as false anyways. But it.might be a 
bug or an oversight. It might actually be falling through some ifs and 
returning the result that was instantiated as null, I dunno...

Sent from my Verizon Wireless 4GLTE smartphone

- Reply message -
From: "James Colannino" 
To: 
Subject: [PHP] mysqli_query() returns NULL?
Date: Fri, Jun 17, 2011 4:40 pm


Hey everyone,

After reading the documentation for mysqli_query(), I was lead to 
believe that on any error it would return false.  However, through a 
stupid mistake, I discovered that when I specify an invalid value for 
the database link identifier (in my case, I accidentally passed an 
integer), instead of false I get a return value of NULL.  Does anyone 
know why?

Thanks!

James

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



[PHP] GD error on 4.3.7: fatal libpng error

2004-06-07 Thread Alex
Hi!

I'm not sure if this is the right place to post this, or if this is a bug or
something I'm doing wrong.

My host recently upgraded to 4.3.7, and since then, GD support for PNG's has
been broken. Accessing GD PNG images directly shows the following error
message:

Fatal error:  imagepng(): gd-png:  fatal libpng error: Incompatible libpng
version in application and library in
/home/cookiebe/public_html/manager/media/graphing/panachart.php on line 469

This occurs on a Linux server runnign PHP as an Apache module, with the
following compile flags set:

'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-xml'
'--enable-bcmath' '--enable-calendar' '--with-curl' '--with-dom'
'--with-dom-xslt' '--with-dom-exslt' '--enable-exif'
'--with-swf=/usr/local/flash' '--enable-ftp' '--with-gd'
'--with-jpeg-dir=/usr/local' '--with-png-dir=/usr'
'--with-xpm-dir=/usr/X11R6' '--with-gettext' '--with-imap' '--with-imap-ssl'
'--with-kerberos' '--enable-mbstring' '--enable-mbstr-enc-trans'
'--enable-mbregex' '--with-mcrypt' '--with-mhash' '--enable-magic-quotes'
'--with-mysql' '--with-openssl' '--enable-discard-path' '--with-pear'
'--enable-sockets' '--enable-track-vars' '--with-ttf'
'--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--enable-versioning'
'--with-xmlrpc' '--with-zlib'

On my Windows server at home, also running PH 4.3.7, it works fine.

Have I done something wrong or have I found a bug (which I then need to
report in the bug tracker)?

Thanks,
Alex

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



[PHP] phpMyAdmin--resetting auto increments to 0

2006-04-15 Thread alex
hi everyone

i have delete a few entries in my database as they were entered for testing 
purposes and are no longer need (actually 102 entries)... and even thought 
that db is empty i noticed that when the next entry went in the id number 
went to 103
not 0 so i was wondering is it possible to somehow reset the value to 
zero...

it is of int type and auto_increment

i have a few db's which id like to reset to zero i have tried placing a zero 
enrty after deleting the lot but it only jumps to  its next increment.
does anyone know what i mean...?
any help will be grateful
regards alex 

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



[PHP] XPath avg(), min(), max() functions not found

2006-06-08 Thread Alex
Hi all. I'm trying to use XPath avg(), min() and max() functions
without success. Others functions like count() or sum() works correctly.

Here is the code I'm using (PHP 5.1):


  
    
      25
      7
    
    
      50
      3
    
  

';

$xml_doc = new DOMDocument();
$xml_doc->loadXML($xml_str);

$xpath = new DOMXPath($xml_doc);

$cards_avg = $xpath->evaluate("avg(//card/[EMAIL PROTECTED]'visits'])");
var_dump($cards_avg);

$cards_sum = $xpath->evaluate("sum(//card/[EMAIL PROTECTED]'visits'])");
var_dump($cards_sum);

?>

I receive the following output:

[EMAIL PROTECTED]:/tmp$ php test.php
PHP Warning:  DOMXPath::evaluate(): xmlXPathCompOpEval: function avg not
found in /tmp/test.php on line 23

Warning: DOMXPath::evaluate(): xmlXPathCompOpEval: function avg not found
in /tmp/test.php on line 23
PHP Warning:  DOMXPath::evaluate(): Unregistered function in /tmp/test.php
on line 23

Warning: DOMXPath::evaluate(): Unregistered function in /tmp/test.php on
line 23
object(DOMNodeList)#5 (0) {
}
float(75)
[EMAIL PROTECTED]:/tmp$

Someone can help me?

Thanks in advance

Alex

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



[PHP] Re: XPath avg(), min(), max() functions not found

2006-06-09 Thread Alex
Rob Richards wrote:
> min(), max() and avg() don't exist in XPath 1.0 which is the version
> implemented in libxml2. You need to calculate these yourself. For example:

Thanks for your help.

Alex

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



[PHP] Unique ID - again

2004-02-12 Thread Alex
Hi folks,
I'm using usual md5(microtime()); to create IDs, but now I've encountered a
problem with that. I need to create explicitly 6 digit unique
number(decimal). Yes, I know I can use for/while loop to fill a string with
digits, but is it ABSOLUTELY sure that the random will never return same
number when seed is microtime()? It is very important as the number will
identify a bank transfer...

Is there any other way than checking with all previous IDs? Or some MySQL
function to do this for me?

thank you
Alex

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



[PHP] php5.0.5 include() terminates script BUGBUGBUGBUG

2006-01-19 Thread alex
has anyone had an issue using php5.0.5 i seem to have a problem when my 
scirpt hits the include() statement it terminates the rest of the script... 
the script im using is a complicated login system...the script works fine 
onlinemy server is using php 4.3.1 (i was too before upgrade) and the 
script runs fine you can view it here http://www.phdev.net the script starts 
working in the ebook center section when registering... my first few lines 
at the start of the page and there after have the include statement... so in 
php 5.0.5 none of the pages appear...does anyone have anyidea i have 
altered this comment to require but still the samethe file tree seems to 
be in order too
regards alex 

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



Re: [PHP] php5.0.5 include() terminates script BUGBUGBUGBUG

2006-01-25 Thread alex
thanks all for your help.. i have upgraded to php5.1.2 and the problem has 
resolved itself...as it stands for me php5.0.5 cannot handle multiple 
include statments..
regards alex
"Jochem Maas" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> David Hall wrote:
>> Jochem Maas wrote:
>>
>>>>
>>>> the first and second line you can alter it or just switch between 
>>>> pending if you want it to display the file or just to tell you if it 
>>>> exists or not so...applying this code just before my include 
>>>> statments all verifys ok(thats the file exists) if i use line 1 
>>>> nothing appearsit says the file exists according to line 2 yet it 
>>>> wont display??? of course i REM either line out 
>>>> accordingly.so...the register page starts with an include called 
>>>> session.php in that session.php i have another 3 includes... 
>>>> mailer.php,database.php and form.php each tested for line 2 and ok but 
>>>> not for line 1 nothing appears if i move that phpinfo.php file around 
>>>> into those directories(folders and subfolders) and test it then it ok's 
>>>> for line 1 i get a display and ok for line 2 too. but of course 
>>>> phpinfo.php when called doesnt have another include statement in it... 
>>>> i really cant explain it perhaps php 5.0.5 doesnt support multiple 
>>>> include statementsstrange???
>>>
>>>
>>> thats just silly.
>>
>>
>> it just isn't displaying errors, doing all this nonsense with file exists 
>> is a waste of time, just add two lines to the top of your script (that 
>> includes the file):
>>
>> error_reporting(E_ALL);
>> ini_set('display_errors','on');
>>
>> (or set these values in the php.ini if you have access to that)
>> and look at what that tells you.  You might not understand the error at 
>> first, but hopefully you will.  My guess is that it will tell you it 
>> can't parse your included file.
>
> right - waste of time - not displaying errors.
> I have documented a problem that has existed since php5beta3 - namely 
> under certain
> conditions (only ever in big codebases in seems) a failed require 
> statement will NOT
> GENERATE ANY ERRORS REGARDLESS OF THE RELATED INI SETTINGS AND CAUSE THE
> ENGINE TO STOP PROCESSING. (you might guess that this problem is a little 
> annoying!)
>
> so the OP _may_ be a blithering idiot who hasn't turned on error reporting 
> to
> full BUT there is a very good chance that php is borking on one of his 
> includes/requires
> and crapping out WITHOUT any errors being reporting.
>
> so its seems like it should be nonsense but it reality there is a real 
> issue the OP
> could walking into.
>
>>
>> David Hall
>> 

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



[PHP] notice prevents setting cookie in 4.3.0RC2?

2002-12-15 Thread Alex Pukinskis
I've been having trouble with a script that works fine in 4.1 and
4.2.3, but doesn't work in 4.3.0RC2.  It seems that if your script
generates a php notice (which is logged, not displayed to the screen)
something gets output anyway; this prevents setting cookies.  Here's
the simplest example I could come up with:



Since $undefinedVariable is undefined, we get the following in the
server log:

PHP Notice:  Undefined variable:  undefinedVariable in
/home/www/dev/pLogin.php on line 2

which is fine; unfortunately, it's followed by:

PHP Warning:  Cannot modify header information - headers already sent
in /home/www/dev/pLogin.php on line 3

This shouldn't happen because display_errors is set to Off (which to me
means that nothing should be output to the user when there is a notice.

Can someone who's running 4.3.0RC3 try this script? (You probably have
to make sure error_reporting  is set to  E_ALL).  If this has been
fixed in RC3, it should say "Cookie set".  If it says "Could not set
cookie", it seems to me like this bug should be reported.

By the way, is there any easy way to see what's changed in pre-release
versions of PHP, short of digging through the CVS logs?

-Alex



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




[PHP] easy spliting

2002-12-18 Thread Alex Ciurea
Hi,

I know it is easy but I can't figure how I should do

I want to split a string from position  1 to 9, from 10 to 36, from 37 to 54 and so 
on...

how can I do this?


is there a function who does this?


Regards,

Alx





Re: [PHP] mcrypt

2002-12-23 Thread Alex Piaz
As far as I know, there is no mcrypt windows version. You´ll have to try to 
compile it yourself. And don´t ask me how because I don´t know:-)

A sugestion: If you can, change to linux. It´s better and it´s Free.

Regards

Alex


At 18:33 23/12/2002 -0500, Ysrael Guzmán wrote:
Hi, my server is win 2000 server and IIS 5.0
i wnat to work to MCRYPT, but i don't know...

help me please.

Por favor yo estoy trabajando con windows 2000 server, y mi servidor web
es un Internet Information Service, trabajo con PHP y Mysql...
deseo encriptar con MCRYPT, pero no viene instalado como hago...
es dificil

alguien sabe o a trabajado con esto en windows...

AYUDA!


Ysrael Guzmán Meza



--
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




[PHP] Can I Copy a directory using PHP?

2003-01-13 Thread Alex Ciurea
Hello,

I want to write a script that makes a backup of a database directory.

Actually, to copy all database files to another directory.
I've figured that I have to use the "copy" function of the PHP, but the
function doesn't works only with files?



Is it possible to copy the entire directory to another location, using PHP?
I presume that is more "resource-friendly" than to copy the directory
file-by-file.


Thanks and best regards,
Alexoiul


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




[PHP] Need some help in "exec"-attack

2003-01-13 Thread Alex Ciurea
Hi all,

this is my situation:
I want to execute some comands using 'shell_exec':

$command=shell_exec("ls -la /usr/dest_dir;cp -R /usr/source_dir/1.php
/usr/dest_dir;cd /usr/dest_dir;ls -la");
echo "$command";

Actually, these commands:
1)ls -la /usr/dest_dir
2)cp -R /usr/source_dir/1.php /usr/dest_dir
3)cd /usr/dest_dir
4)ls -la

This is what I get:

total 8
drwxr-xr-x2 mysqlmysql4096 Jan 13 13:29 .
drwxr-xr-x   18 mysqlmysql4096 Jan 13 12:25 ..
total 8
drwxr-xr-x2 mysqlmysql4096 Jan 13 13:29 .
drwxr-xr-x   18 mysqlmysql4096 Jan 13 12:25 ..

the first 3 lines, before the 'cp' command
the last 3 lines, after the 'cp' command.

As you can see, no changes.

I've looked in the logs of the apache webserver and i've found this line:

cp: cannot create regular file `/usr/dest_dir/1.php': Permission denied

Note: source_dir and dest_dir are both owned by mysql

Another thing :

cp: cannot create regular file `/usr/dest_dir/1.php': Permission denied

The path begin with a back tick . Is that normal?










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




Re: [PHP] Need some help in "exec"-attack

2003-01-13 Thread Alex Ciurea
Hi,

I think I've solved the problem

group owner of the dest_dir must be apache !!! 



- Original Message - 
From: "Alex Ciurea" <[EMAIL PROTECTED]>
To: "php mailing" <[EMAIL PROTECTED]>
Sent: Monday, January 13, 2003 1:53 PM
Subject: [PHP] Need some help in "exec"-attack


> Hi all,
> 
> this is my situation:
> I want to execute some comands using 'shell_exec':
> 
> $command=shell_exec("ls -la /usr/dest_dir;cp -R /usr/source_dir/1.php
> /usr/dest_dir;cd /usr/dest_dir;ls -la");
> echo "$command";
> 
> Actually, these commands:
> 1)ls -la /usr/dest_dir
> 2)cp -R /usr/source_dir/1.php /usr/dest_dir
> 3)cd /usr/dest_dir
> 4)ls -la
> 
> This is what I get:
> 
> total 8
> drwxr-xr-x2 mysqlmysql4096 Jan 13 13:29 .
> drwxr-xr-x   18 mysqlmysql4096 Jan 13 12:25 ..
> total 8
> drwxr-xr-x2 mysqlmysql4096 Jan 13 13:29 .
> drwxr-xr-x   18 mysqlmysql4096 Jan 13 12:25 ..
> 
> the first 3 lines, before the 'cp' command
> the last 3 lines, after the 'cp' command.
> 
> As you can see, no changes.
> 
> I've looked in the logs of the apache webserver and i've found this line:
> 
> cp: cannot create regular file `/usr/dest_dir/1.php': Permission denied
> 
> Note: source_dir and dest_dir are both owned by mysql
> 
> Another thing :
> 
> cp: cannot create regular file `/usr/dest_dir/1.php': Permission denied
> 
> The path begin with a back tick . Is that normal?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> 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] Need some help in "exec"-attack

2003-01-13 Thread Alex Ciurea
:( Yes I've realised that.

It seemed to me that is more efficient to make a copy of that files, rather
than a mysqldump.

but Yes, in order to access files of the mysql directory, I have to give to
the webserver all the rights, solution that I don't aproove, for security
reasons.





- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 13, 2003 3:08 PM
Subject: Re: [PHP] Need some help in "exec"-attack


> On Monday 13 January 2003 19:53, Alex Ciurea wrote:
> > Hi all,
> >
> > this is my situation:
> > I want to execute some comands using 'shell_exec':
> >
> > $command=shell_exec("ls -la /usr/dest_dir;cp -R /usr/source_dir/1.php
> > /usr/dest_dir;cd /usr/dest_dir;ls -la");
> > echo "$command";
> >
> > Actually, these commands:
> > 1)ls -la /usr/dest_dir
> > 2)cp -R /usr/source_dir/1.php /usr/dest_dir
> > 3)cd /usr/dest_dir
> > 4)ls -la
> >
> > This is what I get:
> >
> > total 8
> > drwxr-xr-x2 mysqlmysql4096 Jan 13 13:29 .
> > drwxr-xr-x   18 mysqlmysql4096 Jan 13 12:25 ..
> > total 8
> > drwxr-xr-x2 mysqlmysql4096 Jan 13 13:29 .
> > drwxr-xr-x   18 mysqlmysql4096 Jan 13 12:25 ..
> >
> > the first 3 lines, before the 'cp' command
> > the last 3 lines, after the 'cp' command.
> >
> > As you can see, no changes.
> >
> > I've looked in the logs of the apache webserver and i've found this
line:
> >
> > cp: cannot create regular file `/usr/dest_dir/1.php': Permission denied
> >
> > Note: source_dir and dest_dir are both owned by mysql
>
> Presumably you're trying to backup a mysql database. In a standard setup
the
> database files are only accessible to the 'mysql' user. Your webserver,
under
> normal circumstances, would not be able to access those files. Once you
get
> over this hurdle, the second problem is that your destination directory is
> not writeable by any user other than mysql.
>
> In short you're better off using mysqldump to backup your databases.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> "Consequences, Schmonsequences, as long as I'm rich."
> -- "Ali Baba Bunny" [1957, Chuck Jones]
> */
>
>
> --
> 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] Need some help in "exec"-attack

2003-01-13 Thread Alex Ciurea

Oh, I get it Jason,

it's okay the idea of mysqldump


Now i see it's more efficient mysqldump rather than my stupid thought.


10x alot,
Alexoiul


- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 13, 2003 3:27 PM
Subject: Re: [PHP] Need some help in "exec"-attack


> On Monday 13 January 2003 21:13, Alex Ciurea wrote:
> > Hi,
> >
> > I think I've solved the problem
> >
> > group owner of the dest_dir must be apache !!!
>
> NB if mysql is running whilst you're copying the files then you could end
up
> with incorrect backups.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Q: How many marketing people does it take to change a lightbulb?
> A: I'll have to get back to you on that.
> */
>
>
> --
> 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




[PHP] PHP 4.1.2 session problem

2003-01-29 Thread Alex Shi
Hi,

I am sure at least I was not a newbie in the topic I am talking about.
But this problem made crazy. I was hoping for a bit of help please.

The problem is: you have to make double correct logins to get into 
the session protected area. Here is the situation:

1. server configuration:
PHP 4.1.2,
Rapidsite/Apa/1.3.26 (Unix),
FrontPage/5.0.2.2510,
mod_ssl/2.8.10,
OpenSSL/0.9.6e 

2. the the login script:


3. in the session protected area, each php file must be added with
following code at very begining:



Again, with the script above, the problem is: you have to make 
double correct logins then you can get into the protected location.

The similar scripts have been used in many different projects but 
only this one get so weird result. So I would prefer to say session 
behaviour on this server is abnormalHowever, I do hope I myself 
made something wrong thus the bug is possible to be fixed...

Thanks for any help in advance!

Alex Shi

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




[PHP] text to image

2003-02-14 Thread Alex Shi
Hello,

I am thinking to create php script to dynamically convert a text string to
image. My questions are:

1. with a given text string, say "hello, world", is it possible to
dynamically
convert it to an image? and what php built-in functions can be utilized?
2. if I want to use true-type verdana font, can I just upload the windows
font file to the web server (linux) and use php to load the font?

Thanks in advance!

Alex Shi



--
==
Cell Phone Batteries at 30-50%+ off retail prices!
http://www.pocellular.com
==
TrafficBuilder Network:
http://www.bestadv.net/index.cfm?ref=7029
==


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




Re: [PHP] text to image

2003-02-14 Thread Alex Shi
Hi, THanks for your reply.

I search the manual and created following script.



I got following error msg when ran it:


Warning:  ImageTtfText: No TTF support in this PHP build in
/home/dotkard/www/current_time.php on line 6

Warning:  ImageGif: No GIF support in this PHP build in
/home/dotkard/www/current_time.php on line 7

I checked the phpinfo but failed to find which variable I should turn on.

Alex

> Alex,
> Easy to do what you want.  Check out the "image" functions in the php
> manual.  There are some font limitations, specifically dealing with
> alternate characters, but you'll find out what works and what doesn't soon
> enough.
> Hugh
>
> - Original Message -
> From: "Alex Shi" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, February 14, 2003 10:16 AM
> Subject: [PHP] text to image
>
>
> > Hello,
> >
> > I am thinking to create php script to dynamically convert a text string
to
> > image. My questions are:
> >
> > 1. with a given text string, say "hello, world", is it possible to
> > dynamically
> > convert it to an image? and what php built-in functions can be utilized?
> > 2. if I want to use true-type verdana font, can I just upload the
windows
> > font file to the web server (linux) and use php to load the font?
> >
> > Thanks in advance!
> >
> > Alex Shi
> >
> >
> >
> > --
> > ==
> > Cell Phone Batteries at 30-50%+ off retail prices!
> > http://www.pocellular.com
> > ==
> > TrafficBuilder Network:
> > http://www.bestadv.net/index.cfm?ref=7029
> > ==
> >
> >
> > --
> > 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] text to image

2003-02-14 Thread Alex Shi
forgot somethingwhen try following script in another server I got
500 internal server error.



Alex again

>
> I got following error msg when ran it:
>
> 
> Warning:  ImageTtfText: No TTF support in this PHP build in
> /home/dotkard/www/current_time.php on line 6
> 
> Warning:  ImageGif: No GIF support in this PHP build in
> /home/dotkard/www/current_time.php on line 7
>
> I checked the phpinfo but failed to find which variable I should turn on.
>
> Alex
>
> > Alex,
> > Easy to do what you want.  Check out the "image" functions in the php
> > manual.  There are some font limitations, specifically dealing with
> > alternate characters, but you'll find out what works and what doesn't
soon
> > enough.
> > Hugh
> >
> > - Original Message -
> > From: "Alex Shi" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, February 14, 2003 10:16 AM
> > Subject: [PHP] text to image
> >
> >
> > > Hello,
> > >
> > > I am thinking to create php script to dynamically convert a text
string
> to
> > > image. My questions are:
> > >
> > > 1. with a given text string, say "hello, world", is it possible to
> > > dynamically
> > > convert it to an image? and what php built-in functions can be
utilized?
> > > 2. if I want to use true-type verdana font, can I just upload the
> windows
> > > font file to the web server (linux) and use php to load the font?
> > >
> > > Thanks in advance!
> > >
> > > Alex Shi
> > >
> > >
> > >
> > > --
> > > ==
> > > Cell Phone Batteries at 30-50%+ off retail prices!
> > > http://www.pocellular.com
> > > ==
> > > TrafficBuilder Network:
> > > http://www.bestadv.net/index.cfm?ref=7029
> > > ==
> > >
> > >
> > > --
> > > 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




[PHP] recursion?????

2003-02-14 Thread Alex Davis

Ok ... here is the sitituation... I am creating a registration form.
What I have so far works ... the user registers using this form and the
form calls another page that will check the validity of the data
(checking for username availability, etc...). If there is an error,
display the error and have the user GO BACK AND TRY AGAIN <- This is
the problem I want to fix.

What I want to do is have the registration form, on submit, check the
data validity right then, if there is an error, redisplay the form with
an * next to the field that is incorrect. This way the user does not
have to go back and try again, it will be there in front of them.

Basically, have the form action call itself  hince the recursion.

Any suggestion/examples?

Thanks,

-Alex



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




[PHP] redirect

2003-02-14 Thread Alex Davis
What is the syntax to have php redirect to another web site?


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




[PHP] again, dynamic image of text string

2003-02-15 Thread Alex Shi
Hi,

I am using following script to generate a dynamic picture from 
a text string. It works fine for both my developing server and the
application server (a virtual host). Both server are Linux RH. 



The ImageString utilizes a php built-in font to generate image. 
However if replace this function with ImageFtText() (see the 
commented line), it will get error on both servers. 

On my developing server the error is "no ttf support". I checked 
phpinfo and in the GD section it says it does not have ttf support, 
so I would assume a recompiling with ttf support will resolve the 
issue.  

On the application server since the server API is CGI but not 
Apache, all type of errors will be shown as 500 internal error. 
I checked the phpinfo in its GD section ttf support is enabled. 
I tried several different types of fonts but all get same error. 
I found those font files from windows and uploaded them to the 
server. I don't if the Windows fonts could work for Linux.


Alex Shi


-- 
==
Cell Phone Batteries at 30-50%+ off retail prices!
http://www.pocellular.com
==
TrafficBuilder Network: 
http://www.bestadv.net/index.cfm?ref=7029
==

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




[PHP] Is this an unique user name???

2003-02-18 Thread Alex Davis
Ok... I am trying to have this registration page search a table in a db 
to find out if the user name supplied is unique. Here is the syntax that 
I used but it does not seem to work:


.

$var_UserName = addslashes($_POST['User_Name']);

.

$query  = "SELECT * FROM company_info WHERE UserName = '";
$query .= $var_UserName."'";

$result = mysql_query($query);

// This is where the problem come in... I tried these two options, both
// failed.

//Opt1
$num_results = mysql_num_rows($result);

if( $num_results > 0 ) //this user name is not unique
{ // exec the error methods }
else
{ // add record to db }

//Opt2
if( $results ) // To my knowlegde ;) this would be true if $results > 0
{ // exec error }
else
{ // add record }

.
?>

Is there something that I am missing? Or actually doing wrong? If 
anybody would need to see the whole script I would be glad to supply on 
demand.

Thank for your time,
-Alex


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



[PHP] Post method

2003-02-28 Thread Alex Shi
Hi,

Any one know in a php script, if it is possible to simulate a post method?
I mean I want to header() to an url but don't like to embed the parameters
into that url.

Thanks in advance!

Alex Shi


-- 
==
Cell Phone Batteries at 30-50%+ off retail prices!
http://www.pocellular.com
==
TrafficBuilder Network: 
http://www.bestadv.net/index.cfm?ref=7029
==

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



Re: [PHP] Post method

2003-02-28 Thread Alex Shi
> Curl will let you perform post operationgs, take a look at
> http://www.php.net/curl.
>
> Note you will need to have libcurl installed and PHP will have to be
> compiled with curl support.
>
> There are also probably classes that allow you to do post requests, take
> a look at the script repositories, hotscripts.com and you might try
> phpclasses.org as well.
  ^^
Thanks! I found a great class in phpclasses.org.

Alex


>
> Jason
> On Fri, 2003-02-28 at 14:09, Alex Shi wrote:
> > Hi,
> >
> > Any one know in a php script, if it is possible to simulate a post
method?
> > I mean I want to header() to an url but don't like to embed the
parameters
> > into that url.
> >
> > Thanks in advance!
> >
> > Alex Shi
> >
> >
> > --
> > ==
> > Cell Phone Batteries at 30-50%+ off retail prices!
> > http://www.pocellular.com
> > ==
> > TrafficBuilder Network:
> > http://www.bestadv.net/index.cfm?ref=7029
> > ==
> >
> > --
> > 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



[PHP] PHP WEB module doesn't execute php console scripts?

2003-03-05 Thread Alex Ciurea
Hello,

I have a linux-debian machine. I've installed the php-module for the apache web 
server, and I've realized that my php scripts (launced from console) doesn't work.

What should I install in order to make working those php-scripts ?

I know that's a silly q, but this is the first time when I heard about php web module 
(can you imagine?) and I have no idea



Anyone coould help me ?

Thanks alot,
Alex




[PHP] PEAR AUTH :: Need some advice

2003-03-08 Thread Alex Piaz
Hi Folks!

I am working with pear auth package in order to authenticate some users on 
a project.

Well, I have a mysql table with the following columns:

uid
username
password
name
I can authenticate the user against his username/password without problems, 
but I need also to include the uid, name and age on the session generated 
by Auth. The only data I get is:

Array
(
[auth] => Array
(
[registered] => 1
[username] => geddylee
[timestamp] => 1047172433
[idle] => 1047172433
)
)

The desired results should be:

Array
(
[auth] => Array
(
[registered] => 1
[username] => geddylee
  [uid] => 2112
  [name] => Gary Lee Weinrib
[timestamp] => 1047172433
[idle] => 1047172433
)
)

I read the docs and the mailing list archives, but find nothing about it.

Any tips?

Thanks in advance.

Alex



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


[PHP] ob_start -- output buffer problem

2003-03-09 Thread Alex Lance

Hi all,

to quote from http://www.php.net/manual/en/function.ob-start.php

> void ob_start ( [string output_callback])
>
> An optional output_callback function may be specified. This function
> takes a string as a parameter and should return a string. The function
> will be called when  ob_end_flush() is called, or when the output
> buffer is flushed to the browser at the end of the request.

My callback function does not get called unless I manually call
ob_end_flush().

I'm not interested in calling ob_end_flush() at all,  I want my callback
function to be called "when the output buffer is flushed to the browser
at the end of the request" so the question is why isn't this happening?

here's my example:

msg("got to initialize");
}

function finish($page) {
$this->msg("GOT TO FINISH!!!");
return $page;
}

function msg ($msg) {
$msg = "\n" . exec("date") ." ::: ". $msg;
$fp = fopen($this->msg_file, "a") or die ("cannot open ".$this->msg_file);
fputs ($fp, $msg, strlen($msg)) or die ("cannot write to ".$this->msg_file);
fclose($fp);
}

}

?>


But if ob_end_flush() IS called then the error log WILL have the "GOT TO
FINISH" message.

Any ideas on why the output is not being flushed automatically?
thanks
Alex




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



[PHP] How to set a timeout limit for a call of a connection?

2003-03-10 Thread Alex Shi
Hi,

I have a script in which there is a call to open a remote file:

fopen ("http://www.somewhere.com/file.php?foo=bar";, "r");

Sometimes if www.somewhere.com is down, it will stuck at the function
for very long a time. I hope to setup a timeout limit for this function
(just
this), so that it won't stay very long to wait for a result, but just quit
if the
call take a time longer than timeout limit, and then go on for next steps.

Thanks in advance!

Alex Shi


--
==
Cell Phone Batteries at 30-50%+ off retail prices!
http://www.pocellular.com
==
TrafficBuilder Network:
http://www.bestadv.net/index.cfm?ref=7029
==


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



Re: [PHP] How to set a timeout limit for a call of a connection?

2003-03-10 Thread Alex Shi
> > I have a script in which there is a call to open a remote file:
> > 
> > fopen ("http://www.somewhere.com/file.php?foo=bar";, "r");
> > 
> > Sometimes if www.somewhere.com is down, it will stuck at the function
> > for very long a time. I hope to setup a timeout limit for this
> function
> > (just
> > this), so that it won't stay very long to wait for a result, but just
> quit
> > if the
> > call take a time longer than timeout limit, and then go on for next
> steps.
> 
> You can't control the timeout with fopen(). Try looking at fsockopen().
> You can set a timeout for that.

I checked the manual. From the example, it is apparently that timeout only 
works for the handle setup by fsockopen, but not for fsockopen itself.

Alex


> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 

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



Re: [PHP] How to set a timeout limit for a call of a connection?

2003-03-10 Thread Alex Shi
> > I have a script in which there is a call to open a remote file:
> > 
> > fopen ("http://www.somewhere.com/file.php?foo=bar";, "r");
> > 
> > Sometimes if www.somewhere.com is down, it will stuck at the function
> > for very long a time. I hope to setup a timeout limit for this
> function
> > (just
> > this), so that it won't stay very long to wait for a result, but just
> quit
> > if the
> > call take a time longer than timeout limit, and then go on for next
> steps.
> 
> You can't control the timeout with fopen(). Try looking at fsockopen().
> You can set a timeout for that.

Oh, yes, you are right! there is a parameter for timeout! 
Thanks a lot!

alex


> 
> ---John W. Holmes...
> 
> PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> today. http://www.phparch.com/
> 
> 

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



RE: [PHP] What do I do wrong?

2003-03-13 Thread Alex Piaz
At 20:39 13/3/2003 -0500, John W. Holmes wrote:

I'm not very good at PHP, but I'd have to say the problem is that you've
got an undefined variable called $msg on line 202 in script.php... but I
could be wrong.
LOL:-)

Alex 



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


[PHP] Software Testing and Internationalization - Free book by LISA/Lemoine International

2003-06-06 Thread Alex Lam
Dear colleague,

LISA, in collaboration with Lemoine International has made "Software
Testing and Internationalization"  by Galileo Computing freely available
for download.

This 330 page book will transform how you view testing methodologies and
procedures. It introduces the reader to essential concepts and
approaches used by practitioners in the software testing arena, while
also taking into account the realities of low budgets and real schedule
deadlines. It is in this context that the specific needs of small, agile
project teams are covered in detail.

Topics covered:

* New approaches to quality
* Risk analysis and evaluation
* Risk-based testing
* Exploratory testing
* Testing and tuning
* Testing by using
* Use cases, requirements, and test cases
* Debugging
* Myths and realities of Automated Testing
* Windows scripting
* Test frameworks
* Testing-based application development
* Tools for developers and testers
* Agile test management
* International planning and architecture
* International development issues
* Internationalization testing

To download a copy, please visit
http://www.lisa.org/interact/2003/swtestregister.html


Founded in 1990 as a non-profit association, LISA is the premier
organization for the GILT (Globalization, Internationalization,
Localization, and Translation) business communities. Over 400 leading IT
manufacturers and solutions providers, along with industry professionals
and an increasing number of vertical market corporations with an
international business focus, have helped establish LISA best practice
guidelines and language-technology standards for enterprise
globalization.


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



Re: [PHP] how to read the stuff that got piped (

2003-05-27 Thread Alex Earl
> hi,
>
> i've a simple question:
>
> how can i read the stuff that got piped ("|") to the php-script?
>
> i.e. "ls -l | /home/myuser/phpscript.php"
[snip]

It is the stdin of the script, you can open that file handle with fopen(
"stdin", "r" ); i believe

Slide

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



RE: [PHP] sound

2003-05-30 Thread Alex Earl
I'm guessing perhaps you didn't upload the sound to the server when you
uploaded the webpage?

Slide

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



Re: [PHP] How to secure a download ?

2003-06-01 Thread Alex Earl
> header("Content-type: application/zip");
> header("Content-Disposition: attachment; filename=yourfilename.zip");
> readfile("/path/to/yourfilename.zip");
>

I have found that to make sure it works with all browsers you want to put
quotes around the filename in the content-disposition header.

header( "Content-tpye: application/zip" );
header( "Content-Disposition: attachment; filename=\"yourfile.zip\" );
readfile( "/path/to/yourfilname.zip" );

the reason I say this is because without the quotes, some browsers insert
a "[1]" or something similar without them.

Alex

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



Re: [PHP] This line does not execute...

2003-06-04 Thread Alex Ciurea
did u made copy&paste with your code?

yes? then why don't you try to use the path='image.php?blahblahmoreblah'


no? then please give us more details about the error you're getting...

good luck,
Alex


- Original Message -
From: "Todd Cary" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 03, 2003 6:03 PM
Subject: [PHP] This line does not execute...


> I am trying to get the Sample Barcode to run on my server, however the
> following line does not execute:
>
>  echo "";
>
> To see if it is executing, I have an "Echo" statement in the script.
>
> The image.php file is in the same directory as the other script files.
>  What am I missing here?
>
> Todd
> --
>


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



Re: [PHP] This line does not execute...

2003-06-04 Thread Alex Ciurea
oh I see, you want to execute that image.php script ?


- Original Message -
From: "Alex Ciurea" <[EMAIL PROTECTED]>
To: "php mailing" <[EMAIL PROTECTED]>; "Todd Cary"
<[EMAIL PROTECTED]>
Sent: Tuesday, June 03, 2003 6:07 PM
Subject: Re: [PHP] This line does not execute...


> did u made copy&paste with your code?
>
> yes? then why don't you try to use the path='image.php?blahblahmoreblah'
> 
>
> no? then please give us more details about the error you're getting...
>
> good luck,
> Alex
>
>
> - Original Message -
> From: "Todd Cary" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, June 03, 2003 6:03 PM
> Subject: [PHP] This line does not execute...
>
>
> > I am trying to get the Sample Barcode to run on my server, however the
> > following line does not execute:
> >
> >  echo "";
> >
> > To see if it is executing, I have an "Echo" statement in the script.
> >
> > The image.php file is in the same directory as the other script files.
> >  What am I missing here?
> >
> > Todd
> > --
> >
>
>
> --
> 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] This line does not execute...

2003-06-04 Thread Alex Ciurea
Ok Tod, this is what I understood so far:

1) image.php should generate for you a barcode;

2) you placed an echo statement inside image.php and nothing happens

Marek have good ideea: try to see the html source code, the code that is
interpreted by your browser.

the executable file ./image.php probably don't run.
try to see, from your shell (i think you use linux) if u can run a php
script. e.g.:  ./myscript.php


- Original Message -
From: "Todd Cary" <[EMAIL PROTECTED]>
To: "Alex Ciurea" <[EMAIL PROTECTED]>
Cc: "php mailing" <[EMAIL PROTECTED]>
Sent: Tuesday, June 03, 2003 6:22 PM
Subject: Re: [PHP] This line does not execute...


> Alex -
>
> The code I placed in the messsage is a copy and paste of the code from
> the sample.php script provided by the author of the barcode class and it
> agrees with the demo he has on his site.
>
> The "error" is that nothing is happening which I interpret as the file,
> image.php is not being accessed (I put an Echo statement inside it and
> it does not execute).  Here is the complete block of code:
>
>   if ($obj) {
>
>  if ($obj->DrawObject($xres)) {
>  echo " src='./image.php?code=" . $barcode . "&style=" . $style . "&type=" .
> $type . "&width=" . $width . "&height=" . $height . "&xres=" . $xres .
> "&font=" . $font . "'>";
>
>  // My debug code - this line executes!
>  echo " color='#FF'>Success: Barcode = " . $barcode .
> "";
>  } else {
>  echo "" .
> ($obj->GetError()) . "";
>
>  // My debug code
>  echo " color='#FF'>Problem; Barcode = " . $barcode .
> "";
>  }
>   } else {
> // My debug code
> echo "Obj is
> false; Barcode = " . $barcode . "";
>   }
>
>
> Alex Ciurea wrote:
>
> >did u made copy&paste with your code?
> >
> >yes? then why don't you try to use the path='image.php?blahblahmoreblah'
> >
> >
> >no? then please give us more details about the error you're getting...
> >
> >good luck,
> >Alex
> >
> >
> >- Original Message -
> >From: "Todd Cary" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Tuesday, June 03, 2003 6:03 PM
> >Subject: [PHP] This line does not execute...
> >
> >
> >
> >
> >>I am trying to get the Sample Barcode to run on my server, however the
> >>following line does not execute:
> >>
> >> echo "";
> >>
> >>To see if it is executing, I have an "Echo" statement in the script.
> >>
> >>The image.php file is in the same directory as the other script files.
> >> What am I missing here?
> >>
> >>Todd
> >>--
> >>
> >>
> >>
> >
> >.
> >
> >
> >
>
> --
>
>


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



Re: [PHP] Downloading a file.

2003-06-11 Thread Alex Earl
>
> If he wants to download, in the file downloadit.php, there is:
> header("Content-type: application/octet-stream\n");
> header("Content-Disposition: attachment; filename=mysoft-1.0-truc.zip");
> header('Cache-Control: public');
> header("Content-transfer-encoding: binary\n");
> header("Content-length: " . filesize($path) . "\n");
> $fp=fopen($path, "r");
> fpassthru($fp);
>
> But, with IE, it saves the file with [] as:
> mysoft-1.0[1]-truc.zip
> And with Netscape 7.x, it saves the file with the .php extension:
> mysoft-1.0-truc.zip.php
>
> Does anyone know what to do to make it saved as: mysoft-1.0-truc.zip
>
> And I would like to display a page telling "Thanks for download" or
> something...but if I had to the end:
> header("Location: http://www.mywebsite.com/thanks.html";) ;
> I does not work :(
>
> Does anyone know how change the location and is there is anyway to know
> if the download has been perfomed 'till the end...
>
> Thanks,
> Vincent.

There is no way to tell if the download completes, I don't think, that is
a client side thing that if you send the content-length header it should
know if the file downloaded successfully or not, the browser does not send
a "success" signal back. Also, if you put quotes around the filename in
the Content-Disposition header, it will save the file with the exact
filename you specify, the RFC doesn't specifiy that it has to be this way,
but I have found that putting quotes around it makes it work for pretty
much any browser I have tried.

For your other problems, I would deconstruct them one by one and try and
get a piece of it working and then put the pieces together, it sounds like
you are trying to get too much done in one pass and it is causing you
problems.

Cheers,

Slide

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



Re: [PHP] getting file contents

2003-06-11 Thread Alex Earl
> I have text a file which contains php code.  I am using it as a template
> for some other pages.  I want to take everything in that file and store it
> in a string or array and then output it all to an empty file (this will
> make both files look exactly the same).  I am using the
> file_get_contents() function to do this, but it seems to have trouble
> because it looks like it is trying to execute the php code in the file I
> am trying to get.  Anyone know of a better way to go about this?  Thanks.
>
> Matt


$file_data = join( '', file( '/path/to/file' ) );

Alex


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



Re: [PHP] form name and submit test

2003-06-11 Thread Alex Earl
> At 6/11/2003 09:42 AM, Amanda McComb wrote:
>
>  > If I have multiple forms on a page, and each form has it's own name,
> how
>  > can I tell which form has submitted?
>
> By its contents.
>

Give the submit buttons different names, then you can test to see which
one is set to see which form was submitted.

Alex

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



Re: [PHP] slash trouble when editing text

2003-06-11 Thread Alex Earl
Sounds like you have magic quotes turned on in your php.ini. I would check
that out.

Alex


> Will the stripslashes() remove the slashes that are supposed to be in the
> file?  Because often times there are slashes in the file that need to be
> there.
>
> Matt
> - Original Message -
> From: "CPT John W. Holmes" <[EMAIL PROTECTED]>
> To: "Matt Palermo" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, June 11, 2003 4:42 PM
> Subject: Re: [PHP] slash trouble when editing text
>
>
>> Use stripslashes() to remove the slashes. Use htmlentities() on the text
>> before you put it into the , also.
>>
>> ---John Holmes...
>>
>> - Original Message -
>> From: "Matt Palermo" <[EMAIL PROTECTED]>
>> To: <[EMAIL PROTECTED]>
>> Sent: Wednesday, June 11, 2003 4:16 PM
>> Subject: [PHP] slash trouble when editing text
>>
>>
>> I wrote a small script that creates a link to all the .php and .txt
>> files
> in
>> a given directory.  When one of these links is clicked, it brings up
> another
>> window with the files contents inserted into a text area.  From there
>> the
>> user can edit the text file then click a submit button to make the
> changes.
>> The problem is whenever the file contains quotes, when the file gets
> edited
>> it puts a slash in front of every quote.  Like this.
>>
>> // original .txt file
>> "these are quotes"
>>
>> Then when the submit buttons is clicked, the file looks like this:
>>
>> // edited .txt file
>> \"these are quotes\"
>>
>> If submit is pressed again, then it will look like this:
>>
>> // twice edited file
>> \\"these are quotes\\"
>>
>> Does anyone know how I can avoid this from happening?  Thanks.
>>
>> Matt
>>
>
>
> --
> 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] How to find if a string is an integer?

2003-06-12 Thread Alex Earl

> Sorry, I don´t know that you needed an effective snipet. And you are
> right,
> I only writed for positive integers. Try something like apply 2 type cast
> simunltaneous.
>
> if ( (string) ((int) $_POST["var_int"]) == $_POST["var_int"])
> echo "is int";
>


Why not just use the is_int() function?

www.php.net/is_int


Alex

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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Alex Earl
>> 
>> > Sorry, I don´t know that you needed an effective snipet. And you are
>> > right,
>> > I only writed for positive integers. Try something like apply 2 type
> cast
>> > simunltaneous.
>> >
>> > if ( (string) ((int) $_POST["var_int"]) == $_POST["var_int"])
>> > echo "is int";
>> >
>>
>>
>> Why not just use the is_int() function?
>>
>> www.php.net/is_int
>
> Please try to use is_int() on a value passed from a form and see why.
>
> Also, in the beginning of this thread, the OP already said that is_int()
> had
> been tried.
>
> ---John Holmes...
>

I guess I missed the first part of the thread then.

Thanks for the info.

Alex



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



Re: [PHP] How to find if a string is an integer?

2003-06-12 Thread Alex Earl
> Jumping in a little late here, but what about is_numeric()?
> Haven't tried it, but the php manual for is_int says:
> Note:  To test if a variable is a number or a numeric string (such as
> form input, which is always a string), you must use is_numeric().
>

The problem with is_numeric() is that something like "4e4" comes up as
true, because it could be construed as a HEX value.

Alex

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



Re: [PHP] Error display

2003-06-12 Thread Alex Earl
> I have error reporting set to E_ALL, but no matter what I do, no errors
> display.  Is there somewhere else in the .ini that I have to set
> something?
>

I believe there is a print_errors or show_errors directive in the php.ini
file. Check on php.net for sure.

Alex

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



Re: [PHP] make a variable not exist?

2003-06-12 Thread Alex Earl
>
> Is there a way to make a variable not exist?  There are several places
> where I test (!$variable), and I want to be able to change the
> variable to pass that test, even though it exists, under certain
> circumstances.
>
> Thanks.
>


You can unset the variable www.php.net/unset but also I would recommend
using if(!isset($variable)) instead of just if(!$variable) its a little
more clear as to what you are really trying to see I think.

Alex

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



Re: [PHP] stumped on mysql_num_rows

2003-06-13 Thread Alex Earl
Can you give us the query too?

Alex


> Hello List,
> The issue appears to be that no rows are being found with mysql_num_rows
> using the SQL LIMIT offset. There should be rows found. Further, all
> processing just halts, and no query is shown as per the code here:
>
>
> // RUN THE QUERY TO RETRIEVE EACH FOUND RECORD
> $queryResultHandle = mysql_query($concatquery, $link_identifier) or die (
> mysql_error());
> // make sure that we recieved some data from our query
> $rows = mysql_num_rows ($queryResultHandle);
> if ( $rows > 0 ) { // <<<<<<<<   THIS IS WHERE THE SCRIPT FAILS
>while ($data = mysql_fetch_array ($queryResultHandle)) {
>   /* /
>   // COMMON VARIABLE ASSIGNMENT BLOCK - start
>   $yflastupdate = $data["lastupdate"]; // and other fields too ...
>   // COMMON VARIABLE ASSIGNMENT BLOCK - end
>    */
>   include("showOneRecord.php");  // display the row values in a
> template
>} // while
>// mysql_free_result ($queryResultHandle);
> }else{
>echo"Process anomaly. Please try again.";
>echo $query;
>exit;
> }
>
>
> The result is intermittent failure with the message "Process anomaly.
> Please try again." when the first or subsequent "next page" button is
> clicked. No query shown with the failure, and a query should be shown.
>
>
> CONFIGURATION
> This issue is experienced intermittently on the developer production site
> and "always" on the customer  localhost and production sites. The customer
> is using "I just recently installed PHP and mySQL so they are pretty close
> to the latest versions.  I think it's PHP 4.3.1 and mySQL 4.0.13. I get
> the same error on both the first time I click the "More Results" button.
> My browser is IE 6.0.2800 SP1."
>
>
> What's the problem?
>
>
> Richard
> Information Services
> Global I.S. S.A.
> [EMAIL PROTECTED]
> ---
> Globalissa B2B Websites
> http://phpyellow.com
> http://www.dreamriver.com
>
>
>
>
> --
> 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] create a chmod'd file

2003-06-13 Thread Alex Earl
> I have a script that creates a php file based on user input.  I need this
> newly created file to have write permissions - chmod 777.  How can I have
> the script create the file with these permissions already set?  Is this
> possible?
>
> Thanks,
>
> Matt


How are you creating the file? fopen()? touch()? Give a little more
information please.

Alex

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



Re: [PHP] Will this work right?

2003-06-13 Thread Alex Earl
> The following function converts minutes to years, monthes, weeks, days,
> hours, minutes.  For instance, 61 minutes would become "1 hour, one
> minute".  Before I use it, I want to make sure there are no stupid
> mistakes.  I can't find any, can any of you?
> function min2ymwdhm($min){
> $a = array();
> $years = intval(intval($min) / 525600);
> if($years > 0) $array[] = $years . ' year' . ($years == 1 ? '' : 's');
> $monthes = intval(intval($min) / 43200) % 12;
> if($monthes > 0) $array[] = $monthes . ' month' . ($monthes == 1 ?
> '' : 'es');
> $weeks = intval(intval($min) / 10080) % 4;
> if($weeks > 0) $array[] = $weeks . ' week' . ($weeks == 1 ? '' : 's');
> $days = intval(intval($min) / 1440) % 7;
> if($days > 0) $array[] = $days . ' day' . ($days == 1 ? '' : 's');
> $hours = intval(intval($min) / 60) % 24;
> if($hours > 0) $array[] = $hours . ' hour' . ($hours == 1 ? '' : 's');
> $minutes = intval($min) % 60;
> if($minutes > 0) $array[] = $minutes . ' minute' . ($minutes == 1 ?
> '' : 's');
> return implode($array,', ');
> }
>


Why not just try it?

Alex

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



Re: [PHP] PLEASE STOP SENDING ME MAIL!!! PLEASE UNSUBSCRIBE NOW!!!

2003-06-13 Thread Alex Earl
Read the bottom of the email messages, it tells you how to unsubscribe.

Alex


> --- gregory landry <[EMAIL PROTECTED]> wrote:
>> I figured it out. Yipppee..
>>
>> Thanks
>>
>> -Original Message-
>> From: Gregory Landry [mailto:[EMAIL PROTECTED]
>> Sent: Friday, June 13, 2003 4:10 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] forms question -- simple
>>
>>
>> Hi all,
>>
>> I'm new to the list and to PHP. I haven't bought a
>> book as of yet but I've
>> found a number of resources that are getting me
>> through the basics.
>>
>> I am collecting data from a form. I've having no
>> problems collecting the
>> data and printing it out.  But...
>>
>> I have a form with check boxes with 4 options. See
>> below.
>>
> 
>>
>> > name=investment>
>> > name=vacation>
>> > name=retirement> > type=checkbox value=Primary Home  name=primary>
>>
>>
> 
>>
>> This form data is being sent off to a php page to
>> get the values printed
>> out. See below:
>>
>>
> 
>> **
>>
>> print "Which best describes your reason for wanting
>> to purchase land?";
>> print "$investment $investment2
>> $investment3 $investment4";
>>
>>
> 
>> **
>>
>> The problem is if a check box is not checked a blank
>> space gets printed out
>> which I don't want. Can someone show me how to use
>> an if then statement with
>> the following stucture:
>>
>>
> ***
>> if $investment  then print
>> $investment
>>
> ***
>>
>> I would use this structure for each of the variables
>> in the checkboxes
>> above. I'm sure this could be done with arrays in
>> some form or another but
>> since I'm new at this I would just as soon keep it
>> simple for now and learn
>> more sophisticated techniques later.
>>
>> Thanks so much,
>>
>> Greg Landry
>> [EMAIL PROTECTED]
>>
>>
>>
>> --
>> 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
>>
>
>
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
>
> --
> 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] is my server working

2003-06-15 Thread Alex Ciurea
try to use echo instead of print()   :

>>>>>>
echo $myString;
>>>>>>

or, if u realy want to use the print function, try this:

>>>>>>
print("$myString", %s);
>>>>>>

maybe will work


Alex Ciurea Greets You
www.netonwave.com


- Original Message -
From: "Khoo Merry" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, June 15, 2003 8:09 AM
Subject: [PHP] is my server working


> I'm using windows me, server apache 1.3 for php.
> I had wrote this code and tried it at local host, but the php code didn't
work. The code is like this:
>
>  $Greet = "Hello World"
> $Today = date("l F d, Y");
> ?>
> 
> 
> Today's date is
>  print("$Today\n");
> print("$Greet");
> ?>
> 
> 
> Istead of print
> Today's date is Sunday June 14, 2003
> Hello World
> The out put is only "Today's date is". Is my server working with php?
> I am really appreciate if anyone can answer my problem.
> Thank you.
>
> merry
>
>
>
> -
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!





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



Re: [PHP] is my server working

2003-06-15 Thread Alex Ciurea
oh, I see. My bad, my mistake...

I also have had problems with apache/php in the past. The apache couldn't
parse the php files. All the php tags were interpreted as normal text and
displayed to the browser.

So, try :
>>>>>>
phpinfo();
>>>>>>
into one of your php files.

it should work if your apache/php server is configured properly.


Good luck!


Alex Ciurea Greets You
www.netonwave.com
- Original Message -
From: "Lars Torben Wilson" <[EMAIL PROTECTED]>
To: "Alex Ciurea" <[EMAIL PROTECTED]>
Cc: "php mailinlist" <[EMAIL PROTECTED]>; "Khoo Merry"
<[EMAIL PROTECTED]>
Sent: Sunday, June 15, 2003 11:18 AM
Subject: Re: [PHP] is my server working


> On Sun, 2003-06-15 at 01:07, Alex Ciurea wrote:
> > try to use echo instead of print()   :
> >
> > >>>>>>
> > echo $myString;
> > >>>>>>
> >
> > or, if u realy want to use the print function, try this:
> >
> > >>>>>>
> > print("$myString", %s);
> > >>>>>>
> >
> > maybe will work
> >
> > 
> > Alex Ciurea Greets You
> > www.netonwave.com
>
>
> I think you might be getting confused with printf(). In that case, the
> above would be:
>
>   printf("%s", $myString);
>
> In any event, the choice will have no impact here. It simply appears
> that the original poster has not got PHP installed properly, or else
> the system is not configured to pass that page of through PHP.
>
>
>   http://www.php.net/print
>   http://www.php.net/printf
>
>
> --
>  Torben Wilson <[EMAIL PROTECTED]>+1.604.709.0506
>  http://www.thebuttlesschaps.com  http://www.inflatableeye.com
>  http://www.hybrid17.com  http://www.themainonmain.com
>  - Boycott Starbucks!  http://www.haidabuckscafe.com -
>
>
>
>
> --
> 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



[PHP] Software Testing and Internationalization - Free book by LISA/Lemoine International

2003-06-16 Thread Alex Lam
Dear colleague,

LISA, in collaboration with Lemoine International has made "Software
Testing and Internationalization"  by Galileo Computing freely available
for download.

This 330 page book will transform how you view testing methodologies and
procedures. It introduces the reader to essential concepts and
approaches used by practitioners in the software testing arena, while
also taking into account the realities of low budgets and real schedule
deadlines. It is in this context that the specific needs of small, agile
project teams are covered in detail.

Topics covered:

* New approaches to quality
* Risk analysis and evaluation
* Risk-based testing
* Exploratory testing
* Testing and tuning
* Testing by using
* Use cases, requirements, and test cases
* Debugging
* Myths and realities of Automated Testing
* Windows scripting
* Test frameworks
* Testing-based application development
* Tools for developers and testers
* Agile test management
* International planning and architecture
* International development issues
* Internationalization testing

To download a copy, please visit
http://www.lisa.org/interact/2003/swtestregister.html


Founded in 1990 as a non-profit association, LISA is the premier
organization for the GILT (Globalization, Internationalization,
Localization, and Translation) business communities. Over 400 leading IT
manufacturers and solutions providers, along with industry professionals
and an increasing number of vertical market corporations with an
international business focus, have helped establish LISA best practice
guidelines and language-technology standards for enterprise
globalization.


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



[PHP] convert Excell to MySQL table

2003-06-17 Thread Alex Shi
Hello,

Does any one out there happend to know a php solution to directly 
(without CSV) transfer an Excell spreadsheet into MySQL table?
Thanks in advance!

Alex


-- 
==
Cell Phone Batteries at 30-50%+ off retail prices!
http://www.pocellular.com
==
TrafficBuilder Network: 
http://www.bestadv.net/index.cfm?ref=7029
==

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



Re: [PHP] convert Excell to MySQL table

2003-06-17 Thread Alex Shi
Yes I believe this is an excellent solution for MS planforms...
But how about UNIX/Linux/FreeBSD based applications?

Alex


:[EMAIL PROTECTED]
> If it doesn't have to be automatic, I believe you can open
> an ODBC connection to the MySQL database and use the export
> functionality of Excel. I may be wrong since it's been a
> while since I've done anything with Excel, but it's worth
> a try.
> 
> 
> 
> On Tue, 2003-06-17 at 11:09, Alex Shi wrote:
> > Hello,
> > 
> > Does any one out there happend to know a php solution to directly 
> > (without CSV) transfer an Excell spreadsheet into MySQL table?
> > Thanks in advance!
> > 
> > Alex
> > 
> > 
> > -- 
> > ==
> > Cell Phone Batteries at 30-50%+ off retail prices!
> > http://www.pocellular.com
> > ==
> > TrafficBuilder Network: 
> > http://www.bestadv.net/index.cfm?ref=7029
> > ==
> -- 
> Adam Voigt ([EMAIL PROTECTED])
> Linux/Unix Network Administrator
> The Cryptocomm Group
> 

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



RE: [PHP] Software Testing and Internationalization - Free book by LISA/Lemoine International

2003-06-18 Thread Alex Lam
>> LISA, in collaboration with Lemoine International has made "Software
>> Testing and Internationalization"  by Galileo Computing freely
>> available for download.
>> [snip]
>> To download a copy, please visit
>> http://www.lisa.org/interact/2003/swtestregister.html
>
>How about a privacy statement on the page where you collect all of our
>info?

John, 

A privacy statement has been placed on the page. We will also be putting
up a statement on the other pages.

Thank you.

Alex Lam




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



[PHP] conditional image generation problem

2002-07-25 Thread Alex Maslov

Hi,

I have a problem with conditional image generation. If I generate an
image without any conditional statments, then everything works fine. But
if i introduce conditional statment, then no image is generated in
either case of the condition.

Has anyone dealt with this dilema before?

Thanks in advance,
alex

P.S.

I am generating a hit-counter image.

The set-up is very basic:
if admin looks at the page, then image should be generated and displayed

if anyone else loads the page, no image should be generated.

my code goes smth like this:





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




[PHP] Preg replace & Query Problem

2002-07-29 Thread Alex Beauclair

Hi,

I'm having trouble with preg_replace and a mysql query. Here's my code :

$query = $db->query("SELECT style FROM ".$table_styles." WHERE id = '1'");
$r = $db->fetch_array($query);
$style_1 = $r[style];

$query = $db->query("SELECT id, name, description FROM
".$table_categories."");
while($r = $db->fetch_row($query)) {

 $category_id = $r[0];
 $category_name = $r[1];
 $category_description = $r[2];

 $style_1  = preg_replace('/\[url\]/', "index.php?catID=$category_id",
$style_1);
 $style_1  = preg_replace('/\[title\]/', "$category_name", $style_1);

 echo "$style_1\n";
 echo "\n";

}

This is the schema for $table_styles

++-+-+--
---+
| id | name| description
| style |
++-+-+--
---+
|  1| Title Links | The style for the title links on the main page.
| [title] |
++-+-+--
---+

This is the schema for $table_categories

++--+--+---+
--+
| id | name | description
| picture  | comments |
++--+--+---+
--+
|  1 | PHP  | PHP is a powerful open source language. | icon3.gif   |
0 |
|  2 | ASP  | ASP is microsoft's dynamic web language.| icon2.gif  |
0 |
++--+--+---+
--+

The script should loop and replace [url] and [title] with the relative id
and name from $table_categories, however when it is run, it gives out :

PHP

PHP


I'm really not sure what's going on, can anyone help me ?

Alex





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




[PHP] Update of the problem w/ code - conditional image generation problem?!

2002-07-29 Thread Alex Maslov

Thank everyone for suggestions.

I followed through on them but unsuccessfully. I looked for any mistake but
couldn't find it. I tried commenting out lines in chunks and one by one,
without any effect.

the problem stays the same, if the conditional statement is present then image
is not generated, otherwise the code works and is generating an image.
Also, the image is generating only in Netscape browzer?! Internet Explorer
does not display the image at all, never, with or without conditional.

Is their some trick i need to know to display images both in netscape and
iexplorer?

if smone would give it a shot i would be very thankfull! thnks in advance for
your help.

---file counter.php ---
");
echo("current page = $this_page ");
echo("address = $address ");
echo("screen width = $scr_width ");
echo("screen height = $scr_height ");
echo("color pallette = $color_palt ");
echo("platform = $platform ");
echo("language = $lang ");
echo("browzer info = $bwzr_info ");
echo("java enabled = $java ");
echo("taint enabled = $taint ");
*/
//---   LOG DATA INTO DATABASE  ---//
// todo //

//this is the begining of troublesome conditional statment
if ( false ) {
//echo("we here");
//$image = ImageCreate(1,1);
//$navyblue = ImageColorAllocate($image, 0, 0, 0);
//ImageFilledRectangle($image, 0, 0, 1, 1, $navyblue);
} esle {

$web_uniqe_kount = sprintf("%07d",
$_SESSION['web_uniqe_count']);
$web_total_kount = sprintf("%07d",
$_SESSION['web_total_count']);
$web_print_kount = sprintf("%07d",
$_SESSION['web_print_count']);

$office_uniqe_kount = sprintf("%07d",
$_SESSION['office_uniqe_count']);
$office_total_kount = sprintf("%07d",
$_SESSION['office_total_count']);
$office_print_kount = sprintf("%07d",
$_SESSION['office_print_count']);

$uniqe_str = "Uniqe";
$total_str = "Total";
$print_str = "Print";

$web_head = "Web";
$office_head = "Office";

$header_length = 6;
$column_length = 9;

$spacer = 1;

$font_size = 1;
$charHeight = ImageFontHeight($font_size);
$charWidth = ImageFontWidth($font_size);

$head_cell_Width = ($charWidth * $header_length) + (2 *
$spacer);
$numb_cell_Width = ($charWidth * $column_length) + (2 *
$spacer);
$cell_Height = $charHeight + (4 * $spacer);

$row_Width = $head_cell_Width + (2 * $numb_cell_Width);
$row_Height = $cell_Height;

$column_Width = $numb_cell_Width;
$column_Height = $cell_Height * 4;

$horizontalMargin = 1;
$verticalMargin = 1;

$image_Width = $row_Width + (2 * horizontalMargin);
$image_Height = $column_Height + (2 * verticalMargin);

//create blank image template with specified dimmentions
$image = ImageCreate($image_Width, $image_Height);

//initiate color pallete to be used
$black = ImageColorAllocate($image, 0, 0, 0);
$white = ImageColorAllocate($image, 255, 255, 255);
$red   = ImageColorAllocate($image, 255, 0, 0);

//fill image background with black color
ImageFilledRectangle($image, 0, 0, $imageWidth, $imageHeight,
$black);

//set line style for the image
$line_style = array($black, $black, $black, $black, $black,
$red, $red, $red);
ImageSetStyle($image, $line_style);


//---   DRAW THE IMAGE  ---//

//draw the table
$drawCoordinateX = $horizontalMargin;
$drawCoordinateY = $verticalMargin + $cell_Height;
ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$image_Width-$horizontalMargin, $drawCoordinateY, IMG_COLOR_STYLED);
$drawCoordinateY += $cell_Height;
//ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$image_Width-$horizontalMargin, $drawCoordinateY, IMG_COLOR_STYLED);
$drawCoordinateY += $cell_Height;
ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$image_Width-$horizontalMargin, $drawCoordinateY, IMG_COLOR_STYLED);

$drawCoordinateY = $verticalMargin;
$drawCoordinateX = $horizontalMargin + $head_cell_Width;
ImageLine($image, $drawCoordinateX, $drawCoordinateY,
$drawCoordinateX, $image_Height-$verticalMargin, IMG_COLOR_STYLED);
$drawCoordinateX += $numb_cell_Width;
   

  1   2   3   4   5   6   7   8   9   >