RE: [PHP] [php] explode that :) !

2003-08-16 Thread Sævar Öfjörð
Why not:

echo "Your score is:
".split($P1OC1Q1,"")."\n";

-Original Message-
From: John Taylor-Johnston [mailto:[EMAIL PROTECTED] 
Sent: 17. ágúst 2003 03:48
To: [EMAIL PROTECTED]
Subject: Re: [PHP] [php] explode that :) !

Kind of hoping to do shorten it like this:

echo "Your score is:
".$score[0]=split($P1OC1Q1,"¶")."\n";

No such hopes?

> Looks like a really simple piece of code except for the cryptic
variable names.
>
> >$P1OC1Q1 = "1¶some text or some comment";
> >echo "Your score is: "; $score=split($P1OC1Q1,"¶");
echo $score[0]."\n";
> >
> >Do I have to go through all that to get score[0] ?


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



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



[PHP] executing a shell command within a function

2003-08-15 Thread Sævar Öfjörð
Hi,

I’m coding a function that will create a set of directories using
execution of shell commands within the function. Then the function saves
different sizes of images in each directory. Later in the function I
open one of these directories to list the content in them. The problem
is that the directoris don’t exist when the function is trying to list
the content in them. When I execute the function again with exactly the
same parameters there is no problem, then the directories exist!

I’m thinking that the shell commands are somehow set in some kind of
buffer or queue and are not executed until the rest of the php code is
executed?
Could this be true? If anyone has anything to say on this I’d appreciate
it.

BTW I'm using RH8.0 and PHP 4.2.2
 
Kveðja,
Sævar Öfjörð
[EMAIL PROTECTED]
þetta reddast - hönnunarlausnir
www.reddast.is



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



RE: [PHP] How can I add records to database every 60 minutes???

2003-07-29 Thread Sævar Öfjörð
I'm not sure if this is possible in PHP, but Apache's Cron should take
care of this.

-Original Message-
From: phpu [mailto:[EMAIL PROTECTED] 
Sent: 29. júlí 2003 09:49
To: [EMAIL PROTECTED]
Subject: [PHP] How can I add records to database every 60 minutes???

Hello
I'm making an online game in php and mysql. Can someone tell me how can
I add records to database every 60 minutes (even when i'm not online)


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



RE: [PHP] Re: homemade authentication function [SOLVED]

2003-07-23 Thread Sævar Öfjörð
Hey, thanks Sven. This seems to be working for me.

-Original Message-
From: sven [mailto:[EMAIL PROTECTED] 
Sent: 23. júlí 2003 10:35
To: [EMAIL PROTECTED]
Subject: [PHP] Re: homemade authentication function

i think the problem isn't only your 'return false' but also your 'return
true' in your first loop through your foreach will definetly a 'return'
be
passed. and return means return a value AND stop the function. not?

try it this way:

foreach ($groups as $value)
{
if(!isset($this->user['groups'][$value]) ||
!$this->user['groups'][$value])
{
return false;
}
}
return true;

ciao SVEN

SævË Ölêöyp wrote:
> I'm making an authentication script with groups and roles. This
> function checks if the groups the user belongs to specified groups
> and compares them to the groups required. However, since this is a
> loop, the function doesn't return true or false as expected. If I
> call the function and require 3 groups, and the user belongs to only
> one of them, he is still accepted. Is this method right thinking?
> Should I make the function stop somehow when it returns false for the
> first time? All suggestions and comments are appreciated. Thanks.
>
> This is the function:
>
> function require_groups() {
> if (!isset($this->user['groups'])) {
> $this->user['groups'] =
> $this->get_user_groups($this->id);
> }
> $groups = func_get_args();
> foreach ($groups as $value) {
> if
> (!isset($this->user['groups'][$value]) ||
> !$this->user['groups'][$value]) {
> return false;
> }
> else{
> return true;
> }
> }
> }
>
> And I call it like this: require_groups("admins",
> "moderators","members");
> This returns true.
>
> Kveðja,
> Sævar Öfjörð
> [EMAIL PROTECTED]
> þetta reddast - hönnunarlausnir
>
>
 oft\Signatures\www.reddast.is> www.reddast.is



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



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



RE: [PHP] Session problem

2003-07-23 Thread Sævar Öfjörð
You have to specify which warnings and errors if you want someone to
help

-Original Message-
From: tana dsasa [mailto:[EMAIL PROTECTED] 
Sent: 23. júlí 2003 09:58
To: [EMAIL PROTECTED]
Subject: [PHP] Session problem

I have installed an user-login aplication on my website (
http://www.norbertnet.ro ) but i have problems with session controls.
I receive all kinds of warnings and i don't know how to interpret them
 
thanks advanced


-
Want to chat instantly with your online friends? Get the FREE
Yahoo!Messenger


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



[PHP] homemade authentication function

2003-07-23 Thread Sævar Öfjörð
I’m making an authentication script with groups and roles. This function
checks if the groups the user belongs to specified groups and compares
them to the groups required. However, since this is a loop, the function
doesn’t return true or false as expected. If I call the function and
require 3 groups, and the user belongs to only one of them, he is still
accepted. Is this method right thinking? Should I make the function stop
somehow when it returns false for the first time? All suggestions and
comments are appreciated. Thanks.
 
This is the function:
 
function require_groups() {
if (!isset($this->user['groups'])) {
$this->user['groups'] =
$this->get_user_groups($this->id);
}
$groups = func_get_args();
foreach ($groups as $value) {
if
(!isset($this->user['groups'][$value]) ||
!$this->user['groups'][$value]) {
return false;
}
else{
return true;
}
}
}
 
And I call it like this: require_groups(“admins”,
“moderators”,“members”);
This returns true. 
 
Kveðja,
Sævar Öfjörð
[EMAIL PROTECTED]
þetta reddast - hönnunarlausnir
 
 www.reddast.is
 


RE: [PHP] radio button arrays and php3

2003-07-23 Thread Sævar Öfjörð
This is the very nature of radiobuttons. They are ment to return only
one value because you can only select one of them. If you want all
values returned in an array you have to use checkbox. Checkboxes allow
multiple selections.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 23. júlí 2003 03:12
To: [EMAIL PROTECTED]
Subject: [PHP] radio button arrays and php3

hi there i dont know if this happens in php4 but say i have a list of
radio
buttons in an array like



it only returns the one selected into the array, so instead of having 2
keys i only get the one , the empty one doesnt seem to get submitted ,
how
can i make both turn up in the array ?



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



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



RE: [PHP] retrieving form checkbox values

2003-07-17 Thread Sævar Öfjörð

I think you have to do 
Then $File becomes an array. If you want to retrieve the value for each
checkbox you can use a for loop and do value=$File[$i]

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED] 
Sent: 17. júlí 2003 08:58
To: [EMAIL PROTECTED]
Subject: Re: [PHP] retrieving form checkbox values

On Thursday 17 July 2003 16:45, caspar kennerdale wrote:
> I have a form which I want to post multiple values from one function
to
> another using checkboxes.
>
> Having one value is simple- the form submits the value $File and is
then
> retrieved in the target function via $_Request['File'] So far so good.
>
> Now I want to have multiple values for $File, because $File is a value
> assigned to a dynamically generated list of files in a folder (which
will
> change from folder to folder).
>
> If I have multiple  then
only
> the last value is posted to the next function and retrieved by
> $_Request['File']
>
> How can I post and retrieve all values of $File or am I going about
this
> the wrong way?

manual > PHP and HTML

Or search the archives and/or ask google.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
My doctor told me to stop having intimate dinners for four.  Unless
there
are three other people.
-- Orson Welles
*/


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



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



RE: [PHP] Multiple upload files with php problem!!

2003-07-09 Thread Sævar Öfjörð
This is supported in the standards I think, as it says clearly in the
HTML 4.01 specification on www.w3.org:

"file select - This control type allows the user to select files so that
their contents may be submitted with a form."

Note that 'files' is plural.

However, no browser yet supports this feature. The only way to upload
multiple files in one page is to create multiple fileboxes and store the
filenames in an array.

Or you could do it like me, upload zipfiles and extract them with some
ziplibrary, like zlib.


-Original Message-
From: Francisco Morales
[mailto:[EMAIL PROTECTED] 
Sent: 9. júlí 2003 08:30
To: [EMAIL PROTECTED]
Subject: [PHP] Multiple upload files with php problem!!


Hi, I need to upload multiples files using php, but with the same
"" 
tag,
somebody can help my, is this feature supported by php?.

Anyboy knows how to invocate the browser windows that allow to select
more 
than one file for upload ?

thanks a lot

_
Melodías, logos y mil servicios para tu teléfono en MSN Móviles.  
http://www.msn.es/MSNMovil/


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



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



[PHP] serialize?

2003-07-08 Thread Sævar Öfjörð
Hi. I’m coding a poll system which stores information in MySQL.

When a new poll is created a new row is inserted in the table ‘polls’.
There I keep basic information such as the question, id etc. But should
I keep the poll options in one field also? Then I would create an array
from the poll options the user specifies, serialize it and then
base64_encode it.

Is this a good way of storing an array or should I make a database table
named for example: ‘polls_options’?

Any opinions and thougts on this appreciated.


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



RE: [PHP] Warning: Invalid argument supplied for foreach()

2003-07-06 Thread Sævar Öfjörð
Don't you think it should be like this?

foreach($champs as $key=>$value) {
echo"$key";
//--^
}

-Original Message-
From: arnaud gonzales [mailto:[EMAIL PROTECTED] 
Sent: 6. júlí 2003 20:51
To: Php-General
Subject: [PHP] Warning: Invalid argument supplied for foreach() 

Hi all,
I am getting crazy, can't understand what i missed!
Does anybody know?

$champs = array ("titre_art" => "h3" ,"nom" => "bleu", "prenom" =>
"green",
"resume" => "bold");

foreach($champs as $key => $value) {


echo "$row($key))";
 }

TIA.
zeg


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



RE: [PHP] mysql_query

2003-07-06 Thread Sævar Öfjörð
Hmm. Should have been like this..

-Original Message-
From: Sævar Öfjörð [mailto:[EMAIL PROTECTED] 
Sent: 6. júlí 2003 14:04
To: [EMAIL PROTECTED]
Subject: Re: [PHP] mysql_query

SELECT * FROM my_table WHERE var1='$var1' AND var2='$var2'


--^
 
you use AND
 
-Original Message-
From: Kevin Fradkin [mailto:[EMAIL PROTECTED] 
Sent: 6. júlí 2003 13:43
To: [EMAIL PROTECTED]
Subject: [PHP] mysql_query
 
hi... 1 question...
how can i show in a table the query i'm trying to make
 
this is what i want :
select * from my_table where var1='$val1' /* here comes the trouble
cause i want to use 2 instead of only one... */  var2='$val2'
 
how you have to use it for more than one? where var1='$val1' ???
var2='$val2' ?
 
thanks in advance..
 
 
 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


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



Re: [PHP] mysql_query

2003-07-06 Thread Sævar Öfjörð
SELECT * FROM my_table WHERE var1='$var1' AND var2='$var2'
--^
 
you use AND
 
-Original Message-
From: Kevin Fradkin [mailto:[EMAIL PROTECTED] 
Sent: 6. júlí 2003 13:43
To: [EMAIL PROTECTED]
Subject: [PHP] mysql_query
 
hi... 1 question...
how can i show in a table the query i'm trying to make
 
this is what i want :
select * from my_table where var1='$val1' /* here comes the trouble
cause i want to use 2 instead of only one... */  var2='$val2'
 
how you have to use it for more than one? where var1='$val1' ???
var2='$val2' ?
 
thanks in advance..
 
 
 
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 


RE: [PHP] Using PHP to read style sheet -- create drop-down?

2003-07-03 Thread Sævar Öfjörð
Sorry, my bad. Replace $hm with $file[$i]. $hm was for my testing
purposes and I forgot to change it :)


-Original Message-
From: J J [mailto:[EMAIL PROTECTED] 
Sent: 3. júlí 2003 02:34
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Using PHP to read style sheet -- create drop-down?

It's reading the file but returning a blank drop-down
with your example.  Where I'm confused is where is $hm
defined?


--- Sævar Öfjörð <[EMAIL PROTECTED]> wrote:
> Sure. You should use file functions like 
> 
> http://is.php.net/manual/en/function.fopen.php
> http://is.php.net/manual/en/function.fread.php
> or
> http://is.php.net/manual/en/function.file.php
> 
> to read the file and then maybe
> 
> http://is.php.net/manual/en/function.preg-match.php
> 
> to extract certain elements from the text.
> 
> Here is what i came up with:
> 
> $file=file("whatever.css");
> $total=count($file);
> print "\n";
> for($i=0;$i<$total;$i++){
>   preg_match("/^[.]?([a-zA-Z])+/",$hm,$matches);
>   print " ".$matches[0]."\n";
> }
> print "";
> 
> This should output:
> 
>  .heading
>  .headingBold
> 
> 
> 
> 
> -Original Message-
> From: J J [mailto:[EMAIL PROTECTED] 
> Sent: 2. júlí 2003 21:58
> To: [EMAIL PROTECTED]
> Subject: [PHP] Using PHP to read style sheet --
> create drop-down?
> 
> Is it possible for PHP or maybe javascript+php to
> read
> in a style sheet (whatever.css) and create a
> drop-down
> of all the elements within that style sheet?
> 
> CSS contains:
> .heading {blah blah size blah}
> .headingBold {blah blah size blah bold}
> 
> 
> Then in PHP I'd like to have a drop down that shows
> those elements found in the style:
> 
> 
>  heading
>  headingBold
> 
> 
> Is that possible to read in another file to create a
> drop-down?
> 
> Thanks in advance!
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com


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



[PHP] Problem authenticating through sessions and cookies

2003-07-02 Thread Sævar Öfjörð
I’m trying to write a class for authentication. I’ve got it going quite
good but there are some problems I’m not shure how to deal with.

First, here's the idea:
When the class is called, the constructor checks a session variable to
see if the user is logged in. If not, it checks if a client-cookie is
set.
If the user is already logged in, the checksession function checks a
database to see if ip matches and so on. If all that matces, the session
is updated. If on the other hand a client-cookie is set, the cookie is
compared to the database and if true, the session is updated.

Now, when the user logs in, he can check a box if he wants to
remembered. Then, a cookie is generated and sent to client.

The problem is, a cookie seems to be generated, even if I don't check
the check box. Further more, when I log in, the session seems to be set.
When I refresh, a cookie that isn't supposed to exist is checked and the
session variables don't work. Then if I refresh again the session is ok
but cookie is not checked etc...

If someone has the time it would be great if he or she could take a look
at the code. Thanks in advance for any help.

Class.auth.php
-


debug=$debug;
$this->mysql=dbConnect($debug);
if ($_SESSION['logged']) {
$this->_checkSession();
}
elseif ( isset($_COOKIE['auth']) ) {
$this->_checkRemembered($_COOKIE['auth']);
}
}


function _checkLogin($username,$password,$remember){
if($this->debug) echo "checking login...";
if($remember="true"){
$remember=true;
}
else{
$remember=false;
}
$username=$this->mysqlEsc($username);
$password=$this->mysqlEsc(md5($password));
if($this->mysql->query("SELECT * FROM member WHERE
username=$username AND password=$password")){
if($this->mysql->num_rows() > 0){
while($this->mysql->movenext()){
$values=$this->mysql->getrow();
}
$this->_setSession($values,$remember);
return true;
}
else{
$this->failed=true;
$this->_logout();
return false;
}
}
else{
print "could not connect db.";
}
}


function _setSession(&$values,$remember,$init=true){
if($this->debug) echo "Setting session...";

$this->id = $values[id];
if(!$values[cookie] && $remember==true){
$cookie=$this->generateCookie();
$_SESSION['cookie'] = $cookie;
}
else{
$_SESSION['cookie'] = $values[cookie];
$cookie=$values[cookie];
}
$_SESSION['uid'] = $this->id;
$_SESSION['username'] =
htmlspecialchars($values[username]);
$_SESSION['logged'] = true;
if($remember==true) {
$this->updateCookie($cookie, true);
}
if($init) {
$session = $this->mysqlEsc(session_id());
$ip = $this->mysqlEsc($_SERVER['REMOTE_ADDR']);
$sql = "UPDATE member SET session=$session,
ip=$ip WHERE ".
  "id = $this->id";
$this->mysql->query($sql);
}
}

function _checkSession() {
if($this->debug) echo "checking session...";
$username = $this->mysqlEsc($_SESSION['username']);
$cookie = $this->mysqlEsc($_SESSION['cookie']);
$session = $this->mysqlEsc(session_id());
$ip = $this->mysqlEsc($_SERVER['REMOTE_ADDR']);
$sql = "SELECT * FROM member WHERE " .
  "(username = $username) AND (cookie = $cookie) AND " .
  "(session = $session) AND (ip = $ip)";
if($this->mysql->query($sql)){
while($this->mysql->movenext()){
$result=$this->mysql->getrow();
}
}
if (is_object($result) ) {
$this->_setSession($result, false, false);
}
else{
$this->_logout();
}
}

function updateCookie($cookie, $save) {
if($this->debug) echo "Updating cookie...";


RE: [PHP] Using PHP to read style sheet -- create drop-down?

2003-07-02 Thread Sævar Öfjörð
Sure. You should use file functions like 

http://is.php.net/manual/en/function.fopen.php
http://is.php.net/manual/en/function.fread.php
or
http://is.php.net/manual/en/function.file.php

to read the file and then maybe

http://is.php.net/manual/en/function.preg-match.php

to extract certain elements from the text.

Here is what i came up with:

$file=file("whatever.css");
$total=count($file);
print "\n";
for($i=0;$i<$total;$i++){
  preg_match("/^[.]?([a-zA-Z])+/",$hm,$matches);
  print " ".$matches[0]."\n";
}
print "";

This should output:

 .heading
 .headingBold




-Original Message-
From: J J [mailto:[EMAIL PROTECTED] 
Sent: 2. júlí 2003 21:58
To: [EMAIL PROTECTED]
Subject: [PHP] Using PHP to read style sheet -- create drop-down?

Is it possible for PHP or maybe javascript+php to read
in a style sheet (whatever.css) and create a drop-down
of all the elements within that style sheet?

CSS contains:
.heading {blah blah size blah}
.headingBold {blah blah size blah bold}


Then in PHP I'd like to have a drop down that shows
those elements found in the style:


 heading
 headingBold


Is that possible to read in another file to create a
drop-down?

Thanks in advance!

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



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



RE: [PHP] Sharing Cookies with Java?

2003-07-01 Thread Sævar Öfjörð
I don't know about Java, but JavaScript can use php cookies and
vice-versa.

-Original Message-
From: Jiann-Ming Su [mailto:[EMAIL PROTECTED] 
Sent: 1. júlí 2003 19:50
To: [EMAIL PROTECTED]
Subject: [PHP] Sharing Cookies with Java?

Can php share cookies with java servlets?  Specifically, can php use
cookies
written by a java servlet?

-- 
Jiann-Ming Su  [EMAIL PROTECTED]  404-712-2603
Development Team Systems Administrator
General Libraries Systems Division


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



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



RE: [PHP] need help w/ sql query - update and select at once

2003-07-01 Thread Sævar Öfjörð
Actually, when I took another look at the manual, it says:

Starting with MySQL Version 4.0.4, you can also perform UPDATE
operations that cover multiple tables: 

UPDATE items,month SET items.price=month.price
WHERE items.id=month.id;

So it is even newer than 4.0.1


-Original Message-
From: Andrew McCombe [mailto:[EMAIL PROTECTED] 
Sent: 1. júlí 2003 23:33
To: [EMAIL PROTECTED]
Subject: Re: [PHP] need help w/ sql query - update and select at once



> Theoretically, you should be able to do a multi-table update since
MYSQL
> 3.23, like this:
> 
> UPDATE tablename, tablename2 SET  tablename.field1  =  'yes' WHERE
> tablename.userid = tablename2.userid;
> 
> I haven't tested it, though.
> 

Sorry, no you can't do this in 3.23.*.  MySQL  > 4.01 supports this. 

Regards
Andrew


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



RE: [PHP] need help w/ sql query - update and select at once

2003-07-01 Thread Sævar Öfjörð
Theoretically, you should be able to do a multi-table update since MYSQL
3.23, like this:

UPDATE tablename, tablename2 SET  tablename.field1  =  'yes' WHERE
tablename.userid = tablename2.userid;

I haven't tested it, though.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

Sent: 1. júlí 2003 02:33
To: [EMAIL PROTECTED]
Subject: [PHP] need help w/ sql query - update and select at once

hi i'm trying to get this sql query to work, i'm trying to update and
select at the same time, i'm not even sure if this  is even possible

update db.tablename set field1='yes' where (select * from
db.tablename,db.tablename2 where
db.tablename.userid=db.tablename2.userid);

basically i have a column called 'userid'.  this column exists in both
tablename, and tablename2.  where the value of userid in tablename is
equal to the value of userid in tablename2, i'd like to set the value of
field1 to 'yes'.

can this be done from the command line?  or am i better off writing
another php page to accomplish this?

thanks again
redmond



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



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



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

2003-07-01 Thread Sævar Öfjörð
http://is.php.net/manual/en/features.file-upload.php

There you can see how to use the $_FILES autoglobals ($HTTP_POST_FILES
in php versions prior 4.1.0) to get the size of the uploaded file in
bytes.
So, for example, you can do this before saving the uploaded file:

if($_FILES['userfile']['size'] > $maxsize){
  echo "Error. The file was to large. Max file size is $maxsize.";
}

-Original Message-
From: Dani Matielo [mailto:[EMAIL PROTECTED] 
Sent: 1. júlí 2003 14:25
To: [EMAIL PROTECTED]
Subject: [PHP] File upload: type and size question

Hello,

could someone help me? I am trying to limit the type and size of the
files
to be uploaded, but I can't find how to do this. I have seen examples on
how
to limit to image types, with the MIME function. The problem is, the
type of
file I want is audio, extensions MP3 or WAV. The max file size should be
150Kb.

Thank you for your help! :))

Dani


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.488 / Virus Database: 287 - Release Date: 5/6/2003



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



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



RE: [PHP] Re: Form 2 PDF 2 Form

2003-07-01 Thread Sævar Öfjörð
You could use a temp table in the database which gets cleaned up both
when the last page is completed or if there is data in it when the user
starts from scratch. Of course you would have to use sessions to
identify each user to each line of temp data. I'm not sure if this will
work, there are some problems to overcome here.

-Original Message-
From: Petre Agenbag [mailto:[EMAIL PROTECTED] 
Sent: 1. júlí 2003 12:01
To: Shivanischal A
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Form 2 PDF 2 Form

Hi Shiva
Appreciate your input. Wrt the spanning of the form, I think, in my
situation, it would actually make things worse... You see, my suspicion
is that most of the users who are experiencing problems, have very bad
connections, many complain that they lose connectivity while they are
busy with the form ( it takes them maybe 30 min or so to fill out the
entire form ( they basically transfer the data off paper forms they have
filled out earlier while "on-site", so it's not really alot of data, but
there are a lot of fields...)
So, my fear with this approach is that they will maybe get past the
first part of the form, submit that OK, then start getting trouble with
subsequent parts, leaving me with a whole lot of partial entries in the
DB., and how do I get them to "resume" at a a later stage?
You don't understand the mindset of these people, when something goes
wrong, they'll switch off their PC's and try to start from scratch, so
it's going to be difficult to try and get them to understand the concept
of multi-part forms... I shudder to even think what will happen, or
worse, how I will be able to allow them to make corrections on a certain
part of the form once they have submit it. And sometimes, to their
defense, it's not them that want to change the details on the form, but
the subject of the form who has decided to change their name etc...

I'm not ditching this idea, I will definitely give it some more thought,
it's just at this moment, my mind is running through my original idea of
PDF forms trying to evaluate it.

Each method will have it's pro's and cons, and I'll have to go and weigh
them. I must add, I don't see "effort" as a con for a particular
solution, as long as I know it will solve the problem without adding
other cons...

Thanks again, will take it up with you again ( need some more input on
this PDF thing to get some balanced views)

PS, if you have experience with using this method, I would appreciate it
if you could let me have your "field notes" and how successfull it's
working for you.
You see, the main thing here is that I need to KNOW when someone who
says they have submitted something actually have, and that they are not
trying their luck...

  
On Tue, 2003-07-01 at 13:43, Shivanischal A wrote:
> hi,
> 
> seems u have complicated task on hand mate. cant u simply consider
span the
> user input over multiple pages? i mean using 2 or more form on
different
> pages instead of a single form on one single page. if this cant be
done,
> we'll think of other measures. but this is by far the most simple
method
> 
> -shiva
> 
> 
> "Petre Agenbag" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi List
> >
> > OK, firstly, sorry if this has been on the list before...
> >
> > What I'd like to do is something like this:
> >
> > I currently have an app that takes user input via a normal html
form,
> > and then pops the content into mysql.
> >
> > The problem is that lots of user complain that the submit times out
due
> > to slow/bad connections, and hence the data gets lost.
> >
> > What I was hoping to do now, was to somehow create a PDF form from
the
> > current html form ( should generate itself on the fly ) , the PDF
form
> > will obviously need to be downloaded to the user's PC, and will be
> > unique for each time they use the system, ie, I don't want to just
give
> > them a blank template PDF, some of the values need to be
> > "auto-completed" and inserted into the form as "read-only", as well
as a
> > couple of "hidden" fields with identifying values so I can know
where to
> > pop it into the db.
> >
> > The idea is that the user will now come to the point where he would
> > usually have filled in the html form, but instead, the app must
> > autogenerate a PDF with some values auto-completed and/or hidden,
and
> > the user then downloads the pdf to his/her PC, where they continue
to
> > fill out the pdf form.
> >
> > Then, on completetion, I'd like to investigate several delivery
> > mechanisms, arguably, the easiest way for the users ( who are mostly
> > techno-peasants), is to simply e-mail the pdf as an attachment to
me),
> > but then I will either have to create an auto-parser for the email
> > (prolly difficult and prone to problems with making sure the
attachment
> > is correct etc), or I will have to then manually process the
> > attachments.
> >
> > Either way, I would need to "feed" the pdf to my app, where the
> > form/hidden variables would need to be harv

RE: [PHP] Using Different Fonts on Web Via generated Image

2003-06-30 Thread Sævar Öfjörð
Try this:
http://is2.php.net/manual/en/function.imagettftext.php


-Original Message-
From: Miranda, Joel Louie M [mailto:[EMAIL PROTECTED] 
Sent: 30. júní 2003 07:41
To: '[EMAIL PROTECTED]'
Subject: [PHP] Using Different Fonts on Web Via generated Image

Hello,

Can I generate an image using a different font? For example my font will
be
Anonymous and we all know that on the client side if you don't have the
anonymous font it will display another font. But can we generate an
image
using that font via php?

Thanks



--
Louie

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



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



RE: [PHP] php question... opening external page/writing to it...

2003-06-23 Thread Sævar Öfjörð
I don't know if this is what you mean, but here is what you need to edit
files:

http://us2.php.net/manual/en/function.fopen.php
http://us2.php.net/manual/en/function.fwrite.php
http://us2.php.net/manual/en/function.fclose.php



-Original Message-
From: my [mailto:[EMAIL PROTECTED] 
Sent: 24. júní 2003 00:26
To: [EMAIL PROTECTED]
Subject: [PHP] php question... opening external page/writing to it...

Hey...

A quick question...

How can I do the following (I know it's simple..!!!)

All from the same page...

Do some processing...
Open an external page
Write some stuff to the external page...

The issue I seem to have is that if I open the external page during the
onload... it's not ready when I want to write the data

Any hints/comments/samples

Thanks...

Bruce
[EMAIL PROTECTED]


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



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



RE: [PHP] Change image file size dynamically

2003-06-23 Thread Sævar Öfjörð
Of course you have to have GD library installed.

-Original Message-
From: Chris Sherwood [mailto:[EMAIL PROTECTED] 
Sent: 23. júní 2003 21:34
To: Hardik Doshi; [EMAIL PROTECTED]
Subject: Re: [PHP] Change image file size dynamically

check out this link it should have the answers your looking for

http://ca3.php.net/manual/en/function.imagecreatefromjpeg.php
- Original Message - 
From: "Hardik Doshi" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 23, 2003 2:14 PM
Subject: [PHP] Change image file size dynamically


> Hi Group,
> 
> Is there any way to change the image size (Not height
> and width. I am talking about image file size)
> dynamically? 
> 
> Our users upload the big files and we want to find a
> way so once user upload such file, system will
> automatically generate the small file and store both
> versions on the server location. Later on this small
> file will show up as the thumbnail. Once user clicks
> on thumbnail then system will show the original big
> file.
> 
> Thanks
> 
> Hardik
> 
> -
> 
> Hardik K. Doshi
> Web Application Developer
> 
> Institute of Design
> Illinois Institute of Technology
> 350, North Lasalle Street
> Chicago, Illinois 60610
> 
> 312.595.4907 (direct)
> 312.595.4901 (fax)
> 
> __
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


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



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



RE: [PHP] Convert KB to MB?

2003-06-21 Thread Sævar Öfjörð
Actually, if we want too go into details, according to the international
standard for units, there is a big difference in 'M' and 'm'. 'M' means
Mega and 'm' means milli. You are probably aware of that Mega is 10 in
the power of 3 but milli is 10 in the power of -3. The difference is,
like, a million.

On the other hand, millibytes seems just absurd. I mean, 1/1000 of a
byte, what is that? So I guess nobody cares about wether they are typing
'M' or 'm'...

Sævar - Iceland

-Original Message-
From: Brent Baisley [mailto:[EMAIL PROTECTED] 
Sent: 20. júní 2003 14:27
To: Ian Mantripp
Cc: Mike Migurski; MIKE YRABEDRA; PHP List
Subject: Re: [PHP] Convert KB to MB?

Again I say "Ahhh". Are you mixing your bits and bytes then?
1MB =1024KB
1mb=1000kb

Although upper and lower case seem to have becoming interchangeable, 
even though technically they have different meaning. The simple formula 
is suddenly getting more complicated.

On Friday, June 20, 2003, at 04:41 AM, Ian Mantripp wrote:

>> Ahhh, but then marketing gets involved and changes the 1024 to 1000 
>> and
>> ta da, you now have more MegaBytes. 1024 is the right number to use,
>> but don't be surprised if it doesn't match with some numbers you
might
>> compare it to.
>
> Not necessarily, in data storage 1mb = 1024kb but in data transfer 1mb

> =
> 1000kb.
-- 
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


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



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



RE: [PHP] Pre-4.1 / register_globals=off

2003-06-19 Thread Sævar Öfjörð

>From manual on www.php.net:
"Use $HTTP_SESSION_VARS with PHP 4.0.6 or less"

Sævar - ICELAND


-Original Message-
From: Lee Herron QCS [mailto:[EMAIL PROTECTED] 
Sent: 20. júní 2003 00:01
To: [EMAIL PROTECTED]
Subject: [PHP] Pre-4.1 / register_globals=off

If register_globals is turned off, and the php version being used is
pre-4.1
(meaning no $_SESSION array) how do you access sessions values? How do
you
"register" them?



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



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



RE: [PHP] How to UPDATE only certain fields

2003-06-19 Thread Sævar Öfjörð
The right SQL syntax would be:

UPDATE $table SET type='$type', year='$year' WHERE id='$id';

Sævar - ICELAND



-Original Message-
From: Matt Hedges [mailto:[EMAIL PROTECTED] 
Sent: 19. júní 2003 23:07
To: [EMAIL PROTECTED]
Subject: [PHP] How to UPDATE only certain fields

Hello,

I am building an database of wines.  I have fields of stuff like year,
grape, etc.  However, I want to be able to go in and change something
without having to retype every field.  As I have it right now, I use the
UPDATE where id=$id function.  However, this changes EVERY field. For
example, if I want to only change the grape field and leave everything
else
the same (so I thus leave those fields blank) it overwrites the others
with
a blank field.

Is there anyway to where if it reads a blank field instead of deleting
the
old information, the update php file just leaves it the same?


thanks very much for any help,
Matt Hedges





-- 
___
| Matt Hedges
| http://hedgesinnovations.com
|



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



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



RE: [PHP] strange crypt() problem

2003-06-19 Thread Sævar Öfjörð

Well, if you don't find another solution for this, you could generate
random passwords for each member and mail them to them. Then you would
md5() them and update the DB with new md5()'ed passwords... This is not
the easy way out so I hope someone finds out why the crypt() is behaving
strangely.

Sævar - ICELAND

-Original Message-
From: Huzz [mailto:[EMAIL PROTECTED] 
Sent: 19. júní 2003 22:43
To: [EMAIL PROTECTED]
Subject: Re: [PHP] strange crypt() problem 

I already have about 1000 members their password crypted using crypt();
would they able to login using their password or they have to change it
again??

Thanks


"SævË Ölêöyp" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Try using md5() instead because it is more widely supported than crypt()
and it leaves no room for errors.

Hope it helps,
Sævar ICELAND


-Original Message-
From: Huzz [mailto:[EMAIL PROTECTED]
Sent: 19. júní 2003 21:43
To: [EMAIL PROTECTED]
Subject: [PHP] strange crypt() problem

I have this bit of code to crypt user password in user registration as
shown
below.

 $cryptpass=crypt($makepass);
which generated crypted password like eg 37Q9fppLHc4fQ with php 4.0

And am using the codes below to check for valid login..
// $pass -  from login page
// $dbpass - from the database
 $pass=crypt($pass,substr($dbpass,0,2));
}
if (strcmp($dbpass,$pass)) {
return(0);
}


Recently i have moved the same file to a new server with php 4.3.1 the
problem is the same piece of codes above generates completely differen
crypted  value eg.$1$RjZHv7qx$h/L9ZUNT48rilHB6fGoMP/  .. hence the login
codes above does not work... :(

Please someone tell me that  i am not going mad

please help
huzz




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




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



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



RE: [PHP] explode, split, or what?

2003-06-19 Thread Sævar Öfjörð


why don't you just do this?

***

***

file() returns the file in an array, each line as new value, so line nr.
1 is $line[0], line nr. 2 is $line[1] etc...
I added stripslashes() on the output so that you won't get "John\'s X
Log"


Sævar - ICELAND


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



RE: [PHP] strange crypt() problem

2003-06-19 Thread Sævar Öfjörð
Try using md5() instead because it is more widely supported than crypt()
and it leaves no room for errors.

Hope it helps,
Sævar ICELAND


-Original Message-
From: Huzz [mailto:[EMAIL PROTECTED] 
Sent: 19. júní 2003 21:43
To: [EMAIL PROTECTED]
Subject: [PHP] strange crypt() problem 

I have this bit of code to crypt user password in user registration as
shown
below.

 $cryptpass=crypt($makepass);
which generated crypted password like eg 37Q9fppLHc4fQ with php 4.0

And am using the codes below to check for valid login..
// $pass -  from login page
// $dbpass - from the database
 $pass=crypt($pass,substr($dbpass,0,2));
}
if (strcmp($dbpass,$pass)) {
return(0);
}


Recently i have moved the same file to a new server with php 4.3.1 the
problem is the same piece of codes above generates completely differen
crypted  value eg.$1$RjZHv7qx$h/L9ZUNT48rilHB6fGoMP/  .. hence the login
codes above does not work... :(

Please someone tell me that  i am not going mad

please help
huzz




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



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



[PHP] Problem while retrieving data from cookie with unserialize

2003-06-19 Thread Sævar Öfjörð
Hi, I’m having this problem:

I set a cookie using this:

$sql = "UPDATE member SET cookie=$cookie WHERE
".
  "id = $this->id";
$this->mysql->query($sql);
$cookie =
urlencode(serialize(array($_SESSION['username'], $cookie)));
setcookie('auth', $cookie, time() + 31104000,
'/', 'www.reddast.is');

And then when I check the cookie using this:

list($username, $cookie) =
@unserialize(urldecode($cookie));


using this query:

"SELECT * FROM member WHERE (username = $username) AND
(cookie = $cookie)";

it looks like this when I debug the script and see the actual query that
is sent to Mysql:

"SELECT * FROM member WHERE (username = 'ofjord') AND
(cookie = '\'86aa5f7e6469efe09a17089957f59b0f\'')";


I hope someone has any answers on this.

Best regards,
Sævar Öfjörð Magnússon
[EMAIL PROTECTED]
ICELAND


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