[PHP] Naming a variable with a variable

2003-06-17 Thread Antti
Ho can I create (name) a variable with other variables value?

If $foo = bar;

then the variable I want to create is $bar.

How do I do this?

-antti

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


[PHP] Test tables existance

2003-03-30 Thread Antti
How do I test if a mysql table exists or not? Is there a function for 
this? I didn't find a good one.

-antti

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


[PHP] Directory size

2003-02-02 Thread Antti
How do I get the directory size? Suppose there is a function for this.

antti


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




Re: [PHP] Unable to upload multiple files

2003-02-01 Thread Antti
You don't even have a file form element, or an element named
userfile so your FOR loop will never run...

---John W. Holmes...

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




Yes I do. I just forgot to put it here.

input class='nappi' size='20' type='file' name='userfile[]'

-antti



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




[PHP] Unable to upload multiple files

2003-01-31 Thread Antti
When I push the submit button it starts to send the request to my server 
and uploads a file, but if I upload more than one at a time it doesn't 
even start to upload them. My upload max should be like 50M in php.ini. 
What is the problem.

antti


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



Re: [PHP] Unable to upload multiple files

2003-01-31 Thread Antti
Justin French wrote:

Firstly, try uploading two SMALL files (say, no more than 1k each), just to
check if it's an issue with *two files*, or an issue with *file size*,
*script time outs* (maximum execution time) or something else.

Start ruling them out, one at a time.

Justin


on 01/02/03 12:03 AM, Antti ([EMAIL PROTECTED]) wrote:



When I push the submit button it starts to send the request to my server
and uploads a file, but if I upload more than one at a time it doesn't
even start to upload them. My upload max should be like 50M in php.ini.
What is the problem.

antti






Two 1 kb files went trough but not two mp3's. What are the critical 
lines in php.ini in this case? Maybe I have missed something...?

antti


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



Re: [PHP] Unable to upload multiple files

2003-01-31 Thread Antti
Marek Kilimajer wrote:

check max_post_size in php.ini

Antti wrote:


When I push the submit button it starts to send the request to my 
server and uploads a file, but if I upload more than one at a time it 
doesn't even start to upload them. My upload max should be like 50M in 
php.ini. What is the problem.

antti





Ok now I am able to send the request. I set the post_max_size into 50M 
and now when the request is sent the whole apache goes down giving: The 
document containd no data everytime I send a request. I tried also 10M 
but same happens. What the h**l is this?


antti


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



Re: [PHP] Unable to upload multiple files

2003-01-31 Thread Antti
1lt John W. Holmes wrote:

Ok now I am able to send the request. I set the post_max_size into 50M
and now when the request is sent the whole apache goes down giving: The
document containd no data everytime I send a request. I tried also 10M
but same happens. What the h**l is this?



Do you have this line in your form?

input type=hidden name=MAX_FILE_SIZE value=3

and is it set to a value greater than the size of all the files you're
trying to upload? Some browers actually pay attention to this.

---John Holmes...



No, I don't have that line.


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




Re: [PHP] Unable to upload multiple files

2003-01-31 Thread Antti
1lt John W. Holmes wrote:

Ok now I am able to send the request. I set the post_max_size into 50M
and now when the request is sent the whole apache goes down giving: The
document containd no data everytime I send a request. I tried also 10M
but same happens. What the h**l is this?



Do you have this line in your form?

input type=hidden name=MAX_FILE_SIZE value=3

and is it set to a value greater than the size of all the files you're
trying to upload? Some browers actually pay attention to this.

---John Holmes...



No, I don't have that line.



Try it then...

---John  Holmes...



No affect. Still gives the The document contains no data.


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




Re: [PHP] Unable to upload multiple files

2003-01-31 Thread Antti
Marek Kilimajer wrote:

Show us the code

Antti wrote:


1lt John W. Holmes wrote:


Ok now I am able to send the request. I set the post_max_size into 
50M
and now when the request is sent the whole apache goes down 
giving: The
document containd no data everytime I send a request. I tried 
also 10M
but same happens. What the h**l is this?




Do you have this line in your form?

input type=hidden name=MAX_FILE_SIZE value=3

and is it set to a value greater than the size of all the files you're
trying to upload? Some browers actually pay attention to this.

---John Holmes...



No, I don't have that line.





Try it then...

---John  Holmes...



No affect. Still gives the The document contains no data.






 The upload form: (There are ofcourse many of of the first three inputs.)
form action='$PHP_SELF' method='POST' enctype='multipart/form-data'

input class='form' type='text' size='3' name='tracknum[]' value='$tracks'
input class='form' type='text' size='25' name='uartist[]' value='$uartist'
input class='form' type='text' size='25' name='usong[]' value=''


input type='hidden' name='MAX_FILE_SIZE' value='1'
input type='hidden' name='upload' value='yes'
input class='nappi' type='submit' name='submit' value='Upload songs'


And the php part:

$number_of_files = count($_FILES['userfile']);
for ($i=0; $i  $number_of_files; $i++)
 {
  if ($_FILES['userfile']['size'] !== 0)
{
   $namename= $uartist[$i]-$usong[$i].mp3;
   $file=$_FILES['userfile']['tmp_name'][$i];
 if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], 
/mp3/$namename))
  {
   print trtdFile $namename upload and rename 
succesful!/td/tr;
  }
}
else
{
print trtdYou have to upload some files!/td/tr;
}
  }

antti



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



Re: [PHP] Unable to upload multiple files

2003-01-31 Thread Antti
1lt John W. Holmes wrote:

input type='hidden' name='MAX_FILE_SIZE' value='1'



You're saying you're only uploading 10K total... for all of the files. If
the browser is respecting this, and you're trying to upload more than 10K,
then it could not upload anything and you get your error.

If it was a PHP issue, it seems like you'd get an error or warning from PHP,
not from the web server (which is where document contains no data would
come from, I assume?)

---John Holmes...



That 10 k is not the right value that I had. I had 10 but just 
edited it and it changed when I pasted it here. So that is not the proglem.

After all these changes it still doesn't work =(...

antti


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



[PHP] Send commands to a shell program

2003-01-30 Thread Antti
I want to for example give commands to mpg321 when it is executed with 
the -R option (remote control mode). Is this possible with exec() or 
other execute php functions. What I mean is to execute commands while 
being in a shell program. Hope you got it!

antti


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



[PHP] Upload multiple files

2003-01-18 Thread Antti
I want to do this for multiple files. I tried to do this with a foreach 
-loop but I think I made some mistakes with the array userfile. In 
this example userfile is just the name in the input tag. When 
uploading multiple files userfile is -ofcourse- an array like this: 
name='userfile[]'. Now I want to know how to handle with that array in 
somekind of a loop. For one file the script is this:

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
   $namename=$_FILES['userfile']['name'];
move_uploaded_file($_FILES['userfile']['tmp_name'],/path/$namename);
if (rename(/path/$namename, /path/$uartist-$usong.mp3))
{
 $query = INSERT INTO table (column1,column2,column3) values 
('$value1','$value2','$value3');
 mysql_query($query) or die (Couldn't make query!);
 print File Upload and rename succesful!;
} else { print File Upload failed!; }

}

antti


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



Re: [PHP] session variables

2002-12-18 Thread Antti
Justin French wrote:

1. the opposite of 
session_register('varname') is
session_unregister('varname') NOT
unset($varname)


2. Are you on PHP = 4.1 ??

If so, move away from things like:

?
session_start();
$variable = 'foo';
session_register('variable');
session_unregister('variable')
?

and into:

?
session_start();
$_SESSION['variable'] = 'foo';
$_SESSION['variable'] = 'bah';
unset($_SESSION['variable']);
?

MUCH cleaner to work with :)


Justin



on 17/12/02 10:35 PM, Antti ([EMAIL PROTECTED]) wrote:


How can I change the values of session variables
(session_register('variable');) in a session. Do I just
unset($variable); and do session_register() again and give it a new
value. I tried this and it seems that it doesn't work.

Antti




Justin French

http://Indent.com.au
Web Development  
Graphic Design


Neather this seem to work

$_SESSION['some_variable']=$variable;

nor this:

$_SESSION['today']= date('Y-m-d h:m:s');

antti



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




Re: [PHP] session variables

2002-12-18 Thread Antti
Justin French wrote:

1. the opposite of 
session_register('varname') is
session_unregister('varname') NOT
unset($varname)


2. Are you on PHP = 4.1 ??

If so, move away from things like:

?
session_start();
$variable = 'foo';
session_register('variable');
session_unregister('variable')
?

and into:

?
session_start();
$_SESSION['variable'] = 'foo';
$_SESSION['variable'] = 'bah';
unset($_SESSION['variable']);
?

MUCH cleaner to work with :)


Justin



on 17/12/02 10:35 PM, Antti ([EMAIL PROTECTED]) wrote:


How can I change the values of session variables
(session_register('variable');) in a session. Do I just
unset($variable); and do session_register() again and give it a new
value. I tried this and it seems that it doesn't work.

Antti




Justin French

http://Indent.com.au
Web Development  
Graphic Design


Neather this seem to work

$_SESSION['ses_name']=$variable;

nor this:

$_SESSION['today']= date('Y-m-d h:m:s');

antti



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




[PHP] session variables

2002-12-17 Thread Antti
How can I change the values of session variables 
(session_register('variable');) in a session. Do I just 
unset($variable); and do session_register() again and give it a new 
value. I tried this and it seems that it doesn't work.

Antti


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



[PHP] Count lines from php files

2002-12-12 Thread Antti
How can I count how many code lines I have written? I have many php 
files in one directory. I'm using linux.Do you know any non-php way to 
count the lines.

thanks, antti


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



[PHP] take text before '-' and after it

2002-12-12 Thread Antti
How can I take some text before the mark - and after it and put them for 
example in array. The purpose of this is to read trough mp3 files which 
are in the form of artist - song.mp3 and put them into a text file so I 
can put them into mysql db.

antti


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



Re: [PHP] take text before '-' and after it

2002-12-12 Thread Antti
[EMAIL PROTECTED] wrote:

 Wouldn't it be simpler to just remove the '-'?

$var = str_replace(-,,$var);

Ed


On Thu, 12 Dec 2002, Antti wrote:



How can I take some text before the mark - and after it and put them for 
example in array. The purpose of this is to read trough mp3 files which 
are in the form of artist - song.mp3 and put them into a text file so I 
can put them into mysql db.

antti


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





No, I don't want that 'couse the database has columns artist and song 
and I want to fill them with correct values. The thing is to read the 
files and put the values into an array. but I don't know how to do it...?

antti


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



Re: [PHP] take text before '-' and after it

2002-12-12 Thread Antti


$array = explode(-,$song);

---John Holmes...


Ok, I got this. But still I don't know how to read the files from a 
directory and put them into an array so I can explode them.

antti


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



[PHP] Add lines to a text file

2002-12-11 Thread Antti
How can I add lines to a text file? I didn't find any function for this.

Thanks, antti.


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




Re: [PHP] Add lines to a text file

2002-12-11 Thread Antti
Sean Burlington wrote:

Antti wrote:


How can I add lines to a text file? I didn't find any function for this.

Thanks, antti.




just open it in the right mode

if you just need to add to the end of the file without doing anything 
else with it first

$fp = fopen (/home/rasmus/file.txt, a);

 'a' - Open for writing only; place the file pointer at the end of the 
file. If the file does not exist, attempt to create it.

http://www.php.net/manual/en/function.fopen.php

then use fwite to actually write to it


Thanks it works.
I forgot to say that i need to add a new line to that file. Now it puts 
all the stuff at the same line. How do I make it to add lines?

Antti


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



[PHP] apostrophe checks

2001-04-09 Thread Antti Boman

 Ive got a textarea control on a form where a user will enter info, i
 want to enter this info into an interbase db,ive limited the space to
 200 characters in the text area [snip]

Also remember that you must never trust what you get from the browser. Make
the script check out that the input is less than or equal to 200 before
accepting it.

-agb


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