[PHP] Creating ZIP-File with password

2007-11-12 Thread Sebastian Hopfe

Dear PHP-Friends,

normaly its my job to find solutions about problems around PHP. Now, i have 
a problem, that seems to be unsolved in PHP.


Actually i create some zip-files and this works fine.

 $zip = new ZipArchive();
 $zip-open(./foo.zip, ZIPARCHIVE::CREATE);
 $dir = scandir (doc/);
 foreach($dir as $filename)
 {
   if($filename != . || $filename != ..)
   {
 $zip-addFile(doc/.$filename, doc/.$filename);
   }
 }
 $zip-close();

Now, the ZIP-files must be protect. There a important files included. Each 
site and forum seems to have no solution about this problem. Now, I need a 
solution or a workarround. Are the some people, who have some ideas?


Regards
Sebastian 


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



Re: [PHP] Creating ZIP-File with password

2007-11-12 Thread Sebastian Hopfe
Hmmm... its not possible to use this function, because i can't use the 
command line.


now, i will try to crypt my data bevor i insert them into the zip file. but 
this needs more performance.


i will wait for other comments. I will report my solution.

regards

Per Jessen [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]

Sebastian Hopfe wrote:


Now, the ZIP-files must be protect. There a important files included.
Each site and forum seems to have no solution about this problem. Now,
I need a solution or a workarround. Are the some people, who have some
ideas?


You could just use the zip command line utility and the '-P' option.

However, the zip password mechanism does not really provide much in
terms of protection - if you really need the encryption, I would look
elsewhere.  (PGP, X509).


/Per Jessen, Zürich 


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



[PHP] Re: back-up mysql database using PHP

2007-11-07 Thread Sebastian Hopfe

Dear Vanessa

You can use the SELECT ... INTO OUTFILE 'file_name'  with 
mysql_query($vAnf, $dbconn);
For the syntax you can have a look at 
http://dev.mysql.com/doc/refman/5.0/en/select.html


Should you be allowed to send system-queries to the Server, than you should 
have a look to http://dev.mysql.com/doc/refman/5.0/en/backup.html


There are many ways to backup the Database. I thought this will help you.

Regards
Sebastian

Vanessa Vega [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
hello thereis there a way to create a back-up database through 
PHP?...i would like to create a file maybe an sql file that would served 
as back up of my database. Im using mysql database. I know i could use 
phpmyadmin to do this but i just like to have a function that would do 
this without going to phpmyadmin.any help? 


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



[PHP] Re: enhanced_list_box, 2 tables from a database

2007-11-07 Thread Sebastian Hopfe

Dear kNish,

first of all i have formated your PHP Code it looks better now.

?php

 echo tr\n;
 echo   td height=\33\nbsp;/td\n;
 echo   td width=\14%\ class=\style3\Artist/td\n;

 $options = mysql_query(SELECT artist_name FROM artist);
 $options=mysql_fetch_array($options);

 echo 'td';

 enhanced_list_box(array(
   'table' = 'artist',
   'value_field' = 'artist_name'));

 function enhanced_list_box($options)
 {
   $sql = select  . $options['value_field'];
   $sql .=  from  . $options['table'];
   $result = mysql_query($sql)or die(error in SQL);

   echo 'select name=', $options['value_field'],' size=1';
   while ($row = mysql_fetch_array($result, MYSQL_NUM))
 echo 'option value=' . $row[0] . '' . $row[0] . '/option';
   echo '/select';
 }

 echo '  /td';
 echo /tr\n;

 echo tr\n;
 echo   td height=\33\nbsp;/td\n;
 echo   td width=\14%\ class=\style3\Project/td\n;

 $options = mysql_query(SELECT project_name FROM project);
 $options=mysql_fetch_array($options);

 echo 'td';

 enhanced_list_box(array(
   'table' = 'project',
   'value_field' = 'project_name'));

 function enhanced_list_box($options)
 {
   $sql = select  . $options['value_field'];
   $sql .=  from  . $options['table'];
   $result = mysql_query($sql)or die(error in SQL);

   echo 'select name=', $options['value_field'],' size=1';

   while ($row = mysql_fetch_array($result, MYSQL_NUM))
 echo 'option value=' . $row[0] . '' . $row[0] . '/option';

   echo '/select';
 }

 echo '/td';
?

After i had check your code, my php interpreter shows me an fatal error on 
the browser.



kNish [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]

Hi,

A newbie question. I have more than one table to access from a database.

When I use the code as below, it gives no response on the web page.

What may I do to run more than one table from the same database into the
script.

BRgds,

kNish

.
.
.
.
tr
td height=33nbsp;/td
td width=14% class=style3Artist/td
?php
$options = mysql_query(SELECT artist_name FROM artist);
$options=mysql_fetch_array($options);
echo 'td';
enhanced_list_box(array(
'table' = 'artist',
'value_field' = 'artist_name'));
function enhanced_list_box($options){
$sql = select  . $options['value_field'];
$sql .=  from  . $options['table'];
$result = mysql_query($sql)or die(error in SQL);
echo 'select name=', $options['value_field'],' size=1';
while ($row = mysql_fetch_array($result, MYSQL_NUM))
echo 'option value=' . $row[0] . '' . $row[0] . '/option';
echo '/select';
}
echo '/td';
?
/tr

tr
td height=33nbsp;/td
td width=14% class=style3Project/td
?php
$options = mysql_query(SELECT project_name FROM project);
$options=mysql_fetch_array($options);
echo 'td';
enhanced_list_box(array(
'table' = 'project',
'value_field' = 'project_name'));
function enhanced_list_box($options){
$sql = select  . $options['value_field'];
$sql .=  from  . $options['table'];
$result = mysql_query($sql)or die(error in SQL);
echo 'select name=', $options['value_field'],' size=1';
while ($row = mysql_fetch_array($result, MYSQL_NUM))
echo 'option value=' . $row[0] . '' . $row[0] . '/option';
echo '/select';
}
echo '/td';
?
/tr http://www.php.net/a
.
.
.
.
.



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



[PHP] Re: Sessionvariable

2007-11-07 Thread Sebastian Hopfe

Dear Ronald,

I would like to ask you, want kind of session you use in you application.

regards
Sebastian

Ronald Wiplinger [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]

I use at the first page a session variable to set a flag.

After a few pages, or if somebody wait too long, the pages have another
flag.

I noticed that there are often more than one session file exist.

How can I avoid that?
How can I make sure that for one user is only one session file?

bye

Ronald 


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



[PHP] Re: Help with OOPHP

2007-11-01 Thread Sebastian Hopfe

Dear Andrew,

I think normaly it isn't possible to use another class in a class, without 
using extends. But you should use your array as a container. After you use 
as a container, you can make new instance into a array field.


Now you can use the content of the container to administrate the instances 
of the complete class. I just changed some things at your example. Please 
have a look and ask if you have any questions.


?php

 class fruitBasket ext
 {
   private $fruits = array();  //this is a class Container

   public function addFruit($newFruit)
   {
 $this-fruits[] = new fruit($newFruit);
   }

   public function makeAllApples()
   {
 foreach($this-fruits AS $fruit)
 {
   $fruit-changeName(apple);
 }
   }

   public function showAllFruits()
   {
 foreach($this-fruits AS $fruit)
 {
   echo $fruit-showFruit().br;
 }
   }
 }

 class fruit
 {
   private $name;

   public function __construct($name)
   {
 $this-name = $name;
   }

   public function changeName($newName)
   {
 $this-name = $newName;
   }

   public function showFruit()
   {
 return $this-name;
   }
 }

 $Cls = new fruitBasket();

 $Cls-addFruit(test1);
 $Cls-addFruit(test2);
 $Cls-addFruit(test3);
 $Cls-addFruit(test4);
 $Cls-addFruit(test5);
 $Cls-addFruit(test6);

 $Cls-makeAllApples();

 $Cls-showAllFruits();

?

Andrew Peterson [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]

I'm hoping you guys can help me out.

I'm not sure if you can do this, but i'm trying to create a class  that is 
build of another class.  I also want to be able to do  functions on the 
class1 from within class2.



example:

class fruitBasket{

private $fuit = array();  //this is a class

public function addFruit($newFruit)
{
$this-fruitBasket[] = $newFruit();
}

public makeAllApples()
{
foreach($this-fruit AS $value)
{ $value-changeName(apple);
} }

}



class fruit{

private $name;

public __construct($name)
{
$this-name = $name;
}

public changeName($newName)
{
$this-name = $newName;
}
} 


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



[PHP] Re: Function variables in classes

2007-11-01 Thread Sebastian Hopfe

It seems to be a PHP Bug, because normaly it should very well.

but you can solve this problem, by a workarround.

using eval($a.();); instead of $a(); in the class.

Best regards
Sebastian


Paul van Haren [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]

Hi there,

I'm trying to execute function variables. This works fine outside class
code, but gives a fatal error when run within a class. The demo code is
here:

?php

function bar1 () {
echo Yep, in bar1() right now\n;
}

function foo1 () {
bar1();

$a = bar1;
print_r ($a); echo \n;
$a();
}

class foobar {
function bar2 () {
echo Yep, in bar2() right now\n;
}

public function foo2 () {
foobar::bar2();

$a = foobar::bar2;
print_r ($a); echo \n;
$a();
}
}

foo1();


$fb = new foobar ();
$fb-foo2();
?

The error message reads:
Fatal error: Call to undefined function
foobar::bar2() in /home/paul/demo/demo.php on line 25

Is there anyone out there who can explain what's wrong in this code?

Thanks, Paul 


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



[PHP] Re: Function variables in classes

2007-11-01 Thread Sebastian Hopfe

I think you should log it, because it seems to be, and you found this error.

Regard
Sebastian

Paul van Haren [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]

Thanks, this helps. The code now works.
In case this is truely a bug in PHP, where should I log it? Anything that
I should do to make sure that it gets followed up?

Regards, Paul 


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