[PHP] Error 155 using exec

2002-12-16 Thread ml

Here is what i do to parse a file with a perl script from PHP to get a
formatted output from the file :

error_reporting(E_ALL);
$cmd="/pathto/dump.pl \"".$HTTP_POST_VARS["filename"]."\" 2>&1";
$res=exec($cmd,$tab,$err);

With small files all goes fine, but when parsing a big file i get the
155 error code in $err, while PHP doesn't report any error ($tab
stays empty)
Of course if I launch the same command directly from the shell, all goes fine
even with very very big files.

Where can i find more info about that error code ? Is it returned by
perl, sh, Apache or PHP ?

Probably because of some memory limit, where can i tune that memory limit ?

I'am on FreeBSD4+Apache 1.3+PHP4 apache module+perl 5

Thanks for any help.
David.


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




[PHP] Error 155 using exec

2002-12-16 Thread ml

Here is what i do to parse a file with a perl script from PHP to get a
formatted output from the file :

error_reporting(E_ALL);
$cmd="/pathto/dump.pl \"".$HTTP_POST_VARS["filename"]."\" 2>&1";
$res=exec($cmd,$tab,$err);

With small files all goes fine, but when parsing a big file i get the
155 error code in $err, while PHP doesn't report any error ($tab
stays empty)
Of course if I launch the same command directly from the shell, all goes fine
even with very very big files.

Where can i find more info about that error code ? Is it returned by
perl, sh, Apache or PHP ?

Probably because of some memory limit, where can i tune that memory limit ?

I'am on FreeBSD4+Apache 1.3+PHP4 apache module+perl 5

Thanks for any help.
David.


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




[PHP] Error 155 using exec - please help !

2002-12-16 Thread ml

Here is what i do to parse a file with a perl script from PHP to get a
formatted output from the file :

error_reporting(E_ALL);
$cmd="/pathto/dump.pl \"".$HTTP_POST_VARS["filename"]."\" 2>&1";
$res=exec($cmd,$tab,$err);

With small files all goes fine, but when parsing a big file i get the
155 error code in $err, while PHP doesn't report any error ($tab
stays empty)
Of course if I launch the same command directly from the shell, all goes fine
even with very very big files.

Where can i find more info about that error code ? Is it returned by
perl, sh, Apache or PHP ?

Probably because of some memory limit, where can i tune that memory limit ?

I'am on FreeBSD4+Apache 1.3+PHP4 apache module+perl 5

Thanks for any help.
David.


-- 
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[2]: [PHP] Error 155 using exec - please help !

2002-12-17 Thread ml

> Take a look at http://cvs.php.net/co.php/php4/php.ini-dist
> The part that should you look at is Resource Limits 
> (max_execution_time,memory_limit) and
> set up your php.ini accordingly.

Nope i can't find any solution... It goes well with memory_limit=8M
for a 12Ko file, but won't work for a 32K file with memory_limit=512M !!

I don't think it's due to a PHP settings because when running from the
shell i can launch it with memory_limit=8M for 1Go file

Thanks for your help.


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




[PHP] missing simple php functionality

2003-02-20 Thread ML
Hello all. Im having a strange problem. My php outputs html correctly, and
Ive tried other builtin functions like date and that works too. But when I
try to do something as simple as passing a value from a form to a php file
and display that value, no go.

the HTML:


Enter Your Name







the PHP file:


I fill in my name, I click submit, and where the name should be displayed it
shows nothing. I have gone over this again and again and I just don't know
whats wrong. I also noticed that register globals was OFF so I just turned
that on, but still I have the same problemany ideas? I really appreciate
any feedback. Thank you!

-Mike L



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




[PHP] Mysql DB connect failure

2003-02-21 Thread ML
Currently I have some php code that displays a message if a connect to my
database fails. Is there anyway I
can get a more descriptive error message? So I can see exactly why my php
can't connect to the Database?
I am pretty sure that the username and password are correct and the username
exists as a mysql user...




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




[PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
Where exactly would I put the print mysql_error() ?
Here is the code...






");





"Hans Prins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> did you try:
> print mysql_error();
>
> "Ml" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Currently I have some php code that displays a message if a connect to
my
> > database fails. Is there anyway I
> > can get a more descriptive error message? So I can see exactly why my
php
> > can't connect to the Database?
> > I am pretty sure that the username and password are correct and the
> username
> > exists as a mysql user...
> >
> >
> >
>
>



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




Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
You were right Prins, I got the error:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

So I guess I need to investigate what this means now...
Thanks!

-ML

"Hans Prins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
>
> maybe so, but it works nonetheless.
>
> if for example the username stated in the connection initialization was
> wrong it will print an error like:
>
> "Access denied for user: 'username@localhost' (Using password: YES)"
>
> MI,
>
> my code would look somethign like this:
>
> $link = @mysql_pconnect("localhost", "test1", "test1");
>
> // If connection failed...
> if (!$link) {
> // Inform user of error and quit
> print "Couldn't connect to database server\n";
> print mysql_error();
> exit;
> }
>
>
>
> "Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
> >
> > What you probably should attempt going for is getting something back
> > from PHP itself regarding the error returned when the mysql_connect
> failed.
> >
> > Here's a snippet from:
> > http://www.php.net/manual/en/language.operators.errorcontrol.php
> >
> > If the track_errors feature is enabled, any error message generated by
> > the expression will be saved in the global variable $php_errormsg. This
> > variable will be overwritten on each error, so check early if you want
> > to use it.
> >
> > Hope that clears things up a bit.
> >
> > Regards,
> > Jason k Larson
> >
> >
> >
> > Hans Prins wrote:
> > > did you try:
> > > print mysql_error();
> > >
> > > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > >
> >
> >
>
>



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




Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
I see that its looking for mysql.sock in /tmp/mysql.sock
but I searched on my system and only found mysql.sock in /var/lib/mysql/

is there a section where I need to change this setting? or a conf file?


"Hans Prins" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
>
> maybe so, but it works nonetheless.
>
> if for example the username stated in the connection initialization was
> wrong it will print an error like:
>
> "Access denied for user: 'username@localhost' (Using password: YES)"
>
> MI,
>
> my code would look somethign like this:
>
> $link = @mysql_pconnect("localhost", "test1", "test1");
>
> // If connection failed...
> if (!$link) {
> // Inform user of error and quit
> print "Couldn't connect to database server\n";
> print mysql_error();
> exit;
> }
>
>
>
> "Jason K Larson" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Would you care to explain to the rest of the list how you intend to use
> > mysql_error () to return connection failure information?
> >
> > It returns the text of the error message from previous MySQL operation
> > Description: string mysql_error ( [resource link_identifier])
> >
> > Seems to me that without a connection, we wouldn't have a valid
> > link_identifier.
> >
> > What you probably should attempt going for is getting something back
> > from PHP itself regarding the error returned when the mysql_connect
> failed.
> >
> > Here's a snippet from:
> > http://www.php.net/manual/en/language.operators.errorcontrol.php
> >
> > If the track_errors feature is enabled, any error message generated by
> > the expression will be saved in the global variable $php_errormsg. This
> > variable will be overwritten on each error, so check early if you want
> > to use it.
> >
> > Hope that clears things up a bit.
> >
> > Regards,
> > Jason k Larson
> >
> >
> >
> > Hans Prins wrote:
> > > did you try:
> > > print mysql_error();
> > >
> > > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > >
> >
> >
>
>



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




Re: [PHP] Re: Mysql DB connect failure

2003-02-21 Thread ML
Thanks rick, that is a much cleaner solution!


"Rick Emery" <[EMAIL PROTECTED]> wrote in message
009f01c2d9c1$51171d20$0500a8c0@honeybee">news:009f01c2d9c1$51171d20$0500a8c0@honeybee...
> $db = mysql_pconnect("localhost", "test1", "test1") or die(mysql_error());
>
> - Original Message -
> From: "ML" <[EMAIL PROTECTED]>
> To: <>
> Sent: Friday, February 21, 2003 9:33 AM
> Subject: [PHP] Re: Mysql DB connect failure
>
>
> Where exactly would I put the print mysql_error() ?
> Here is the code...
>
> 
>  @ $db = mysql_pconnect("localhost", "test1", "test1")
>or
>die("
> 
> 
> 
> 
> ");
>
>
>
>
>
> "Hans Prins" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > did you try:
> > print mysql_error();
> >
> > "Ml" <[EMAIL PROTECTED]> schreef in bericht
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > Currently I have some php code that displays a message if a connect to
> my
> > > database fails. Is there anyway I
> > > can get a more descriptive error message? So I can see exactly why my
> php
> > > can't connect to the Database?
> > > I am pretty sure that the username and password are correct and the
> > username
> > > exists as a mysql user...
> > >
> > >
> > >
> >
> >
>
>
>
> --
> 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] Mail Sending Error

2003-02-21 Thread ML
Im having some more error checking issues :)
This time its with sending email using php.
Im absolutely sure that the email address is correct and that my IMAP module
is enabled for
php as I successfully read emails from my ISP. But when I sent an email
with:

mail($to, $subject, $body, $headers)

it failed and I wanted to know how I can get a more descriptive error from
the failure of this function...
any ideas?

Thanks again, I really appreciate the help.

-ML



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




[PHP] mail function fails with no error code

2003-02-21 Thread ML
I am unable to send emails, and there are no errors being generated or
populated in the $php_errormsg variable, since I enabled track errors in the
php.ini. So I have no idea why the mail send is failing. Am I supposed to
specify
a mail server to use for sending mail? My sendmail was setup automatically
in my Redhat Setup and I have not touched its configuration options...is
there something I need to change? The sendmail path that is shown in the
phpinfo() function display is correct. Any feedback would be greatly
appreciated. Thanks!

-M L



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



[PHP] mail function works, but always from nobody@localhost!

2003-03-03 Thread ML
How exactly would I go about fixing my current php/sendmail setup so that it
uses the value specified in my php input form in the
from box instead of always setting the email from address as :
[EMAIL PROTECTED] ???

Any help would be greatly appreciated. Thanks!



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



[PHP] Mkdir() and fdopen()

2003-03-05 Thread ML
When trying to create files/directories with PHP, in terms of the system,
who would be the user actually performing those actions?
Would it be the nobody user which runs the apache web daemons? I am trying
to figure out a safe way to make files writeable,
but hopefully chown-ing those files/dirs that are served by apache to the
nobody user or the web daemon system user...



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



[PHP] snippets google plus with wordpress

2011-11-28 Thread ml

Hello list
hello php
hello bearded

I just finished partially implement the google snippets about wordpress

I say partially
Indeed j arrives to recover as the author and date
No I can not seem to recover to recover the image and description of 
the subject


Here is the code that uses the j page themes index.php page.php 
single.php


 http://schema.org/Article";>
  
   


I get the title the author el date

how to properly run the snippets
I thank you for your help our

--
 http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7
 gpg --keyserver pgp.mit.edu --recv-key 092164A7

 http://urlshort.eu fakessh @
 http://gplus.to/fakessh
 http://gplus.to/john.swilting

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



Re: [PHP] PHP5 TUTORIAL

2007-06-26 Thread php-ml
Hi Preethi


> Kindly suggest me the good online tutorial for PHP5.
> Am already working on php4.
> Need to migrate from php4 to php5.

i think this is very important for OOP:

http://www.php.net/manual/en/language.oop5.php

and this one:

http://www.php.net/manual/en/language.exceptions.php


regards,
Hagen

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



[PHP] PHP and getting part of URL

2008-10-07 Thread Jason ML

Hi PHP'ers,

PHP 4.4.8 and 5.

say I have a url like:

http://www.mydomain.tld/jason/index.php

In that index.php I want to have a piece of code that runs that tells  
me the 'jason' part of the URL so that I can run some custom read only  
queries for 'jason'


How can I do this? I know how to do everything except what PHP  
commands to run to get the info.


Thanks!

-Jason


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



Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Jason ML

Hi Micah,


dirname($_SERVER['REQUEST_URI']);



I have tried that and I dont get the proper URI:

Example running 	print_r($_SERVER); I get: [REQUEST_URI] => /net1003/ 
people/jason/


But then doing:

$jason = dirname($_SERVER['REQUEST_URI']);

echo "URL: ";
echo $jason;

I get: URL: /net1003/people

Thoughts on what I am doing wrong.

Jason


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



Re: [PHP] PHP and getting part of URL

2008-10-07 Thread Jason ML

Daniel,


I get: URL: /net1003/people

Thoughts on what I am doing wrong.


   Yeah.  Not R'ing TFM.  dirname() gives you the name of the
directory ABOVE what you pass.

   http://php.net/dirname


Thanks for the pointer. You are indeed correct.

-Jason


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



RE: [PHP] Getting uploaded filename & directory

2001-11-12 Thread Luboslav Gabal ml.

> In setting up a form to allow a user to upload a file,
> upon submission of that form, you can get the actual
> file name that is being uploaded by accessing the
> variable:
> 
> $userfile_name
> 
> (assuming the form element's name where the user
> specifies the file is "$userfile").
> 
> Is there a way to get the full path as well?  ie:
> 
> "c:\program files\this directory\uploaded_file.txt"
> 
> ?  I tried echoing out $userfile to no avail.  I also tried
> some javascript that when the form was submitted,
> the value for the userfile element was copied to a hidden
> form element, but that didn't work either.
> 
> Any ideas? Suggestions?

It's not very secure, I think it isn't possible to get a full path 

Lubo Gabal


-- 
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] problem with getting data from NNTP server

2001-09-16 Thread Luboslav Gabal ml.

I have script for getting header of article from NNTP server using sockets:

";
}
?>

output have look so:

...
Path: csnews.vslib.cz!not-for-mail
From: "Antonin Mohaupt" <[EMAIL PROTECTED]>
Newsgroups: cz.comp.lang.php
...

but it is only

...
Path: csnews.vslib.cz!not-for-mail
From: "Antonin Mohaupt"
Newsgroups: cz.comp.lang.php
...

What's the problem ? I tried higher raise length of data (second argument of
fgets()), but with no result.
When I am doing it by telnet, all is ok. What to do ?

Luboslav Gabal


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




RE: [PHP] dynamic menu possible?

2001-09-16 Thread Luboslav Gabal ml.


> What I want to do is have a drop-down menu where the options are files

This is matter of HTML or JavaScript

> located in a folder on the server that changes as items are added to or
> removed. Then the user can select an item from the menu, submit, and that
> page will load.

This is script for writing all files located in a folder:

$folder = "c:/borland/";
$dir = opendir($folder);
while ($file = readdir($dir)) {
 echo $file."";
}

> Did that make sense?
> So I have 1.htm and 2.htm and 3.htm in a folder. A selectable menu reads
the
> folder and lists those three files as options. The user can click on it
and
> submit and that page will load. And if I add 4.htm, the menu will add that
> to the drop down on its own.
>
> That that's not possible, how close can I get to something like that?
> An example of something close to that I found on www.megatokyo.com . They
> have a dropdown menu where a user selects an item and gets sent to that
> page. A URL from one attempts shows as
> http://www.megatokyo.com/index.php?date=2001-09-04 . How is that done?
>
> Again, if I could just be pointed to the related PHP concepts I'll take it
> from there.

Try to start here:

http://www.php.net/manual/en/ref.dir.php
http://www.php.net/manual/en/ref.filesystem.php

Lubo


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




RE: [PHP] Comining variables into a single string

2001-09-16 Thread Luboslav Gabal ml.


> Greetings to All:
>
> I'm inexperienced, although enthusiastic about using PHP.  I want to write
> data more effectively to a file.
>
> This doesn't work:  fputs($frank, "Testing " $whatever " more testing
> \n\n\n");
> Right now, all I know is using three separate fputs statements.  I'd like
to
> use just one.

fputs($frank, "Testing ".$whatever." more testing\n\n\n");

see http://www.php.net/manual/en/language.operators.string.php

Luboslav Gabal


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




RE: [PHP] Help with database queries

2001-09-17 Thread Luboslav Gabal ml.

> Hi,
>
> need some help with the code below. I am thinking of reusing this for
> building a thumbnail gallery from a database.
>
> First, is the code actually good? Do i do something that will slow down
the
> responses?
>
> Second, can anyone help me with a code sample to implement that will limit
> how many records the query is displaying? (break the database response
into
> pages)
>
> Third, any good ideas on how to do this the easiest way is appreciated :)
>
> Thanks!
> - Daniel
>
>
> $db = mysql_connect("localhost", "xxx", "xxx");
>
> mysql_select_db("xxx",$db);
>
> $result = mysql_query("SELECT * FROM film WHERE artnr LIKE '$avd'",$db);
>
> if ($myrow = mysql_fetch_array($result)) {
>
> echo "\n";
> echo "Art.nr\n";
> echo "Titel\n";
> echo "\n";
>
> do {
>
> printf("%s
> %s
> %smin
> \n", $myrow["artnr"], $myrow["titel"], $myrow["dur"]);

use fullstops instead of commas:

printf($myrow["artnr"].$myrow["titel"].$myrow["dur"]);

>
> } while ($myrow = mysql_fetch_array($result));
> echo "\n";
>
> } else {
> echo "No records available...";
> }

If you want to limit record outputed at the page, try change mysql query:

SELECT * FROM film WHERE artnr LIKE '$avd' LIMIT 0, 10

where first number is row with record and second is number of getting
records,
or you can to use function mysql_data_seek(), which move pointer to database
on
selected row:

mysql_data_seek($result, 10);

this move your internal result pointer to 10. line. Now, when you can output
ten next
lines, you can do it so:

for ($i = 0; $i < 10; $i++) {
$row = mysql_fetch_array($result);
echo $row["titel"]; // this outputs you "titel" from 11. row of table
} // then will be next 9 rows outputed

Luboslav Gabal


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




RE: [PHP] Counting

2001-09-17 Thread Luboslav Gabal ml.

> I'm using php/mysql. I want to be able to count the number of records that
> match something.
> I've used mysql_num_rows() and it does work, but is there a better way?
> Something like COUNT(*)? I've tried to use it, but all I get is Resource
ID
> #1 or something similar. Any ideas for the best way to do this?
>
> Max

$result = mysql_db_query($database, "SELECT COUNT(*) AS count FROM table;");
$count = mysql_fetch_array($result);
echo $count["count"];

Luboslav Gabal


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




RE: [PHP] NEED HELP: select box repeat

2001-09-17 Thread Luboslav Gabal ml.

> OK I am trying to write a script that will bring data out of a database
into
> a select box. But what I need it to do is repeat 5 times or more depending
> on what it brings out. I can only get it to display one select box. Here
is
> what I got so far:
>
>  require 'common.inc';
> // Connect to the Database
> if (!($link = mysql_pconnect($DB_SERVER, $DB_LOGIN, $DB_PASSWORD))){
> DisplayErrMsg(sprintf("internal error %d:%s\n",
> mysql_errno(), mysql_error()));
> exit() ;
> }
> ?>
>
> 
> Flavors Select
> 
>
> 
>  // Send the Query to the Server, to get the list of flavors
> if (!($result = mysql_db_query($DB,"SELECT * FROM extras WHERE
name='$flav'
> ORDER BY 'choice'")))
> {
> DisplayErrMsg(sprintf("internal error %d:%s\n",
> mysql_errno(), mysql_error()));
> return 0 ;
> }
> ?>
> 
> 
> 
> 
>  {
> ?>
> ">
>  } // End of while loop
> ?>
> 
> 
> 
> 
>
>  }
> ?>

Try to check if query doesn't return only one row, for example:

echo mysql_num_rows($result);

Luboslav Gabal


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




RE: [PHP] Help with database queries

2001-09-17 Thread Luboslav Gabal ml.


- Pôvodná správa -
Od: "Luboslav Gabal ml." <[EMAIL PROTECTED]>
Komu: "Daniel Alsén" <[EMAIL PROTECTED]>; "PHP" <[EMAIL PROTECTED]>
Odoslané: 17. zárí 2001 23:39
Predmet: RE: [PHP] Help with database queries


> > Hi,
> >
> > need some help with the code below. I am thinking of reusing this for
> > building a thumbnail gallery from a database.
> >
> > First, is the code actually good? Do i do something that will slow down
> the
> > responses?
> >
> > Second, can anyone help me with a code sample to implement that will
limit
> > how many records the query is displaying? (break the database response
> into
> > pages)
> >
> > Third, any good ideas on how to do this the easiest way is appreciated
:)
> >
> > Thanks!
> > - Daniel
> >
> >
> > $db = mysql_connect("localhost", "xxx", "xxx");
> >
> > mysql_select_db("xxx",$db);
> >
> > $result = mysql_query("SELECT * FROM film WHERE artnr LIKE '$avd'",$db);
> >
> > if ($myrow = mysql_fetch_array($result)) {
> >
> > echo "\n";
> > echo "Art.nr\n";
> > echo "Titel\n";
> > echo "\n";
> >
> > do {
> >
> > printf("%s
> > %s
> > %smin
> > \n", $myrow["artnr"], $myrow["titel"], $myrow["dur"]);
>
> use fullstops instead of commas:
>
> printf($myrow["artnr"].$myrow["titel"].$myrow["dur"]);
>

I take it back :-). My mistake ... But the rest is right (I believe :-))

> >
> > } while ($myrow = mysql_fetch_array($result));
> > echo "\n";
> >
> > } else {
> > echo "No records available...";
> > }
>
> If you want to limit record outputed at the page, try change mysql query:
>
> SELECT * FROM film WHERE artnr LIKE '$avd' LIMIT 0, 10
>
> where first number is row with record and second is number of getting
> records,
> or you can to use function mysql_data_seek(), which move pointer to
database
> on
> selected row:
>
> mysql_data_seek($result, 10);
>
> this move your internal result pointer to 10. line. Now, when you can
output
> ten next
> lines, you can do it so:
>
> for ($i = 0; $i < 10; $i++) {
> $row = mysql_fetch_array($result);
> echo $row["titel"]; // this outputs you "titel" from 11. row of table
> } // then will be next 9 rows outputed
>
> Luboslav Gabal



-- 
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] closing persistance connection

2001-09-20 Thread Luboslav Gabal ml.

How to close persistance connection to MySQL server ?

Luboslav Gabal


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

2002-04-06 Thread Joerg Hanke [ML-php]

hi!

i've got the following problem and hope one of you is able to help me
solving that:

i've got a system in php that writes data (e.g. variable-name = $data)
to a mysql database. there are two more scripts: one for displaying the
data and one for writing the data into a formular. the displaying-script
includes a link to the formular-script which submits the values for
$data. i use the command 'htmlentities' to express the value (there is
an html-tag like ) correctly. when the
formular-script is executed via this link i get a wrong result:  there are these backslashes...


what 2 do??

thX,
George


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




[PHP] redirector

2002-04-06 Thread Joerg Hanke [ML-php]

hi,

i've got the possibility to create alias subdomains, which redirect all
to the document-root...

e.g.:

http://adam.domain.com redirects to http://domain.com

i want to redirect the users who access http://adam.domain.com to
http://domain.com/home/adam

how to do this best in php??

reguards,
george


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




Re: [PHP] php and images

2004-07-23 Thread Miroslav Hudak (php/ml)
I have a certain difficulties in case of processing large images thru GD2 
library. GD2 has some problems with image processing and it results in some 
exception and GD just crashes. I have to mention, that the crash causes whole 
php interpreter to crash and execution of the script is terminated without any 
warning or handlable event :(...

I don't know for certain now, which command causes it, but it seems that 
imagecopyresampled is the origin of the problems.

So if you are using GD2 with large images, this may be the issue.
regards,
m.
Roman Duriancik wrote:
I have problem with jpg pictures in php pages. Path and picture is 
correct but when i want  see picture in php script  picture don't show. 
I use PHP4.3.4 on apache server 2.0.44 on Windopws 2000 Server.

Thanks for help.
--
Miroslav Hudak
developer & designer
http://hudak.info
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] editor for remote files using ssh

2004-07-24 Thread Miroslav Hudak (php/ml)
Vi or ViM :)
m.
Peter Risdon wrote:
I have been using emacs/tramp for editing files on remote machines, but 
I find it can be flaky - no doubt I am doing something wrong. Can anyone 
suggest a good programmers' text editor that at least has syntax 
highlighting and can use ssh for accessing files directly on remote 
machines? I need a Unix program, preferably a FreeBSD port, but am happy 
to compile something myself if it will work consistently or at least 
give some kind of error message if it has difficulty, and not just hang.

TIA.
Peter.
--
Miroslav Hudak
developer & designer
http://hudak.info
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Question about for

2004-07-25 Thread Miroslav Hudak (php/ml)

m.
Henri Marc wrote:
Hello,
I woudlike to use a loop:
for ($i=1;$i<11;$i++)
But instead of incrementing with 1, I would like to
increment by 2. So $i would be 1,3,5,7,9. I tried to
find the answer may be with "step" but couldn't find
anything.
Thank you for your help.
Dave

	
		
Vous manquez d’espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer 
instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com
--
Miroslav Hudak
developer & designer
http://hudak.info
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] URGENT: Space char in rewriterule

2004-07-27 Thread Miroslav Hudak (php/ml)
I think, the point, Curt wanted to point out was, that URI CAN NOT contain SPACE 
character and all SPACE characters (ord 32) are converted to %20 ... thus, space 
character in rewrite rule will lead to bogus URI... thus, browser will send %20 
instead and... dunno if apache will convert it to " " before applying the 
regexp, but if not, this will lead into your problem. Couldn't you just avoid 
that space by encoding?

m.
Robert Winter wrote:
It didn't work. Still the same problem.
Thanks
"Marek Kilimajer" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
Robert Winter wrote:
I have the following rewriterule:
RewriteRule ^(([0-9]|[A-Z]|[a-z]|_)+)$ redirect.php?$1 [L]
that transforms http://mysite.com/XXX to
http://mysite.com/redirect.php?XXX
and I need to also include to space char, for example
that transforms http://mysite.com/AB XX to
http://mysite.com/redirect.php?AB
XX
I didn't find a way to write the " " characters. I tested with
RewriteRule
^(([0-9]|[A-Z]|[a-z]|_| )+)$ redirect.php?$1 [L] but didn't work.
Thanks!
Rob
Did you try
RewriteRule ^([0-9A-Za-z_%]+)$ redirect.php?$1
?

--
Miroslav Hudak
developer & designer
http://hudak.info
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] reading txt file - certain lines

2004-07-29 Thread Miroslav Hudak (php/ml)
Everything is possible :)
And in this case, it seems, that lines are delimited by  ... i'm not quite 
sure, whether "" can be used in explode as a delimiter, if so, you have no 
problem and you just read all the file into variable, $lines = explode('', 
$variable) and you have lines in $lines... if "" can not be explode's 
parameter, i would use str_replace to replace it with ie. #13 and then explode 
it... or use some regular expressions... it depends on how fast you need it... :)

hope this was what you needed... :)
regards,
m.
Dustin Krysak wrote:
Hi there.. .I am displaying info (on music) from a text file with the 
following code...



Now the contents of said text file would read something like the following:
Liarby Sex Pistols"Never Mind The 
Bollocks"Played: 2004/07/28, 1:48:29 
PM--Let's Rave Onby The 
Raveonettes"Chain Gang Of Love"Played: 2004/07/28, 
1:46:37 PM--No Remorseby 
Metallica"Kill 'Em All"Played: 2004/07/28, 
1:40:17 PM--This Is Our Emergencyby 
Pretty Girls Make Graves"The New 
Romance"Played: 2004/07/28, 1:36:37 
PM--Freestylin'by 
Greyboy"Freestylin'"Played: 2004/07/28, 
1:30:25 PM--In My Headby Naked 
Raygun"Raygun...Naked Raygun (Reissue)"Played: 
2004/07/28, 1:26:37 PM--Lust To Loveby 
The Go-Go's"Return To The Valley Of The 
Go-Go's"Played: 2004/07/28, 1:23:13 PM--Kim 
You Bore Me To Deathby Grandaddy"Concrete 
Dunes"Played: 2004/07/28, 1:18:37 
PM--Sonderkommandoby 
Gwar"This Toilet Earth"Played: 2004/07/28, 
1:13:49 PM--

Now what I want to do is read this file, but only say read 5 songs 
worth, then I would place the PHP code in (another table) and display 
the next 5 songs and so on This just allows for a more flexible 
layout in the final presentation. the way I am having the text files 
written, there is no way to get it to produce seperate text files - 
otherwise this would be easy to do

Is this possible?
Thanks in advance!
Dustin
--
Miroslav Hudak
developer & designer
http://hudak.info
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: [Q] Why does my php file gets displayed instead of executed

2004-07-11 Thread Miroslav Hudak (php/ml)
this all seems just fine to me, aren't you sending some Header: 
Content-type -s?
could you post that init.php script source? and is that apache server 
working well for other scripts that are called from the forms?
AND ... just to be sure,... are you calling that html which contains the 
form thru server? (like http://localhost/myform.html) ... ? because, 
when calling it directly from dreamweaver,
it could be called like direct html file (eg. 
file://c:/myhtmls/myform.html) and then the script will be called as 
file://c:/myhtmls/my_authentication_script.php instead of 
http://localhost/my_authentication_script.php

that's all what comes to my mind,
regards,
m.
Michael T. Peterson wrote:
Here is some additional info:
My other PHP scripts execute just fine, including the php script init.php
which uses header(...) to dispatch to the member_login.htm page. Recall that
the problem arises when validate_member_login.php is invoked from
member_login.htm. When validate_member_login.php is invoked directly, it
executes properly.
I'm running the most recent production release of the Apache server on
winxp. My ISP is running the same version. I've configured PHP identically
with my ISP's Apache config. I use Dreamweaver MX for development and
testing. I've not tested for this problem on my ISP's system, yet
Once again, note that the php script, validate_member_login.php is executed
properly in one case, yet is displayed in the browser in the other. Here is
the code for validate_member_login.php:

/**
* Variables set by member_login.htm are:
*  username -- contains the username of the member.
*  password -- contains the member's password.
*/
$username = trim($HTTP_POST_VARS['username']);
$password = trim($HTTP_POST_VARS['password']);
$result = authenticate_member_login( $username, $password );
if( $result == 0 ) {
$HTTP_SESSION_VARS['session_id'] = crypt_password( $password );
$HTTP_SESSION_VARS['username'] = $username;
header( 'Location: '.MEMBER_HOME_PAGE );
} else {
header( 'Location: '.MEMBER_LOGIN_PAGE );
}
?>
'init.php' executes session_start(), sets a bunch of constants (e.g.,
MEMBER_HOME_PAGE, etc.), sets an error handler, and includes a bunch of
libraries. All standard stuff.
Again, any help would be appreciated.
Cheers,
Michael
"Michael T. Peterson" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
 

When a user first comes to my site, the user's session id is checked and
validated. If no session id is present or the validation fails, the user
   

is
 

vectored to a second page containing a login form.  When the user enters
   

the
 

username and password and then clicks the submit button the info is
forwarded to a third page, a php script, validate_member_login.php, that
checks the username and password against a database.  Just for
   

completeness,
 

note that the php script, validate_member_login.php, is invoked via login
form's action parameter, i.e.,
   
The problem is that the php script, validate_member_login.php, is
   

displayed
 

in the browser rather than being executed.
This is my first attempt at designing a dynamic web site so I'm sure I've
missed something really basic, but I have hardly any hair left to pull
   

out.
 

Thanks, in advance,
Michael
--
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] parse error: [PHP] usort e & é together

2004-07-11 Thread Miroslav Hudak (php/ml)
Dunno the original question, but this obviously should be escaped...
So the correct code follows...
usort($authors, create_function('$a,$b','
  $a = str_replace(array(\'é\', \'a\'), array(\'e\', \'a\'), $a);
  $b = str_replace(array(\'é\', \'a\'), array(\'e\', \'a\'), $b);
  return strcasecmp($a,$b);'));
Regards,
m.
John Taylor-Johnston wrote:
Sorry. Still getting a parse error on line 40:
39> usort($authors, create_function('$a,$b','
40>  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41>  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42>  return strcasecmp($a,$b);'));
Can you have two arrays there? http://ca2.php.net/manual/en/function.str-replace.php
All the brackets are in the right place. Hmmm ...?
Thanks,
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] usort e & é together

2004-07-11 Thread Miroslav Hudak (php/ml)
this is slightly changed function of yours, written for better 
readability...


$authors = array('élen', 'Élen', 'Elison', 'ámadeus', 'albert', 
'alfred', 'amadeus', 'elen');

function usort_callback($a, $b) {
$a = strtolower($a); $b = strtolower($b);
$a = str_replace(array('á', 'é'), array('a', 'e'), strtolower($a));
$b = str_replace(array('á', 'é'), array('a', 'e'), strtolower($b));
return (strcmp($a, $b));
}
usort($authors, 'usort_callback');
var_dump($authors);
?>
it does diacritics safe and case-insensitive sort of authors... at least 
on my workstation... is it what you need? while i don't have your 
original problem, i just can guess... hope it helps.

m.
John Taylor-Johnston wrote:
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é
It still sorts "é" and "e" separately, but without a parse error:
$first = array('à', 'é');
$second  = array('a', 'e');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
Back to the drawing board? I tried this too:
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
Ideas? Thanks,
John

Parse error on line 40:
39> usort($authors, create_function('$a,$b','
40>  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41>  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42>  return strcasecmp($a,$b);'));


if(!$ausenquiry) $ausenquiry ="a";
echo "
Note: A star, \"*\", indicates that the author uses a pseudonym.Noter : Une étoile, 
\"*\", indique que cet auteur est connu par un nom de plume.
\n";
##
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select id,AUS from $table");
##
$authors = array();
$author_list = array();
while ($mydata = mysql_fetch_object($news))
{
  $mydata->AUS = str_replace(" ;", ";", $mydata->AUS);
  $mydata->AUS = str_replace("; ", ";", $mydata->AUS);
  $tempauthors = explode(";", $mydata->AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor <> "")
{
  array_push($authors, $singleauthor);
  $author_list[$singleauthor][] = $mydata->id; // use an associative array...
   }
  }
}
#sort($authors);
#usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));
#usort($authors, create_function('$a,$b','
# $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
# $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
# return strcasecmp($a,$b);'));
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
foreach (array_count_values ($authors) as $author=>$count)
{
 if((strtolower(substr($author, 0, 1)) == $ausenquiry))
 {
  echo "";
   echo "".$author." [<--Search Entire 
Database]";
   echo "(".$count." ";
if($count > 1)
{echo "records found/trouvés)";}
else{echo "record found/trouvé)";}
   echo"\n";
   echo " ";
   echo "";
   $temp = "";
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= "".$ausid.", ";
   }
   $temp = substr("$temp", 0, -2);
   echo "$temp";
   echo " ";
  echo "\n";
 }
}
mysql_close($myconnection);
##
echo "

\n";
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] usort e & é together

2004-07-11 Thread Miroslav Hudak (php/ml)
Pardon me for the strtolower line, i've just forgot there... it's 4:30AM 
here in Slovakia... :/

correct listing follows...

$authors = array('élen', 'Élen', 'Elison', 'ámadeus', 'albert', 
'alfred', 'amadeus', 'elen');

function usort_callback($a, $b) {
$a = str_replace(array('á', 'é'), array('a', 'e'), strtolower($a));
$b = str_replace(array('á', 'é'), array('a', 'e'), strtolower($b));
return (strcmp($a, $b));
}
usort($authors, 'usort_callback');
var_dump($authors);
?>
regards,
m.
John Taylor-Johnston wrote:
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é
It still sorts "é" and "e" separately, but without a parse error:
$first = array('à', 'é');
$second  = array('a', 'e');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
Back to the drawing board? I tried this too:
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
Ideas? Thanks,
John

Parse error on line 40:
39> usort($authors, create_function('$a,$b','
40>  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41>  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42>  return strcasecmp($a,$b);'));


if(!$ausenquiry) $ausenquiry ="a";
echo "
Note: A star, \"*\", indicates that the author uses a pseudonym.Noter : Une étoile, 
\"*\", indique que cet auteur est connu par un nom de plume.
\n";
##
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query("select id,AUS from $table");
##
$authors = array();
$author_list = array();
while ($mydata = mysql_fetch_object($news))
{
  $mydata->AUS = str_replace(" ;", ";", $mydata->AUS);
  $mydata->AUS = str_replace("; ", ";", $mydata->AUS);
  $tempauthors = explode(";", $mydata->AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor <> "")
{
  array_push($authors, $singleauthor);
  $author_list[$singleauthor][] = $mydata->id; // use an associative array...
   }
  }
}
#sort($authors);
#usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));
#usort($authors, create_function('$a,$b','
# $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
# $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
# return strcasecmp($a,$b);'));
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
foreach (array_count_values ($authors) as $author=>$count)
{
 if((strtolower(substr($author, 0, 1)) == $ausenquiry))
 {
  echo "";
   echo "".$author." [<--Search Entire 
Database]";
   echo "(".$count." ";
if($count > 1)
{echo "records found/trouvés)";}
else{echo "record found/trouvé)";}
   echo"\n";
   echo " ";
   echo "";
   $temp = "";
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= "".$ausid.", ";
   }
   $temp = substr("$temp", 0, -2);
   echo "$temp";
   echo " ";
  echo "\n";
 }
}
mysql_close($myconnection);
##
echo "

\n";
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] HTML and PHP output to PHP variable

2004-07-12 Thread Miroslav Hudak (php/ml)
hello!
use output buffering...

regards,
m.
Maris wrote:
Hi!
Let's say my index.php consists of the following:
PHP says Hello World"; ?>
HTML says Hello World

..some other HMTL output..
My question is:
how can I make the whole index.php generated output put in one PHP variable?
It is also important that it is done from the same index.php file.
Thanks,
Maris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OT but need guidance in timing page views

2004-07-19 Thread Miroslav Hudak (php/ml)
I would do it this way:
- open the page and create hidden iframe (or frame with 0% width/height) 
which will be refreshing itself every ... let's say ... 2 minutes... 
then you'll get up to 2 minutes accurate numbers... the refreshed page 
would write timestamp to database every refresh... when the user crashes 
or leaves the page without logging off, you know, that his next refresh 
(and last one) would be LASTREFRESH + 2mins ... that gives you quite 
accurate numbers when implemented correctly.

On the other hand, it will be a bit load producing, while that 
subsequent writes to database...

Hope it helped a bit,
regards,
m.
Robb Kerr wrote:
I know that this is somewhat off topic, but I just need a starting place to
do the research and thought someone here might be able to help. I am
developing an application in which I need to time how long a visitor
remains within a module and how long they view each page. I can create the
appropriate fields in MySQL and can use PHP to do the appropriate
calcualtions. What I don't know is how I communicate this information to
the server. I can use POST or GET statements to pass info with page turns
but what do I do if the visitor leaves the site without logging out or
experiences a machine crash?
Also, if anyone knows of a good javascript newsgroup, please pass along the
info.
Thanx,
Robb
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] OT but need guidance in timing page views

2004-07-19 Thread Miroslav Hudak (php/ml)
Hi!
This is what you need :)
You have hidden frame (FRAME not layer!!!) (it means )...
then in check.php would be something like this:

$id = $myid; //myid will be stored in session after user logs in
Connect to database, pair ID with a row in table and
update mytable set endtime = UNIX_TIMESTAMP() where id = myid;
do this every 2 minutes (ie with  refresh tag set to 120 secs)
...
if user changes page, then do following:
check, if last refresh (endtime) is less then 2 minutes ago... if so, 
write the new value as an endtime and set some flag to consider this 
session closed and then you can count the time... (if some open sessions 
for this user open)

Set new start time for this user and generate new frameset with frame 
mentioned above...

In case, that the difference between current timestamp and last endtime 
is 2+ minutes, time endtime + 2 minutes will be written as endtime and 
flags properly set to finished session ... and then start the new one... 
and so on...

i hope i've explained it right :)
regards,
m.
Robb Kerr wrote:
On Mon, 19 Jul 2004 15:54:14 +0200, Miroslav Hudak wrote:

I would do it this way:
- open the page and create hidden iframe (or frame with 0% width/height) 
which will be refreshing itself every ... let's say ... 2 minutes... 
then you'll get up to 2 minutes accurate numbers... the refreshed page 
would write timestamp to database every refresh... when the user crashes 
or leaves the page without logging off, you know, that his next refresh 
(and last one) would be LASTREFRESH + 2mins ... that gives you quite 
accurate numbers when implemented correctly.

On the other hand, it will be a bit load producing, while that 
subsequent writes to database...

Hope it helped a bit,
regards,
m.
Robb Kerr wrote:

I know that this is somewhat off topic, but I just need a starting place to
do the research and thought someone here might be able to help. I am
developing an application in which I need to time how long a visitor
remains within a module and how long they view each page. I can create the
appropriate fields in MySQL and can use PHP to do the appropriate
calcualtions. What I don't know is how I communicate this information to
the server. I can use POST or GET statements to pass info with page turns
but what do I do if the visitor leaves the site without logging out or
experiences a machine crash?
Also, if anyone knows of a good javascript newsgroup, please pass along the
info.
Thanx,
Robb

Thanx for the suggestion. Now to ask for more help... I know how to create
the layer which you mentioned. But, how do I make it auto update every few
minutes and send data to the database?
Thanx again,
Robb
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Can't install PHP on Windows/Apache

2004-07-20 Thread Miroslav Hudak (php/ml)
Have you added the line with the hash mark (#) ??? if so, then it's 
commented out... that's the first point.

The second one is, that when using Apache 2.0.50, you should use 
php4apache2 module instead (I'm not ABSOLUTELLY sure of it, while for a 
longer time using PHP5, but I hope, that somewhat like this was 
there,... check it :)

Regards,
m.
abrea wrote:
Dear list,
I am trying to install PHP 4.3.8 as a module of Apache 2.0.50 on a 
Windows 98 computer.
Apache alone runs ok. After I installed PHP with the installer package, I 
added the following line at the end of the Apache httpd.conf together 
with the AddType statements:
# LoadModule php4_module c:/php/php4apache.dll

When I uncomment this line there is an error message saying that a 
resource is missing (or something like that, the DOS window disappears 
very quickly so I can't copy it).
This line has worked ok on other computers I have installed with PHP 
4.3.4 on Apache 1.3.29 and PHP 4.3.3 on Apache 1.3.27. I tried to install 
these programs but PHP does not run either, although Apache does.
I have tried with both php4apache.dll and php4apache2.dll, but I still 
get the error message.
The paths in the c:\windows\php.ini file point to the .dll file correctly.
Could anybody please tell me what the problem could be?
Thank you in advance
Alberto Brea

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


Re: [PHP] unlink(), is it suppose to delete file???

2004-07-20 Thread Miroslav Hudak (php/ml)
This could happpen when the file is open by another process,... then 
file is deleted, but filename is still there until the file is not free 
of any open filedescriptors... I don't know exactly what processes 
happens in kernel when deleting the file, but it's something like 
that... and it could result in your problem...

m.
Scott Fletcher wrote:
I have a file that was 25 KB and I use the unlink() to remove the file.
When I rechecked it, I found that the file is still there but it's filesize
is 0 KB.  Is unlink() suppose to remove the file or what??
FletchSOD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php