[PHP] Running mount from PHP

2008-07-09 Thread Mário Gamito
Hi,

I'm trying to run /bin/mount and /sbin/mount.cifs from a PHP page.

So, I´ve added this to /etc/sudoers:

-
Cmnd_AliasCMD_MOUNT = /bin/mount
Cmnd_AliasCMD_CIFS ) = /sbin/mount.cifs

nobody   ALL = NOPASSWD: CMD_MOUNT
nobody   ALL = NOPASSWD: CMD_CIFS
-

Problem is that I need to run it from PHP and in this way, it doesn't mount.

I'm using PHP's exec function:
exec(sudo mount -t cifs ...)

I have the ownership and permissions of the mount point set correctly.

As it is a dynamic application, the mount point always changes
(/mnt/user1, /mnt/user2, etc.), so, /etc/fstab is not an option :(

Any ideas ?

Warm Regards,
Mário Gamito

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



[PHP] mount

2008-07-09 Thread Mário Gamito
Hi,

I need to perform a mount and a umount from PHP.

I've searched the manual, but didn't find anything useful.

Any ideas ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] PDF inline viewer

2008-06-20 Thread Mário Gamito
Hi,

Does someone knows of a PHP software that is an inline PDF reader ?
You can view the idea here:
http://www.scribd.com/doc/2025925/Clinical-chemistry-II-Biomedical-Science-practical-1

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] Flush file contents

2008-05-15 Thread Mário Gamito

Hi,

How do I open a file and flush all it's contents to insert new ones and 
close again ?


I've browsed through the fopen function aguments and didn't find one 
that do this (or I misunderstood one of them).


Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] JavaScript and PHP

2008-05-14 Thread Mário Gamito

Hi,

I have this HTML/JS page that switches images clicking on the radio 
buttons and call template.php with the image ID as parameter: 
http://portulan-online.net/einstein.html


Now, I need to make it a PHP page, because it is going to receive a 
parameter from the URL that calls it and pass it as is to template.php



So, einstein.php will be called with a parameter (satellite): 
http://portulan-online.net/einstein.php?satellite=123


After that, in einstein.php, I do:

$satellite = $_REQUEST['satellite'];

Next thing, I need the action in the JavaScript to be, for example:
http://portulan-online.net/template.php?id=3&satellite=123

What I don't know is how to mix the "PHP variable" satellite with the 
image ID here:
document.getElementById('image1').src = 
"http://portulan-online.net/einstein-"; + ID + ".png";


I've tried putting einstein.php all inside an "echo", but the radio 
buttons and the submit button stopped working.


Does anyone knows how to do this ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] Problems with mod_vhost_alias and PHP require

2008-05-07 Thread Mário Gamito
Hi,

I have this Apache server with mod_vhost_alias and set /home/pages/%0
as the VirtualDocumentRoot

In /home/pages/gamito.foo.com I have a index.php file. This generates
the http://gamito.foo.com URL.
Also, I have a /home/pages/fckeditor with FCKeditor. *This is not
defined as a subdomain in the DNS*

I need to include in my index.php the file /home/pages/fckeditor/fckeditor.php

I have:

@define('FCKEDITOR_BASE', dirname(__FILE__));
require FCKEDITOR_BASE . '/../fckeditor/fckeditor.php';

But no good, Apache says it can't find the file:

/home/pages/gamito.foo/fckeditor/fckeditor.php

So, there's a "gamito" hanging wrongly in the request.

How can I solve this ?

Any help woud be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] Problem in a generate password function

2008-03-31 Thread Mário Gamito
Hi,

I have the code of a function to generate a random 10 character long
password following my signature.

To test it i do:

$clearpass = create_pass();
print('Clear: ' . $clearpass);
die();

But the output is only "Clear:"

Why isn't it working ?

Any help would be appreciated.

Warm Regards,
Mário Gamito
--
function create_pass ()
{

  $length=10;

  $password = "";

  $possible = "0123456789abcdefghijklmnopqrstuvxz";

  $i = 0;

  while ($i < $length) {
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);

if (!strstr($password, $char)) {
  $password .= $char;
  $i++;
}

  }

   return $password;

}

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



[PHP] Deleting file in /tmp directory

2008-03-28 Thread Mário Gamito
Hi,

I have this PHP script (simplificated here), called delete_tmp.php
that basically calls external commands:



delete_tmp.php file is owned by gamito.users

/tmp/sess_89765 file has permissions -rw-- and is owned by gamito.users

My /tmp permissions are rwxrwxrwt and is owned by root.root

I know that the the sticky bit only allows files to be deleted by
their owners, the owner of the directory or by root.

Never the less, i can switch to /tmp directory and delete sess_89765
file as user gamito.

If I run:
$ php delete_tmp.php

as root, it deletes sess_89765 file.

But if I do the same has user gamito, it doesn't delete the file !!!

Ideas ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] This beats me (variable not being passed through pages)

2008-03-24 Thread Mário Gamito
Hi,

I have a ASP.NET / C# page calling a webmail Linux server:

 WebRequest request =
WebRequest.Create("http://192.168.1.4/horde/imp/index.php?username=gamito";);
 (etc...)

 It seems to work as in my Linux Apache logs, i get:
 (...) "GET /horde/imp/index.php?username=gamito HTTP/1.1" 200 223

 File index.php is:

 

But index.php only shows "Hello" and not "Hello gamito" as I'd expect.

Any ideias ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] Problem with quotes

2008-02-21 Thread Mário Gamito

Hi,

Sorry for such a laim question.



I have this code:

$host = 'http://' . $_SERVER['HTTP_HOST'];

"foreach($browser as $key => $val){
echo "" . " ";
(...) "


but it has a bug, I need to add the server domain before the picture, so 
 I did:


$host = 'http://' . $_SERVER['HTTP_HOST'];

"foreach($browser as $key => $val){
echo $host . "" . " ";
(...)"

But this way, all it echoes is the $host variable.

What am I missing here ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



Re: [PHP] Help on running external command / Partially solved

2008-02-20 Thread Mário Gamito

Hi,

>  $username = "lixo";
> exec('su -c - vpopmail "/var/qmail/bin/maildirmake
> /home/vpopmail/domains/wwlib.lan/'.$username.'"',$ret,$err);
> echo "\n";
> print_r($ret);
> echo "\n";
> echo isset($err) ? "Error: ".$err : null;
> ?>

No output at all and I have "display_errors = On" in php.ini

Still no directory creation.

If I run the file as user vpopmail it asks me for a password:

# su - vpopmail
$ php /home/www/hash.php

Output:"
[EMAIL PROTECTED] ~]$ php /home/www/hash.php
Password:"

Any ideas ?

Warm Regards,
Mário Gamito

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



Re: [PHP] Help on running external command / Partially solved

2008-02-20 Thread Mário Gamito

Of course the code is:

$username = 'lixo';

exec("su -c - vpopmail \"/var/qmail/bin/maildirmake 
/home/vpopmail/domains/wwlib.lan/\"$username");


Mário Gamito wrote:

Hi,

Thank you for your answers.

I got it working with:
"//$username = 'lixo';

exec("su -c - vpopmail \"/var/qmail/bin/maildirmake 
/home/vpopmail/domains/wwlib.lan/\"$username");"


Now, if I run it from the shell, it creates the directory.
 From a page on the web server it doesn't.

Directory /home/vpopmail/domains/wwlib.lan/ is owned by vpopmail.vchkpw 
(as well as my .php page) with 700 permission.


I even tried chmoding 777 to my page, but still, it doesn't create the 
directory.


Any ideas ?

Warm Regards,
Mário Gamito



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



Re: [PHP] Help on running external command / Partially solved

2008-02-20 Thread Mário Gamito

Hi,

Thank you for your answers.

I got it working with:
"//$username = 'lixo';

exec("su -c - vpopmail \"/var/qmail/bin/maildirmake 
/home/vpopmail/domains/wwlib.lan/\"$username");"


Now, if I run it from the shell, it creates the directory.
From a page on the web server it doesn't.

Directory /home/vpopmail/domains/wwlib.lan/ is owned by vpopmail.vchkpw 
(as well as my .php page) with 700 permission.


I even tried chmoding 777 to my page, but still, it doesn't create the 
directory.


Any ideas ?

Warm Regards,
Mário Gamito

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



[PHP] Help on running external command

2008-02-20 Thread Mário Gamito

Hi,

I need to run an eternal command from a PHP page.

My code is:
"
$username= 'lixo';

$username = 'lixo';

exec('su - vpopmail -c 
"/var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/" . $username');

"

But I get the error:
"/var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/: Not a 
directory"


Which means that the $username variable isn't being appended to the string.

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



Re: [PHP] Re: Call PHP script from MySQL

2008-02-19 Thread Mário Gamito

Hi Nathan,


>> Is it possible to call from within MySQL an external PHP script ?
>> I've read "MySQL Stored Procedure Programming" from O'Reilly but
>> found nothing :(
> I'd really like to see an example of why you need this functionality,
> if that'd be okay. Not to judge, just to learn :)

I'm inserting values in a Linux/MySQL table from an ASP.NET/C# page.
I need to insert the password field with the correct hash (vpopmail).

So, after the first insert leaving the password field blank, I need to 
invoke a PHP script that calculates the hash and then insert it.


Warm Regards,
Mário Gamito

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



[PHP] Call PHP script from MySQL

2008-02-19 Thread Mário Gamito

Hi,

Is it possible to call from within MySQL an external PHP script ?
I've read "MySQL Stored Procedure Programming" from O'Reilly but found 
nothing :(


How can I do this ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



Re: [PHP] Where to insert a phrase in the right place

2007-04-09 Thread Mário Gamito
Hi,

André Medeiros wrote:
>  session_start();
> if(!isset($_SESSION['greeted'])) {
>echo "Welcome";
>$_SESSION['greeted'] = 1;
> }
> ?>

It doesn't work :(

if ($_SESSION['greeted'] == 1)
 print('Welcome ' . $name);

$_SESSION['greeted'] is always equal to 1 as set in the beginning of the
file.

http://www.telbit.pt/2/login.php

Warm Regards
-- 
:wq! Mário Gamito

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



Re: [PHP] Where to insert a phrase in the right place

2007-04-09 Thread Mário Gamito
Hi,

Jay Blanchard wrote:
> [snip]
> How can i make the word "Welcome" appear only after the login ?
> [/snip]
> 
> If you set a cookie upon login you can then check for the existence of the 
> cookie. If the cookie exists do not display 'Welcome'.
I have:

session_start();
session_register("email");

in the beginning of the file.

I've tried:

if (isset($_SESSION['email']))
 print('Welcome ' . $name);

but obviously it prints the "Welcome" word as the same.

Any ideas ?

Thanks in advance.

Warm Regards
-- 
:wq! Mário Gamito

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



[PHP] Where to insert a phrase in the right place

2007-04-09 Thread Mário Gamito
Hi,

I'm making this site that was static and now has some dynamic features,
so it's a little bit patched :)

If you care to visit
http://www.telbit.pt/2/login.php

you'll notice that the word "Welcome" is already present, and only
should be after the download.

Also, the error "You didn't fill all fields, please try again." is being
displayed on page load.

This is my problem and to which i ask you for your help.

How can i make the word "Welcome" appear only after the login ?

My code follows my signature.

Any help would be appreciated.

Warm Regards
-- 
:wq! Mário Gamito
--

Forgot your password ?

debug=1;
$conn = &ADONewConnection('mysql');
$conn->PConnect($host,$user,$password,$database);

// get password from db
$rsSel = "SELECT name, password FROM subscribers WHERE email = '$email'
AND valid = '1'";
$rs = $conn->Execute($rsSel);

$name= $rs->fields[0];
$password_db = $rs->fields[1];

if ($pass != $password_db) {

"&field1=".urlencode($_POST['field1'])."&field2=".urlencode($_POST['field2']);
  echo "
Wrong password, please try again.
";
exit;
}

print('Welcome ' . $name);

unset ($_SESSION['error']);

$conn->Close();

?>








 



Copyright©2006 Telbit -
Tecnologias de Informação, Lda.

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



Re: [PHP] "Sense" last record

2007-04-09 Thread Mário Gamito

Hi,

Thank you all for your answers.

I solved the problem with:


 debug=1;
  $conn = &ADONewConnection('mysql');
  $conn->PConnect($host,$user,$password,$database);

  // insert subscription values
  $recordSet = &$conn->Execute("SELECT id_news, date, now, title, lead, 
body FROM news ORDER BY now DESC LIMIT 3");


  $counter = 0;

  if (!$recordSet)
   print $conn->ErrorMsg();
  else
   while (!$recordSet->EOF) {
$counter++;
 if ($counter == 3)
  $div = '';
 else
  $div = '';
print($div);
print '' . $recordSet->fields[3] . '' . '' 
 . $recordSet->fields[1] . '' . '' . $recordSet->fields[4] . 'href=news.php?news='. $recordSet->fields[0] . '>[+]' . '' . 
'';

   $recordSet->MoveNext();
   }

 echo ""; 
 $recordSet->Close();
$conn->Close();
?>
  


Warm Regards
--
:wq! Mário Gamito

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



[PHP] "Sense" last record

2007-04-09 Thread Mário Gamito

Hi,

I'm doing this site that has three news in the homepage.
You can see the static version here:
http://www.telbit.pt
As you can see, the two first news have "blocoTexto" class and the 
third, "blocoTextoLast"


Now, i'm developing a dinamyc structure where the news are stored in a 
MySQL database and retrieved from there.


My problem is with the third news and it's different class.
I'm using AdoDB recordSet to get the news from the database.
You can see it here:
http://www.telbit.pt/2/

How can i "sense" that i've reached the last row and apply the 
"blocoTextoLast" class to it ?


My code follows my signature.

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito
--

 debug=1;
  $conn = &ADONewConnection('mysql');

$conn->PConnect($host,$user,$password,$database);

  // get news data
  $recordSet = &$conn->Execute("SELECT date, now, title, lead, body 
FROMnews ORDER BY date DESC LIMIT 3");


 if (!$recordSet)
  print $conn->ErrorMsg();
 else
  while (!$recordSet->EOF) {
   print '' . ' ' . $recordSet->fields[2] . 
   '' . '' . $recordSet->fields[0] . '' .

'' . $recordSet->fields[3] . '' . '';

 $recordSet->MoveNext();
}
 echo ""; 

 $recordSet->Close();
 $conn->Close();
?> 


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



Re: [PHP] PDF: error

2007-04-05 Thread Mário Gamito
Hi,

> Where did you get the $data variable?
> as filesize($data) would return false here, and that's not a good
> value for the Content-Length header :)
Sorry, bad Copy & Paste.

I get it from:
$data = readfile($full);

Result in the browser is:

"%PDF-1.4 %âãÏÓ 351 0 obj <> endobj xref 351 434 16 0 n
010281 0 n 010417 0 n 010574 0 n 010607
0 n 012850 0 n 012884 0 n 013037 0 n
013174 0 n 013704 0 n 014104 0 n 014488
0 n 014700 0 n 014747 0 n 014794 0 n
014842 0 n 014889 0 n 014937 0 n 014984
0 n 015033 0 n 015082 0 n 015130 0 n
015179 0 n 015228 0 n 015277 0 n 015326 "
(etc...)

Full code after my signature.

Any help would be appreciated.
-- 
:wq! Mário Gamito
--



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



[PHP] PDF: error

2007-04-05 Thread Mário Gamito
Hi,

I've managed to make the PDF download system work.

But when it opens in acrobat reader, i get the error you can see in:
http://www.gamito.org/fucked-pdf-2.jpg

The code follows my signature.

Any help would be appreciated.

Warm Regards
-- 
:wq! Mário Gamito
--



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



Re: [PHP] Problems downloading a PDF / Partially solved

2007-04-04 Thread Mário Gamito

Ok,

I don't get the warnings anymore, but the PDF is still being displayed 
with its binary code inside in the PHP page:


"%PDF-1.4 %âãÏÓ 351 0 obj <> endobj xref 351 434 16 0 n 
010281 0 n 010417 0 n 010574 0 n 010607 
0 n 012850 0 n 012884 0 n 013037 0 n 
013174 0 n 013704 0 n 014104 0 n 014488 
0 n 014700 0 n 014747"


Something must be wrong with the definition of the file type.
Warm Regards
--
:wq! Mário Gamito

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



Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito

Hi,


by reading the freaking replies that you get?!? :-), I did give you
the answer to this in the rewritten code I offered. (granted

You the code you gave me i get

"Warning: Cannot modify header information - headers already sent by 
(output started at /var/www/telbit_website/2/products-testudio.php:14) 
in /var/www/telbit_website/2/products-testudio.php on line 120


Warning: Cannot modify header information - headers already sent by 
(output started at /var/www/telbit_website/2/products-testudio.php:14) 
in /var/www/telbit_website/2/products-testudio.php on line 121


Warning: Cannot modify header information - headers already sent by 
(output started at /var/www/telbit_website/2/products-testudio.php:14) 
in /var/www/telbit_website/2/products-testudio.php on line 122
%PDF-1.4 %âãÏÓ 351 0 obj <> endobj xref 351 434 16 0 n 
010281"


Any ideas ?

Warm Regards
--
:wq! Mário Gamito

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



Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito

Hi,


that's what I said before. you echo out some html before the file
headers. that will never work.
remove the echo statement on line 14 and you should be okay

But i need the line

echo "   " rel=\"external\">Download TESTUDIO flyer";


to display the link for download!!!

How can i sove this puzzle ?

Full code follows my signature.

Thanks for all your help guys.

Warm Regards,
--
:wq! Mário Gamito
--
Download TESTUDIO flyer";
  exit;
  }
  header('Content-type: application/pdf');
  header("Content-Length: " . filesize($full));
  header('Content-disposition: attachment; 
   filename="testudio.pdf"');

  readfile($full);
  exit;
  } else {
echo "Please, login to download the PDF";
 }
?>

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



Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito

Hi,

Ok, i've hardcoded the filename and i no longer get a 404 error.
But the "PDF" file i get is this:

"Warning: Cannot modify header information - headers already sent by 
(output started at /var/www/telbit_website/2/products-testudio.php:14) 
in /var/www/telbit_website/2/products-testudio.php on line 120


Warning: Cannot modify header information - headers already sent by 
(output started at /var/www/telbit_website/2/products-testudio.php:14) 
in /var/www/telbit_website/2/products-testudio.php on line 121


Warning: Cannot modify header information - headers already sent by 
(output started at /var/www/telbit_website/2/products-testudio.php:14) 
in /var/www/telbit_website/2/products-testudio.php on line 122
%PDF-1.4 %âãÏÓ 351 0 obj <> endobj xref 351 434 16 0 n 
010281 0 n 010417 0 n 010574 0 n 010607 
0 n 012850 0 n 012884 0 n 013037 0 n 
013174 0 n 013704 0 n 014104 0 n 014488 
0 n 014700 0 n 014747 0 n 014794 0 n 
014842 0 n 014889 0 n 014937 0 n 014984 
0 n 015033 0 n 015082 0 n 015130 0 n 
015179 0 n 015228 0 n 015277 0 n 015326"

(etc...)


You are echoing stuff before sending the file that is not possible. So
remove the echo and it should work. If not, try this for debugging:

if(!is_readable($full)) echo "the file $full is not readable by apache";
else {
//same as before
}

I'm not sure if i understand you :(

Warm Regards
--
:wq! Mário Gamito

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



Re: [PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito

Hi,

Thank you all for your answers.


I would say almost the opposite:

I get a Page Not found.
The problem is that $file variable is empty (tested with a print).

Any ideas ?

Warm Regards
--
:wq! Mário Gamito

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



[PHP] Problems downloading a PDF

2007-04-04 Thread Mário Gamito

Hi,

I'm building this site that has several PDFs to download, but only to 
registered users.


To prevent people to insert the full URL to the documents, i moved them 
outside Apache's DocumentRooot, which is /var/www.


My site is in /var/www/telbit and i put the PDFs in /var/www

I've coded in order to do the trick, but it's failing.
I can't get the name of the file.
Notice that the page which has the code is products-teststudio.php itself.

The code follows my signature.

Any help would be appreciated.

Warm Regards
--
:wq! Mário Gamito
--

  echo"rel=\"external\">Download TESTUDIO flyer";


  $file = $_GET['file'];

  // try to sanitize the filename
  if (preg_match('/[^A-Za-z0-9._]/', $file))
   die("Invalid filename.");

  $path = '/var/www/';
  $full = $path . $file;

  header('Content-type: application/pdf');
  header("Content-Length: " . filesize($full));
  header('Content-disposition: attachment; filename="'. basename($file) 
.'"');

  readfile($full);
 }

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



Re: [PHP] Downloads for subsrcibers only

2007-04-03 Thread Mário Gamito
Hi,

> One popular method is to place your files outside of the webroot.
I thought about that.

> This makes it so people cannot access the files directly.  Then create
> a PHP script to read the file to the user with the correct mime type
> using a header() call.
Humm... and how do i do this, if i may ask ?

I'm much a system's administrator than a PHP programmer.

Warm Regards
-- 
:wq! Mário Gamito

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



Re: [PHP] Question about form submitting / clarification

2007-04-03 Thread Mário Gamito
Hi,
> Of the three items you specify a and b should be handled with Javascript
> in an onsubmit handler.  The error messages would be generated by this
> handler.  Email validity would have to be handled by the web server and
> your php script, usually by trying the address.
I think i was misunderstood.
I know how to do the error handling.
What i don't know is how to display the error messages in the same page
as the submit form.

Warm Regards
-- 
:wq! Mário Gamito

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



[PHP] Question about form submitting

2007-04-03 Thread Mário Gamito
Hi,

Sorry for the lame question, but i didn't find a satisfactory answer in
the web.

I have this subscribe form (subscribe.php) and on submit i have to check
for errors:

a) password and password confirmation mismatch;
b) missing filled fields
c) check e-mail validity
d) etc.

My question is how do i make all these possibilities show a different
error message without leaving subscribe.php ?

I know that the for action must be subscribe.php, from there i'm blind
as a bat.

Any help would be appreciated.

Warm Regards
-- 
:wq! Mário Gamito

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



[PHP] Sending mail through another (SMTP authenticated) host

2007-04-02 Thread Mário Gamito
Hi,

How can i use the mail function to send messages through another server
that has authenticated SMTP ?

Any help would be appreciated.

Warm Regards
-- 
:wq! Mário Gamito

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



[PHP] Problems with mail

2007-04-02 Thread Mário Gamito
Hi,

I have this very straight forward code to send an e-mail:

$subject_users_subscription_confirmation = "Subscription confirmation";
$message_users_subscription_confirmation = 'Please, click this link to
confirm your subscritpion:
http://www.telbit.pt/subscribe-confirm.php?email=' . $email . '&conf=' .
$barfles;

mail($email, $subject_users_subscription_confirmation,
$message_users_subscription_confirmation);  

The three variables are ok, as i debuged them with prints, but no mail
is sent.

If i do a test with

mail('[EMAIL PROTECTED]', 'Hello', 'Hello');

then the mail is sent ok!

I'm driving nuts here.

Can someone give me a hand on this, please ?

Warm Regards
-- 
:wq! Mário Gamito

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



Re: [PHP] Re: Downloads for subsrcibers only

2007-04-01 Thread Mário Gamito
Hi,

itoctopus wrote:
> Depends where you store the file, if you store the file in the database,
> then it's much easier to do it.
> Your idea (as it is right now) won't work, because anyone will be able to
> copy and paste the link to your PDF document and download it (thus easily
> overriding the logic you have in the page).
> I've attached a class, called the FileManager class, which handles saving
> and displaying data (virtually all types) from the database. It's extremely
> easy to use. The usage is demonstrated in download.php (also attached). You
> have to add some logic in order to restrict access to your files.
Thanks a bunch.
I'll try it tomorrow at work

Warm Regards
-- 
:wq! Mário Gamito

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



[PHP] Downloads for subsrcibers only

2007-04-01 Thread Mário Gamito
Hi,

I made this site in PHP that has a page with some PDFs to download.
My costumer wants that only subscribed people are allowed to download
the PDFs.

I've already made the subscrbe and login mechanism.

Now, my question for you is about letting only subscribers download the
PDFs.
What is the best approach ?
Register a session when they login and then in the PDFs page apply a

if email is registered
  you can download the PDFs
else
  you can't

Something like this ?
Or is it there a better way ?

Any help would be appreciated.

Warm Regards
-- 
:wq! Mário Gamito

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



[PHP] Error compiling lib

2007-02-08 Thread Mário Gamito

Hi,

I want to compile PHP with IMAP  support.

I've downloaded imap2006e and run:

# make slx

but i got this error:

"make[2]: Entering directory `/usr/local/src/imap-2006e/mtest'
`cat ../c-client/CCTYPE` -I../c-client `cat ../c-client/CFLAGS` -o mtest 
mtest.o   ../c-client/c-client.a `cat ../c-client/LDFLAGS`
.../c-client/c-client.a(osdep.o)(.text+0x87e4): In function 
`ssl_onceonlyinit':
/usr/local/src/imap-2006e/c-client/osdep.c:301: warning: the use of 
`tmpnam' is   dangerous, better use `mkstemp'

mtest.o(.text+0x1680): In function `smtptest':
/usr/local/src/imap-2006e/mtest/mtest.c:781: warning: the `gets' 
function is dan  gerous and should not be used.
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x38): In function 
`dlfcn_load  ':

: undefined reference to `dlopen'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0xa0): In function 
`dlfcn_load  ':

: undefined reference to `dlclose'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0xc9): In function 
`dlfcn_load  ':

: undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x13e): In function 
`dlfcn_unl oad':

: undefined reference to `dlclose'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x1f5): In function 
`dlfcn_bin d_var':

: undefined reference to `dlsym'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x241): In function 
`dlfcn_bin d_var':

: undefined reference to `dlerror'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x2d5): In function 
`dlfcn_bin d_func':

: undefined reference to `dlsym'
/usr/local/ssl/lib/libcrypto.a(dso_dlfcn.o)(.text+0x321): In function 
`dlfcn_bin d_func':

: undefined reference to `dlerror'
collect2: ld returned 1 exit status
make[2]: *** [mtest] Error 1
make[2]: Leaving directory `/usr/local/src/imap-2006e/mtest'
make[1]: *** [bundled] Error 2
make[1]: Leaving directory `/usr/local/src/imap-2006e'
make: *** [slx] Error 2"

Can someone help me out, please ?

Warm Regards,
Mário Gamito

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



Re: [PHP] Re: How to effectuate translations

2006-09-30 Thread Mário Gamito
Hi,

Yes, but what i was looking for is the best solution for the users to
choose their language.

Thanks for the useful link anyway.

Best Regards,
Mário Gamito

Tony Marston wrote:
> If you read
> http://www.tonymarston.net/php-mysql/internationalisation.html#determine.use
> r.language you will see that it determines the user's language from
> $_SERVER["HTTP_ACCEPT_LANGUAGE"] which is taken from settings in the
> client's browser. It is also possible for this to be overridden in the
> Control Record or the MNU_USER record.
> 
> Tony Marston
> 
> http://www.tonymarston.net 
> http://www.radicore.org
> 
> 
> 
>> -Original Message-
>> From: Mário Gamito [mailto:[EMAIL PROTECTED] 
>> Sent: 30 September 2006 16:11
>> To: Tony Marston
>> Subject: Re: [PHP] Re: How to effectuate translations
>>
>>
>> Hi Tony,
>>
>> But this works automagiacaly from the browser language or the 
>> users can choose ?
>>
>> Regards,
>> Mário Gamito
>>
>> Tony Marston wrote:
>>> Take a look at
>>>
>> http://www.tonymarston.net/php-mysql/internationalisation.html which 
>>> documents the solution which I have adopted.
>>>
>>
> 
> 

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



Re: [PHP] Re: How to effectuate translations

2006-09-30 Thread Mário Gamito
Hi,

But this allows users to choose the language or is it an automatic
process from the browser language ?

Regards,
Mário Gamito

Tony Marston wrote:
> Take a look at 
> http://www.tonymarston.net/php-mysql/internationalisation.html which 
> documents the solution which I have adopted.
> 

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



[PHP] Displaying MySQL results on runtime

2006-09-27 Thread Mário Gamito
Hi,

I have this code to create a database and a few tables.

Is there a way to display the MySQL actions at runtime, i. e., display
the MySQL commands while they are being executed ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



Re: [PHP] Why this doesn't work ?

2005-10-24 Thread Mário Gamito

Hi,


Make this line instead
$result = mysql_query($query) or die(mysql_error() . " with the query $query";
and you'll likely see the error.


Here it goes:

"You have an error in your SQL syntax; check the manual that corresponds 
to your MySQL server version for the right syntax to use near '(login) 
FROM formacao WHERE login = 'a'' at line 1"


Regards,
Mário Gamito

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



Re: [PHP] Why this doesn't work ?

2005-10-24 Thread Mário Gamito

Hi,

Sorry, i do have the table name.
It just passed me while transcripting.

The code is:

---
$query = "SELECT COUNT (login) FROM formacao WHERE login = '$login'";
$result = mysql_query($query);
mysql_fetch_row($result);
---

It works perfectly on MySQL prompt.

Regards,
Mário Gamito

Colin Shreffler wrote:

It looks to me like you forgot to specify the table in your query:

SELECT COUNT (login) FROM  WHERE login = '$login'



Hi,

Why this doesn't work ?

---
$query = "SELECT COUNT (login) FROM WHERE login = '$login'";
$result = mysql_query($query);
mysql_fetch_row($result);
---

It gives me
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL
result resource in /var/www/html/registar_action.php on line 22

Any help would be apreciated.

Warm Regards,
Mário Gamito

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







Thank you,
Colin Shreffler
Principal
303.349.9010 - cell
928.396.1099 - fax
[EMAIL PROTECTED]

Warp 9 Software, LLC.
6791 Halifax Avenue
Castle Rock, CO 80104

Confidentiality Notice: The information in this e-mail may be confidential
and/or privileged. This e-mail is intended to be reviewed by only the
individual or organization named in the e-mail address. If you are not the
intended recipient, you are hereby notified that any review, dissemination
or copying of this e-mail and attachments, if any, or the information
contained herein, is strictly prohibited.



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



[PHP] Why this doesn't work ?

2005-10-24 Thread Mário Gamito

Hi,

Why this doesn't work ?

---
$query = "SELECT COUNT (login) FROM WHERE login = '$login'";
$result = mysql_query($query);
mysql_fetch_row($result);
---

It gives me
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL 
result resource in /var/www/html/registar_action.php on line 22


Any help would be apreciated.

Warm Regards,
Mário Gamito

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



[PHP] Dummy question about gettion "select option" choosen

2005-05-29 Thread Mário Gamito
Hi,

Thank you all who have helped me in the checkbox's question.

This is an area to which i'm very fresh in PHP.

I now have this code in a form:
---

1
2
3
(etc...)

--

My question is, how can i, in the action code, retrieve the option
choosen by the user ?

My most apologies for yet another dummy question, but i google and
google, and i always end up seeing examples fulls of complexity, when i
want is such a simple thing.

Thanking you in advance.

Warm Regards,
Mário Gamito

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



[PHP] Getting parameters from a URL coming from outside the site

2005-05-20 Thread Mário Gamito
Hi,

Following the previous discussion regarding confirmation of
subscriptions (to all the people who replied, my thanks), i now generate
an URL something like this:


http://www.bar.com/[EMAIL PROTECTED]&code=vu782
This hit will come from someone's mail client.

Then, in file confirma_registo_action.php, i do:

  $email= $_GET['email'];
  $code = $_GET['code'];
  print($email);
  print($code);

for testing, but it does print nothing.
So, i'm not getting the parameters from the URL.
I have register_globals=Off in php.ini

Why is this wrong and how to make it right ?

Thanking you in advance.

Warm Regards,

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



[PHP] Code stoped working after upgrading from 4 to 5

2005-04-28 Thread Mário Gamito
Hi,

I have this simple piece of code that worked like a chram in PHP 4.x
Now that i've moved to PHP 5 it doesn't work anymore.
I always get 0 for $form_ok even if all fields are filled.

The variables come from a form in a previous page.

Any ideas on where the problem might be ?
I have "register_globals = Off" in php.ini

Any help would be apreciated.


// test if all fields were filled   
if (($email == '') || ($name == '') || ($pass == '') || ($pass2 == '')
|| ($magic_number == '') || ($answer == ''))
   $form_ok = 0;


Warm Regards,

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



[PHP] Question regarding PDF creation

2005-04-18 Thread Mário Gamito
Hi,

I'm using FPDF (http://www.fpdf.org/) to create a... PDF.

I'm trying to use a variable inside an instruction, but i'm getting
errors or malformed PDFs and i can't figure how to overcome them.

This instruction

$pdf->Cell(60,10,'Powered by FPDF.',0,1,'C');

inserts a line in the PDF, starting in coordinates 60,10 of the sheet,
without border (0), breaking to the next line (1) and centered (C).

Now, i want to use this with a variable:

$pdf->Cell(40,10,'CV de ' . $full_name . ',' . 0,0 . ',C');

The problem here is that the part ,0,1, is not stringed, while C is.
So, what i get in the PDF is

Curriculum Vitae de Mário Gamito,0,0,C
(Mário Gamito == $full_name)

So, how to "unparse" the ,0,1, in the middle of the instruction ?

Any help would be apreciated.


Warm Regards,
Mário Gamito

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



Re: [PHP] Parsing... the hell of PHP

2005-03-30 Thread Mário Gamito
Hi,
Thank you all that answered my question.
It worked.
I think i'll never get used to this parsing PHP stuff :(
Warm Regards,
Mário Gamito

[EMAIL PROTECTED] wrote:
> $url = ".HtmlEntities($url)."\">".";
>
> It appears the parse error is at the end of your opening link tag, so 
PHP doesn't know what >.HtmlEntities($url) means.  I'm at work so I 
can't test it, but that appears the culprit to me.
>
> $url = "" . HtmlEntities($url) . ""; should suffice.
>
> Martin Austin
>
>
>
>
>
> Mário Gamito <[EMAIL PROTECTED]>
> 03/30/2005 07:51 AM
>
> To: php-general@lists.php.net
> cc: Subject:[PHP] Parsing... the hell of PHP
>
>
> Hi,
>
> I'm trying to transform a url taken from the DB from "plain text", to 
the same, but linkable url.
>
> All i get is parse errors and alike.
>
> Here is my last (of many) attempt:
>
> $url = ".HtmlEntities($url)."\">".";
>
> A warning and a parse error is what i get.
> Can't get there :(
>
> Any help would be apreciated.
>
> Warm regards,
> Mário Gamito
>

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


Re: [PHP] Parsing... the hell of PHP

2005-03-30 Thread Mário Gamito
Hi,
Thank you all that answered my question.
It worked.
I think i'll never get used to this parsing PHP stuff :(
Warm Regards,
Mário Gamito

[EMAIL PROTECTED] wrote:
$url = ".HtmlEntities($url)."\">".";
It appears the parse error is at the end of your opening link tag, so PHP 
doesn't know what >.HtmlEntities($url) means.  I'm at work so I can't test 
it, but that appears the culprit to me.

$url = "" . HtmlEntities($url) . ""; should suffice.
Martin Austin


Mário Gamito <[EMAIL PROTECTED]>
03/30/2005 07:51 AM
 
To: php-general@lists.php.net
cc: 
Subject:[PHP] Parsing... the hell of PHP

Hi,
I'm trying to transform a url taken from the DB from "plain text", to 
the same, but linkable url.

All i get is parse errors and alike.
Here is my last (of many) attempt:
$url = ".HtmlEntities($url)."\">".";
A warning and a parse error is what i get.
Can't get there :(
Any help would be apreciated.
Warm regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Parsing... the hell of PHP

2005-03-30 Thread Mário Gamito
Hi,
I'm trying to transform a url taken from the DB from "plain text", to 
the same, but linkable url.

All i get is parse errors and alike.
Here is my last (of many) attempt:
$url = ".HtmlEntities($url)."\">".";
A warning and a parse error is what i get.
Can't get there :(
Any help would be apreciated.
Warm regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Why not @ ?

2005-03-22 Thread Mário Gamito
Hi Richard,
Thanks a lot for your tip and explanation.
It did worked :)
Warm Regards,
Mário Gamito
Richard Davey wrote:
Hello Mário,
Tuesday, March 22, 2005, 11:42:13 AM, you wrote:
MG> However, if you click and go to the respective page, you'll see that the
MG> "@" is switched by "%40".
Yes, because you are URL encoding it, which does exactly that. Put a
space into an email address and you'd see a %20 instead, etc.
The browser will convert it back for display purposes *within the
actual browser* (i.e. title bar, status bar) but the actual text
really contains a %40.
If you don't want this behaviour, don't URL encode the email address.
Best regards,
Richard Davey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Why not @ ?

2005-03-22 Thread Mário Gamito
Hi,
If you care to take a peak at http://www.dte.ua.pt/cv/
and pass your mouse over the link "Mário Gamito", you'll see in the 
status bar that the link is:

http://www.dte.ua.pt/cv/[EMAIL PROTECTED]
Allright.
However, if you click and go to the respective page, you'll see that the 
"@" is switched by "%40".

There is no need to even click it.
Just Copy the link in the page and paste it in some editor.
Even this way, the link is wrong.
This completely bogles me.
I mean, i pass the mouse over the link and i see "@" in the status bar.
If i Copy the link and paste it into a text editor, i get "%40".
Any help would be apreciated.
The relevant code follows my signature.
Warm Regrds,
Mário Gamito
--
while (!$recordSet->EOF) {
   print ("http://www.dte.ua.pt/cv/cv_show.php?email=".UrlEncode($recordSet->fields[1])."\">".HtmlEntities($recordSet->fields[0])."");
   //print ("http://www.dte.ua.pt/cv/email=?\".$recordSet->fields[0].");
   $recordSet->MoveNext();
  }

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


[PHP] Escaping

2005-03-21 Thread Mário Gamito
Hi,
I want this code to display peoples' names within an hyperlink.
I'm tired of trying different ways, read all about it in PHP's manual, 
but i can't get it there.

You can visit http://www.dte.ua.pt/cv
In the rightmost column it is suposed to apear two name below "Links", 
but... it doen't, becuase i can't straight the escaping :(

Any help would be apreciated.
The code follows my signature.
Warm Regards,
Mário Gamito
--
// select names to display in the right column
  $recordSet = &$conn->Execute('SELECT name FROM users');
  while (!$recordSet->EOF) {
   print ('http://www.dte.ua.pt/cv/email=?' . 
$recordSet->fields[0] . '\'' . '');
   $recordSet->MoveNext();
  }

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


[PHP] Damn escaping... Grunf...

2005-03-21 Thread Mário Gamito
Hi,
I want this code to display peoples' names within an hyperlink.
I'm tired of trying different ways, read all about it in PHP's manual, 
but i can't get it there.

You can visit http://www.dte.ua.pt/cv
In the rightmost column it is suposed to apear two name below "Links", 
but... it doen't, becuase i can't straight the escaping :(

Any help would be apreciated.
The code follows my signature.
Warm Regards,
Mário Gamito
--
// select names to display in the right column
  $recordSet = &$conn->Execute('SELECT name FROM users');
  while (!$recordSet->EOF) {
   print ('http://www.dte.ua.pt/cv/email=?' . 
$recordSet->fields[0] . '\'' . '');
   $recordSet->MoveNext();
  }

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


Re: [PHP] Re: Question about "shortening" a string

2005-03-11 Thread Mário Gamito
Hi Sokolewicz,
Thanks a lot.
It just working really fine :)
Thank you again.
Warm regards,
Mário Gamito
M. Sokolewicz wrote:
> Mário Gamito wrote:
>
>> Hi,
>>
>> In Portgal we have big names.
>> My complete name, for instance, is "Mário Augusto Machado dos Reis 
Gamito".
>> "Mário" is the Christian name and "Gamito" - the last one - is 
always the last name of the father.
>>
>> I have a form where i want to let my users insert their full big 
name like mine, but i want to shorten them just to the first and the last.
>>
>> For example, if i fill the form with "Mário Augusto Machado dos Reis 
Gamito", i want to change this string to only "Mário Gamito".
>>
>> The total number of names is not fix.
>> Could be 3, 4, 5, 6,...
>> My son name is "Manuel Ramos Gamito". Only 3 names.
>> Should be changed to "Manuel Gamito", also.
>>
>> I've looked at the strings functions in the manual, made a lot of 
experiences, but couldn't get there :(
>>
>> Does anyone knows how to do this ?
>>
>> Any help would be apreciated.
>>
>> Warm Regards,
>> Mário Gamito
>
>
> 
> $parts = explode(' ', $fullName);
> $shortenedName = $parts[0].' '.$parts[count($parts)-1];
> ?>
>

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


[PHP] Question about "shortening" a string

2005-03-11 Thread Mário Gamito
Hi,
In Portgal we have big names.
My complete name, for instance, is "Mário Augusto Machado dos Reis Gamito".
"Mário" is the Christian name and "Gamito" - the last one - is always 
the last name of the father.

I have a form where i want to let my users insert their full big name 
like mine, but i want to shorten them just to the first and the last.

For example, if i fill the form with "Mário Augusto Machado dos Reis 
Gamito", i want to change this string to only "Mário Gamito".

The total number of names is not fix.
Could be 3, 4, 5, 6,...
My son name is "Manuel Ramos Gamito". Only 3 names.
Should be changed to "Manuel Gamito", also.
I've looked at the strings functions in the manual, made a lot of 
experiences, but couldn't get there :(

Does anyone knows how to do this ?
Any help would be apreciated.
Warm Regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] How to ge the ones which are not

2005-03-11 Thread Mário Gamito
Hi,
I've built this little regular expression to test wether an e-mail 
address is valid or not:

if(eregi 
("[EMAIL PROTECTED]", 
$email))
  print ('valid email)
else
  print ('Invalid email');

--
ok, now i want to use this in a filling form web page scenario.
I have this forms with its fields to be filled and when it gets to the 
e-mail address textbox, i want to check if the address is not well formed.

So i did (notice the "!" before the eregi):
if (!eregi 
("[EMAIL PROTECTED]", 
$email))
 { send a warn to the user telling the e-mail address is not correct}

--
Well, if the first block of code works pretty good saying if an address 
is valid or invalid, the second one, when the data from the filled form 
is checked, always says the adress is invalid.

I thought the "!" would adapt the confition to its new scenario, but, 
well... as i've told you, it isn't.

Any ideas of how to solve this, i.e., being the regular expression (and 
it is), what do i have to do to get only the invalid adresses ?
In short, i only want to trap the invalid ones.

Any help would be apreciated.
Warm Regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP / JavaScript integration

2005-03-08 Thread Mário Gamito
Hi,
I'm trying to integrate some JavaScript functions in PHP, but so far, no 
good :(

I want to have a js.php file that has the JavaScript functions i want to 
use. This file, albeit its extension, has no PHP code or even tag.

It's just like this:
js.php
--
</pre><br>
<tt>function def(word) {<br>
if (word == 'all_not_filled') {<br>
type = 'error1';<br>
definition = 'You didn't filled all form fields.';<br>
}<br>
myFloater = 
window.open(filename,'myWindow','scrollbars=no,status=no,width=300,height=200')<br>
}</tt><br>
<br>
<pre style="margin: 0em;">
--
Now... i want to call this JavaScript function from the regular PHP files.
In particular, before the HTML code.
Like this:
index.php
--

 if (condition)
  def('all_not_filled') // def is a JS function in js.php
?>

 
(...)

--
How can i do this ?
How to tell PHP, that def(word) is a JS function in js.php file ?
I've tried include ('js.php'), etc., but got no results :(
Any help would be apreciated.
Best regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Quite a basic question

2005-03-08 Thread Mário Gamito
Hi,
This is quite a very basic question, but i think the code following my 
signature should work.
Instead, i get a
"Warning: Cannot modify header information - headers already sent by 
(output started at /home/vhosts/dte/cv/register_action.php:10) in 
/home/vhosts/dte/cv/register_action.php on line 12"

and no redirection :(
How can i solve this ?
Any help would be apreciated.
Warm Regards,
Mário Gamito

  $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  $sub_domain = explode (".", $hostname);
  if ($sub_domain[1] != 'dte') {
echo"
<br>
	  window.open (\"<a  href="http://www.google.com\"">http://www.google.com\"</a>;, \"mywindow\", \"status=1, 
toolbar=0, resizable=0,<br>
	  width=200, height=200\");<br>
";	
   }
   header("Location: http://www.dte.ua.pt/cv/";);
?>   	


 
 Gestão de currículos do DDTE
(...)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Free library for PDF functoins ???

2005-01-18 Thread Mário Gamito
Hi,
Does anyone knows of a free library to compile PHP against and have PDF 
functions support ?

Any help would be apreciated.
Warm regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Warnings on the bottom of the pages on Linux

2004-12-30 Thread Mário Gamito
Hi,
A friend of mine told me that in Windows, PHP shows its warnings at the 
bottom of the pages.

Actually, i've never had thought about this issue before.
Better still... i even didn't know PHP for Windows had this behaviour.
In Linux they're shown at the top and now i'm in the mood to make PHP 
warnings appear at the bottom too. But...

... i've browsed php.ini and didn't found any way (obvious, at least) to 
do the same thing in Linux.

Already googled also, but nothing.
Is it possible to achieve this in Linux ?
Any help would be apreciated.
Warm regards.
--
Mário Gamito
Administração de sistemas e desenvolvimento
Netual - Multimédia e Telecomunicações, Lda.
Rua João Afonso, Nº1
3800-198 Aveiro - Portugal
Tel. +351 234 371 431 / Fax. +351 234 371 438
E-mail: [EMAIL PROTECTED]
www.netual.pt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Good and free encoder for PHP5

2004-12-15 Thread Mário Gamito
Hi Manuel,
Yes, Turck works with PHP5.
My question is: if the last version was released a year ago, how much 
can i trust it ?

BTW, how good is Truck's algorithm and how hard it is to reverse 
engineer the code ?


Abraço aí para o Brasil, meu.
A curtir o sol e as macacas no calçadão :)

Warm Regards,
Mário Gamito
Manuel Lemos wrote:
Hello,
Mário gamito said the following on 12/14/2004 08:51 AM:
Does anyone around here knows a *good* and *free* encoder for PHP5 ?
I used to run Turck, but it seems that somehow it has been discontinued.
(At least, the last release occured about a year ago).

Did it stop working? My Turck copy still works. ;-)

--
Mário Gamito
Administração de sistemas e desenvolvimento
Netual - Multimédia e Telecomunicações, Lda.
Rua João Afonso, Nº1
3800-198 Aveiro - Portugal
Tel. +351 234 371 431 / Fax. +351 234 371 438
E-mail: [EMAIL PROTECTED]
www.netual.pt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Good and free encoder for PHP5

2004-12-14 Thread Mário Gamito
Hi,
Does anyone around here knows a *good* and *free* encoder for PHP5 ?
I used to run Turck, but it seems that somehow it has been discontinued.
(At least, the last release occured about a year ago).
Any help would be apreciated.
Warm Regards.
--
Mário Gamito
Administração de sistemas e desenvolvimento
Netual - Multimédia e Telecomunicações, Lda.
Rua João Afonso, Nº1
3800-198 Aveiro - Portugal
Tel. +351 234 371 431 / Fax. +351 234 371 438
E-mail: [EMAIL PROTECTED]
www.netual.pt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] PID needed to hammer squid

2004-08-25 Thread Mário Gamito
Hi,
I need to kill (squid) -D
pidof (squid) -D gives an error :(
Regards,
Mário Gamito
raditha dissanayake wrote:
Mário Gamito wrote:
Hi,
I need to restart squid from PHP, but my squi doesn't stop because a 
lot of stupid errors.

So, i need to kill it and then start it again.

killing a process owned by another user is a tough ask. The squid docs 
say you shouldn't run it as root and it also advice against using nobody 
- the user that typically own the apache process. How to make use of 
sudo/suexec/cron to overcome these issues have been discussed often in 
the past and you will find it in the archives.

To answer your specific question on getting the PID. I would try looking 
in /var/run/squid.pid or executing `pidof squid`
instead of trying to parse the output of ps.


squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D

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


[PHP] PID needed to hammer squid

2004-08-25 Thread Mário Gamito
Hi,
I need to restart squid from PHP, but my squi doesn't stop because a lot 
of stupid errors.

So, i need to kill it and then start it again.
[EMAIL PROTECTED] init.d]# ps aux | grep squid
root  9281  0.0  0.3  6124 1792 ?S16:04   0:00 squid -D
squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D
squid 9284  0.0  0.0  1360  264 ?S16:04   0:00 (unlinkd)
root  9288  0.0  0.1  3860  592 pts/0S16:10   0:00 grep squid
[EMAIL PROTECTED] init.d]# echo $$;
The pid i need to kill is the one from the line:
squid 9283  0.0  1.0  8392 5060 ?S16:04   0:00 (squid) -D
How can i get this pid so i can kill -9 it and then start squid again ?
Any help would be appreciated.
Warm Regards,
Mário Gamito
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Very, very wiered problem - Part 2

2004-03-09 Thread Mário Gamito
Hi, 

> Is /home/vhosts/dte/ticct/include/complete_url.php readable 
> for the apache process?
Sure :-)

Warm Regards,
Mário Gamito


smime.p7s
Description: S/MIME cryptographic signature


[PHP] Very, very wiered problem - Part 2

2004-03-09 Thread Mário Gamito
Hi,

Here's the output of PHP error log:

"[09-Mar-2004 10:09:33] PHP Fatal error:  renderer(): Failed opening
required '../include/complete_url.php' (include_path='.:/usr/local/lib/php')
in /home/vhosts/dte/ticct/object/renderer.php on line 21"

But the file complete_url is in it's place.

Any ideas ?

Warm Regards,
Mário Gamito 

> -Original Message-
> From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 08, 2004 11:34 PM
> To: Mário Gamito
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Very, very wiered problem
> 
> Mário Gamito wrote:
> > Hi,
> > 
> > I have this site at http://www.dte.ua.pt/ticct
> > 
> > I don't know why, but it has a very strange behaviour.
> > If you visit it and make a few reloads or browse through the site 
> > you'll see that *randomly* it shows only a blank page or an error 
> > saying it cannot find file whatever_file.php although it's there.
> > 
> > I'm running SuSE 9, with a compiled Apache 1.3.29, PHP 4.3.4, and 
> > MySQL
> > 3.23.28
> > 
> > Can it be SuSE's compiler the source of the problem ?
> > It's random character makes it so difficult to debug :-(
> > 
> > Any ideas would be apreciated.
> > 
> > Warm Regards,
> > Mário Gamito
> 
> check apache logs if there is any error saying child pid ... 
> died unexpectably. disable various php extensions and check if the 
> problem still occurs. hopefully this will help you pinpoint the 
> problem
> 
> --
> PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
> http://www.php.net/unsub.php
> 
> 


smime.p7s
Description: S/MIME cryptographic signature


[PHP] Very, very wiered problem

2004-03-08 Thread Mário Gamito
Hi,

I have this site at http://www.dte.ua.pt/ticct

I don't know why, but it has a very strange behaviour.
If you visit it and make a few reloads or browse through the site you'll see
that *randomly* it shows only a blank page or an error saying it cannot find
file whatever_file.php although it's there.

I'm running SuSE 9, with a compiled Apache 1.3.29, PHP 4.3.4, and MySQL
3.23.28

Can it be SuSE's compiler the source of the problem ?
It's random character makes it so difficult to debug :-(

Any ideas would be apreciated.

Warm Regards,
Mário Gamito


smime.p7s
Description: S/MIME cryptographic signature


[PHP] Class not working after PHP 4.2.3

2003-07-01 Thread Mário Gamito
Hi,

I have this class for sending mail, which worked until PHP 4.2.3
Since 4.3.0 it stops functioning. No error message. The mail is simply 
not send.
I've searched everywhere and found no explanation for this behaviour.

Any help would be appreciated.

Warm regards,
Mário Gamito
class html_mime_mail{

var $mime;
var $html;
var $body;
var $do_html;
var $multipart;
var $html_text;
var $html_images;
var $headers;
var $parts;
var $charset;
var $charsetlist;
/***
** Constructor function. Sets the headers
** if supplied.
***/
function html_mime_mail($headers = ''){

$this->html_images = array();
$this->headers = array();
$this->parts   = array();
$this->charsetlist = array('iso'  => 'us-ascii',
   'big5' => 'big5',
   'gb'   => 'gb2312');
$this->charset = 'us-ascii';

if($headers == '') return TRUE;
if(is_string($headers)) $headers = explode("\n", 
trim($headers));
for($i=0; $i
if(is_array($headers[$i])) for($j=0; 
$jheaders[] = $headers[$i][$j];
if($headers[$i] != '') $this->headers[] = 
$headers[$i];
}
}

/***
** Accessor function to set the body text.
** Body text is used if it's not an html
** mail being sent.
***/
function set_body($text = ''){
if(is_string($text)){
$this->body = $text;
return TRUE;
}
return FALSE;
}
/***
** Accessor function to return the mime
** class variable. Purely for debug.
***/
function get_mime(){
if(!isset($this->mime)) $this->mime = '';
return $this->mime;
}
/***
** Function to set a header. Shouldn't
** really be necessary as you could use
** the constructor and send functions,
** it's here nonetheless. Takes any number
** of arguments, which can be either
** strings or arrays full of strings.
** this function is php4 only and will
** return false otherwise. Will return
** true upon finishing.
***/
function add_header(){
if((int)phpversion() < 4) return FALSE;
$args = func_get_args();
for($i=0; $i
if(is_array($args[$i])) for($j=0; 
$jheaders[] = 
$args[$i][$j];
if($args[$i] != '') $this->headers[] = $args[$i];
}
return TRUE;
}

/***
** Accessor function to set the content charset.
** Matt add 2000/10/19
***/
function set_charset($charset = '', $raw = FALSE){
if($raw == TRUE){
$this->charset = $charset;
return TRUE;
}
if(is_string($charset)){
while(list($k,$v) = each($this->charsetlist)){
if($k == $charset){
$this->charset = $v;
return TRUE;
}
}
}
return FALSE;
}
/***
** Adds a html part to the mail.
** Also replaces image names with
** content-id's.
***/
function add_html($html, $text){
$this->do_html   = 1;
$this->html  = $html;
$this->html_text = $text;
if(is_array($this->html_images) AND 
count($this->html_images) > 0){
for($i=0; $ihtml_images); $i++) 
$this->html = ereg_replace($this->html_images[$i]['name'], 
'cid:'.$this->html_images[$i]['cid'], $this->html);
}
}

/***
** Builds html part of email.
***/
function build_html($orig_boundary){
$sec_boundary = '=_'.md5(uniqid(time()));
$thr_boundary = '=_'.md5(uniqid(time()));
if(count($this->html_images) == 0){
$this-&

Re: [PHP] File upload: type and size question

2003-07-01 Thread Mário Gamito
Hi,

I have this class for sending mail, which worked until PHP 4.2.3
Since 4.3.0 it stops functioning. No error message. The mail is simply 
not send.
I've searched everywhere and found no explanation for this behaviour.

Any help would be appreciated.

Warm regards,
Mário Gamito
class html_mime_mail{

var $mime;
var $html;
var $body;
var $do_html;
var $multipart;
var $html_text;
var $html_images;
var $headers;
var $parts;
var $charset;
var $charsetlist;
/***
** Constructor function. Sets the headers
** if supplied.
***/
function html_mime_mail($headers = ''){

$this->html_images = array();
$this->headers = array();
$this->parts   = array();
$this->charsetlist = array('iso'  => 'us-ascii',
   'big5' => 'big5',
   'gb'   => 'gb2312');
$this->charset = 'us-ascii';

if($headers == '') return TRUE;
if(is_string($headers)) $headers = explode("\n", 
trim($headers));
for($i=0; $i
if(is_array($headers[$i])) for($j=0; 
$jheaders[] = $headers[$i][$j];
if($headers[$i] != '') $this->headers[] = 
$headers[$i];
}
}

/***
** Accessor function to set the body text.
** Body text is used if it's not an html
** mail being sent.
***/
function set_body($text = ''){
if(is_string($text)){
$this->body = $text;
return TRUE;
}
return FALSE;
}
/***
** Accessor function to return the mime
** class variable. Purely for debug.
***/
function get_mime(){
if(!isset($this->mime)) $this->mime = '';
return $this->mime;
}
/***
** Function to set a header. Shouldn't
** really be necessary as you could use
** the constructor and send functions,
** it's here nonetheless. Takes any number
** of arguments, which can be either
** strings or arrays full of strings.
** this function is php4 only and will
** return false otherwise. Will return
** true upon finishing.
***/
function add_header(){
if((int)phpversion() < 4) return FALSE;
$args = func_get_args();
for($i=0; $i
if(is_array($args[$i])) for($j=0; 
$jheaders[] = 
$args[$i][$j];
if($args[$i] != '') $this->headers[] = $args[$i];
}
return TRUE;
}

/***
** Accessor function to set the content charset.
** Matt add 2000/10/19
***/
function set_charset($charset = '', $raw = FALSE){
if($raw == TRUE){
$this->charset = $charset;
return TRUE;
}
if(is_string($charset)){
while(list($k,$v) = each($this->charsetlist)){
if($k == $charset){
$this->charset = $v;
return TRUE;
}
}
}
return FALSE;
}
/***
** Adds a html part to the mail.
** Also replaces image names with
** content-id's.
***/
function add_html($html, $text){
$this->do_html   = 1;
$this->html  = $html;
$this->html_text = $text;
if(is_array($this->html_images) AND 
count($this->html_images) > 0){
for($i=0; $ihtml_images); $i++) 
$this->html = ereg_replace($this->html_images[$i]['name'], 
'cid:'.$this->html_images[$i]['cid'], $this->html);
}
}

/***
** Builds html part of email.
***/
function build_html($orig_boundary){
$sec_boundary = '=_'.md5(uniqid(time()));
$thr_boundary = '=_'.md5(uniqid(time()));
if(count($this->html_images) == 0){
$this-&