[PHP] how to acess php array var in Js?

2001-11-27 Thread Christian Dechery

If I have a series of checkboxes like this:

input type=checkbox name=cb[] value=1 This is 1
input type=checkbox name=cb[] value=2 This is 2
input type=checkbox name=cb[] value=3 This is 3
input type=checkbox name=cb[] value=4 This is 4

how can I acess cb[] in Javascript other than using the elements array??

I can't do cb[][0].checked for example... it gives me parse error...
using the elements array is not that nice codewise...

any hints?

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] Redirect upon execution of script...

2001-11-25 Thread Christian Dechery

I think I really don't understand what do you want... hehehe :)
which is fine!

but take that code I sent ya... now I'll explain the functions... then tell 
me if I'm right:

function ShowHeader
{
 ?
 html
 titleSomething/title
 body
 ?
}

function ShowFooter()
{
 ?
 /body
 /html
 ?
}

function ShowForm()
{
 global $SCRIPT_NAME:
 ?
 form ... bla bla bla action=?=$SCRIPT_NAME?
 input type=hidden name=action value=process-form
 ?
}

function ProcessForm()
{
 if( !ValidateFormFields() )
 return false;
 else
 {
 if( !ExecuteDBInsert() )
 return false;
 else
 return true;
 }
}

wouldn't that work?

there's no $done variable here... the return of the function is all you 
need... if it's true redirect, if not display error...

At 19:03 25/11/01 +0100, Daniel Alsén wrote:
Hmm...either i don´t really get what you mean, or you missed the problem.

This is the situation:

I have a form which results is to be inserted in a db. When the form is
submitted the page calls itself and does a db INSERT based on if a couple of
statements is true - otherwise it displays a proper error message.

So far everything is fine and is working like a charm.
But:

I want a redirection after a successfull db INSERT. After the INSERT is made
(which is what the page is for) i set a variable, $done, to 1.
Right now i only use $done to display a message at the bottom of the screen
saying that the INSERT worked. But i want the page to redirect itself as
soon as $done is set to 1.

The problem i have is: I can only send headers (wich i use for redirection -
right??) at the top of the page - before all the other code. But since $done
is set far down in the code, after my form and db-statements, the header
will never know when to be sent.

Is there a way of calling a headerfunction in the top of the page?

- Daniel

  -Original Message-
  From: Christian Dechery [mailto:[EMAIL PROTECTED]]
  Sent: den 25 november 2001 18:41
  To: Daniel Alsén; PHP; Miles Thompson
  Subject: RE: [PHP] Redirect upon execution of script...
 
 
  sorry if I'm not understanding correctly your problem... but it
  seems quite
  simple to me...
  I've created like 10.000 php forms that does that... I don't see a prob...
 
  what do you want to do?
 
  process a form:
  if something's wrong, print error message and go back
  if everything is fine go to another page... that's it?
 
  well... database inserts has nothing to do with headers...
 
  you can easily do something like
 
  ?php
  switch ($action)
  {
   case process-form:if( ProcessForm() )
   header(Location:
  next-page.php);
   else
   {
   ShowHeader(); // function to
  display all the HTML you want
   printErrMessage();
   ShowFooter();
   }
   break;
   default:ShowForm();
   break;
  }
  ?
 
  where ProcessForm returns true or false depending on the DB operation...
 
  of course there cannot be any output before the switch?
 
  did it help?
 
  At 18:24 25/11/01 +0100, Daniel Alsén wrote:
2. User fills in a form, clicks submit which calls the same script,
passing itself the values. Depending on the value passed by the submit
button, the script processes the information (INSERT or
  UPDATE) and sets
$done = 1 if successful.
   
The second scenario is easier to handle.
Call the same script, passing it $done, and depending on
  whether or not
$done is set you redirect.
   
Juli Meloni has done an excellent tutorial on just this at
http://www.thickbook.com. look in the tutorials for something
  like Form
With Error Message. You just have to adapt the logic to suit
  your needs.
  
  The second scenario is correct. I am actually already using the method in
  Melonis tutorial for error messages. But i can´t do a
  redirection that way
  since $done isn´t set until after the db INSERT. My if-statement for the
  header is at the top of the page (wich is the only place i can
  put it) and
  will never know if $done is set or not below.
  
  - Daniel
  
  
  --
  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]
 
 
  _
  . Christian Dechery
  . . Gaita-L Owner / Web Developer
  . . http://www.webstyle.com.br
  . . http://www.tanamesa.com.br
 


_
. Christian

[PHP] automatic serial/unserializing with sessions

2001-11-25 Thread Christian Dechery

Sessions do automatically serialize and unserialize it's variables?

How is it done??... is it via session_register() that calls serialize() ??
and then session_start() unserializes it all?

/* I'm just guessing here */

can someone explain me how does this work?

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] some questions on sessions (long)...

2001-11-21 Thread Christian Dechery

How about the sessions?

doesn't sessions also needs to send header data (before any other output)?

the sessions are registered normally..

At 17:07 12/11/01 -0800, Christopher William Wesley wrote:
Your problem probably is including the miec.php from the .shtml
document.  Does the .shtml document send any output to the browser before
including your .php script?  If so, you're not going to be able to send
any cookies from the .php script.  Once any standard output makes it to
the browser (including any leading whitespace), no more headers can be
sent to the browser.  PHP sends cookies to the browser as header data.
Hence, if your .shtml document has any output before your .php document is
included, your session cookie cannot be sent.

 ~Chris   /\
  \ / September 11, 2001
   X  We Are All New Yorkers
  / \ rm -rf /bin/laden

On Mon, 12 Nov 2001, Christian Dechery wrote:

  I've recently had a problem with sessions, and came up with a problem that
  apparently has no solution...
 
  I want to understand why EXACTLY it does't work...
 
   From what I understand about sessions (reading PHP Docs), cookies are
  default and URLs holding the session_id are used if the cookies can be used
  to get the current session_id right?
 
  So if, there's a cookie indicating a session, PHP will detect it and the
  session will work beatifully..
  If when a session is created, a cookie cannot be set, then the URLs come
  into play.. right?
 
  -- I'm I right so far? --
 
  So, I can only presume, that whenever I can see those URLs with
  session_ids, this means that no cookie was created... and if one of those
  URLs is clicked, the session will persist, since the URL is carrying the
  session_id.
 
  Well, now to the problem with no solution... I've described it here on the
  list a couple of times... sorry if this is getting too annoying.
 
  1 - I have a PHP script, that uses sessions, it's called miec.php
miec.php uses both cookies and sessions... the cookie holds the
  user_id and the session holds an array of every
product the user has seen, so they won't repeat... of course, the
  session only gets initialized if the cookie with the
user id is found... if not, a login form is shown...
  2 - I have a html file, demo.shtml, which with SSI includes miec.php
The inclusion works fine, even the cookie with the user id gets
  detected and the username is shown as expected
 
  Now, the problem. If I run miec.php solo on the browser, everything works
  perfectly.
  But if I call demo.shtml, something goes wrong, and I want to know what.
 
  When demo.shtml is called, the cookie works (the user id is detected) and
  the session gets started. I can see the URLs with the session id AND the
  session file in my webserver. The problem is that, the session doesn't
  persist, each time I reload demo.sthml, a new session is created.
 
  Now get this... if I call miec.php and then demo.shtml, everything works.
  Why? My guess is, miec.php running solo is able to create the cookie with
  the session id, while when SSI included it can't, which explain the URLs.
 
  Obviously, URLs (example: demo.shtml?sID=3897348734) aren't helpful here,
  since it's a html file, and it can't parse the query string to send the
  variable to an SSI included php file.
 
  But why the cookie can't be created? Headers aren't the problem... if a
  session can be created and the session vars registered it's because the
  headers have not been sent, so why can't a cookie be created in this
  conditions.
 
  Does anyone has a clue??
 
  p.s: the problem is solved, I force the user to login in case of miec.php
  is SSI included, which works, since the session is created elsewhere
  (login.php).
 
  _
  . Christian Dechery
  . . Gaita-L Owner / Web Developer
  . . http://www.webstyle.com.br
  . . http://www.tanamesa.com.br
 
 
  --
  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 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]


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] query works in mysql, but not from php

2001-11-19 Thread Christian Dechery

remove the ; at the end...

mysql_query() doesn't need it... since it only executes on atomic command, 
the ; is useless..

that's what's causing the error...

At 22:58 19/11/01 +, Olav Drageset wrote:
Hi

$sql = SELECT user FROM persons WHERE user = '$firstName' and domain = 
'$domainName' ; ;
$result = mysql_query($sql,$connection ) or die(mysql_error());

Calling above lines from php returns: You have an error in SQL syntax 
near ';'  at line 1

Issuing the command

SELECT user FROM persons WHERE user = 'fred' AND domain = 'company.net' ;

in mysql give a proper result.

Can anyone explain what might be causing the error???
regards Olav


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


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] very weird PHP behaviour...

2001-11-14 Thread Christian Dechery

I don't know what it is... but PHP is acting very weird today... or I am 
becoming crazy... can anyone tell me which one?

I have this function:
function Upload($source_file,$source_filename,$dest_dir,$allowed_types=array())
{
global $upload_errmsg;

if( count($allowed_types) )
{
   $file_ext=ArquivoExt($source_filename);
   $ext_found=in_array($file_ext,$allowed_types);
   //die(source=$source_filename);
   //var_dump($ext_found);
   //die;
   if( !$ext_found )
   {
 $upload_errmsg=O arquivo \$source_filename\ não está entre os tipos 
autorizados;
 //die(errmsg=$upload_errmsg);
 return false;
   }
}
... some more code here ..
return true;
}

the first crazy behaviour is... I use a test file called something.jpg, 
ArquivoExt() returns me the extension of a given filename, in this case 
jpg. $allowed_types contains gif,jpg and png so that in_array() 
should return true... and it does... but get this... if I uncomment that 
var_dump() guess what it outputs?

bool(true) bool(false)

very weird... how can one var_dump() call gives me two outputs?
This double output doesn't occur if I uncomment the die after the 
var_dump(). It only outputs bool(true) in that case.

Now for the second weird behaviour... since no matter what, $ext_found will 
always be false (due to the previous weirdness) it will always enter the 
IF... but the weird thing is when the caller of Upload() prints 
$upload_errmsg it only outputs:

O arquivo  não está entre os tipos autorizados

where is the filename? I've checked it tons of times... If I uncomment the 
second die, right after the $upload_errmsg assignment, it outputs ok, with 
the filename.

Now, can someone explain me this VERY WEIRD behaviour??



--
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] very weird PHP behaviour...

2001-11-14 Thread Christian Dechery

that's exactly the problem... damn, how couldn't I think of this..

I didn't realise that when a file is NOT uploaded its value is set to 
'none'... and I was using empty() to check it...

thanks a lot.

At 10:54 14/11/01 -0600, Steve Cayford wrote:
Sure sounds like you're hitting this function twice by accident. Are you 
sure you're only calling it once? That would explain why you only get one 
output with the die(), but two without it.

-Steve

On Wednesday, November 14, 2001, at 10:34  AM, Christian Dechery wrote:

I don't know what it is... but PHP is acting very weird today... or I am 
becoming crazy... can anyone tell me which one?

I have this function:
function 
Upload($source_file,$source_filename,$dest_dir,$allowed_types=array())
{
global $upload_errmsg;

if( count($allowed_types) )
{
   $file_ext=ArquivoExt($source_filename);
   $ext_found=in_array($file_ext,$allowed_types);
   //die(source=$source_filename);
   //var_dump($ext_found);
   //die;
   if( !$ext_found )
   {
 $upload_errmsg=O arquivo \$source_filename\ não está entre os 
 tipos autorizados;
 //die(errmsg=$upload_errmsg);
 return false;
   }
}
... some more code here ..
return true;
}

the first crazy behaviour is... I use a test file called something.jpg, 
ArquivoExt() returns me the extension of a given filename, in this case 
jpg. $allowed_types contains gif,jpg and png so that in_array() 
should return true... and it does... but get this... if I uncomment that 
var_dump() guess what it outputs?

bool(true) bool(false)

very weird... how can one var_dump() call gives me two outputs?
This double output doesn't occur if I uncomment the die after the 
var_dump(). It only outputs bool(true) in that case.

Now for the second weird behaviour... since no matter what, $ext_found 
will always be false (due to the previous weirdness) it will always enter 
the IF... but the weird thing is when the caller of Upload() prints 
$upload_errmsg it only outputs:

O arquivo  não está entre os tipos autorizados

where is the filename? I've checked it tons of times... If I uncomment 
the second die, right after the $upload_errmsg assignment, it outputs ok, 
with the filename.

Now, can someone explain me this VERY WEIRD behaviour??



--
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 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] some questions on sessions (long)...

2001-11-13 Thread Christian Dechery

But what about the session? It get's registered... doesn't sessions also 
need to send header information?
it gets registered... it just doesn't persist...

At 17:07 12/11/01 -0800, you wrote:
Your problem probably is including the miec.php from the .shtml
document.  Does the .shtml document send any output to the browser before
including your .php script?  If so, you're not going to be able to send
any cookies from the .php script.  Once any standard output makes it to
the browser (including any leading whitespace), no more headers can be
sent to the browser.  PHP sends cookies to the browser as header data.
Hence, if your .shtml document has any output before your .php document is
included, your session cookie cannot be sent.

 ~Chris   /\
  \ / September 11, 2001
   X  We Are All New Yorkers
  / \ rm -rf /bin/laden

On Mon, 12 Nov 2001, Christian Dechery wrote:

  I've recently had a problem with sessions, and came up with a problem that
  apparently has no solution...
 
  I want to understand why EXACTLY it does't work...
 
   From what I understand about sessions (reading PHP Docs), cookies are
  default and URLs holding the session_id are used if the cookies can be used
  to get the current session_id right?
 
  So if, there's a cookie indicating a session, PHP will detect it and the
  session will work beatifully..
  If when a session is created, a cookie cannot be set, then the URLs come
  into play.. right?
 
  -- I'm I right so far? --
 
  So, I can only presume, that whenever I can see those URLs with
  session_ids, this means that no cookie was created... and if one of those
  URLs is clicked, the session will persist, since the URL is carrying the
  session_id.
 
  Well, now to the problem with no solution... I've described it here on the
  list a couple of times... sorry if this is getting too annoying.
 
  1 - I have a PHP script, that uses sessions, it's called miec.php
miec.php uses both cookies and sessions... the cookie holds the
  user_id and the session holds an array of every
product the user has seen, so they won't repeat... of course, the
  session only gets initialized if the cookie with the
user id is found... if not, a login form is shown...
  2 - I have a html file, demo.shtml, which with SSI includes miec.php
The inclusion works fine, even the cookie with the user id gets
  detected and the username is shown as expected
 
  Now, the problem. If I run miec.php solo on the browser, everything works
  perfectly.
  But if I call demo.shtml, something goes wrong, and I want to know what.
 
  When demo.shtml is called, the cookie works (the user id is detected) and
  the session gets started. I can see the URLs with the session id AND the
  session file in my webserver. The problem is that, the session doesn't
  persist, each time I reload demo.sthml, a new session is created.
 
  Now get this... if I call miec.php and then demo.shtml, everything works.
  Why? My guess is, miec.php running solo is able to create the cookie with
  the session id, while when SSI included it can't, which explain the URLs.
 
  Obviously, URLs (example: demo.shtml?sID=3897348734) aren't helpful here,
  since it's a html file, and it can't parse the query string to send the
  variable to an SSI included php file.
 
  But why the cookie can't be created? Headers aren't the problem... if a
  session can be created and the session vars registered it's because the
  headers have not been sent, so why can't a cookie be created in this
  conditions.
 
  Does anyone has a clue??
 
  p.s: the problem is solved, I force the user to login in case of miec.php
  is SSI included, which works, since the session is created elsewhere
  (login.php).
 
  _
  . Christian Dechery
  . . Gaita-L Owner / Web Developer
  . . http://www.webstyle.com.br
  . . http://www.tanamesa.com.br
 
 
  --
  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 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]


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] some questions on sessions (long)...

2001-11-12 Thread Christian Dechery

I've recently had a problem with sessions, and came up with a problem that 
apparently has no solution...

I want to understand why EXACTLY it does't work...

 From what I understand about sessions (reading PHP Docs), cookies are 
default and URLs holding the session_id are used if the cookies can be used 
to get the current session_id right?

So if, there's a cookie indicating a session, PHP will detect it and the 
session will work beatifully..
If when a session is created, a cookie cannot be set, then the URLs come 
into play.. right?

-- I'm I right so far? --

So, I can only presume, that whenever I can see those URLs with 
session_ids, this means that no cookie was created... and if one of those 
URLs is clicked, the session will persist, since the URL is carrying the 
session_id.

Well, now to the problem with no solution... I've described it here on the 
list a couple of times... sorry if this is getting too annoying.

1 - I have a PHP script, that uses sessions, it's called miec.php
  miec.php uses both cookies and sessions... the cookie holds the 
user_id and the session holds an array of every
  product the user has seen, so they won't repeat... of course, the 
session only gets initialized if the cookie with the
  user id is found... if not, a login form is shown...
2 - I have a html file, demo.shtml, which with SSI includes miec.php
  The inclusion works fine, even the cookie with the user id gets 
detected and the username is shown as expected

Now, the problem. If I run miec.php solo on the browser, everything works 
perfectly.
But if I call demo.shtml, something goes wrong, and I want to know what.

When demo.shtml is called, the cookie works (the user id is detected) and 
the session gets started. I can see the URLs with the session id AND the 
session file in my webserver. The problem is that, the session doesn't 
persist, each time I reload demo.sthml, a new session is created.

Now get this... if I call miec.php and then demo.shtml, everything works. 
Why? My guess is, miec.php running solo is able to create the cookie with 
the session id, while when SSI included it can't, which explain the URLs.

Obviously, URLs (example: demo.shtml?sID=3897348734) aren't helpful here, 
since it's a html file, and it can't parse the query string to send the 
variable to an SSI included php file.

But why the cookie can't be created? Headers aren't the problem... if a 
session can be created and the session vars registered it's because the 
headers have not been sent, so why can't a cookie be created in this 
conditions.

Does anyone has a clue??

p.s: the problem is solved, I force the user to login in case of miec.php 
is SSI included, which works, since the session is created elsewhere 
(login.php).

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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 probs with SSI

2001-11-10 Thread Christian Dechery

At 12:03 10/11/01 -0800, Rasmus Lerdorf wrote:
Perhaps because you keep asking non-PHP related questions on the PHP
lists.  I see a bunch of questions about Apache and .htaccess from you
which you yourself admitted has nothing to do with PHP.  So, yes, your
history of lame questions work against you.

ok... sorry about that... I'm desperate...


But to answer your question, it is very likely your session id will get
lost through an SSI include virtual.  Probably no way to fix that
depending on how you are doing things.  Generally using SSI at all is a
bad idea.  SSI will have to be turned on and that is just as much a hassle
as turning on PHP these days.

I guess I explained very well my case...

I need to know exactly... sorry if I'm being to annoying, but I got to have 
a precise information... does sessions work with SSI or not? And I need to 
know why... I don't understand the process of an SSI... does the included 
file gets processed after or before the parent? It has its own header or 
its the same as the parents'? I checked with headers_sent() and it seems 
that the included file has its own header, or it wouldn't even register the 
session variables... meaning it could as well work the session...

And the weirdest thing is that, as I explained in my mails, if the session 
gets started elsewhere, then it works beatifully even with SSI... that's 
why I think this is not an expected behaviour...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


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

2001-11-10 Thread Christian Dechery

what does SetCookie() returns???

I did a var_dump() on it and it gave me 'bool(true)' when in fact the 
cookie was not set...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] converting string to double

2001-11-10 Thread Christian Dechery

try floatval()

At 21:13 10/11/01 -0500, Kal Amry wrote:

Any handy function to convert a string such as

$string1 = '55.32'

To A Number such as

55.32



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


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] Why no one helps?

2001-11-10 Thread Christian Dechery

Why doesn't anyone say something about my messages probelms with sessions 
and SSI?

Is it such a lame question???

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] Why no one helps?

2001-11-10 Thread Christian Dechery

At 10:33 10/11/01 -0800, you wrote:
On Saturday 10 November 2001 08:42 am, Christian Dechery wrote:
  Why doesn't anyone say something about my messages probelms with sessions
  and SSI?

This list gets 2000 - 3000 messages per month and you find it surprising that
not all messages get a response?

My suggestion regarding SSI and PHP is to not use SSI.  Use include() or
require() instead and keep it an all-PHP affair.

but I'm trying to build a system that can be used without the need of PHP.
The person could include the PHP from another server in a HTML file... or 
even in the same server but without having to switch all the files from 
.html to .php just to install my system.

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] Real problemas with sessions and SSI...

2001-11-09 Thread Christian Dechery

Can someone explain to me why sessions don't work with SSI?

Let me explain my case:
I have a php script called miec.php, which uses sessions extensively. It's 
a script to show products from a catalog randomly, and in the session it 
keeps the products already shown, so it doesn't repeat... it works just fine.

So... if I go to my browser and point to miec.php, and keep reloading it, I 
can see it working... the sessions get updated perfectly and then reseted 
when the maxinum number of allowed products is reached...

Then I have another file called test.shtml which includes miec.php via SSI 
(!--#include virtual=miec.php--), the include is perfect... even the 
cookies holding the userId works... but the session simply doesn't work...

When I load test.shtml, a session is create by miec.php, I can even see the 
file on the server. But if I reload the page, another session is created 
instead of using the same, so it's not persistent... thus, it doesn't work 
at all.

The weird thing is: if I call miec.php directly, the session gets created 
normally, if then I point the browser to test.shtml, the session persists 
normally, and then everything works as expected... I believe this is not 
the expected behaviour...

Does sessions work with SSI or not?



-- 
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] sessions and SSI

2001-11-08 Thread Christian Dechery

Doesn't sessions work with SSI?

I have a page that uses sessions extensively called miec.php...

if you call miec.php right out on the browser, the sessions works fine... 
the session is set and then persists normally...

but if a file I have, called demo.shtml, uses a SSI - !--#include 
virtual=miec.php-- -, then the session stops working...
why?? Isn't a SSI supposed to be in a separate process?

And the weird thing is... If I call miec.php directly, it sets the session 
right? So if right after I call demo.shtml, the session is still there and 
as good as it gets... so, an SSI included file can't create a session, but 
can use it if it is set by another page?

I don't understand...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] help measuring time for img creating...

2001-10-28 Thread Christian Dechery

I have a script that generates quite a complex report...

at this script I call several times another script that generates images 
(of course based on the main report script)...

I'd like some ideas on how I can measure the WHOLE time it took the build 
the entire page... because the images are not accounted for in the main 
script... it always returns something like 1 or 2 seconds when it actually 
took 30 or 40 seconds to finish...

any ideas?

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


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

2001-10-28 Thread Christian Dechery

At 19:04 28/10/01 -0500, Gary wrote:
How do you get a SSI to work on a php page?

you don't need SSI if you're running PHP... just use include()...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] problems with sessions (not working)

2001-10-27 Thread Christian Dechery

I have a file called miec.php that does quite a lot of processing and then 
include()s user_track.inc.php...

miec.php:

?
a lot of db processing  (NO OUTPUT whatsoever)
include(user_track.inc.php);
UserTrack($products);
the output starts here...
?

user_track.inc.php:
--
?
session_start();

function UserTrack($products)
{
global $prod_views;

if( !session_is_registered(prod_views) )
{
fill the $prod_views array, serialize it...
session_register(prod_views);
// I've tested the code above... and session_register returns 
TRUE and I 
saw the session file...
}
else
{
do other stuff with the prod_views array
}
}
?

the problem is why does it NEVER go into the 'else'... it seems that 
the session is registered... but as soon as I refresh the page the session 
is lost...

why?



_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] how many data can a session hold?

2001-10-25 Thread Christian Dechery

I want to know how many data can a session (treated as cookie) can hold...

The number of bytes... and if possible the max size of an - let's say - 
array of ints. I need this to know how many IDs I can hold in the session...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] generating several images in sequence...

2001-10-25 Thread Christian Dechery

I have a page that calls a image creating script lots of times... this 
script takes two parameters... the type of graph to be created and an array 
with data to fill the graph to be created...

now I'm doing it like this:

img 
src=?=WEB_ROOT./adm/relatorio_graph.php?tipo=catviewsemp_graphArray=.urlencode($categs)?

and it generates an output something like this:

img 
src=/vitrine/adm/relatorio_graph.php?tipo=catviewsemp_graphArray=a%3A3%3A%7Bi%3A2%3Ba%3A2%3A%7Bs%3A4%3A%22view%22%3Bi%3A22%3Bs%3A5%3A%22click%22%3Bi%3A1%3B%7Di%3A3%3Ba%3A1%3A%7Bs%3A4%3A%22view%22%3Bi%3A12%3B%7Di%3A4%3Ba%3A2%3A%7Bs%3A4%3A%22view%22%3Bi%3A10%3Bs%3A5%3A%22click%22%3Bi%3A1%3B%7D%7D

it works just fine.. all the graphs show up perfectly...

but I was wondering if there is a better way of doing this... I tried with 
sessions, but I couldn't get the varible to be reseted correctly between 
two graphs of the same type... and they would repeat...

any ideas?

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] In Toronto Next week

2001-10-23 Thread Christian Dechery

At 15:47 23/10/01 -0700, Rasmus Lerdorf wrote:
I have a couple of free days in Toronto Monday and Tuesday next week.
Anybody able to gather enough of a crowd of interested bodies for a PHP
tutorial?  I'd say at least 10 for it to be worth my effort.

-Rasmus

how about Rio, Brazil??

:))


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] GD: need better solution...

2001-10-23 Thread Christian Dechery

I have a page that calls a image creating script lots of times... this 
script takes two parameters... the type of graph to be created and an array 
with data to fill the graph to be created...

now I'm doing it like this:

img 
src=?=WEB_ROOT./adm/relatorio_graph.php?tipo=catviewsemp_graphArray=.urlencode($categs)?

and it generates an output something like this:

img 
src=/vitrine/adm/relatorio_graph.php?tipo=catviewsemp_graphArray=a%3A3%3A%7Bi%3A2%3Ba%3A2%3A%7Bs%3A4%3A%22view%22%3Bi%3A22%3Bs%3A5%3A%22click%22%3Bi%3A1%3B%7Di%3A3%3Ba%3A1%3A%7Bs%3A4%3A%22view%22%3Bi%3A12%3B%7Di%3A4%3Ba%3A2%3A%7Bs%3A4%3A%22view%22%3Bi%3A10%3Bs%3A5%3A%22click%22%3Bi%3A1%3B%7D%7D

it works just fine.. all the graphs show up perfectly...

but I was wondering if there is a better way of doing this... I tried with 
sessions, but I couldn't get the varible to be reseted correctly between 
two graphs of the same type... and they would repeat...

any ideas?

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] how many data can a session hold?

2001-10-23 Thread Christian Dechery

I want to know how many data can a session hold?

The number of bytes... and if possible the max size of an - let's say - 
array of ints. I need this to know how many IDs I can hold in the session...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] IDE for Linux

2001-10-21 Thread Christian Dechery

Can you guys give me some hints of IDEs for programming PHP in Linux?

thanks

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] generating charts/graphics

2001-10-21 Thread Christian Dechery

I'm working on (actually I'm almost finished) on a very nice ad management 
system.

It has a script that generates a very informative report, in HTML. But I 
wanted something more... like some comparative chart... or pie chart...

can anyone give some hints, where can I find info on this? Is this easy to 
do in PHP?

Can I get something already implemented? Some class or something?

thanks...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] IDE for Linux

2001-10-21 Thread Christian Dechery

At 17:20 21/10/01 -0700, you wrote:
You can try ActiveState's Komodo.
http://www.activestate.com/Products/ASPN_Komodo/
 It supports PHP, Perl, Python, etc., has a debugger, pretty cool 
 editor,
etc.  It's only a 1.0 (at least the last time I used it), but was pretty
solid for a 1.0.

What are you looking for in an IDE?  Instead of an IDE I use Visual
SlickEdit.  It's a commercial editor, but it supports PHP, and does a lot of
things an IDE does (it has projects  workspaces, you can do your builds in
it, awesome editor, stuff like function name completion, shows you what
params the function takes, etc.).

exactly what I'm looking for... it's not for me really... It's for a 
friend... I develop in Win32... and use HomeSite... I tried this Komodo... 
but never saw this SlickEdit... does it have a win32 version???


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] help with exec()...

2001-10-05 Thread Christian Dechery

I'm running with some trouble with exec(), system() and it's friends...

I have a MySQL backup script that somewhere have something like

$cmd=mysqldump ..  somefile.sql;

if( !fopen(somefile.sql,r) ) { print error message };

$cmd is correct... I've copy-pasted it tons of times in the command shell 
and it worked... created the 'somefile.sql' and all. But none of the 
functions (exec, system..) works. When I use system it outputs me some 
header for mysqldump and that's all...

I've also checked the directory with getcwd()... it is in the right dir to 
execute the mysqldump...

I'm running PHP 4.06 in Apache 1.3.12 in a Win98 machine...

what might be?


-- 
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] PHP 4.0.6 on NT (IIS 4.0) Can't replace uploaded file

2001-10-01 Thread Christian Dechery

I had the same problem... chmod doesn't work in Windows...

I'm using win2000 server... to make uploads possible you have to set 
permissions to the users: IUSR_COMPUTERNAME and IWAM_COMPUTERNAME, set them 
both to FULL and test...

At 15:54 1/10/2001 -0500, Joseph Koenig wrote:
The script is moving the file to its final destination and then doing a
chmod(filename, 0777) (the php function, not through exec() or
anything); Even setting the mode to 0777 doesn't help at all. Am I doing
this completely wrong from IIS/NT? Thanks,

joe

Joe Kaiping wrote:
 
  Sounds like their upload script isn't setting the correct file permissions
  when creating the file.  Directory permissions don't seem to be a problem
  for you.
 
  -Joe2
 
   -Original Message-
   From: Joseph Koenig [mailto:[EMAIL PROTECTED]]
   Sent: Monday, October 01, 2001 12:38 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] PHP 4.0.6 on NT (IIS 4.0) Can't replace uploaded file
  
  
   I've got a script on an NT (IIS 4.0) server that uploads a file. When
   the user attempts to replace the uploaded file with a new one via the
   form, the script is generating errors.
  
   Warning: Unable to create
   'D:/public/HJ/www.h-jenterprises.com/test/pics/catalog/104_2.gif':
   Permission denied in
   D:\public\HJ\www.h-jenterprises.com\test\admin\item_functions.php on
   line 41
  
   Warning: Unable to move 'C:/PHP/uploadtemp\php4F6.tmp' to
   'D:/public/HJ/www.h-jenterprises.com/test/pics/catalog/104_2.gif' in
   D:\public\HJ\www.h-jenterprises.com\test\admin\item_functions.php on
   line 41
  
   Is there anything I should have their IT guy check as to why
   this script
   can upload, but not replace a file? Thanks,
  
   Joe
  
  
 
  --
  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 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]


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] session var being lost between pages

2001-10-01 Thread Christian Dechery

are you sure you have session_start() on all three pages and you have 
enabled 'track_vars'???
cuz if you don't you'll have to manually pass the session id trought the 
form...

At 07:50 1/10/2001 +, Jean-Christian Imbeault wrote:
Ok, newbie I am but ... I seem to be losing my session vars when I load up 
a different php page.

My set-up:

1- main page starts session and logs user in

if (isset($PHPSESSID))
  session_start($PHPSESSID);
else
  session_start();

$PHPSESSID = session_id();
$SID   = PHPSESSID=$PHPSESSID;

if(!isset($userid)) {
   login_form();
   exit;
}
else {
   session_register(userid, userpassword);
}

Once the user is logged in I have no problem accessin the vars $userid and 
$userpassword.

On the page I even have an A HREF link to second php page and the vars 
are accessible there also.

However this other page has a form. When the user submits the form, a 
third php page is loaded. On this third page the vars no longer have any 
values.

Why is this? How can I access the vars from this third page?

Thanks!

Jc



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] displaying certain columns

2001-09-30 Thread Christian Dechery

You have to fetch the row data with some function...

try mysql_fetch_row() or mysql_fetch array(), examples:

$arr=mysql_fetch_row($result);
echo $arr[0];

or

$arr=mysql_fetch_array($result);
echo $arr[$dbrow];

that should do...


At 21:19 30/9/2001 -0400, you wrote:
i have a database and it randomly selects one piece of data from a table of
quotes, but it will only print the quote when I include the row that it's
picked with. I have my SELECT statement at

$sql = SELECT $dbrow FROM $dbtable ORDER BY RAND() LIMIT 1;

and then to display the result

$result = mysql_db_query($dbname, $sql)


then in the code,

print td $result /td;

what do i need to add? (the result is Resource id #3)

thank you,
Melih



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


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] help with some printing stuff

2001-09-25 Thread Christian Dechery

I'm having some trouble putting on a formatting to printer script.

I've done it in ASP to print CDs tracklists... 4 per page.

Since I know nothing about Word macros, I've done it in HTML and it's 
working fine... it's customizable and all..
but the problem I have is printers... since it's in HTML each printer 
prints the way it wants... cuz HTML is not a fixed doc or anything.

So I was wondering if this would be easy to implement in PDF, it would be 
closed, fixed and printer independent cuz it would have fixed sizes of 
fields and all...

is it easy... can anyone give me some pointers?

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]




Re: [PHP] help with some printing stuff

2001-09-25 Thread Christian Dechery

what do you mean cheat??? I want the best solution possible...
I don't want a bomb in my hands that will work for 100 orders but will 
crash and make the printer crazy with 10.000 orders...

If I converted the html doc to PDF would it be as perfect as if I produced 
a PDF directly from PHP dinamically?

At 10:16 25/9/2001 -0700, Evan Nemerson wrote:
If you want to cheat, I would create the html doc, then use one of the many
HTML - PDF converters out there. Of course you could also create the PDF by
hand, there is a module for that



On Tuesday 25 September 2001 08:19, you wrote:
  I'm having some trouble putting on a formatting to printer script.
 
  I've done it in ASP to print CDs tracklists... 4 per page.
 
  Since I know nothing about Word macros, I've done it in HTML and it's
  working fine... it's customizable and all..
  but the problem I have is printers... since it's in HTML each printer
  prints the way it wants... cuz HTML is not a fixed doc or anything.
 
  So I was wondering if this would be easy to implement in PDF, it would be
  closed, fixed and printer independent cuz it would have fixed sizes of
  fields and all...
 
  is it easy... can anyone give me some pointers?
 
  thanks...


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] help with Mysql Query...

2001-09-24 Thread Christian Dechery

I'm having trouble puting up a query in Mysql because of his lack of SQL 
syntax.

I have a table A and a table B... I want all occurences from A there are 
not in B...

in ANSI SQL... it's nothing more than:

select a.id, a.name from table_a a, table_b b where a.id NOT IN (select id 
from table_b)

and that's it... but in Mysql, since there are no sub-selects, I'm burning 
my brains out and not getting it... I don't wanna create a temp table like 
the manual suggests... this is way NOT efficient... I'd rather do it in PHP 
code than having a query that creates a temporary table, then drop it...


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


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

2001-09-23 Thread Christian Dechery

At 07:00 23/9/2001 -0700, you wrote:
hi

how can I remove duplicted values (Data) in my array ?

there are several solutions to this problem, you can:

1 - use the function array_count_values() to find all the values that occur 
more then once and then loop trough the result array and removing all the 
duplicates.
2 - you can copy you array to a new one, but only copy values that aren't 
there... something like..

$your_array;
$new_array=array(); // this is the one that should have no copies...

foreach($your_array as $value)
{
 if( !in_array($value,$new_aray) )
 {
 $new_array[]=$value;
 }
}

at the end of this loop $new_array contains all data from $your_array with 
no duplicates...

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


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

2001-09-23 Thread Christian Dechery

At 07:00 23/9/2001 -0700, Alawi Albaity wrote:
hi

how can I remove duplicted values (Data) in my array ?

my bad... I didn't check the manual... there's a function that does exactly 
that:

http://www.php.net/manual/en/function.array-unique.php

sorry... :)

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] Re: calling javascript function from a form image

2001-09-21 Thread Christian Dechery

At 09:29 21/9/2001 -0700, Chris Lee wrote:
this isnt reallt a php question but I'll answer it anyhow because Ive been
stuck with netscapes incompatabilities before. do this.

input type=image border=0 name=sub src=genre.png
onsubmit=set_category()

onSubmit is not an event for the input type image... it is for the 
form..  tag...

it should look like form name= action=something onSubmit=func()

this would be activated by clicking on a input type=submit and NOT a 
input type=image...


if that doesnt work you'll have todo this.

script
function set_category()
{
   alert(category set);
   document.formMoviesSearch.submit();
}
/script
...
input type='hidden' name='sub' value=''
img src=genre.png onclick=set_category()

or if you want the hand to show up over the image. change the img tag to

a href='javascript: set_category()'img src=genre.png/a

--

   Chris Lee
   [EMAIL PROTECTED]



Neil Freeman [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  Hi,
 
  I have a form which contains an:
  input type=image
 
  When the user clicks this image I want a javascript function to be
  called. I have added an onclick event to this input line (see code
  below) which works great in IE and all is well. Netscape doesn't
  recognise this onclick event though for the image so how do you call a
  javascript function here? Normally I'd wrap an img with a/a tags
  but I don't think a form will like this.
 
  Has anyone a solution?
 
  Here is my code
 
  #
  head
  titleimagesubmit.htm/title
 
  script
  function set_category() {
   alert(category set);
  }
  /script
  /head
 
  body bgcolor=#FF text=#00
 
  ?php
 
  if ($submit_form)  //if this equals true then the form has been
  submitted
  {
   echo scriptalert(\form submitted\);/script;
  }
  else
  {
   echo scriptalert(\not submitted\);/script;
  }
 
  ?
 
  form name=formMoviesSearch method=post action=imagesubmit.htm
 
  input type=image border=0 name=sub src=genre.png
  onclick=set_category()
  input type=hidden name=submit_form value=true
 
  /form
 
  /body
  /html
  #
 
  Neil
 
  
   Email:  [EMAIL PROTECTED]
   [EMAIL PROTECTED]
  
 
 



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


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] calling javascript function from a form image

2001-09-21 Thread Christian Dechery



form name=formMoviesSearch method=post action=imagesubmit.htm

input type=image border=0 name=sub src=genre.png
onclick=set_category()
input type=hidden name=submit_form value=true

/form

I understand Netscape is a real pain in the a**... but that should work... 
maybe it (Netscape)'s being picky about syntax... trye being 
perfectionist... like:

input type=image name=sub value= src=genre.png 
onClick=set_category();

_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] real simple regex

2001-09-18 Thread Christian Dechery

but can imap replace my old mail() calls? Don't I have to get a server that 
supports it or something??

the regex thing I already got working...

thanks...

At 21:53 17/9/2001 -0700, Frank M. Kromann wrote:
Take a look at http://php.net/manual/en/function.imap-rfc822-parse-adrlist.php

This function will do the trick. You can also have a look at 
http://php.net/manual/en/function.imap-mail.php. This is an extended mail 
function and it works on both WIndows and *nix.

- Frank

  I had to write my own mail() function cuz PHP's does not work in Windows
  very well..
 
  But I suck at regex and I need to get the email address from the field 
 from
  that can be something like:
  $from = Christian Dechery [EMAIL PROTECTED];
 
  so what I want is:
  the string between '' and '' or the last 'word' of the 'sentence' (for
  something like \Christian Dechery\ [EMAIL PROTECTED]).
 
  thanks...
 
  p.s: meu novo email é [EMAIL PROTECTED]
  
  . Christian Dechery (lemming)
  . http://www.tanamesa.com.br
  . Gaita-L Owner / Web Developer
 
 
  --
  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]
 
 
 


_
. Christian Dechery
. . Gaita-L Owner / Web Developer
. . http://www.webstyle.com.br
. . http://www.tanamesa.com.br


-- 
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] real simple regex

2001-09-17 Thread Christian Dechery

I had to write my own mail() function cuz PHP's does not work in Windows 
very well..

But I suck at regex and I need to get the email address from the field from 
that can be something like:
$from = Christian Dechery [EMAIL PROTECTED];

so what I want is:
the string between '' and '' or the last 'word' of the 'sentence' (for 
something like \Christian Dechery\ [EMAIL PROTECTED]).

thanks...

p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] sorting multi-dimensional arrays

2001-09-16 Thread Christian Dechery

it was just a typo... I meant:

$categories[0][id]=2;
$categories[0][name]=lele;
$categories[1][id]=6;
$categories[1][name]=lala;
.. ...

and so on...


At 00:52 16/9/2001 -0400, you wrote:
The below code would result in an array of:

$categories[0][id]=2;
$categories[0][name]=Lele;

Please tell us the actual code you're using, or print_r($arrayname);

/* Chris Lambert, CTO - [EMAIL PROTECTED]
WhiteCrown Networks - More Than White Hats
Web Application Security - www.whitecrown.net
*/

- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, September 09, 2001 11:51 PM
Subject: [PHP] sorting multi-dimensional arrays


| I'm having a little trouble sorting mult-dimensional arrays by key...
|
| I looked-up the manual and found out that array_multisort() thing... but I
| don't think it does what I want... or I don't understand it...
|
| I have an array like this...
|
| $categories=array();
| $categories[0][id]=1;
| $categories[0][name]=Xyz;
| $categories[0][id]=7;
| $categories[0][name]=Lala;
| $categories[0][id]=2;
| $categories[0][name]=Lele;
|
| I want it sorted by name... the way I'm doing it  right now is by using
| an auxiliar array that gets all the names, sorts them, and then build a
new
| array based on that...
|
| is a better way?
|
| p.s: meu novo email é [EMAIL PROTECTED]
| 
| . Christian Dechery (lemming)
| . http://www.tanamesa.com.br
| . Gaita-L Owner / Web Developer
|
|
| --
| 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]
|
|
|


p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] Parsing html table into MySQL

2001-09-16 Thread Christian Dechery

wait a minute... do you want to parse the HTML to get the values to 
populate a mysql table, or do you have this table in another DB and just 
want it copied to your mysql one??

If it is the former, you'll some very hardcore regex work to be done... I 
once did this... it is very stressing work...
- you need to analyse the HTML document and find patterns that indicate 
'begin of row' 'begin and end of column' and 'end of row', 'end of table' - 
these patterns must be unique or you'll find yourself looking for it 
indefinetly and going into an endless loop - do a giant loop that only ends 
on 'end of table' and grab the values within this patterns... the code to 
get this done is huge (not complex), and (I expect) will be only used once, 
right?

At 19:25 16/9/2001 +0500, i_union wrote:


I  need to get from another page table and put it into MySQL table
dynamically



for example http://66.96.230.191/table.html  so I need to parse this table
in database.



If you have any code how to implement such operation by using php MySQL
please help me;



thanks in advance



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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: Fwd: Re: [PHP] Parsing html table into MySQL

2001-09-16 Thread Christian Dechery

ok... so the hard way.

I'm no regex wizard myself... as a matter of fact I suck at it.
I do it the hard (old C like) way.

You have to find some chunks of HTML that determine and end of the data in 
the table and use them to walk trough the doc fetching what you want... let 
me give an example...

html
table
trtdfont face=arialTitle/font/tdtdfont 
face=arialPrice/font/td/tr
trtdfont face=arialXXX/font/tdtdfont 
face=arial10.00/font/td/tr
trtdfont face=arialYYY/font/tdtdfont 
face=arial25.2/font/td/tr
/table
/html

I know that with regex this would be a lot easir but you can do this:

$fp=fopen(htmldoc,r);
while(!feof($fp))
{
 // lets find the first row of DATA (the first were only titles)
 while(!strstr(fgets($fp,256),/tr);

 //now we are the first line
 while(!strstr(fgets($fp,256),/table)
 {
 // see where I'm getting at?
 }
}

No I need to copy the rows values from HTML table you can see it in exlamle
http://66.96.230.191/table.html This is a live score system which updates
every  2 min, So I need to get these values and parse it in MySQL after that
I neeed to get some element from my database and show in my page..

I have problems in regex I dont know good coding and need only smmall
support Please help me :)



- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: i_union [EMAIL PROTECTED]; Chris Lambert [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Monday, September 10, 2001 7:57 PM
Subject: Re: [PHP] Parsing html table into MySQL


  wait a minute... do you want to parse the HTML to get the values to
  populate a mysql table, or do you have this table in another DB and just
  want it copied to your mysql one??
 
  If it is the former, you'll some very hardcore regex work to be done... I
  once did this... it is very stressing work...
  - you need to analyse the HTML document and find patterns that indicate
  'begin of row' 'begin and end of column' and 'end of row', 'end of
table' -
  these patterns must be unique or you'll find yourself looking for it
  indefinetly and going into an endless loop - do a giant loop that only
ends
  on 'end of table' and grab the values within this patterns... the code to
  get this done is huge (not complex), and (I expect) will be only used
once,
  right?
 
  At 19:25 16/9/2001 +0500, i_union wrote:
 
 
  I  need to get from another page table and put it into MySQL table
  dynamically
  
  
  
  for example http://66.96.230.191/table.html so I need to parse this
table
  in database.
  
  
  
  If you have any code how to implement such operation by using php MySQL
  please help me;
  
  
  
  thanks in advance
  
  
  
  _
  Do You Yahoo!?
  Get your free @yahoo.com address at http://mail.yahoo.com
  
  
  --
  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 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] Re: is PHP crazy, or am I?

2001-09-15 Thread Christian Dechery

thanks for all your help... I got it after a bit of REAl thinking I got 
what that algorithm was meant to... it wasn't really the original 
bubble-sort... it's a kinda of pseudo-optimized 'one'... it goes like above:

 function bubblesort($vetor,$tam)
 {
 $troca=0;
 $i=0;

 for($i=$tam; $i0; $i--)
 {
 $troca=1;
 for($j=0; $j$tam ;$j++)
 {
 if($vetor[$j]  $vetor[$j+1])
 {
 $aux=$vetor[$j];
 $vetor[$j]=$vetor[$j+1];
 $vetor[$j+1]=$aux;
 $troca=$j;
 }
 }
 $tam=$troca;
 }
 }

well... enough about that poor sorting method... :)

At 16:45 14/9/2001 -0500, Richard Lynch wrote:
It's been far too long since I've done bubble sort versus Shell versus etc.

If it's your girlfriend's homework, she should know, or know how to find
out, better than either of us...

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: Richard Lynch [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, September 14, 2001 9:12 AM
Subject: Re: is PHP crazy, or am I?


  I must have deleted the line by accident...
 
  $trocou=true; is right below $vetor[$j+1]=$aux;
 
  would that make sense?
 
  I'm not worried about the optimization here... I want to get time results
  for bubblesort... and then I'm going to heap, quick, and others... It's
  some college homework for my girlfriend...
 
 
  At 00:07 14/09/01 -0500, you wrote:
  function bubblesort($vetor,$tam)
  {
   $trocou=true;
   $i=$j=0;
  
   while($trocou)
   {
   $trocou=false;
  
  # You set $trocou to false here, and never reset it to true
  # This loop will execute exactly once.
  
   for($j=0; $j$tam-$i; $j++)
   {
   if($vetor[$j]  $vetor[$j+1])
   {
   $aux=$vetor[$j];
   $vetor[$j]=$vetor[$j+1];
   $vetor[$j+1]=$aux;
   }
   $i++;
   }
   }
  }
  
it's right right?
  
  No.
  
  As near as I can figure, you are incrementing $j and decrementing $i on
  every iteration.
  That would mean that even if you fixed $trocou your sort algorithm would
be
  O(n)
  (Actually it's exactly 1/2 n, but that's the same as O(n) for
sufficiently
  large n.)
  
  Alas, that can't be correct (we wish) and is not the standard bubble
sort...
  
  Try this for the body:
  for ($i = 0; $i  $tam -1; $i++){
   for ($j = $i + 1; $j  $tam -1; $j++){
   if ($vetor[$i]  $vetor[$j]){
   $aux = $vetor[$i];
   $vetor[$i] = $vetor[$j];
   $vetor[$j] = $aux;
   }
   }
  }
  
  Forget the trocou bit.
  
so why when I print the array (with a for(;;) or with print_r) it
still
shows me it's not ordered... I printed it INSIDE the function...
what's
  the
thing here? I'm I nuts?
  
  --
  WARNING [EMAIL PROTECTED] address is an endangered species -- Use
  [EMAIL PROTECTED]
  Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
  Volunteer a little time: http://chatmusic.com/volunteer.htm


p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] help with some nasty recursive algorithm

2001-09-15 Thread Christian Dechery

I need some help with an algorithm that I'm writing to build a categories 
array, based on the mysql table.

the table goes by:
id_category, name_category, parent_category

and with a simple query, with a group by and after doing a little for(;;) 
processing, I get the following array..

categ   | parent| num_childs
null   1   1
null   4   0
1  5   2
5  6   0
5  7   0

well... I have a function called CatName($id) that returns me the name of 
that giving its ID... so, I want from that array build a new array like this:

[0][id] = 1
[0][name] = Electronics
[1][id] = 5
[1][name] = Electronics/Palm
[2][id] = 6
[2][name] = Electronis/Palm/WindowsCE
[3][id] = 7
[3][name] = Electronis/Palm/PalmOS
[3][id] = 4
[3][name] = Food

preety nasty hun? I know its something recursive... but I can't figure out 
how to walk trough the array to get this kind of output...

any help will be welcome..

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] sorting multi-dimensional arrays

2001-09-15 Thread Christian Dechery

I'm having a little trouble sorting mult-dimensional arrays by key...

I looked-up the manual and found out that array_multisort() thing... but I 
don't think it does what I want... or I don't understand it...

I have an array like this...

$categories=array();
$categories[0][id]=1;
$categories[0][name]=Xyz;
$categories[0][id]=7;
$categories[0][name]=Lala;
$categories[0][id]=2;
$categories[0][name]=Lele;

I want it sorted by name... the way I'm doing it  right now is by using 
an auxiliar array that gets all the names, sorts them, and then build a new 
array based on that...

is a better way?

p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


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

2001-09-15 Thread Christian Dechery

I just got (1:30 AM) something that was really annoying me.

I had to do it... but I got so into the I must do it thing I ended up 
doing it in an unoptimized way, I think.
I got to this conclusion for the amount of loops I'm using and the number 
of lines of code.

The problem is in my previous mail help with  nasty recursive algorithm...

I'm using 5 for(;;) loops, and it took 68 lines of code (including 3 small 
functions) to achieve it... it's kinda of too much, don't you think???

p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] Re: is PHP crazy, or am I?

2001-09-14 Thread Christian Dechery

I must have deleted the line by accident...

$trocou=true; is right below $vetor[$j+1]=$aux;

would that make sense?

I'm not worried about the optimization here... I want to get time results 
for bubblesort... and then I'm going to heap, quick, and others... It's 
some college homework for my girlfriend...


At 00:07 14/09/01 -0500, you wrote:
function bubblesort($vetor,$tam)
{
 $trocou=true;
 $i=$j=0;

 while($trocou)
 {
 $trocou=false;

# You set $trocou to false here, and never reset it to true
# This loop will execute exactly once.

 for($j=0; $j$tam-$i; $j++)
 {
 if($vetor[$j]  $vetor[$j+1])
 {
 $aux=$vetor[$j];
 $vetor[$j]=$vetor[$j+1];
 $vetor[$j+1]=$aux;
 }
 $i++;
 }
 }
}

  it's right right?

No.

As near as I can figure, you are incrementing $j and decrementing $i on
every iteration.
That would mean that even if you fixed $trocou your sort algorithm would be
O(n)
(Actually it's exactly 1/2 n, but that's the same as O(n) for sufficiently
large n.)

Alas, that can't be correct (we wish) and is not the standard bubble sort...

Try this for the body:
for ($i = 0; $i  $tam -1; $i++){
 for ($j = $i + 1; $j  $tam -1; $j++){
 if ($vetor[$i]  $vetor[$j]){
 $aux = $vetor[$i];
 $vetor[$i] = $vetor[$j];
 $vetor[$j] = $aux;
 }
 }
}

Forget the trocou bit.

  so why when I print the array (with a for(;;) or with print_r) it still
  shows me it's not ordered... I printed it INSIDE the function... what's
the
  thing here? I'm I nuts?

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm


-- 
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] PHP core error in mail()

2001-09-13 Thread Christian Dechery

I wrote a PHP script to send a lot of emails, some of them with lots of 
bytes that comes from a URL-fopen()'ed ASP page...
the script works fine... but when a large (I don't mean huge... just some 
50k worth of HTML data) email is going to be sent, PHP crashes with an 
error like this error in emalloc() couldn't alloc -274843 bytes or something.

So I installed the SAPI version instead... and the error persisted only 
changing the error message to something like segment fault in PHP and 
crashed again.

Details:
I'm running Win2k Server and I made this tests both in IIS 5 and Apache 
1.3.19. (when in Apache, the error messages didn't even show and the HTTP 
connection was lost - which in my opinion is far worse to debug)

So I wrote a mail function that talks directly to my SMTP server and now 
it's working...

Well... just to report something that might be a bug or something.


-- 
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] is PHP crazy, or am I?

2001-09-13 Thread Christian Dechery

whats wrong with the code below?

function bubblesort($vetor,$tam)
{
$trocou=true;
$i=$j=0;

while($trocou)
{
$trocou=false;
for($j=0; $j$tam-$i; $j++)
{
if($vetor[$j]  $vetor[$j+1])
{
$aux=$vetor[$j];
$vetor[$j]=$vetor[$j+1];
$vetor[$j+1]=$aux;
}
$i++;
}
}
}

it's right right?
so why when I print the array (with a for(;;) or with print_r) it still 
shows me it's not ordered... I printed it INSIDE the function... what's the 
thing here? I'm I nuts?

p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] foo? bar? wtf?

2001-08-29 Thread Christian Dechery

At 20:11 29/8/2001 +0100, you wrote:
Why is it that every example uses foo and bar.  In my head I put these
together to get FUBAR, the meaning of which I won't spell out for Kyle's
benefit.

Is this what foo and bar refer to?  And WHY are they used so extensively?

they don't mean anything... but I think they refer to FUBAR.

Do you know what FUBAR is right?

F*CKED UP BEYOND ALL RECOGNITION.

heheh :)

p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] PHP mysql admin?

2001-08-27 Thread Christian Dechery

phpMyAdmin is very nice...
but not even close to Mysqlfront... try it out...

http://www.mysqlfront.de/


At 10:38 27/8/2001 -0500, Joseph Bannon wrote:
Thanks. I'll give it a try.

Joseph


-Original Message-
Try phpMyAdmin

http://phpwizard.net/


- Original Message -

  Are there any free PHP mysql database admin programs out there?


p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



Re: [PHP] Certification

2001-08-27 Thread Christian Dechery

The real reason I was looking for some kind of certification, is the course 
I'm trying to start.

Here in Rio de Janeiro, there are ZERO PHP Training Courses (in all Brazil 
I don't think there are more than three), and I think Certification is the 
reason.
All other courses has a certification or at least a diploma from a 
'Macromedia Certified' or 'Microsoft Oficial Partner' establishment.

It wouldn't be so bad to have 'PHP Endorsing Site', 'PHP Certified 
Professional' and so on... don't you think?

At 11:51 27/8/2001 -0400, Michael Kimsal wrote:
I know it's not specifically what you're looking for, but it may help
further the discussion.

We offer PHP training courses.  While it's not 'certification' in the sense
that we're not a 'well-known, respected' authority, we provide a hands-on
environment where you learn a series of skills - from hello world thru
connecting to a database, add/edit/delete info from a db, and a bit
more (user authentication techniques, etc).  While we're not accredited in
anyway, it has been helpful to many of our students who need the
helping hand and/or something more than a book/magazine.

We'd love to work with others in the PHP community to help develop
a set of certification standards, though there doesn't seem to be a big
outcry for it right now from the community.


Christian Dechery wrote:

I know this is a recurrent question around here... but it's always nice 
to ask:

Is there (or is it in process of...) any kind of certification for PHP.

I live in Brazil and have been developing with PHP+Mysql for over a year, 
but there are no courses around here... none. And in part, it's because 
there is no certification, or proof of any kind from a respected or 
well-known organization.


---
michael kimsal
http://www.tapinternet.com/php/
php training courses
734-480-9961



p.s: meu novo email é [EMAIL PROTECTED]

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


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

2001-08-26 Thread Christian Dechery

I know this is a recurrent question around here... but it's always nice to ask:

Is there (or is it in process of...) any kind of certification for PHP.

I live in Brazil and have been developing with PHP+Mysql for over a year, 
but there are no courses around here... none. And in part, it's because 
there is no certification, or proof of any kind from a respected or 
well-known organization.

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



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

2001-08-26 Thread Christian Dechery

I am the employer... :)

I don't think Brainbench is exactly what I was looking for... but thanks 
anyway.

BTW... has anyone taken the Brainbench test?
Is it difficult?

If I were to use it... like, I give a PHP course, and add to the cost the 
US$ 20. How many hours of PHP do u think it would take the users to get 
certified?

At 18:00 26/8/2001 -0400, Chris Lambert wrote:
Brainbench offers a PHP certification:
http://www.brainbench.com/xml/bb/common/testcenter/subcatresults.xml?cat1=9;
cat2=31cat3=22

However, I'd contact employers in Brazil and see what their recommendations
are in terms of degrees or certifications.

/* Chris Lambert, CTO - [EMAIL PROTECTED]
WhiteCrown Networks - More Than White Hats
Web Application Security - www.whitecrown.net
*/

- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, August 26, 2001 4:53 PM
Subject: [PHP] Certification


| I know this is a recurrent question around here... but it's always nice to
ask:
|
| Is there (or is it in process of...) any kind of certification for PHP.
|
| I live in Brazil and have been developing with PHP+Mysql for over a year,
| but there are no courses around here... none. And in part, it's because
| there is no certification, or proof of any kind from a respected or
| well-known organization.
| 
| . Christian Dechery (lemming)
| . http://www.tanamesa.com.br
| . Gaita-L Owner / Web Developer
|
|
|
| --
| 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]
|
|
|


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



-- 
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] AudioGalaxy-like stuff

2001-08-25 Thread Christian Dechery

yeah... but other then returning the image, can it do stuff with DB and all?

BTW.. I saw how it's done... it's Javascript all the way... and there's no 
call to a php script to switch the image...

At 03:35 23/8/2001 +0100, you wrote:
See this is the lack of my explaining powers :)

U click the image, and JScript loads a new image named (image.php) this is
infact a php script which returns a image...
So it like doing
img src=myscript.php
where myscript.php will do some GD or something and return a image.

That make sense?

Bramp
- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: Andrew Brampton [EMAIL PROTECTED]
Sent: Wednesday, August 22, 2001 12:57 PM
Subject: Re: [PHP] AudioGalaxy-like stuff


  At 04:22 22/8/2001 +0100, you wrote:
  When you click on the image it reloads the image which is really a PHP
page
  which returns a image.
  
  That way when it loads the image, it can actually run some PHP and do
  whatever is required, once done it returns the approiate image
  
  That make sense?
 
 
  well, it could, if PHP was client-side... but it isn't... how is it gonna
  call a PHP function to return something without having to call a PHP
script
  to do that? Even if it is on the same script the page would still have to
  be reloaded... right?
  Or wrong? Can u give me some dumb example?
 
  
  . Christian Dechery (lemming)
  . http://www.tanamesa.com.br
  . Gaita-L Owner / Web Developer
 
 
 


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



-- 
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] AudioGalaxy-like stuff

2001-08-21 Thread Christian Dechery

Is there anyone here familiar with Audiogalaxy's site? It's all in PHP, and 
there is something there which is really something...

when you're searching for songs, there's an icon that when u click, it adds 
the song to the queue. But the page remains... the file is added to the 
queue without leaving your current page... and the icon changes color (this 
is easy with Js, but that's not the point)..

Does anyone know how they did that?

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



-- 
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] md5(), uniqid(), rand(), password()

2001-08-21 Thread Christian Dechery

Is mysql's PASSWORD() function secure for storing passwords?

Or should I use one of PHP's md5() or uniqid(), or even md5(uniqid()) ???

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



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

2001-08-14 Thread Christian Dechery

I have pages that uses session for security that looks something like this:

?php
session_start();

if( !isset($uid) )
{
include(include/auth.inc.php);
auth_user();
}

more code...
?

so $uid tells me if the user is logged on or not...

but what if somebody calls the script directly from the address bar like 
this: http://server/script.php?uid=10

wouldn't this be a security problem?

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] Re: session security issue

2001-08-14 Thread Christian Dechery

I guess it is... but read the replys to my email, the solution is quite 
simple and effective.

At 16:49 14/8/2001 +0100, you wrote:
what about registering a var called loggedin with the session and then
testing on each script to see if it's set to 1 or something ?

then base the access on that ? that's what i use and then register uid with
the session as well so you can use it througout your site ...

ok you've got me worried now, are there any problems with security doing it
that way 

Steve

Christian Dechery [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I have pages that uses session for security that looks something like
this:
 
  ?php
  session_start();
 
  if( !isset($uid) )
  {
  include(include/auth.inc.php);
  auth_user();
  }
 
  more code...
  ?
 
  so $uid tells me if the user is logged on or not...
 
  but what if somebody calls the script directly from the address bar like
  this: http://server/script.php?uid=10
 
  wouldn't this be a security problem?
  
   Christian Dechery (lemming)
   http://www.tanamesa.com.br
   Gaita-L Owner / Web Developer
 



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

____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] javascript reference (slightly ot)

2001-08-14 Thread Christian Dechery

Sorry for the OT but, but I'm struggling to get my forms to have a good 
validation in JavaScript.

Does anyone know a complete reference to JavaScript, like, with all 
objects, it's functions, parameters and etc...

that would help a lot..

Thanks...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] NuSphere.. what is it???

2001-07-29 Thread Christian Dechery

What's the deal with that NuShere stuff... I visited their website and 
download a Free version (40MB)...
I just don't get what are they asking 200, 400, 500 and even 5.000 dollars for.

It's just a combo of PHP, MySQL and Apache pre-configured, some samples and 
some tools... but other than that... I can't see why it's so expensive... 
it's all opensource... it's all free... they have phpMyAdmin as the MySQL 
client...

what are we paying for here?

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] highlighting keywords problem

2001-07-23 Thread Christian Dechery

I want to highlight some keywords in a text without losing its case.

How do I do that? I have something like the following:

$keyword=something here;

ob_start(highlight_keyword);
?
pfont face=tahoma size=2just some textbr
to get it to grab the text and highlight itbr

the keyword is right now... check it outbr
Something Here, see? it's with a different case.../font/p
?
ob_end_flush();

function highlight_keyword($buffer)
{
global $keyword;

return eregi_replace($keyword,b.$keyword./b,$buffer);
}

the problem is that it's going to give me ...bsomething here/b, see? 
it's with a different case..., with a lowercased keyword... I want to 
preserve the case of the found text... any ideas

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] weird behaviour with (Z = Z)

2001-07-10 Thread Christian Dechery

Yeah... I solved it using ord() in the for clause and chr() in the 
output... it worked just fine...
thanks anyway...

At 11:57 10/7/2001 -0400, Jack Dempsey wrote:
Perhaps not a great answer, but this issue has been brought up before,
and it has to do with the incrementing of a string...search the
archives...i think someone had a simple workaround using chr() to get
what you want...

jack

-Original Message-
From: Christian Dechery [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 11:45 AM
To: [EMAIL PROTECTED]
Subject: [PHP] weird behaviour with (Z = Z)

Z = Z is true right??

then why this weird thing happens when I have this code:

for($letter=A; $letter=Z ; $letter+)
   echo  $letter;

it should output  A B C D E . W X Y Z right?

but it outputs  A B C D E ... W X Y Z AA AB ... YW YX YY YZ.

why?



. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



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


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] weird behaviour with (Z = Z)

2001-07-10 Thread Christian Dechery

well... I think u may be wrong if Z is a string and there's nothing 
bigger or lower than it what is the result of strcmp(Z,a)???

I guarantee you it will not be 0...

At 01:09 11/7/2001 +0900, Maxim Maletsky wrote:
what???

are you sure it does that to you?
You sound so confident that it confuses my knowledge that for loop should be
counting integers, not strings (Z is a string and there's nothing bigger
or lower it)

-maxim maletsky




-Original Message-
From: Christian Dechery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 12:45 AM
To: [EMAIL PROTECTED]
Subject: [PHP] weird behaviour with (Z = Z)


Z = Z is true right??

then why this weird thing happens when I have this code:

for($letter=A; $letter=Z ; $letter+)
   echo  $letter;

it should output  A B C D E . W X Y Z right?

but it outputs  A B C D E ... W X Y Z AA AB ... YW YX YY YZ.

why?



. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



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


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] weird behaviour with (Z = Z)

2001-07-10 Thread Christian Dechery

that is exactly what I did... it worked perfectly...

At 01:40 11/7/2001 +0900, Maxim Maletsky wrote:

I would rather go for the following solution:


 for($i=ord('A'); $i=ord('Z'); $i++)
 echo chr($i).' ';

I know it's same and even slower as it takes two more functions to execute,
but at least it is visually closer to what Christian was trying to do.




Sincerely,

  Maxim Maletsky
  Founder, Chief Developer

  PHPBeginner.com (Where PHP Begins)
  [EMAIL PROTECTED]
  www.phpbeginner.com





-Original Message-
From: Jack Dempsey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 1:13 AM
To: 'Maxim Maletsky'; [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] weird behaviour with (Z = Z)


Try this:
?
for($i=65;$i=90;$i++){
 $str .= chr($i) .  ;
}
echo $str;
?

jack

-Original Message-
From: Maxim Maletsky [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 12:10 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [PHP] weird behaviour with (Z = Z)

what???

are you sure it does that to you?
You sound so confident that it confuses my knowledge that for loop
should be
counting integers, not strings (Z is a string and there's nothing
bigger
or lower it)

-maxim maletsky




-Original Message-
From: Christian Dechery [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 11, 2001 12:45 AM
To: [EMAIL PROTECTED]
Subject: [PHP] weird behaviour with (Z = Z)


Z = Z is true right??

then why this weird thing happens when I have this code:

for($letter=A; $letter=Z ; $letter+)
   echo  $letter;

it should output  A B C D E . W X Y Z right?

but it outputs  A B C D E ... W X Y Z AA AB ... YW YX YY YZ.

why?



. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



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


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] datetime on MSSQL doesn't work with PHP

2001-07-08 Thread Christian Dechery

why does PHP converts the 'datetime' and 'smalldatetime' types of MSSQL to 
a 'prettier' output?

in the table I have '2001-07-01 12:45:01' but when I run a query in PHP to 
get it I recieve 'Jul 7 2001 12:45AM'.
I didn't ask for that... I want the exact value in the field with seconds 
and all, not a converted value. How can I prevent this?

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] mssql returnin type date all wrong

2001-07-04 Thread Christian Dechery

In a script I have a query that gets the time of a desired track. It is
in SQL Server table with the smalldatetime type, whihc returns me something
that looks like '2001-07-04 12:04:12', but PHP is giving me 'Jul 04 2001
12:04AM'.

Why does this happen?

I want the seconds, where are they???


. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
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 in getting results from mysql

2001-07-03 Thread Christian Dechery

well... I tought of that.
It doesn't work for many reasons:
1 - '*' always has to be the first on the select list
2 - you can't have expressions (max, min, avg) without a group by clause
if you are handling multiple rows
3 - etc. etc.. etc...

that's why I included the code in between the queries...

Try

$rs1=mysql_query(select max(date) AS latest, * from tablename where
item_id=34 and item_type_id=3);

but consider that you may possibly have multiple entries for the latest

date?




. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
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 in getting results from mysql

2001-07-03 Thread Christian Dechery

At 12:07 4/7/2001 +0930, David Robley wrote:
On Wed,  4 Jul 2001 00:00, Christian Dechery wrote:
  well... I tought of that.
  It doesn't work for many reasons:
  1 - '*' always has to be the first on the select list
  2 - you can't have expressions (max, min, avg) without a group by
  clause if you are handling multiple rows
  3 - etc. etc.. etc...
 
  that's why I included the code in between the queries...
 
  Try
  
  $rs1=mysql_query(select max(date) AS latest, * from tablename where
  item_id=34 and item_type_id=3);
  
  but consider that you may possibly have multiple entries for the
   latest
  
  date?

Of course, had forgotten that. I think maybe you want UNION.

not really... the function I need is sub-selects. Union wouldn't help 
here... and still, mysql does not support UNION. I want something like this:

select qty,value
from tablename
where exists (select max(date) from tablename where item_id=34 and 
item_type_id=3)
and item_id=34 and item_type_id=3

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] help in getting results from mysql

2001-07-02 Thread Christian Dechery

I have to get some results from a mysql table, and I'm pretty sure that I'm 
not doing it the best way.

its like this... I have a table (a historical one) with these fields:
date | item_id | item_type_id | qty | value

and there are multiple lines for the pair item/type (as I said it's a 
historical table). I want the row with the last date.
So if I had:

2001-29-6 | 34 | 3 | 5 | 15.0
2001-30-6 | 34 | 3 | 7 | 13.0
2001-1-7 | 34 | 3 | 9 | 12.0
2001-2-7 | 34 | 3 | 1 | 3.5

I only want the last one '2001-2-7'. But I can't think of a way of doing 
this without sub-select. So I did this:

pre
$rs1=mysql_query(select max(date) from tablename where item_id=34 and 
item_type_id=3);
$last_date=mysql_result($rs1,0,0);

$rs2=mysql_query(select qty,value from tablename where date='$last_date');
list($qty,$value) = mysql_fetch_row($rs2);
/pre

it works fine... but I don't think it is good... whenever there is 'code' 
between queries to get results I think something could be optimized.
Any ideas?

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] $REMOTE_ADDR error

2001-06-27 Thread Christian Dechery

why do $REMOTE_ADDR always returns 127.0.0.1 no matter the user's IP who is 
seeing the page?

this doesn't look 'remote' to me...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] file uploads in Win9x, anyone? please?

2001-06-23 Thread Christian Dechery

Has anyone successfully set up a script to upload a file with PHP running 
Apache in Win9x (in my case 98Me)?

I tried everything... the script is correct, I checked out a lot of 
examples... is there any config in Apache or in PHP I'm missing???

I really need this...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] upload on Win9x

2001-06-19 Thread Christian Dechery

I can't get file uploads to work on my Windows 98Me running Apache+PHP4.05...

I did everything correctly according to the script I found on phpbuilder...

it simply won't go... the error message is something like can't open 
c:\file.ext for reading... it's like it thinks it's a local file... this 
is the code...
pre
$upload_dir=c:\\apache\\htdocs\\mydir\\;
$upload_tmp_path=ini_get(upload_tmp_dir); // this returns the correct 
path BTW

$file=stripslashes($file);
$newfile=$upload_dir.file.tmp; // just for debugging, but it still 
doesn't work...

chdir($upload_tmp_path);
if(!copy($file,$newfile))
echo pfont face=tahoma size=2bError uploading 
$newfile./b/font/p;
else
process_file($newfile);
/pre

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer




Re: [PHP] upload on Win9x

2001-06-19 Thread Christian Dechery

yes... it goes like form enctype=multipart/form-data method=post.

this is correct right?

At 17:17 19/6/2001 +0930, Andrew Halliday wrote:
Have you set the content type of the form to be multipart MIME ?  That
screws me every time...

AndrewH

- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, June 19, 2001 11:16 AM
Subject: [PHP] upload on Win9x


  I can't get file uploads to work on my Windows 98Me running
Apache+PHP4.05...
 
  I did everything correctly according to the script I found on
phpbuilder...
 
  it simply won't go... the error message is something like can't open
  c:\file.ext for reading... it's like it thinks it's a local file... this
  is the code...
  pre
  $upload_dir=c:\\apache\\htdocs\\mydir\\;
  $upload_tmp_path=ini_get(upload_tmp_dir); // this returns the correct
  path BTW
 
  $file=stripslashes($file);
  $newfile=$upload_dir.file.tmp; // just for debugging, but it still
  doesn't work...
 
  chdir($upload_tmp_path);
  if(!copy($file,$newfile))
  echo pfont face=tahoma size=2bError uploading
  $newfile./b/font/p;
  else
  process_file($newfile);
  /pre
  
  . Christian Dechery (lemming)
  . http://www.tanamesa.com.br
  . Gaita-L Owner / Web Developer
 


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer




[PHP] a little ot, mysql binary fields

2001-05-24 Thread Christian Dechery

How do I backup a blob field in mysql? Every time I dump it (to a text file 
via phpMyAdmin)... it creates insert lines but the binary data is all 
screwed up and when I load it it gives me error messages... 


-- 
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] include and include-virtual

2001-05-23 Thread Christian Dechery

What is the main difference between:
!--#include ...
!--#include virtual ...
!--#exec cgi...

the only one that seems to work for PHP files is 'include virtual'.
'exec cgi' as well as 'include' gives me that message 'an error ocurred 
while processing this directive'...


-- 
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] include and include-virtual

2001-05-23 Thread Christian Dechery

At 22:23 23/5/2001 +0100, James, Yz wrote:
Christian,

Those are SSI calls (Server Side Includes, for use with .shtml files).

I know what they are... I wanna know what's the difference between them


Try:

include(/path/to/filename);
require(/path/to/filename);

no... I want SSI calls cause this is to be changed in a pure html (with 
html extension) file...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] Getting email out of a database

2001-05-19 Thread Christian Dechery

how about grabbing the first result out of the 'while'??? something like:

list($var1) = mysql_fetch_row($result);
while( list($email) = mysql_fetch_row($result) )
 $var2[] = $email;

hope this helps...

At 11:04 19/5/2001 -0700, Richard Kurth wrote:

   I am trying to pull all the e-mail address out of a database to be
   able to do a mass send.
   This gets me all the e-mail address and puts a , between them which is what
   I want.

$sql = SELECT CONCAT(email) AS str_email FROM customers;
 $result = mysql_query($sql);
  $recip = array();
 while ($myrow = mysql_fetch_array($result))
 $recip[] = $myrow[str_email];
 $recipient_list = implode(, ,$recip);

   I t gives me this list which is what I wanted
[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]

  But now I would like to get the first address in the list into a
  variable and the rest in the list to a second variable Like
  this
 $v1=  [EMAIL PROTECTED]
 $v2=  [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED]

 How would I go about this



Best regards,
  Richard
mailto:[EMAIL PROTECTED]


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


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] converting int to char

2001-05-19 Thread Christian Dechery

how do I convert and integer value to its ASCII correspondent?

in C I would go something like:

int i = 90;
char c;

c = i + '0'; // now c would be 'Z'

in PHP I'm simply clueless since there's no (char) type...

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] sessions / cookies / header(Location...

2001-05-17 Thread Christian Dechery

I have a page that does a login... right after the login is successfull it 
registers a session var called 'userid'... and does a header(Location: 
newpage.php) which checks for the existance of this var... if it exists it 
will show, otherwise it goes back to the login page...

the weird thing is... it always worked fine, even if I logged in and out 
with three different users to test it... but now it only works if I replace 
the header() thing with:
header(Location: newpage.php?PHPSESSID=$PHPSESSID)

why is this weird now? it use to work...
and the weird thing is... while in newpage.php the user does some stuff 
which calls itself and also gets this 'userid' var... and gets it fine 
without any PHPSESSID stuff...

any clues?


-- 
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] sessions / cookies / header(Location...

2001-05-17 Thread Christian Dechery

it does not have anything to do with my browser... that's for sure...
I'm using MSIE 5.5, and never had any trouble... and as I said on the 
email... it used to work fine... it just stopped working...

and now yet some fresh info... it's working again now... I've tried...
one thing I noticed, that when I was testing and it was not working f2s.com 
was relly slow... sluggish really... then 1 hour later got faster... I 
tested it and it worked...

so... does speed has anything to do with it? Maybe they were doing some 
maintenance or whatever...



At 14:35 17/5/2001 -0500, Chris Lee wrote:
yup, your browser is not accepting cookies. thats a good guess. when a 
browser does not accept cookies, trans-sid will kick in, trans-sid will 
not work on full urls, just reletive urls.

no trans-sid
http://www.mediawaveonline.com/index.php

trans-sid
/index.php

header redirectect require (supposed to require) full urls. in other words 
its a good idea to put PHPSESSID=$PHPSESSID on all your full urls anyhow, 
just incase for non-cookie browsers.

--

  Chris Lee
  [EMAIL PROTECTED]



Christian Dechery [EMAIL PROTECTED] wrote in message 
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
I have a page that does a login... right after the login is successfull it
registers a session var called 'userid'... and does a header(Location:
newpage.php) which checks for the existance of this var... if it exists it
will show, otherwise it goes back to the login page...

the weird thing is... it always worked fine, even if I logged in and out
with three different users to test it... but now it only works if I replace
the header() thing with:
header(Location: newpage.php?PHPSESSID=$PHPSESSID)

why is this weird now? it use to work...
and the weird thing is... while in newpage.php the user does some stuff
which calls itself and also gets this 'userid' var... and gets it fine
without any PHPSESSID stuff...

any clues?


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

____
. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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 some ideas here...

2001-05-16 Thread Christian Dechery

At 09:27 16/5/2001 +0100, James Holloway wrote:
Hi Christian,

I have an account with f2s.com that I use for sampling scripts with - I set
up a mailform yesterday after reading this, using mail() to send the email
to myself.  It got here - albeit 6am today (I sent it yesterday
lunchtime)  Perhaps you're using the mail() function incorrectly?

Well.. maybe something is wrong with my account or something cuz I'm using 
it fine... I've tried 3 different ways to send mail that works everywhere 
else I just put up this little script to send a sample mail...

$to=[EMAIL PROTECTED];
$from=MySelf [EMAIL PROTECTED];
$subject=just testing;
$body=h1Hello! Just testing here/h1;
$headers=Content-type: text/html\nFrom: .$from;

$rs=mail($to,$subject,$body,$headers);
$result=($rs)?successfull.:failed.;
echo Mail to .$to.: .$result;

guess what was the output? Mail to [EMAIL PROTECTED]: failed.

what's wrong with the script above?


-- 
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] sending mail alternatives...

2001-05-16 Thread Christian Dechery

I have an account at f2s.com and it seems to me that is IMPOSSIBLE to send 
mail... I've got answers from other users there that got it working... I 
don't know how

below are listed all the things I've tried to do:

1 - use mail() function (even tested with the most basic 
mail(myemail,test,test), and it returned false)
2 - use my alternate smail() function that calls 'sendmail' (it actually 
works until the popen(), then it stops...)
2 - placed a sendmail.php script in another site I have that can send 
emails... this sendmail.php receives querystring parameters to send the 
email... so I do an 
fopen(http://thisothersite.com/sendmail.php?to=emailfrom=lalal... etc...) 
and it works fine... I've tested it from a lot of sites...
the error it displays (after 60 seconds) is 'Bad file descriptor'
4 - built a function that sends mail with fsockopen (which also works, as 
tested) and call it with my local smtp server... for whatever smtp I place 
there it gives me timeout...

so I'm guessing there's a firewall there that blocks any access right?
why? Sending email is really that hazardous?
_
. Christian Dechery - CTO
.. WebDeveloper @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
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 some ideas here...

2001-05-15 Thread Christian Dechery

At 20:32 14/5/2001 -0500, Ben Gollmer wrote:
If you have an account on a remote host, you can always do something like 
this:

?php
 include(http://www.remotehost.com/~myaccount/mailfunction.inc;);

 mymail($to, $mailbody);
?

where mailfunction.inc has the mymail function defined to just take your 
parameters and stuff them into the standard mail().

Of course include()ing from remote hosts can be disabled when compiling 
PHP, and if your host is really evil, the will have disabled this too.

Your last resort is to create your own mail function by fsockopen()ing a 
connection to port 25 of your SMTP server and sending raw SMTP commands. 
This would require some reading of the relevant mail RFCs...but is 
definitely feasible.


I tried using fopen('.') on a script hosted at a domain that belongs to 
me that sends email... trying it here (even calling the script elsewhere on 
the internet 'http://www.mydomain.com') it wordked perfect...
then I tried the fsockopen alternative... it didn't work...

f2s runs in safemode... so in their faq, they tell us that if we won't some 
more advanced scripts... to use the cgi version (script.cgi starting with 
'#!/usr/bin/php'... and so on)... nothing works... they must have a real 
protection against acessing outer files there...


-- 
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 some ideas here...

2001-05-15 Thread Christian Dechery

At 22:40 14/5/2001 -0700, Ethan Schroeder wrote:
I don't know how you can find sendmail on that system if you don't have
telnet access.  Try writing a script that does an exec(which sendmail) and
see if it tells you.  I doubt it will, though.  Otherwise try different
sendmail locations: /usr/sbin/sendmail, /usr/lib/sendmail, etc.  The
.htacess file overwrites the value of the php.ini file, so you can specify
to php where sendmail is for any script that is under the directory your
.htaccess file resides in (unless they don't allow .htaccess).  I've had to
use this approach a couple times to get php to send mail off properly.


actually I discovered with ini_get()... I'll try now with popen() and stuff 
again... may it'll work... this is my last hope... I tried calling a script 
in another domain, I tried fsockopen... nothing seems to work...

this is my last attempt...


-- 
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] need some ideas here...

2001-05-14 Thread Christian Dechery

My free-web-hosting (www.f2s.com) does not allow PHP to send emails... I've 
tried everything... the mail() function, my alternate function which calls 
popen(/usr/lib/sendmail -t) and even a script.cgi with '#!/usr/bin/php' 
and all that stuff...

the mail simply won't go an mail() always returns false...
I'm guessing there's no mail sending in this server...

so what do I do?

is it possible for me to call a script on another host from with a script 
and return something to it?

like
?php
code ... code ... code...;
code ... code ... code...;

here I'd have some code to call a script in another host that can send 
mails, of course with the necessary parms...;

code code code;
code code code;
?

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] need better solution...

2001-05-14 Thread Christian Dechery

In most of my scripts there are always headers and footers to html outputs...
like logos, images, and on the bottom some links and stuff like that... 
that should always apear...

the most basic is:

html
... header here ...
?php
lots of code
?
... footer here ...
/html

but sometimes I want something like this:
?php
 session_start(); // for instance
 code code code
 if(something)
 print error message and terminate script;
?
html
sadasdsa
/html

what do I do in this case??? I've tried all kinds of programing 
techniques... but none of them seems to fit here.


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer



Re: [PHP] need better solution...

2001-05-14 Thread Christian Dechery

At 10:35 15/5/2001 +0930, David Robley wrote:
On Tue, 15 May 2001 09:40, Christian Dechery wrote:
  In most of my scripts there are always headers and footers to html
  outputs... like logos, images, and on the bottom some links and stuff
  like that... that should always apear...
 
  the most basic is:
 
  html
  ... header here ...
  ?php
  lots of code
  ?
  ... footer here ...
  /html
 
  but sometimes I want something like this:
  ?php
   session_start(); // for instance
   code code code
   if(something)
   print error message and terminate script;
  ?
  html
  sadasdsa
  /html
 
  what do I do in this case??? I've tried all kinds of programing
  techniques... but none of them seems to fit here.

exit or die are probably the tools you want.

yeah... that's what I use... but then the footer isn't going to be displayed...


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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 better solution...

2001-05-14 Thread Christian Dechery

At 11:02 15/5/2001 +1000, Jason Brooke wrote:
  but sometimes I want something like this:
  ?php
   session_start(); // for instance
   code code code
   if(something)
   print error message and terminate script;
  ?
  html
  sadasdsa
  /html
 
  what do I do in this case??? I've tried all kinds of programing
  techniques... but none of them seems to fit here.

I don't understand why you're asking what to do in that case - what exactly is
the problem there?


the problem is, if I terminate the script on that condition the footer 
won't be displayed...


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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 some ideas here...

2001-05-14 Thread Christian Dechery

what??? I didn't understand... how will I find out where sendmail is in a 
free-web-host? I don't have telnet access... how can I figure that out? and 
how a .htaccess file would help me here?

At 19:50 14/5/2001 -0500, Ethan Schroeder wrote:
Find where there sendmail is and put this in an .htaccess file: php_value
sendmail_path  '/path/to/sendmail -t'

Ethan Schroeder

- Original Message -
From: Christian Dechery [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, May 14, 2001 7:04 PM
Subject: [PHP] need some ideas here...


  My free-web-hosting (www.f2s.com) does not allow PHP to send emails...
I've
  tried everything... the mail() function, my alternate function which calls
  popen(/usr/lib/sendmail -t) and even a script.cgi with '#!/usr/bin/php'
  and all that stuff...
 
  the mail simply won't go an mail() always returns false...
  I'm guessing there's no mail sending in this server...
 
  so what do I do?
 
  is it possible for me to call a script on another host from with a script
  and return something to it?
 
  like
  ?php
  code ... code ... code...;
  code ... code ... code...;
 
  here I'd have some code to call a script in another host that can send
  mails, of course with the necessary parms...;
 
  code code code;
  code code code;
  ?
  
  . Christian Dechery (lemming)
  . http://www.tanamesa.com.br
  . Gaita-L Owner / Web Developer
 
 
  --
  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]
 


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] mysql: UPDATE statment

2001-05-11 Thread Christian Dechery

At 21:40 10/5/2001 -0400, [EMAIL PROTECTED] wrote:
why isnt this working

i need to get 5 values updated in a table called 'user_polls'

how do I do this?
i have

UPDATE user_polls WHERE id = '$id' VALUES($1, $2. and so on


your statement is incorrect... the correct UPDATE syntax is:

UPDATE user_polls set field='value', field2='value2', field3=value3 where 
id=$id;

hope it helps...


. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] fopen() and persmissions

2001-05-10 Thread Christian Dechery

as I've seen PHP running as Apache module cannot create or update files...

it gives me 'permission denied'...

so I've tried these solutions:

* fopen(ftp://user:[EMAIL PROTECTED]/directory/newfile.ext,w;);
this actually works... but only for w... if I wanna update this file, 
like a, it can't be done as it says the file already exists... so I'd 
have to read it entirely, add the new data and write it back... (not so 
good)

* chmod 777 in the dir I am... so 'nobody' (apache user) can write to it... 
but what happens is that, the file isn't mine... it belongs to nobody... so 
I have no rights to it in FTP or telnet...

is there a better solution then either of these two???

. Christian Dechery (lemming)
. http://www.tanamesa.com.br
. Gaita-L Owner / Web Developer


-- 
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] download successfull... but in binary... why?

2001-05-09 Thread Christian Dechery

I got my script to successfully force the otuput to be redirected to a download
of a new file.

using:

if(stristr($HTTP_USER_AGENT,MSIE))
$att=;
else
$att= attachment;;
header(Content-type: application/download);
header(Content-disposition:.$att. filename=.$filename);

but the problem is, the output is comming as binary... so the '\n' is not
working, instead it'comming as a one giant line with lots of weird chars
instead of '\n'... how do I force it to be in ASCII mode?

and where can I find reference on these header stuff?





. [ Christian Dechery  ]
. Webdeveloper @ Tá Na Mesa!
. Listmaster @ Gaita-L
. http://www.tanamesa.com.br



--
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] download successfull... but in binary... why?

2001-05-09 Thread Christian Dechery

At 08:39 9/5/2001 -0500, Boget, Chris wrote:
  header(Content-type: application/download);

I think you'd need to change this to:

header(Content-type: text/plain);

but I could be wrong...

  and where can I find reference on these header stuff?

Not sure.  I find bits and pieces in this list...

tried it... doesn't work.

if I change to 'text/plain' the download doesn't occur... it shows the 
output on screen...


-- 
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] download successfull... but in binary... why?

2001-05-09 Thread Christian Dechery

At 07:45 9/5/2001 -0700, you wrote:
You decided it was using binary because \n was not being converted to \r\n?

Aren't you just struggling with the difference between unix and windows
files?

Perhaps if you filtered the files replacing \n to \r\n when destination is
windows platform.

thanks man... that actually worked out... now the file is in perfect ascii 
mode just the way I wanted it.

Thanks a lot!


-- 
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] attach file to email

2001-05-09 Thread Christian Dechery

How do I attach a file to an email?

I'd have a mailbody also, with some text... ad I wanna attach a text file 
to it, but I don't want it to be appended in the body... I want it as an 
attachment.
_
. Christian Dechery - CTO
.. WebDeveloper @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
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] Working with numbers

2001-05-09 Thread Christian Dechery

At 11:22 9/5/2001 -0700, Gerry wrote:
Could you suggest a function for displaying decimal zeros.

For example I have this:
$num = 2.00;
$num2 = 3.00;
$result = $num + $num2;
echo $result;

I get 5 but not 5.00

try $result = (float)$num + (float)$num2;


-- 
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] sending attachments via mail(), possible?

2001-05-09 Thread Christian Dechery

Is it possible to send attachments via mail() function?

I tried it, and it didn't work out... the email I receive is all messed up, 
and even the simple text part of it is screwed up. I now very little about 
MIME, but I really need to send an attachment, any help? It's a text 
attachment...

This is the code I'm using:

function send_email($body,$num_pedido,$filename)
{
define(NL,\n);
$boundary=test.chr(rand(65,91))..md5(uniqid(rand()));
$message=Segue em anexo dados referentes ao pedido $num_pedido..NL.NL;
$message=Content-type: text/plain\nContent-transfer-encoding: 
7bit.NL.NL.$message;
$attach=Content-type: text/plain\nContent-transfer-encoding: 
base64\nContent-disposition: attachment; filename=.$filename.NL.NL;
$attach.=base64_encode($body);
$attach.=NL;
$mail_body=$boundary.NL.$message.$boundary.NL.$attach.$boundary.-;
$header=MIME-Version: 1.0\nContent-Type: 
multipart/mixed;\n\tboundary=\.$boundary.\\nContent-Transfer-Encoding: 
7bit;
// echo pre$mail_body/pre;
mail([EMAIL PROTECTED],CDYOU Pedido: 
.$num_pedido,$mail_body,$header);
}

the headers are sent perfectly... and if I echo the $mail_body (I think) 
it's correct, but when I get the mail it's all screwed up...

thanks...
_
. Christian Dechery - CTO
.. WebDeveloper @ Webstyle!
.. http://www.webstyle.com.br
.. http://www.tanamesa.com.br


-- 
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] About MySQl and Transactions

2001-05-09 Thread Christian Dechery

At 20:09 9/5/2001 +0200, Fredrik Rodland wrote:
I don't think MySql does not have support for transactions.  Try using
another DB - like postgres.

yes it does... download Mysql-Max or install BDB in your mysql dist (if you 
are under *ux or *ix)...

Mysql-Max is the newest Mysql dist including BDB (which support transactions)...


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




  1   2   >