Re: [PHP] E-Mail Attachment Filename Encoding Problem

2009-02-16 Thread Carl-Fredrik Gustafsson

Per Jessen schrieb:

Edmund Hertle wrote:


my problem is that I send an e-mail with an attachment (pdf file). I
get the filename out of a mysql table. While using echo or downloading
the file, the filename is showed as expected but as an attachment it
is not properly encoded:
Should be: PC-Beschaffung 2008 (nur für Lehre)
Will be: US-ASCII''PC-Beschaffung%202008%20(nur%20f%C3%BCr%20Lehre)

I think I have to encode the file name and already tried utf8encode
but this didn't help.


I think you need to mime-encode it - mb_encode_mimeheader().  I haven't
tried it with attachments though.


/Per





To me it looks like he only wants the spaces and special-chars in the 
filename to be readable again.
I guess you submit the filename over the url, by doing that it 
automatically gets url-encoded (spaces and special chars are converted 
to entities).
If that's all you want (convert the entities to chars again), you need 
to apply a urldecode() on the filename, then I think you should be fine.


Greets Calle

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



Re: [PHP] Re: Simple PHP setting arrays with keys question

2007-07-10 Thread Fredrik Thunberg


Dan skrev:
Oh yeah, the problem isn't that I'm using - instead of =.  Well that 
was a problem but I fixed that and it's still not working.


- Dan

Dan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I'm having a little problem assigning a value to an array which has a 
key. It's simple, I just don't know what I'm doing wrong.


   foreach($Checkout as $value)
  {
  $products[] = $value['productName'] - 
$value['actualValue'];

   }

HELP! 




either:

$products[$value['productName']] = $value['actualValue'];

OR

$products[] = array( $value['productName'] = $value['actualValue'] );

--
/Thunis

I think you ought to know I'm feeling very depressed.
  --The Hitchikers Guide to the Galaxy

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



Re: [PHP] Re: Simple PHP setting arrays with keys question

2007-07-10 Thread Fredrik Thunberg

Jim Lucas wrote:

Fredrik Thunberg wrote:


Dan skrev:
Oh yeah, the problem isn't that I'm using - instead of =.  Well 
that was a problem but I fixed that and it's still not working.


- Dan

Dan [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
I'm having a little problem assigning a value to an array which has 
a key. It's simple, I just don't know what I'm doing wrong.


   foreach($Checkout as $value)
  {
  $products[] = $value['productName'] - 
$value['actualValue'];

   }

HELP! 




either:

$products[$value['productName']] = $value['actualValue'];

OR

$products[] = array( $value['productName'] = $value['actualValue'] );


But these are not the same...


I never said that they we're. Just wanted to show what he could do. :)

/T

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



Re: [PHP] A very strange loop!

2007-07-09 Thread Fredrik Thunberg

For exactly the same reason as

for( $i = 0; $i  10; $i++)

produces  0-9

It loops whule $i is lesser than 'Z'
When $i becomes 'Z' it stops and doesn't echo

But i guess you're having trouble with (note the '='):

for ($i = 'A'; $i = 'Z'; $i++)
{
echo $i . ' ';
}

This might produce a wierd result.

This is because when $i is 'Z' and $i++ is run $i become 'AA'

And:
'AA'  'Z'

So it loops until $i becomse 'ZA'.


Xell Zhang skrev:

Hello all,
I met a very strange problem today. Take a look at the codes below:
for ($i = 'A'; $i  'Z'; $i++) {
echo $i . ' ';
}

If you think the output is A-Z, please run it on your server and try.
Who can tell me why the result is not A-Z?




--
/Thunis

This must be Thursday, said Arthur musing to himself, sinking low over 
his beer, I never could get the hang of Thursdays.

  --The Hitchikers Guide to the Galaxy

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



Re: [PHP] A very strange loop!

2007-07-09 Thread Fredrik Thunberg

No, that won't work

Either use != 'AA'

or

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

Jason skrev:

Because you need $i= 'Z' to get Z included as well.

J

At 08:49 09/07/2007, Xell Zhang wrote:

Hello all,
I met a very strange problem today. Take a look at the codes below:
for ($i = 'A'; $i  'Z'; $i++) {
echo $i . ' ';
}

If you think the output is A-Z, please run it on your server and try.
Who can tell me why the result is not A-Z?


--
Zhang Xiao

Junior engineer, Web development

Ethos Tech.
http://www.ethos.com.cn




--
/Thunis

Why do you need to think? Can't we just sit and go budumbudumbudum with 
our lips for a bit?

  --The Hitchikers Guide to the Galaxy

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



Re: [PHP] Re: spliting the elements in array

2007-07-04 Thread Fredrik Thunberg

Stut skrev:

sivasakthi wrote:

Thanks for your response..

Actually i have the collections of strings like,

$not_quite_an_array =
'squid %tu %tl %mt %A
test %st.%hs %a %m %tu %th %Hs %Ss
test1 %tv %tr %Hs.%Ss %mt';


from that i need to split name of each line..


$names = array();
foreach (explode(\n, $not_quite_an_array) as $line)
{
$line = trim($line);
if (strlen($line) == 0) continue;
$names[] = array_shift(explode(' ', $line, 2));
}

-Stut




Or:

$result = preg_match_all(/\s*([^\s]+)(?:\n|.*)/, $not_quite_an_array, 
$out);

$names = array_pop( $out );


--
/Thunis

I think you ought to know I'm feeling very depressed.
  --The Hitchikers Guide to the Galaxy

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



Re: [PHP] Date Calculation Help

2007-07-02 Thread Fredrik Thunberg

$q = ceil( month / 4 );

--
/Thunis

The ships hung in the sky in much the same way that bricks don't.
  --The Hitchikers Guide to the Galaxy

revDAVE skrev:

I have segmented a year into four quarters (3 months each)

nowdate = the month of the chosen date (ex: 5-30-07 = month 5)

Q: What is the best way to calculate which quarter  (1-2-3 or 4) the chosen
date falls on?

Result - Ex: 5-30-07 = month 5 and should fall in quarter 2



--
Thanks - RevDave
[EMAIL PROTECTED]
[db-lists]



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



Re: [PHP] Date Calculation Help

2007-07-02 Thread Fredrik Thunberg

of course ceil( month / 3 );

--
/Thunis

Don't panic.
  --The Hitchikers Guide to the Galaxy

Fredrik Thunberg skrev:

$q = ceil( month / 4 );



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



Re: [PHP] shuffle or mt_rand

2007-06-29 Thread Fredrik Thunberg



snip


Just did a quick benchmark for 10.000 hands (making a full deck on
your code, 23.5 players):
Microtime difference:
Ryan's code:15.725826978683
Tijnema's code:0.40006709098816

Unique decks out of 1:
Ryan's code:1
Tijnema's code:1

When making a full deck my code is 40 times faster, and a lot less
memory intensive. And as you can see, for both all 1 decks are
unique, so both are random :)

But, also when generating cards for only 4 players, my code is twice
as fast as yours, and both generate still 1 random decks:

Microtime difference:
Ryan's code:0.82403707504272
Tijnema's code:0.40426802635193

Unique decks out of 1:
Ryan's code:1
Tijnema's code:1


Tijnema



Just a pointer:

Just because you get 1 different decks doesn't mean that it is random.

Since there are 52! (around 8*10^67) different decks and you choose 
1 of theese you would be very lucky to get 2 that are the same.

--
/Thunis

I refuse to answer that question on the grounds that I don't know the 
answer.

  --The Hitchikers Guide to the Galaxy

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



Re: [PHP] Date

2007-06-20 Thread Fredrik Thunberg

Ron Piggott skrev:

How do I break $start_date into 3 variables --- 4 digit year, 2 digit
month and 2 digit day?

$start_year = ;
$start_month = ;
$start_day = ;




Of course depending on what $start_date looks like, but this should work
 most of the time:


$timestamp = strtotime( $start_date );

$start_year = date( Y, $timestamp );
$start_month = date( m, $timestamp );
$start_day = date( d, $timestamp );

/T

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



Re: [PHP] Limit query results

2007-05-04 Thread Fredrik Thunberg

GROUP BY whatever_id_you_want in the SQL

Dan Shirah skrev:

Good Morning everyone.

In the below code I am pulling records from two tables.  the records are
tied together by a common key in a 3rd table.  Everything works correctly
down to the $result.


// Connect to the database
 $connection = mssql_pconnect($host, $user, $pass) or die ('server
connection failed');
 $database = mssql_select_db($database, $connection) or die ('DB
selection failed');
 // Query the table and load all of the records into an array.
  $sql = SELECT
support_payment_request.credit_card_id,
support_payment_request.status_code,
criminal_payment_request.credit_card_id,
criminal_payment_request.status_code,
credit_card_payment_request.credit_card_id,
credit_card_payment_request.date_request_received
   FROM
credit_card_payment_request LEFT OUTER JOIN support_payment_request
   ON support_payment_request.credit_card_id =
credit_card_payment_request.credit_card_id
LEFT OUTER JOIN criminal_payment_request
   ON criminal_payment_request.credit_card_id =
credit_card_payment_request.credit_card_id
   WHERE support_payment_request.status_code = 'P'
   OR criminal_payment_request.status_code = 'P';

   // print_r ($sql);
 $result = mssql_query($sql) or die(mssql_error());
  // print_r ($result);
 $number_rows= mssql_num_rows($result);
?
table width='780' border='1' align='center' cellpadding='2' 
cellspacing='2'

bordercolor='#00'
?php
if(!empty($result)) {
while ($row= mssql_fetch_array($result)) {
 $id = $row['credit_card_id'];
 $dateTime = $row['date_request_received'];
 //print_r ($id);
?
tr
td width='88' height='13' align='center' class='tblcell'div
align='center'?php echo a href='javascript:editRecord($id)'$id/a
?/div/td
td width='224' height='13' align='center' class='tblcell'div
align='center'?php echo $dateTime ?/div/td
td width='156' height='13' align='center' class='tblcell'div
align='center'?php echo To Be Processed ?/div/td
td width='156' height='13' align='center' class='tblcell'div
align='center'?php echo Payment Type ?/div/td
td width='156' height='13' align='center' class='tblcell'div
align='center'?php echo Last Processed By ?/div/td
/tr
?php
}
}
?

The picture below is what mu output looks like.  BUT, what I am trying 
to do

is have only ONE row returned per ID regardless of however many records may
be associated with that ID.   Below record number 122 has three results, I
only want one row for record 122 to be displayed.

Any ideas?


  2 javascript:editRecord(2)
Oct 6 2010 12:00AM
To Be Processed
Payment Type
Last Processed By
46 javascript:editRecord(46)
Feb 23 2007 2:27PM
To Be Processed
Payment Type
Last Processed By
66 javascript:editRecord(66)
Feb 26 2007 3:16PM
To Be Processed
Payment Type
Last Processed By
68 javascript:editRecord(68)
Feb 26 2007 3:39PM
To Be Processed
Payment Type
Last Processed By
76 javascript:editRecord(76)
Mar 21 2007 7:36AM
To Be Processed
Payment Type
Last Processed By
77 javascript:editRecord(77)
Mar 21 2007 7:40AM
To Be Processed
Payment Type
Last Processed By
78 javascript:editRecord(78)
Mar 21 2007 7:40AM
To Be Processed
Payment Type
Last Processed By
79 javascript:editRecord(79)
Mar 21 2007 7:41AM
To Be Processed
Payment Type
Last Processed By
122 javascript:editRecord(122)
Mar 27 2007 5:29PM
To Be Processed
Payment Type
Last Processed By
122 javascript:editRecord(122)
Mar 27 2007 5:29PM
To Be Processed
Payment Type
Last Processed By
122 javascript:editRecord(122)
Mar 27 2007 5:29PM
To Be Processed
Payment Type
Last Processed By



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



Re: [PHP] Selecting a special row from the database

2007-05-04 Thread Fredrik Thunberg



Edward Kay skrev:



-Original Message-
From: Marcelo Wolfgang [mailto:[EMAIL PROTECTED]
Sent: 04 May 2007 14:37
To: php-general@lists.php.net
Subject: [PHP] Selecting a special row from the database


Hi all,

I'm building a news display page for a website, and since the user has 2
ways to arrive there, I want to know if this is possible:

1) the user arrive at news.php

I will run a query at the db, and get the latest news to be the main one
  (full display) and display the others news in a list

2) the user arrived from a link to a specific news to news.php?id=10

It should display the news with id = 10 as the main news and get the
latest ones to display in a list of other news

I've so far was able to add a dinamic WHERE to my query ( if I have or
not the id GET parameter ) and if I don't have it, I'm able to display
the latest result as the main news, but when I have an id as a GET
parameter, I have a where clause in my query and it will return only the
main news and not build up the news list

what I want is to separate the news that the user want to see ( the
id=XX one ) from the others rows, can someone advice me ?

Here is the code I have so far, I hope it serve as a better explanation
than mine!

?
$newsId = $_GET['id'];
if (isset($newsID)){
$whereClause = 'WHERE auto_id ='.$newsId;
} else {
$whereClause = '';
}
mysql_connect(localhost,$user,$pass) or die (mysql_error());
mysql_select_db ($db_table);
$SQL = SELECT * FROM tb_noticias $whereClause ORDER BY auto_id DESC;
$news_Query = mysql_query($SQL);
$recordCount = mysql_numrows($news_Query);
mysql_close();
?

TIA
Marcelo Wolfgang



If id is set, query the DB for this news article and put as the first
element in an array. Then perform a second query WHERE ID != id and append
the results to the array. If id isn't set, just perform the one query
without any where clause.

If you want to do it all in one query, if id is provided use SELECT... WHERE
ID = id UNION (SELECT...WHERE ID != id ORDER BY id DESC) to get the ordering
you want. If id isn't set just use SELECT ... ORDER BY id DESC.

I'm not sure if there would be much difference in performance as I still
think the database would perform two queries internally.

Edward



Maybe
SELECT ..., if (id = my_id,1,0) as foo
...
ORDER BY foo DESC;

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



Re: [PHP] Split string

2007-05-02 Thread Fredrik Thunberg

Lester Caine skrev:
Can someone with a few more working grey cells prompt me with the 
correct command to split a string.


The entered data is names, but I need to split the text up to the first 
space or comma into one string, and the rest of the string into a 
second. It's the 'first either space or comma' that eludes me at the 
moment :(


In know it's probably obvious, but it always is when you know the answer.



$myString = John Doe;

$pos = strpos($myString,  )  strpos($myString, ,) ? 
strpos($myString,  ) : strpos($myString, ,);


$part1 = substr($myString, 0, $pos);
$part2 = substr($myString, $pos);

/T

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



[Fwd: Re: [PHP] a little math]

2007-04-20 Thread Fredrik Thunberg

Don't know your problem but:

if $totalTime is total length in seconds

$minutes = floor($totalTime / 60);
$seconds = $totalTime % 60;

/Fredrik


Sebe skrev:

maybe someone can figure why sometimes i get negative values for seconds..

$job['finished'] and $job['finished'] are both unix timestamp.
i subtract both to get how many seconds some thing took.. well you 
should be able to read the rest. sometimes it works fine but other times 
i get negative seconds.



$job['run_time']  = ($job['finished'] - $job['started']);

$minutes = number_format($job['run_time'] / 60, 0, '', '');

// seconds left after calculating minutes
$seconds = (($job['run_time']- 60) * $minutes);

$job['runtime'] = $minutes . ' mins ' . $seconds . ' secs';



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



Re: [PHP] UPDATE and redirect

2007-04-11 Thread Fredrik Thunberg

marcelo Wolfgang skrev:

Hi all,

I'm new to this list and new to php programming so sorry if I do 
something wrong here :)


Ok, now to my problem.

I've created a query to update a mysql db, and it isn't working, and 
it's not throwing me any errors, so I need some help to figure out 
what's wrong here. My code follows :


?
if($_GET['act'] = 'a'){
$action = 1;
} else if ($_GET['act'] = 'd'){
$action = 0;
}



Don't use =, use == (or in some cases ===).
= is for assignment.

Also, what if $_GET['act'] is neither 'a' or 'd'?



$id = $_GET['id'];



Again, what if $_GET['id'] is null?


mysql_connect(localhost,,) or die (mysql_error());
mysql_select_db (taiomara_emailList);


$email_Query = mysql_query(UPDATE 'tb_emails' SET 'bol_active' = 
$action WHERE `auto_id` = $id);


Use backticks if you think you need them
In this case you don't

$sql = UPDATE `tb_emails` SET `bol_active` = $action WHERE `auto_id` = 
$id;


echo DEBUG: $sql;

$email_Query = mysql_query( $sql );

This is how to get the error:

if ( !$email_Query )
echo mysql_error();



mysql_close();
?

The page is executed, but it don't update the table ... I've tried with 
the '' and without it ( the phpmyadmin page is where I got the idea of 
using the '' ). Any clues ?


Also, how can I make a redirect after the query has run ?



header(Location: http://www.foobar.com;);

Will work as long as you don't print out any output whatsoever to the 
browser before this line of code.




TIA
Marcelo Wolfgang



/T

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



Re: [PHP] Setting printf results as a variable

2007-02-09 Thread Fredrik Thunberg

Stephen wrote:
Hi list, I'm trying to make a script which requires that I perform a 
printf() formatting on a string, but instead of outputting the result 
I need to set the result as a variable to write to a file. Can any one 
advise me on how to do this? or if it's even possible?


Kind regards, Stephen.


sprintf...

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



Re: [PHP] convert date to reversed date

2007-01-30 Thread Fredrik Thunberg

Reinhart Viane skrev:

Is this a good way to convert 01/02/2007 to 20070201

 


$value='01/02/2007';

list($day, $month, $year) = split('[/.-]', $value);

$filename=$year.''.$month.''.$day;

 


It does work but i would like to verify if there are no better, more logical
ways to do this.

Thanks in advance


  

date(Ymd, strotodate( $value ));

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



Re: [PHP] convert date to reversed date

2007-01-30 Thread Fredrik Thunberg



date(Ymd, strotodate( $value ));



Of course I mean:

date( Ydm, strtodate( $value ));

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



Re: [PHP] Forms and destroying values

2007-01-12 Thread Fredrik Thunberg
It doesn't help to reset any values. The form data is being resent by 
the browser itself, just if the user presses the submit button again 
with the same data.


What you could do is mabye use a session to see if the particular user 
has sent form data before.


/Fredrik Thunberg

Beauford skrev:

Hi,

How do I stop contents of a form from being readded to the database if the
user hits the refresh button on their browser.

I have tried to unset/destroy the variables in several different ways, but
it still does it. 


After the info is written I unset the variables by using unset($var1, $var2,
$etc). I have also tried unset($_POST['var1'], $_POST['var2'],
$_POST['etc']). I even got deperate and tried $var = ; or $_POST['var'] =
;

What do I need to do to get rid of these values??? Obviously I am missing
something.

Any help is appreciated.

Thanks

  


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



Re: [PHP] Sort Array not working

2007-01-09 Thread Fredrik Thunberg

Hi

sort returns a bool, the sorted array passed by reference.

So try:

$result = sort( $array );

//Now $array is sorted
print_r( $array );

/Fredrik Thunberg

Kevin Murphy skrev:
I'm having trouble sorting an array. When I do, it empties the array 
for some reason. Take the following code:


$data = bird,dog,cat,dog,,horse,bird,bird,bird,lizard;

$array = explode(,,$data);// Create the array
$array = array_diff($array, array());// Drop the empty elements
$array = array_unique($array);// Drop the duplicate elements
$array = array_merge($array);// Reset the array keys

print_r ($array);

Up to here it works great. The resulting output is:

Array ( [0] = bird [1] = dog [2] = cat [3] = horse [4] = lizard )

Then if I do this:

$array = sort($array);// Sorts the array

print_r ($array);

The output is 1. I've tried asort, rsort in the place of sort and 
get the same results. I've also tried putting the sort in between the 
first 4 steps and that doesn't work either. Obviously I'm doing 
something wrong here. I'm using PHP 4.3.4. Any suggestions?


--Kevin Murphy
Webmaster: Information and Marketing Services
Western Nevada Community College
www.wncc.edu
775-445-3326





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



Re: [PHP] EZ array problem - What's wrong with my brain?

2006-12-01 Thread Fredrik Thunberg

Try

$try = $var[1.2];

If your array looks like the one below then there is no $var[0] and 
therefore you get NULL



/Thunis
Brian Dunning skrev:
That seems right to me too - but everything I try returns NULL. I set 
$try=$var[0], and $try ends up being null; print_r($try) gives blank. 
I even tried $try=$var[1] and it was the same result. Am I in the 
Twilight Zone?



On Dec 1, 2006, at 12:26 AM, Youri LACAN-BARTLEY wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Well, I've only just fallen out of bed, but I'd say you'd be able to
access it via $var[0][0][0] as in $var[1.2][code][0] to change 111
to something else and $var[1.2][status][0] to set/change new.

Brian Dunning wrote:

var_dump() gives me this:

array(1) {
  [1.2]=
  array(2) {
[code]=
array(1) {
  [0]=
  string(3) 111
}
[status]=
array(1) {
  [0]=
  string(3) new
}
  }
}

I'm trying to set a variable to that 1.2. Shouldn't I be able to get
it with $var = $arr[0][0]?

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


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFFb+cnWC9/YPePNU4RAmnzAKDGUlHxZiQvyhLfSiHKXV9sI73fTQCfe/Ub
pKYeQqK4FcNhmTdEIm41kic=
=PSbi
-END PGP SIGNATURE-


--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] Tidy HTML source?

2006-11-29 Thread Fredrik Thuresson
is ever generated by anyone at anytime?   Most pre-packaged applications
 such as blogs, CMS, picture galleries do produce HTML directly without
 template engines which would require a separate installation issues and
 dependencies which most designers try to avoid.  Even template engines
 have
 libraries of gadgets which do produce HTML directly.

Good point. That's the example I was looking for. Thanks. Just didn't make
sense late last night why you would go through all the effort and I did
read your thread. The \n\t\t\t was just meant to show one of the reasons
why I chose to move it out of the php code.

No doubt, is your solution impressive for the purpose it serves. I did not
mean to offend you in any way.
GL.
Fredrik

 - Original Message -
 From: Fredrik Thuresson [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Wednesday, November 29, 2006 5:45 AM
 Subject: Re: [PHP] Tidy HTML source?


 At one point or another plain HTML has to be generated. 

 Care to give me an example? I never generate any html in my php code
 anymore.

 You are entitled not to, but stretching it to the point of denying that
 HTML
 is ever generated by anyone at anytime?   Most pre-packaged applications
 such as blogs, CMS, picture galleries do produce HTML directly without
 template engines which would require a separate installation issues and
 dependencies which most designers try to avoid.  Even template engines
 have
 libraries of gadgets which do produce HTML directly.

 So, you might not echo HTML directly.  That is fine, it is an option.
 This
 is not for you.  Evidently those who participated in these thread before
 do
 generate HTML directly because they are concerned about formatting it and
 that would be unnecesary if they used templates.

 It's not very pretty when your code looks like echo
 \n\t\t\t\t\t\ttr;


 Look at the examples I pointed to, you won't see anything like that.

 Is that not a form of a templating engine that your are building?

 No, not at all.  Just read the document.  Moreover, I would appreciated if
 you read my e-mail in full, specially the part that says:   I would
 appreciate any comment on the project, EXCEPT that you use template
 engines
 and that you do not generate HTML  directly.

 Satyam



 Fredrik

 Satyam wrote:
 May I invite you to check http://satyam.com.ar/pht/?   This is a
 project
 I started some time ago to help me produced HTML in a more clean and
 efficient way.  Usually, producing good HTML involves running a sample
 output through some HTML validator or looking at the HTML and checking
 it
 out by hand, which, of course, requires good formatting to make it
 understandable.   In the case of too dynamic HTML (meaning, output can
 vary widely) it is impossible to produce enough samples of all the
 possible outputs to get them checked out.

 So, my idea was to embed HTML into the language itself so that the
 final
 output could be checked at 'compile time' and even before, using the
 standard tools provided by the IDE (even just matching braces goes a
 long
 way into checking for missmatched HTML tags).

 The samples page (http://satyam.com.ar/pht/sample.htm) show several
 examples.

 I think that a tool such as this one might avoid any concern about
 tidying up HTML since, after all, most of the checking could be done at
 the PHP source level.   Further development (which I have not started
 yet) would lead to automatic verification against DTDs or XSchemas.

 And, of course, I would appreciate any comment on the project, EXCEPT
 that you use template engines and that you do not generate HTML
 directly.
 I've heard that and it is completely missing the point so, please,
 spare
 me that one.  At one point or another plain HTML has to be generated.

 Satyam

 - Original Message - From: Mark Kelly [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Tuesday, November 28, 2006 4:13 AM
 Subject: Re: [PHP] Tidy HTML source?


 On Monday 27 November 2006 17:10, Mark Kelly wrote:

 Am I crazy to make an extra effort in my code to make the generated
 HTML
 pretty?

 Thanks everyone for your thoughts on this - I'm quite relieved that
 I'm
 not
 the only one who sits and tweaks so that the HTML is nice and
 readable.

 It just struck me that trying to make my PHP spit out page source that
 looks like it was made lovingly by hand was perhaps the work of an
 obsessive.

 Now I know that even if it is, I'm not alone :)

 Cheers!

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




-- 
-Fredrik

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



Re: [PHP] Tidy HTML source?

2006-11-28 Thread Fredrik Thuresson

At one point or another plain HTML has to be generated. 

Care to give me an example? I never generate any html in my php code 
anymore.


It's not very pretty when your code looks like echo \n\t\t\t\t\t\ttr;

Is that not a form of a templating engine that your are building?

Fredrik

Satyam wrote:
May I invite you to check http://satyam.com.ar/pht/?   This is a 
project I started some time ago to help me produced HTML in a more 
clean and efficient way.  Usually, producing good HTML involves 
running a sample output through some HTML validator or looking at the 
HTML and checking it out by hand, which, of course, requires good 
formatting to make it understandable.   In the case of too dynamic 
HTML (meaning, output can vary widely) it is impossible to produce 
enough samples of all the possible outputs to get them checked out.


So, my idea was to embed HTML into the language itself so that the 
final output could be checked at 'compile time' and even before, using 
the standard tools provided by the IDE (even just matching braces goes 
a long way into checking for missmatched HTML tags).


The samples page (http://satyam.com.ar/pht/sample.htm) show several 
examples.


I think that a tool such as this one might avoid any concern about 
tidying up HTML since, after all, most of the checking could be done 
at the PHP source level.   Further development (which I have not 
started yet) would lead to automatic verification against DTDs or 
XSchemas.


And, of course, I would appreciate any comment on the project, EXCEPT 
that you use template engines and that you do not generate HTML 
directly.  I've heard that and it is completely missing the point so, 
please, spare me that one.  At one point or another plain HTML has to 
be generated.


Satyam

- Original Message - From: Mark Kelly [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Tuesday, November 28, 2006 4:13 AM
Subject: Re: [PHP] Tidy HTML source?



On Monday 27 November 2006 17:10, Mark Kelly wrote:

Am I crazy to make an extra effort in my code to make the generated 
HTML

pretty?


Thanks everyone for your thoughts on this - I'm quite relieved that 
I'm not

the only one who sits and tweaks so that the HTML is nice and readable.

It just struck me that trying to make my PHP spit out page source that
looks like it was made lovingly by hand was perhaps the work of an
obsessive.

Now I know that even if it is, I'm not alone :)

Cheers!

--
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] GD - Problem writing text

2006-11-23 Thread Fredrik Thunberg

Hi all

This is my first attempt to wrie to this mailing list, so please bare 
with me.


My problem is as follows

I'm trying to generate a dynamic picture with some text on it. The code 
works fine on one of my servers, but not on the other one.


The code I'm using:

$im = imagecreatetruecolor (400,  100);
$black = imagecolorallocate ($im,  0, 0, 0 );
$white = imagecolorallocate ($im,  255, 255, 255 );

imagerectangle ($im,0, 0,399,99 ,$black);
imagefilledrectangle ($im,0, 0,399,99 ,$white);
imagettftext  ($im, 30,  0, 10, 40 , $black, TTF_DIR. times.ttf,  
Hello World!);

header (Content-type: image/png );
imagepng ($im);

Where TTF_DIR is the complete path to the times.ttf-file (which i've 
chmodded to 777).


This is the gd-info from where it works:
GD Support enabled
GD Version bundled (2.0.28 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.1.3
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

The one things that differs between the servers is:
FreeType Linkagewith TTF library is set on the faulty one. Can 
this be the problem?


Cheers
/Fredrik Thunberg
[EMAIL PROTECTED]

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



[PHP] imagecreatefromjpeg() uses too much memory

2006-03-28 Thread Fredrik Enestad
Hi!

I'm making a function for uploading and resizing images to my web hotel.
Problem is, memory_limit is set to 16M so when uploading larger images the
script crashes.

So, I tried to override the memory_limit setting, but as it turns out, my
web host has set some safe mode setting,
so that no settings can be changed in the php.ini, and they wont change the
setting to a higher value themselves.

This is were the code crashes:

$image_p = imagecreatetruecolor($widthNew, $heightNew);
if($mime==image/jpeg || $mime==image/pjpeg) {
  $image = imagecreatefromjpeg($imgarray[tmp_name]);
  imagecopyresampled($image_p, $image, 0, 0, 0, 0, $widthNew, $heightNew,
$widthOrg, $heightOrg);
  imagejpeg($image_p, $save_dir.$temp_filename, 80);
  return Done;
}

The line $image = imagecreatefromjpeg($imgarray[tmp_name]); causes the
problem.

Do any of you know any other way to solve this problem?

--
Thanks
Fredrik


Re: [PHP] imagecreatefromjpeg() uses too much memory

2006-03-28 Thread Fredrik Enestad
The image I'm trying is 2848x2144 @ 2,13MB so its pretty big..

An other user in this mail-group asked me if ImageMagick existed on the
server,
but I'm pretty new to all this, and I don't actually know how to check if it
does?

Thanks for taking the time
Fredrik


2006/3/28, Richard Davey [EMAIL PROTECTED]:

 On 28 Mar 2006, at 14:21, Fredrik Enestad wrote:

  I'm making a function for uploading and resizing images to my web
  hotel.
  Problem is, memory_limit is set to 16M so when uploading larger
  images the
  script crashes.
 
  So, I tried to override the memory_limit setting, but as it turns
  out, my
  web host has set some safe mode setting,
  so that no settings can be changed in the php.ini, and they wont
  change the
  setting to a higher value themselves.
 
  Do any of you know any other way to solve this problem?

 What size images are you uploading? (as in what dimensions, and file
 size)

 Do you have access to something like ImageMagik on the server?

 Cheers,

 Rich
 --
 http://www.corephp.co.uk
 Zend Certified Engineer
 PHP Development Services

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




--
Mvh
Fredrik Enestad


[PHP] SESSION and include

2006-02-08 Thread Fredrik Tillman

Hi

PROBLEM:

I want to let certain users use certain funcions on my page. To manage 
that I start a session and define $_SESSION[user_level] to a value from 
a mySQL table. So far so good. Users with $_SESSION[user_level]==1 can 
access things on the .php page they are on. I made a simple if-statement 
to handle that.


Now the problem is that i want to use include(page.php) and let the 
users with user_level=1 access special things on that included page. The 
if statements that let them change things work if I access the page 
directly from my browser but not when it is included in that main page.


Whats am I missing?

/Fredrik

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



Re: [PHP] Re: SESSION and include

2006-02-08 Thread Fredrik Tillman

ok.. Let me explain the problem better.

'user_level' is set by a login script. It seems to be working fine since 
I can make things like:

if  (1==$_SESSION[user_level]) { let this stuff happen }
on my mainpage.

on that same mainpage I use
include (page.php);
(I also tried require...)

If I access page.php directly (by writing the URL in my browser) things 
like

if  (1==$_SESSION[user_level]) { let this stuff happen }
will work just fine, but when page.php is included in mainpage the 
$_SESSION[user_level] is empty for that included part...


/Fredrik

Barry wrote:


Fredrik Tillman wrote:


Hi

PROBLEM:

I want to let certain users use certain funcions on my page. To 
manage that I start a session and define $_SESSION[user_level] to a 
value from a mySQL table. So far so good. Users with 
$_SESSION[user_level]==1 can access things on the .php page they 
are on. I made a simple if-statement to handle that.


Now the problem is that i want to use include(page.php) and let the 
users with user_level=1 access special things on that included page. 
The if statements that let them change things work if I access the 
page directly from my browser but not when it is included in that 
main page.


Whats am I missing?

/Fredrik


use require()

www.php.net/require

Greets
Barry



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



Re: [PHP] Re: SESSION and include

2006-02-08 Thread Fredrik Tillman
ok.. I was a little too fast again when explaining my problem.. Gonna 
put some code up for you to see...


First of all I DO use quotes. I tried both single and double ones (',)

Ok here are some code:

IN LOGINSCRIPT:
?
/* Check User Script */
session_start();  // Start Session

include 'db.php';
// Convert to simple variables
$username = $_POST['username'];
$password = $_POST['password'];

if((!$username) || (!$password)){
   echo Please enter ALL of the information! br /;
   include 'index.htm';
   exit();
}

// Convert password to md5 hash
$password = md5($password);

// check if the user info validates the db
$sql = mysql_query(SELECT * FROM users WHERE username='$username' AND 
password='$password' AND activated='1');

$login_check = mysql_num_rows($sql);

if($login_check  0){
   while($row = mysql_fetch_array($sql)){
   foreach( $row AS $key = $val ){
   $$key = stripslashes( $val );
   }

   $_SESSION['first_name'] = $row[first_name];
   $_SESSION['last_name'] = $row[last_name];
   $_SESSION['email_address'] = $row[email_adress];
   $_SESSION['user_level'] = $row[user_level];   
  
   header(Location: index.php);

   }
} else {
   echo You could not be logged in! Either the username and password 
do not match or you have not validated your membership!br /Please try 
again!br /;

   include 'index.htm';
}
?



IN INDEX.PHP:

?
session_start();
if ( empty( $_SESSION['first_name'] ) ) {
   ? centerfont color=redstrongYou are not logged 
in!/strong/font/centerbr /


   ? include 'index.htm';
} else { include 'db.php';
  include(http://test.bluenotevoices.se/data.php;);
?

   [... Some code here...]

/*   
defining variables ... ($main is actually transered from last page the 
user was on, so in my script it is not defined but I put the code here 
to let you see it...)  
*/

$main=page.php

   ?php  if (1==$_SESSION['user_level']){
   ?  
[ Some working code here ]

  ? }
require ($main);
?
}


IN PAGE.PHP
?php
session_start();
include data.php;
if (empty($_SESSION['user_level'])) { echo (Session is empty);}
?
[More code here]


Can you see anything I am doing wrong?
/F


Jochem Maas wrote:


Fredrik Tillman wrote:


ok.. Let me explain the problem better.

'user_level' is set by a login script. It seems to be working fine 
since I can make things like:

if  (1==$_SESSION[user_level]) { let this stuff happen }



$_SESSION[user_level] is wrong unless 'user_level' is a defined constant
in your code (I bet it isn't).

instead write: $_SESSION['user_level']

-- notice the quotes, they delimit the _string_ that is the key of the
array. array keys are either strings or integers.


on my mainpage.

on that same mainpage I use
include (page.php);
(I also tried require...)

If I access page.php directly (by writing the URL in my browser) 
things like

if  (1==$_SESSION[user_level]) { let this stuff happen }
will work just fine, but when page.php is included in mainpage the 
$_SESSION[user_level] is empty for that included part...



how is $_SESSION['user_level'] being set and/or updated?
have you tried a var_dump($_SESSION) on the included page to
see what _is_) in the session?
are you per change closing the session prior to including the relevant 
file?


I think you'll need to show some code - the way you describe it seems
to me to be not possible that $_SESSION['user_level'] is set in the 
first script
and nolonger available in the included script ($_SESSION is a super 
global

that is available everywhere so long as there is an active/open session)



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



Re: [PHP] Re: SESSION and include

2006-02-08 Thread Fredrik Tillman

PROBLEM SOLVED!

What I actually was including was a variable ($main) and since some my 
pages are called on from different pages in different folders what I 
actually did was seting $main to the full URL to the site 
(http://mysite.com/page.php) to avoid confusion. But when calling on a 
URL I guess PHP is set to drop $_SESSION variables...


$main=../page.php;
require($main);
Works fine.

Thanks for all your time and help!
/Fredrik



Jochem Maas wrote:


your problem is probably the fact that when you include
page.php you are in effect calling session_start() twice -
no idea what that does to your session but I wouldn't be
suprised if that borked the _SESSION array.

TIP: create a 'global include file' that contains all the code
required by every 'page' (i.e. every request) and have each page
do a require_once on the 'global include' - below is a basic
example:

INDEX.PHP

?php

require_once 'global.inc.php';

// bla bla bla - do stuff



GLOBAL.PHP

?php

session_start();

// do more repetitive 'init' stuff




Fredrik Tillman wrote:

ok.. I was a little too fast again when explaining my problem.. Gonna 
put some code up for you to see...


First of all I DO use quotes. I tried both single and double ones (',)



I can't smell that from here though can I? but on the plus side you
have just learnt to cut and paste the real [problem] code as opposed
to writing out a similar bit of code as an example.





if($login_check  0){
   while($row = mysql_fetch_array($sql)){
   foreach( $row AS $key = $val ){
   $$key = stripslashes( $val );



one has to wonder why you are needing to stripslashes on the values
you are retrieving from the DB ???

especially given that you then don't use the values you have just 
stripped.


you could remove this whole foreach loop and the
code would work indentically (based on what I can see here).





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



Re: [PHP] actually the egrave; not the ampersand

2005-11-04 Thread Fredrik Tolf
,
rArr = 8658,
dArr = 8659,
hArr = 8660,
forall = 8704,
part = 8706,
exist = 8707,
empty = 8709,
nabla = 8711,
isin = 8712,
notin = 8713,
ni = 8715,
prod = 8719,
sum = 8721,
minus = 8722,
lowast = 8727,
radic = 8730,
prop = 8733,
infin = 8734,
ang = 8736,
and = 8743,
or = 8744,
cap = 8745,
cup = 8746,
int = 8747,
there4 = 8756,
sim = 8764,
cong = 8773,
asymp = 8776,
ne = 8800,
equiv = 8801,
le = 8804,
ge = 8805,
sub = 8834,
sup = 8835,
nsub = 8836,
sube = 8838,
supe = 8839,
oplus = 8853,
otimes = 8855,
perp = 8869,
sdot = 8901,
lceil = 8968,
rceil = 8969,
lfloor = 8970,
rfloor = 8971,
lang = 9001,
rang = 9002,
loz = 9674,
spades = 9824,
clubs = 9827,
hearts = 9829,
diams = 9830,
quot = 34,
amp = 38,
lt = 60,
gt = 62,
OElig = 338,
oelig = 339,
Scaron = 352,
scaron = 353,
Yuml = 376,
circ = 710,
tilde = 732,
ensp = 8194,
emsp = 8195,
thinsp = 8201,
zwnj = 8204,
zwj = 8205,
lrm = 8206,
rlm = 8207,
ndash = 8211,
mdash = 8212,
lsquo = 8216,
rsquo = 8217,
sbquo = 8218,
ldquo = 8220,
rdquo = 8221,
bdquo = 8222,
dagger = 8224,
Dagger = 8225,
permil = 8240,
lsaquo = 8249,
rsaquo = 8250,
euro = 8364,
);
?

Hope it helps.
Fredrik Tolf

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



[PHP] PHP from CLI with SAPI

2005-07-18 Thread Fredrik Tolf
Hi!

I've begun to be more and more displeased with Apache lately, so I've
been thinking of writing my own HTTP server instead. I still want PHP
support, but writing a new SAPI for PHP seems like overkill.

Therefore, is it possible to use PHP from the command line, but still
enable some HTTP-server-only stuff, like GET and POST variables,
cookies, session management, file uploads, and so on? I haven't been
able to find any docs on doing that, but I'm thinking that it should be
possible.

So, can someone either point me to some docs in this, or, lacking such,
give me a short intro to it?

Thanks for reading!

Fredrik Tolf

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



Re: [PHP] PHP from CLI with SAPI

2005-07-18 Thread Fredrik Tolf
On Mon, 2005-07-18 at 15:57 -0400, Evert | Rooftop wrote:
 Fredrik Tolf wrote:
 I've begun to be more and more displeased with Apache lately, so I've
 been thinking of writing my own HTTP server instead. I still want PHP
 support, but writing a new SAPI for PHP seems like overkill.
 
 Therefore, is it possible to use PHP from the command line, but still
 enable some HTTP-server-only stuff, like GET and POST variables,
 cookies, session management, file uploads, and so on? I haven't been
 able to find any docs on doing that, but I'm thinking that it should be
 possible.
 
 So, can someone either point me to some docs in this, or, lacking such,
 give me a short intro to it?
 
 Hi Fredrick,

Hi!

 I wonder too why you are displeased with apache =) to me (and I know
 many others in this group) it is the best webserver around.

One of the problems for me with Apache is that it's too complex. To
begin with, it contains a million feature that I'll never use, but which
does bring up resource consumption.

It also contains a lot of high-performance stuff which impedes
flexibility, such as not being able to keep file descriptors to instead
be able to load-balance requests between workers and servers.

Almost foremost, however, I'm looking to build a server with far better
support for multi-user operation. While Apache with UserDir and suexec
does some things good, it cannot, for example, running PHP applications
as different users. I know there is a worker module for apache that can
run different vhosts as different users, but that's just vhosts -- you
still cannot define arbitrary authoritative domains (such as
directories) that are run as different users. At least not the way I've
understood it.

I'm just running a multi-user POSIX system at home with shell access,
and having to run all web processing as the apache user, well, kinda
sucks, when it could instead actually be run as the user it should run
as, and access the users' data correctly.

 If you would want to do it (and not use php as a library [SAPI-style] )
 you shouldn't look in to CLI, but into CGI.

Yes, that's what I meant. I meant calling PHP's CLI interface with a
CGI-style interface.

 Using CGI you can lauch a php process every time a script is called.
 Many years ago they discovered this isn't the best way to handle this.
 To launch a process every time a script is called takes too much time
 and resources.
 So they invented the FASTCGI interface, which allows php processes to
 remain persistant in the memory. You would probably (depending on your
 demands) want to have a bunch of php processes forked in the memory.

While that is true, I don't think that the real CGI interface would be
a problem with the kind of load that my server is under.

 If it's an experment, I would say go for it. If you want to use it
 commercially or at least in a live enviroment I would strongly
 discourage you to do it.

Well, of course it's not a commercial environment. I just want a good
multi-user server on my home system.

 In any case, if you want it to be fast, you want to do it 'SAPI-style'..

Well, I've been considering writing a SAPI for PHP. I haven't actually
looked at the SAPI interface, but I'm getting the feeling that that's
probably more work than writing an entire web server. ;)

Anyways, thanks for your input!

Fredrik Tolf

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



Re: [PHP] Re: PHP from CLI with SAPI

2005-07-18 Thread Fredrik Tolf
On Mon, 2005-07-18 at 20:44 +0100, Mikey wrote:
 Catalin Trifu wrote:
 Fredrik Tolf wrote:
 I've begun to be more and more displeased with Apache lately, so I've
 been thinking of writing my own HTTP server instead. I still want PHP
 support, but writing a new SAPI for PHP seems like overkill.
 
 Therefore, is it possible to use PHP from the command line, but still
 enable some HTTP-server-only stuff, like GET and POST variables,
 cookies, session management, file uploads, and so on? I haven't been
 able to find any docs on doing that, but I'm thinking that it should be
 possible.
 
 So, can someone either point me to some docs in this, or, lacking such,
 give me a short intro to it?
 
 All of the features you mentioned are those provided for you by Apache, 
 barring the session management.  If you really want to write your own 
 http server then maybe take a look at the Apache source code.  It will 
 either give you some good pointers or make you realise what a huge task 
 you are undertaking...

Are you sure about this? The way I've understood it, the web server just
passes the URL to PHP, and then PHP parses and extracts the GET
variables from it and construct an array of them.

Likewise, surely the server just passes the content passed by the client
browser, and then PHP extracts the POST variables and file uploads,
right? I wouldn't think that Apache extracts POST variables and file
uploads by itself.

Same thing with cookies, right? Surely, the webserver just passes the
headers to PHP, which extracts the cookies, right?

I would think that it should be possible to pass the URL, headers, and
client-passed content to PHP via PHP's CLI interface, to let it do that
job. Isn't that possible?

Even if not, parsing GET URLs and headers doesn't really seem like a
very huge undertaking. I realize that Apache is huge, but that's just
because it has so insanely many features -- an HTTP server in itself
shouldn't need to be very complex, the way I see it.

Thanks for responding!

Fredrik Tolf

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



[PHP] Unix sockets and fsockopen

2005-07-16 Thread Fredrik Tolf
Hi List!

I'm writing an open source PHP application which uses (connects to) Unix
sockets. To that means, I'm using the fsockopen function.

However, when reading the fsockopen documentation on php.net and being
referred to Appendix N, it seems clear that one should use the notation
unix:///path/to/socket. However, that doesn't work with any version of
PHP that I've tried myself -- they only work if I give them a normal
path (without the unix:// specifier). Right now, I'm using PHP 4.2.2
(comes with RH9), but previously I was using some PHP 4.3 version,
although I don't remember which.

Recently, however, I've started receiving mails from people who say that
it only works if they replace the fsockopen call so that it uses the
unix:// scheme. At least one of them was using PHP 4.3.11, and another
one was using PHP 5. I don't think I asked for the PHP versions of the
others.

So, what is one supposed to do with this really? Is there any particular
way that I can detect if I should use unix:// and prepend it if
necessary? If you don't mind me asking, what's the reason for this
inconsistency?

Thanks for your attention!

Fredrik Tolf

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



[PHP] Check for doubleposts

2005-05-04 Thread Fredrik Arild Takle
Hi,

what is the easiest way to check if a person i registered twice in a 
mysql-table. Lets assume that I only check if the last name is in the table 
more than once. This is in mysql 4.0 (subquery not an option).

Do I have to use arrays and in_array. Or is there a more elegant solution?

Best regards
Fredrik A. Takle 

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



[PHP] display imap inline image?

2005-01-28 Thread Fredrik Hampus
Hi!
I have rewritten the script and now the output appers in a text form
$testbody = imap_body($mbox, $msgno, IMAGE/JPEG);
   $testbody = base64_encode($testbody);
// header('Content-Type: image/jpeg');
echo $testbody;
This is a sample of the script how can i convert the ouput to an  
image/jpeg?
The output look like this..

LS0tLS0tPV9QYXJ0XzEyNzk4NjFfNTUz... and so on
The reason the header line above is comment out is that when enable it  
doesn't
print out anything but an little frame whith the text image.

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


[PHP] display imap attached files?

2005-01-21 Thread Fredrik Hampus
Hi!
Iam trying too make a page where the function is to display an attached  
.jpg file
from a imap mailbox. This is a small code i found and rewrote some...

?php
include '/etc/labbuser';
$mbox = imap_open ({localhost:993/imap/ssl/novalidate-cert}INBOX,  
$imuser, $impass);
$mno = 57;

$parttypes = array (text, multipart, message, application,  
audio, image, video, other);
 function buildparts ($struct, $mno = ) {
   global $parttypes;
   switch ($struct-type):
 case 1:
   $r = array ();
   $i = 1;
   foreach ($struct-parts as $part)
 $r[] = buildparts ($part, $mno...$i++);

   return implode (, , $r);
 case 2:
   return {.buildparts ($struct-parts[0], $mno).};
 default:
echo --Size--;
echo $struct-bytes;
echo  ;
echo $struct-subtype;
echo br;
if ($struct-subtype == JPEG) {
echo MATCH;
echo br;
}
   return 'a href=?p='.substr ($mno,  
1).''.$parttypes[$struct-type]./.strtolower ($struct-subtype)./a;
   endswitch;
 }
  $struct = imap_fetchstructure ($mbox, $mno);

  echo buildparts ($struct);
imap_close($mbox);
?
This will display how many parts there is in the mail and the size of each  
one of them and what type they are.
but how do a display the image of an attached jpg file on a webpage?

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


[PHP] String replace inside img

2005-01-07 Thread Fredrik Arild Takle
I have a some problems doing a search and replace in a string.
I want to replace:
img ALT= src=base/image.php?id=3 border=0
with
img ALT= src=image.php?id=3 border=0

Note ALT, src, border properties may come in random order.

My solution today is a not good enough because I only do an eregi_replace on 
all image.php, I only want to replace those inside a img

Todays solution
 $string = eregi_replace(base\/image.php, image.php, $string);

Solution?

Best Regards
-Fredrik A. Takle 

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



[PHP] Re: [PHP-I18N] How to get WIN-1255 encoded string

2004-11-07 Thread Fredrik Tolf
On Sun, 2004-11-07 at 13:57 +0200, Marina Markus wrote:
 Hello,

Hi!
 
 I need a PHP script to create an email message in a way that a subject line
 in Hebrew will be readable in all mail clients. Some mail clients cannot
 cope with Hebrew if they don't have character set explicitly denoted. 

I believe that should be _all_ e-mail clients. Since the default MIME
charset is US-ASCII (as per RFC 2047 and 2822), only faulty e-mail
clients would be able to cope with non-ASCII characters without wrapping
the header in MIME.
 
 Is there a possibility in PHP allowing to encode a string
 with WIN-1255 character set encoding? The result should look like:
  
 =?windows-1255?B?Rlc6IOz26eHl+CDk8uXj6e0=?=
  
 which the mail client then is able to decode back into Hebrew. 

If you're running PHP5, you might want to look at iconv_mime_encode. If
not, you can take these functions, which are from a GPL:d webmail I'm
writing, and adapt them to your purpose:

function mimifyhdr($header)
{
if(strpos($header,  ) !== FALSE)
{
$temp = ;
$cp = 0;
while(($np = strpos($header,  , $cp)) !== FALSE)
{
$temp .= mimifyhdr(substr($header, $cp, $np - $cp)) .  ;
$cp = $np + 1;
}
$temp .= mimifyhdr(substr($header, $cp));
return($temp);
}
$nh = ;
$num = 0;
for($i = 0; $i  strlen($header); $i++)
{
$c = substr($header, $i, 1);
if(ord($c) = 128)
$num++;
}
if($num == 0)
return($header);
if($num  (strlen($header) / 4))
return(=?UTF-8?B? . encodemime($header, base64) . ?=);
$nt = ;
for($i = 0; $i  strlen($header); $i++)
{
$c = substr($header, $i, 1);
if(($c == =) || (ord($c) = 128) || ($c == _))
{
$nt .= = . strtoupper(dechex(ord($c)));
} else if($c ==  ) {
$nt .= _;
} else {
$nt .= $c;
}
}
return(=?UTF-8?Q? . $nt . ?=);
}

function addhdr($name, $val)
{
global $headers;

if(trim($val) != )
{
$temp .= $name . :  . mimifyhdr($val);
$maxlen = strlen($temp);
$ls = 0;
while($maxlen  70)
{
$cp = $ls + 70;
while(strpos(\t , substr($temp, $cp, 1)) === FALSE)
{
if(--$cp  $ls)
break;
}
if($cp  $ls)
break;
$temp = substr($temp, 0, $cp) . \r\n\t .
substr($temp, $cp+ 1);
$ls = $cp + 3;
$maxlen = strlen($temp) - $ls;
}
$headers .= $temp . \r\n;
}
}

Note that they take values which are already in the UTF-8 encoding. If
your values aren't in UTF-8, take a look at the iconv function.

 If anyone has a solution for another character set, I suppose it can also
 help.

I'd recommend that you use UTF-8 instead. It's more general than
Windows-1255 (copes with characters outside the Hebrew range), and is
probably supported by more MUAs.

Hope it helps!

Fredrik Tolf

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



[PHP] Re: [PHP-I18N] How to get WIN-1255 encoded string

2004-11-07 Thread Fredrik Tolf
On Sun, 2004-11-07 at 20:42 +0100, Fredrik Tolf wrote:
 On Sun, 2004-11-07 at 13:57 +0200, Marina Markus wrote:
  Is there a possibility in PHP allowing to encode a string
  with WIN-1255 character set encoding? The result should look like:
   
  =?windows-1255?B?Rlc6IOz26eHl+CDk8uXj6e0=?=
   
  which the mail client then is able to decode back into Hebrew. 
 
 If you're running PHP5, you might want to look at iconv_mime_encode. If
 not, you can take these functions, which are from a GPL:d webmail I'm
 writing, and adapt them to your purpose:
 [snip]
   return(=?UTF-8?B? . encodemime($header, base64) . ?=);
 [snip]

Sorry, it seems the `encodemime' function was mine as well:

function encodemime($text, $encoding)
{
if($encoding == quoted-printable)
{
$nt = ;
for($i = 0; $i  strlen($text); $i++)
{
$c = substr($text, $i, 1);
if(($c == =) || (ord($c) = 128))
$nt .= = . dechex(ord($c));
else
$nt .= $c;
}
return($nt);
}
if($encoding == base64)
return(base64_encode($text));
return($text);
}

Sorry for taking two mails.

Fredrik Tolf

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



[PHP] local (config) value not overriding master

2004-03-16 Thread Fredrik de Vibe
Hi

On the system I'm working on atm, php is set up with a non-modifiable
php.ini, but I can make php config changes in httpd.conf. The changes
I make are reflected in the local value row in the output from
phpinfo() while the values from php.ini are in the master value row.

This seemed to be working fine until I tried to override the
disable_functions value. The master value has ini_set disabled, I have
removed it from the local value's disabled_functions (phpinfo() agrees
on this), but I still can't use ini_set (it is still disabled).

I might be missing something important here (probably am), but I can't
see why (tried googling and going through the docs, but I couldn't see
any reference to this). Can anybody shed some light here?

Thanks in advance.


-- 
- Fredrik

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



[PHP] Java and PHP

2003-11-21 Thread Fredrik
Hi

I want to start a java system from a php script, anybody who know how i can
do that.

Something like this:

if(isset($trigger)){
java javasystem -scenario;
}

Is this possible and how can i do it.


-Fred

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



[PHP] date from weeknumber

2003-11-20 Thread Fredrik
Hi

I want to get the last date in a week.
Is there anybody who know how i can do this.

something like this:

function date getDateFromWeek( $week, $year){
...
...
return date;
}


 - Petter

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



[PHP] Including text with PHP and keeping blanks

2003-06-16 Thread Fredrik Fornwall
Hello!

I am just wondering if there exist some built-in function in PHP to 
include text files in HTML while retaining blank spaces and tabs. While 
I have found some text to HTML converting scripts I would prefer to let 
PHP format the text while including it into a web page, instead of 
creating a separate file first. Any suggestions?

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


Re: [PHP] Re: Including text with PHP and keeping blanks

2003-06-16 Thread Fredrik Fornwall
Hugh Bothwell wrote:

echo pre$mytext/pre;//  ;-)

Unless you are going to render to a fixed-width font,
your spacing will suffer anyway... or do you only
care about left-hand spaces, ie for indenting?
 

Thanks!

I did not know about the pre tag, but this was what I needed (and yes, 
I only really care about indenting)!.

Fredrik.

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


[PHP] array into another site

2003-03-25 Thread Fredrik
Hi

I have an PHP array and  want to send it into another PHP site.

  $arr =
array(251,1,23,54,15,135,1651,156,13,123,321,123,32,54,654,456,32,1);

  ?
  script language=JavaScript type=text/javascript
  a href=\javascript: void(vindu2 =
window.open('view.php?arr=?$arr;?','windowname','toolbar=no, location=no,
directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes,
width=850, height=700')); vindu2.focus();\View/a
  /script


Anybody knows how to do this?

Fred



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



[PHP] mail() function.

2003-03-19 Thread Fredrik
Hi

I have a problem whith the mail() function.

I have used this function several times, but to day it don't work..

I use it like this:

mail(  $to,  $subjekt,  $body,  $from );

and i got this warning:

  Warning: Failed to Connect in \\HQ-ADMIN\mail.php on line 237


  Fred





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



[PHP] remove ' from string

2003-03-19 Thread Fredrik
Hi

Any functions to remove'from a longstring?


Fred



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



[PHP] date check

2003-03-12 Thread Fredrik
Hi

I want to check if  $var  14 days or $var   14 days

($var = $date2  - $date1)

$date1 = 2003-01-16;
$date2 = 2003-03-16;


How can i check this?
Are there any functions for this or do i have to make one?





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



[PHP] Char check

2003-02-13 Thread Fredrik
Hi

I want to check if  $var is a char or an int.

Freddy



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




[PHP] Date check

2003-02-11 Thread Fredrik
Hi

I have to dates that i want to check who is biggest.

This does not work:

if( $date1  $date2){


How can i check them?


Svein Olai




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




[PHP] Advanced PHP Debugger

2003-01-30 Thread Fredrik Johansson
Hey,

Where can I find a compiled php_apd.dll for Windows 2000 / PHP 4.3.0? If 
you have it, it would be great if you could send it to me (to me 
personally and not the list).

Thanks!

// Fredrik Johansson



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



[PHP] Advanced PHP Debugger

2003-01-05 Thread Fredrik Johansson
 Hi,

If someone out there has an .dll file for the Advanced PHP Debugger 
(APD) extension to run i Windows 2000 (PHP version 4.2.2) I would be 
glad if you could send it to me. I have tried to compile one myself but 
has failed each and every time :(

Regards,
Fredrik Johansson



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



[PHP] Session, performance, timeout

2002-07-11 Thread Fredrik Nygren

I use PHP sessions for my sites. The session_set_save_handler() is set to 
Files. I would like to increase the gc_maxlifetime to get longer 
sessions. Today my sites generate about 1500-2000 simultaneous sessions. 
The number of sessions will probably grow if I increase the gc_maxlifetime. 
My question is: how does increased sessions affect the performance?

Best regards
Fredrik Nygren

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




[PHP] RE: [php-objects] XML parser vs objects

2002-05-21 Thread Fredrik Davidsson

Dear Mirek,

This is how we use the handler for our XML class.
Hope it helps!

class XML
{
function parseXML()
{

/
Parse string XML data.

/
$parser = xml_parser_create(); 
xml_set_object($parser, $this);
xml_set_element_handler($parser, start_element,
stop_element);
}

function start_element($parser, $name, $attrs) 
{ 
/***
Handles opening tags
/
}

function stop_element($parser, $name) 
{ 

/
Handles closing of  tags!

/
}
}

Best regards

Fredrik Davidsson
Alfaproject AB


-Original Message-
From: Mirek Novak [mailto:[EMAIL PROTECTED]] 
Sent: den 21 maj 2002 14:52
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [php-objects] XML parser vs objects

Hi,
   is it possible to use methods of a class as a handlers in
xml_set_element_handler(...)? How it can be done?
TIA,
   M.N.


 Yahoo! Groups Sponsor -~--
Tied to your PC? Cut Loose and
Stay connected with Yahoo! Mobile
http://us.click.yahoo.com/QBCcSD/o1CEAA/sXBHAA/saFolB/TM
-~-

Look here for Free PHP Classes of objects:
http://phpclasses.UpperDesign.com/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

 

Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/ 


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




[PHP] eregi

2002-05-02 Thread Fredrik Arild Takle

Hi,

I'm doing:

eregi($start(.*)end, $rf, $my_var);

And I want it to stop at the first presedence of $end, not the last (thats
what this is doing).

Any hints?

Best Regards
Fredrik A. Takle



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




[PHP] help: eregi problem (?)

2002-05-02 Thread Fredrik Arild Takle

Hi,

I'm doing:

eregi($start(.*)end, $rf, $my_var);

And I want it to stop at the first presedence of $end, not the last (thats
what this is doing).

Any hints?

Best Regards
Fredrik A. Takle



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




Re: [PHP] XML to HTML?!

2002-05-01 Thread Fredrik Arild Takle

Wrap into a output buffer.  ob_start, ob_get_contents

This was neat.
I did:

ob_start();
$myvar = ob_get_contents();

But it still outputs the page, can I disable that?

Regards
Fredrik



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




Re: [PHP] XML to HTML?!

2002-05-01 Thread Fredrik Arild Takle


Miguel Cruz [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Wed, 1 May 2002, Fredrik Arild Takle wrote:
 Wrap into a output buffer.  ob_start, ob_get_contents
 
  This was neat.
  I did:
 
  ob_start();
  $myvar = ob_get_contents();
 
  But it still outputs the page, can I disable that?

 Read the output buffering section of the manual. Look for the word flush.

Correct me if I am wrong, but isn't flush() a function to output the buffer?
What I want to do is to prevent xml_parse() to output the html.

Hints?

Best Regards
Fredrik



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




[PHP] Parsing XML

2002-04-30 Thread Fredrik Arild Takle

Hi,

this might be a silly question, but I really haven't used XML alot with PHP.
I've parsed som XML, when I do xml_parse it outputs the html-codes.

I want to make a variable out of it.. I've tried $output = xml_parse();



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




[PHP] XML to HTML?!

2002-04-30 Thread Fredrik Arild Takle

Hi,

this might be a silly question, but I really haven't used XML alot with PHP.
I've parsed some XML, when I do xml_parse it outputs the html-codes.

I want to make a variable out of it, so I can write it to a file. I've tried
$output = xml_parse();



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




[PHP] eregi_replace

2002-04-04 Thread Fredrik Arild Takle

Why won't this work?

  $NoteNm[$i] = eregi_replace (V:\memo\F0001\, , $NoteNm[$i]);
  $NoteNm[$i] = eregi_replace (\\LOBBY\VismaDok\Memo\, ,
$NoteNm[$i]);

Best Regards
Fredrik A. Takle
Norway



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




Re: [PHP] eregi_replace

2002-04-04 Thread Fredrik Arild Takle

 Backslashes are magic.

 Double them and try again (e.g., ---

$NoteNm[$i] = eregi_replace (LOBBY\\VismaDok\\Memo\\, ...

Well I've allready tried that one:

Outputs:
Warning: REG_EESCAPE:~trailing backslash (\) in
D:\Inetpub\wwwroot\www_lobb\phpshop.php on line 28

Warning: REG_EESCAPE:~trailing backslash (\) in
D:\Inetpub\wwwroot\www_lobb\phpshop.php on line 29

Best Regards
Fredrik A. Takle



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




[PHP] Security Issue?!

2002-02-13 Thread Fredrik Arild Takle

Hi,

I found a weekness in one of my local dev projects today.
php.ini is set ut with cookies off in session handling.

I asked another user to send me his url when logged in,
I copied and pasted it and then I was logged in as him.

What should I do? Turn cookies on? Or write ip to mysql? or...?

Best Regards
Fredrik





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




[PHP] Re: Difference between i586 RPM and SRC.RPM?

2002-01-24 Thread Fredrik Wahlberg

src.rpm is the source code packaged in an rpm-file. If you install it as
rpm --rebuild it will compile a binary rpm for you. If you use Redhat you
can find the binary rpm in /usr/src/Redhat/RPMS

i586.rpm is a compiled binary for the i586-platform architecture

/Fredrik
--

Fredrik WahlbergW: +46-8-54 54 56 12
Fusage AB   C: +46-70-576 16 51
Kungstensgatan 38A  F: +46-8-54 54 56 10
113 59 Stockholm[EMAIL PROTECTED]
Sweden


Gaukia 345 [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Wanted to download PHP 4.1.1 RPM.
 What's the difference between i586 RPM and SRC.RPM?
 What sites provide non-FTP download for PHP4.1.1 RPM?

 Thanx ppl!



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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] PHP + GD 2.0.1 + WIN2K

2001-12-29 Thread Fredrik Arild Takle

I have a win2k machine set-up with iis 5.0, php 4.1.0 and now I want to use
image_copy_resample()

image_copy_resample() is not working in the version of gd included in php
4.1.0.

Where should I download the .dll for version 2.0.1?

Regards
Fredrik A. Takle



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: redirect

2001-11-22 Thread Fredrik Wahlberg

Make sure that you have no blank spaces before the ?php tag. It really must
be the first line in the script.

/Fredrik

Etienne Colla [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
hi

I 'm newbie with php and i have a small problem.
I have a script that uploads 4 pictures
But when that is done there has to be a redirect to an other page.

but i keep getting the folowing error:

Warning: Cannot add header information - headers already sent by (output
started at /home/users/A000456/x.be/upload.php:1) in
/home/users/A000456/x.be/upload.php on line 2









-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: RPM Installation Did Not Install PHP Modules

2001-11-19 Thread Fredrik Wahlberg

Gabriel Richards wrote:

 I installed PHP/Apache/MySQL via the Red Hat installation process (7.2),
 but Apache isn't processing PHP files, they show up as plain text in the
 browser. I checked with the FAQ and related documentation which said to
 ensure that the AddModule and LoadModule directives where there and not
 commented out. They are there, although they are within IfDefine
 HAVE_PHP tags. When I followed the path the modules are supposed to be in
 (modules/mod_php.so for example), I discovered there were no php modules
 in /etc/httpd/modules, nor any other place on my system (after a find...).
 
Try rpm -qa |grep php in the commandline.
You should see at least php there, but you probably want to find php-mysql, 
php-pgsql etc also. 

If you get no output, the php is not installed. Insert the cd, goto the 
RPMS directory and do rpm -Uvh php* and restart apache.

/Fredrik


-- 
--
Fredrik Wahlberg Tel: 08-54 54 56 12
Fusage   Fax: 08-54 54 56 10
Kungstensgatan 38a   Mobil: 070-576 16 51
113 59  STOCKHOLMhttp://www.fusage.com
--- [EMAIL PROTECTED] ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Windows 2000 Permissions error

2001-10-19 Thread Fredrik Arild Takle

I guess you have to set EVERYONE.
(Don't now for sure)

Fredrik A. Takle

Justin King [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
While trying to use dir() on a certain directory, I get the error

Warning: OpenDir: Invalid argument (errno 22) in
c:\inetpub\wwwroot\search\update.php on line 71.

I'm aware this is most likely a permissions error, but I've already
given SYSTEM, SELF, and SERVICE full control over the directory.  I have
to restrict access to a few users on our network for this directory so
EVERYONE isn't an option.

Anyone have any ideas as to what I need to set the permissions to?

-Justin





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Performance question

2001-10-18 Thread Fredrik Wahlberg

Hi!

I have a page that uses server-side includes to display different
features. Something like this:
html
  !--#include virtual=feature1.php-- (a few db calls)
  !--#include virtual=feature2.cgi-- (perl-script with db calls)
  !--#include virtual=feature3.php-- (even more db calls)
/html

If everything is embedded in a php-page I assume that the parser would
start only once, and that the db-connections would be open until the
whole page closes? 

If the assumption above is correct, does the same apply to a .shtml-page?
Or does the parser execute eache php-script one at the time, each time
invoking the parser?

Somehow I'm afraid I have to rewrite my perl code to php and put
everything on one page, but I would sure like to hear a few arguments on
how to plan for performance.

/Fredrik

-- 
--
Fredrik Wahlberg Tel: 08-54 54 56 12
Fusage   Fax: 08-54 54 56 10
Kungstensgatan 38a   Mobil: 070-576 16 51
113 59  STOCKHOLMhttp://www.fusage.com
--- [EMAIL PROTECTED] ---

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Checking if session has been started

2001-09-22 Thread Fredrik Arild Takle

  session_start();
  $valid_session = true;
  session_register(valid_session);

OR SOMETHING LIKE THIS?

 if (session_is_registered($valid_session)) {

  // Do something?!

  }

Gaylen Fraley [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Why not populate a session variable, in the page that starts the session,
 like :

   session_start();
   session_register(valid_session);
   $valid_session = true;

 Then in the page that you need to check, like:

 if ($session_valid) {
 // Do something since a session is already running
 }

 --
 Gaylen
 [EMAIL PROTECTED]
 http://www.gaylenandmargie.com
 PHP KISGB v1.2 Guestbook http://www.gaylenandmargie.com/publicscripts

 Alexander Skwar [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 I need to run some code if a session has been started.  However, to do
 this, I need to figure out IF the session has been started at all.

 How can I do this?

 Is checking for the count of elements in HTTP_SESSION_VARS the only
 reliable way of doing this?  Like so?

 ?php
 if (0  count($HTTP_SESSION_VARS)){
 // Do something since a session is already running
 }
 ?

 Thanks,

 Alexander Skwar
 --
 How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
 Homepage: http://www.digitalprojects.com   |   http://www.iso-top.de
iso-top.de - Die günstige Art an Linux Distributionen zu kommen
 Uptime: 3 days 3 hours 9 minutes





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: PHP EDITOR 4 WINDOWS?

2001-08-01 Thread Fredrik Arild Takle

Codewhiz is great.
Remember to download php-language-files if you want syntax-highlighted-code
(or something!)

Best Regards
Fredrik A. Takle

Kyle Smith [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Does it really exist? If so could someone post some URLs for me?


-lk6-
http://www.StupeedStudios.f2s.com
Home of the burning lego man!

ICQ: 115852509
MSN: [EMAIL PROTECTED]
AIM: legokiller666






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Hmmm?

2001-08-01 Thread Fredrik Arild Takle

I think it's impossible to read/understand my own scripts if i don't do it.

Do:

?php
  if ($submit) {
echo Counting from 1-32br;
for ($ii = '1'; $ii = '32' $ii++) {
  echo $ii. ;
}
  }
  echo brAll done!;
?

instead of:

?php
if ($submit) {
echo Counting from 1-32br;
for ($ii = '1'; $ii = '32' $ii++) {
echo $ii. ;
}
}
echo brAll done!;
?

Best Regards
Fredrik A. Takle

Keith Jeffery [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Simply indent formatting for readability.  I personally don't indent after
 the ? tag, but to each his/her own.


 Kyle Smith [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Whenever i get a php script off a website why is it that most of the main
 parts in the script have a space from the left border. eg

 ?php
 echospazzz;
 ?

 

 -lk6-
 http://www.StupeedStudios.f2s.com
 Home of the burning lego man!

 ICQ: 115852509
 MSN: [EMAIL PROTECTED]
 AIM: legokiller666








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: function that will print the url for embedded links

2001-08-01 Thread Fredrik Arild Takle

You might wanna make a function for links:

?php
  function makelink($descr, $href) {
global $printer;
if ($printer) {
  $link = $descr ($href);
} else {
  $link = a href=\$href\$descr/a;
}
return $link;
  }

 To echo an link in a site, do:

  html above
?php
  echo makelink(Offical PHP-site, http://www.php.net;);
?
 html under

  contact.php will echo:
a href=http://www.php.net;Offical PHP-site/a

  contact.php?printer=true will echo:
Offical PHP-site (http://www.php.net)

Hope this works!

Best Regards
Fredrik A. Takle
ElanIT

[EMAIL PROTECTED] wrote in message
BB6D932A42D6D211B4AC0090274EBB1D2EF03B@GLOBAL1">news:BB6D932A42D6D211B4AC0090274EBB1D2EF03B@GLOBAL1...
 I'm looking for a way to have a url for a link explode into the actual
url
 address.  So for example, on a dynamically created webpage, I have a link
 called: Contact.

 When someone chooses to view the printer friendly version of this page,
I
 want the link on the the printer-friendly page to change to the following:
 Contact (http://www.web.com/contact.html).

 Any ideas of how to automate this process?

 Thank you, Shawna





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: check if user exists

2001-08-01 Thread Fredrik Arild Takle


$result = mysql_query(SELECT uname FROM users WHERE
uname=\'$username@$domain\');
$numrows = mysql_num_rows($result);

if ($numrows == '1') {
  echo User already exists;
} else {
  echo User don't exist;
}

Best Regards
Fredrik A. Takle
Bergen, Norway

Ker Ruben Ramos [EMAIL PROTECTED] wrote in message
009f01c11aba$1110d6c0$323039ca@weblinq1">news:009f01c11aba$1110d6c0$323039ca@weblinq1...
 how do i check if user exist?
 I tried...
 $result = mysql_query(SELECT count(uname) FROM users WHERE
 uname=\'$username@$domain\');
 if(isSet($result))
 return(Username already exists.br\n);
 but still wont work.. :(




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Output (Urgent!)

2001-07-17 Thread Fredrik A. Takle

Why doesn't this work? Any ideas?!

  $resolution = SCRIPT
LANGUAGE=\JavaScript\document.write(screen.width)/SCRIPT;

  if ($resolution = '1024') {
$resolution = 1024;
  } else {
$resolution = 800;
  }
echo $resolution;

It always output 1024

Best regards
Fredrik A. Takle
Bergen, Norway



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Output (Urgent!)

2001-07-17 Thread Fredrik A. Takle

This fixed it, but I don't like it! If you have any other suggestions,  feel
free to email me.

SCRIPT LANGUAGE=JavaScript
  if (screen.width = 1024) {
var resolution = (1024)
  } else {
var resolution = (800)
  }
/SCRIPT

Best Regards
Fredrik A. Takle

Fredrik A



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Custom Headers?

2001-07-17 Thread Fredrik A. Takle

Can I send like custom headers?

header (Resolution: 1024);
and echo it in the phpscript?

Can I do this or is it a silly question?

Best Regards
Fredrik A. Takle



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] protected Images without using htaccess

2001-06-22 Thread Fredrik Arild Takle

1. Authenticate user
2. Put the pictures in a secret folder or outside http_root
3. Do this:

?php
  header(Content-Type: application/download\n);
  header(Content-Disposition: filename=\$file\);
  $fn = fopen($file , r);
  fpassthru($fn);
?

I hope this helps!

Fredrik A. Takle
[EMAIL PROTECTED]
www.iportal1.com


Arash Dejkam [EMAIL PROTECTED] wrote in message
9gvk5g$8o0$[EMAIL PROTECTED]">news:9gvk5g$8o0$[EMAIL PROTECTED]...
 Hi,

 I'm going to make a page in which users (being authenticated by PHP
session
 management) upload pictures and specify which other users can see those
 pictures, and I want all the process be automated, and I don't want to use
 Apache protection on directories, now I have a problem: if I store images
in
 a directory which is in root directory
 of  HTTP server, then any user can access any image by sending a direct
 query from his browser like :
 www.mysite.com/members/images/img023.jpg even if he is not allowed. and
also
 I can not save image out of HTTP root directory because then http can not
 serve them.
 I found a very foolish solution for this :) I can store the images out of
 HTTP root dir and then use a PHP script which first checks the session ID
 and then sends the images with ImageCreateFromJPEG() and ImageJPEG()
 functions.

 Can anybody give me a better way to solve this problem ?

 Thanks
 Arash Dejkam






 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Is this a joke?!

2001-06-22 Thread Fredrik Arild Takle

Is this a joke?
http://www.perl.com/search/index.php

*hehe*



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] protected Images without using htaccess

2001-06-22 Thread Fredrik Arild Takle

added the wrong script... arghh...

?php
  Header(Content-type: image/gif);
  $fp = @fopen($img,rb);
  fpassthru($fp);
  fclose($fp);
?

Fredrik Arild Takle [EMAIL PROTECTED] wrote in message
9gvl19$er6$[EMAIL PROTECTED]">news:9gvl19$er6$[EMAIL PROTECTED]...
 1. Authenticate user
 2. Put the pictures in a secret folder or outside http_root
 3. Do this:

 ?php
   header(Content-Type: application/download\n);
   header(Content-Disposition: filename=\$file\);
   $fn = fopen($file , r);
   fpassthru($fn);
 ?

 I hope this helps!

 Fredrik A. Takle
 [EMAIL PROTECTED]
 www.iportal1.com


 Arash Dejkam [EMAIL PROTECTED] wrote in message
 9gvk5g$8o0$[EMAIL PROTECTED]">news:9gvk5g$8o0$[EMAIL PROTECTED]...
  Hi,
 
  I'm going to make a page in which users (being authenticated by PHP
 session
  management) upload pictures and specify which other users can see those
  pictures, and I want all the process be automated, and I don't want to
use
  Apache protection on directories, now I have a problem: if I store
images
 in
  a directory which is in root directory
  of  HTTP server, then any user can access any image by sending a direct
  query from his browser like :
  www.mysite.com/members/images/img023.jpg even if he is not allowed. and
 also
  I can not save image out of HTTP root directory because then http can
not
  serve them.
  I found a very foolish solution for this :) I can store the images out
of
  HTTP root dir and then use a PHP script which first checks the session
ID
  and then sends the images with ImageCreateFromJPEG() and ImageJPEG()
  functions.
 
  Can anybody give me a better way to solve this problem ?
 
  Thanks
  Arash Dejkam
 
 
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] ftp_nlist not listing directories

2001-05-17 Thread Fredrik de Vibe

Hi

I'm having problems using ftp_nlist() to list directories. I've scanned
the internet and found that there's probably some incompability with the
version of wu-ftp used on the server and ftp_nlist(). With version
2.6.1, this doesn't work, but with version 2.5.0 it does. Anybody know
why this is? I've heard that there were serious bugs / security issues
in wu-ftp 2.5.0. Is the function ftp_nlist() based on a bug in wu-ftp in
order to work with directories or is there something else causing this?
Could this be a bug in PHP?


--Fredrik


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to format a date variable

2001-05-17 Thread Fredrik de Vibe

Carlos Fernando Scheidecker Antunes wrote:

 If I issue the comand date(d./.m./.Y. .H.:.i.:.s)
 I get the Today's date and time formated accordingly.

Don't you want to put the letters inside the quotes?

 So what I need is to format variable $OrderDate to Day/Month/year Hour:Min:Sec.. How 
can I do it the same way as the Date() function above?

I guess $OrderDate is in the DATETIME format and not the DATE, in which case you'd 
only have, well, the date and not the time. If this is the case, then the format of 
the $OrderDate string will be '-MM-DD
HH:MM:SS'. I haven't tried, but this should work:
?
list($year, $month, $day, $hours, $mins, $secs) = split('[- :]', $OrderDate);
?
There's probably heaps of ways to do this, but this is (hopefully) one.
http://www.php.net/manual/en/function.split.php

--Fredrik


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] About MySQl and Transactions

2001-05-09 Thread Fredrik Rodland

I don't think MySql does not have support for transactions.  Try using
another DB - like postgres.

Fredrik


On Wed, 9 May 2001, Hassan Arteaga wrote:

 Hi all !!!

 I'd like to implement this pseudocode

 1-open connection with MySQL
 2-beintransaction
 3-add data to table1
 4-add data to table2
 5-commit transacction   or die (rollbacktransacciont)

 How I implements transaccions in MySQL


 Thanks all !!!

 --
 M. Sc. Hassan Arteaga Rodríguez
 Microsoft Certified System Engineer
 Network Admin, WEB Programmer
 FUNDYCS, Ltd
 [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


F


--
Fredrik Rødland   ASTON Technology  Phone: +47 23 28 40 17
Technical Architect   Stocknet  Fax  : +47 910 73 621
[EMAIL PROTECTED]  http://www.aston.no   Mob  : +47 992 19 817


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




SV: [PHP] if... then... else with HTML

2001-04-23 Thread Fredrik Wahlberg

I hope I understood your question right. 
You can do like this
?php
  if () {
?
bhtml text/b
?php
  else {
?
bother html/b
?php
  }
?



 -Ursprungligt meddelande-
 Fran: Martin Thoma [mailto:[EMAIL PROTECTED]]
 Skickat: den 23 april 2001 14:41
 Till: [EMAIL PROTECTED]
 Amne: [PHP] if... then... else with HTML
 
 
 Hello !
 
 I want to do something like
 
 if (condition)
 output this html-block
 else
 output that html-block
 
 
 Without printig or echoing the html-block out (because the block has a
 lot of  , which I all would have to slash out...)
 
 How can I do that ?
 
 Martin
 
 
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/cpdf cpdf.c php_cpdf.h

2001-03-30 Thread Fredrik Öhrn

ohrnFri Mar 30 12:36:19 2001 EDT

  Modified files:  
/php4/ext/cpdf  cpdf.c php_cpdf.h 
  Log:
  Implemented cpdf_set_viewer_preferences (previously a stub).
  Added new functions: cpdf_set_font_directories and cpdf_set_font_map_file.
  
  
Index: php4/ext/cpdf/cpdf.c
diff -u php4/ext/cpdf/cpdf.c:1.22 php4/ext/cpdf/cpdf.c:1.23
--- php4/ext/cpdf/cpdf.c:1.22   Thu Feb 15 06:48:56 2001
+++ php4/ext/cpdf/cpdf.cFri Mar 30 12:36:18 2001
@@ -27,7 +27,7 @@
+--+
  */
 
-/* $Id: cpdf.c,v 1.22 2001/02/15 14:48:56 thies Exp $ */
+/* $Id: cpdf.c,v 1.23 2001/03/30 20:36:18 ohrn Exp $ */
 /* cpdflib.h -- C language API definitions for ClibPDF library
  * Copyright (C) 1998 FastIO Systems, All Rights Reserved.
 */
@@ -97,6 +97,8 @@
PHP_FE(cpdf_text, NULL)
PHP_FE(cpdf_continue_text, NULL)
PHP_FE(cpdf_set_font, NULL)
+   PHP_FE(cpdf_set_font_directories, NULL)
+   PHP_FE(cpdf_set_font_map_file, NULL)
PHP_FE(cpdf_set_leading, NULL)
PHP_FE(cpdf_set_text_rendering, NULL)
PHP_FE(cpdf_set_horiz_scaling, NULL)
@@ -176,6 +178,17 @@
 {
CPDF_GLOBAL(le_outline) = zend_register_list_destructors_ex(_free_outline, 
NULL, "cpdf outline", module_number);
CPDF_GLOBAL(le_cpdf) = zend_register_list_destructors_ex(_free_doc, NULL, 
"cpdf", module_number);
+
+   REGISTER_LONG_CONSTANT("CPDF_PM_NONE", PM_NONE, CONST_CS | CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("CPDF_PM_OUTLINES", PM_OUTLINES, CONST_CS | 
+CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("CPDF_PM_THUMBS", PM_THUMBS, CONST_CS | 
+CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("CPDF_PM_FULLSCREEN", PM_FULLSCREEN, CONST_CS | 
+CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("CPDF_PL_SINGLE", PL_SINGLE, CONST_CS | 
+CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("CPDF_PL_1COLUMN", PL_1COLUMN, CONST_CS | 
+CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("CPDF_PL_2LCOLUMN", PL_2LCOLUMN, CONST_CS | 
+CONST_PERSISTENT);
+   REGISTER_LONG_CONSTANT("CPDF_PL_2RCOLUMN", PL_2RCOLUMN, CONST_CS | 
+CONST_PERSISTENT);
+
+
return SUCCESS;
 }
 
@@ -335,32 +348,77 @@
 }
 /* }}} */
 
-/* {{{ proto void cpdf_set_viewer_preferences(int pdfdoc, int pagemode)
-   How to show the document by the viewer */
+/* {{{ proto void cpdf_set_viewer_preferences(int pdfdoc, array preferences)
+   How to show the document in the viewer */
 PHP_FUNCTION(cpdf_set_viewer_preferences) {
-   pval *argv[6];
-   int id, type, pagemode;
-   int argc;
+   zval *arg1, *arg2;
+   zval **zvalue;
+
+   int id, type;
+
CPDFdoc *pdf;
+   CPDFviewerPrefs vP = { 0, 0, 0, 0, 0, 0, 0, 0 };
CPDF_TLS_VARS;
 
-   argc = ZEND_NUM_ARGS();
-   if(argc  1 || argc  2)
+   if(ZEND_NUM_ARGS() != 2)
WRONG_PARAM_COUNT;
-   if (getParametersArray(ht, argc, argv) == FAILURE)
+
+   if (getParameters(ht, 2, arg1, arg2) == FAILURE)
WRONG_PARAM_COUNT;
 
-   convert_to_long(argv[0]);
-   convert_to_long(argv[1]);
-   id=argv[0]-value.lval;
-   pagemode=argv[1]-value.lval;
+   convert_to_long(arg1);
+   convert_to_array(arg2);
+
+   id = Z_LVAL_P (arg1);
+
pdf = zend_list_find(id,type);
if(!pdf || type!=CPDF_GLOBAL(le_cpdf)) {
php_error(E_WARNING,"Unable to find identifier %d",id);
RETURN_FALSE;
}
+
+   if (zend_hash_find (arg2-value.ht, "pagemode", sizeof ("pagemode"), (void **) 
+zvalue) == SUCCESS)
+   {
+   convert_to_long_ex (zvalue);
+   vP.pageMode = Z_LVAL_PP (zvalue);
+   }
+   if (zend_hash_find (arg2-value.ht, "hidetoolbar", sizeof ("hidetoolbar"), 
+(void **) zvalue) == SUCCESS)
+   {
+   convert_to_long_ex (zvalue);
+   vP.hideToolbar = Z_LVAL_PP (zvalue);
+   }
+   if (zend_hash_find (arg2-value.ht, "hidemenubar", sizeof ("hidemenubar"), 
+(void **) zvalue) == SUCCESS)
+   {
+   convert_to_long_ex (zvalue);
+   vP.hideMenubar = Z_LVAL_PP (zvalue);
+   }
+   if (zend_hash_find (arg2-value.ht, "hidewindowui", sizeof ("hidewindowui"), 
+(void **) zvalue) == SUCCESS)
+   {
+   convert_to_long_ex (zvalue);
+   vP.hideWindowUI = Z_LVAL_PP (zvalue);
+   }
+   if (zend_hash_find (arg2-value.ht, "fitwindow", sizeof ("fitwindow"), (void 
+**) zvalue) == SUCCESS)
+   {
+   convert_to_long_ex (zvalue);
+   vP.fitWindow = Z_LVAL_PP (zvalue);
+   }
+   if (zend_hash_find (arg2-value.ht, "centerwindow", sizeof ("centerwindow"), 
+(void **) zvalue) == SUCCESS)
+   {
+   convert_to_long_ex (zvalue);
+   vP.centerWindow = Z_LVAL_PP (zvalue);
+   }
+   if (zend_hash_find (arg2-value.ht, "pagelayout", sizeof ("pagelayout"), (void 
+**) zvalue) == 

[PHP-CVS] cvs: php4 /ext/yp yp.c

2001-03-20 Thread Fredrik Öhrn

ohrnTue Mar 20 12:04:41 2001 EDT

  Modified files:  
/php4/ext/ypyp.c 
  Log:
  really fix the build
  
  
Index: php4/ext/yp/yp.c
diff -u php4/ext/yp/yp.c:1.18 php4/ext/yp/yp.c:1.19
--- php4/ext/yp/yp.c:1.18   Tue Mar 20 04:50:26 2001
+++ php4/ext/yp/yp.cTue Mar 20 12:04:41 2001
@@ -16,7 +16,7 @@
|  Fredrik Ohrn|
+--+
  */
-/* $Id: yp.c,v 1.18 2001/03/20 12:50:26 sas Exp $ */
+/* $Id: yp.c,v 1.19 2001/03/20 20:04:41 ohrn Exp $ */
 
 #include "php.h"
 #include "ext/standard/info.h"
@@ -214,11 +214,10 @@
 static int php_foreach_all (int instatus, char *inkey, int inkeylen, char *inval, int 
invallen, char *indata)
 {
int r;
-   CLS_FETCH();
-
zval *status, *key, *value;
zval **args [3] = { status, key, value };
zval *retval;
+   CLS_FETCH();
 
MAKE_STD_ZVAL (status);
ZVAL_LONG (status, ypprot_err (instatus));



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/standard rand.c

2001-03-20 Thread Fredrik Öhrn

ohrnTue Mar 20 12:48:43 2001 EDT

  Modified files:  
/php4/ext/standard  rand.c 
  Log:
  Fix erronous out of bounds error message in rand(min,max)
  
  
Index: php4/ext/standard/rand.c
diff -u php4/ext/standard/rand.c:1.25 php4/ext/standard/rand.c:1.26
--- php4/ext/standard/rand.c:1.25   Sun Feb 25 22:07:23 2001
+++ php4/ext/standard/rand.cTue Mar 20 12:48:42 2001
@@ -19,7 +19,7 @@
| Based on code from: Shawn Cokus [EMAIL PROTECTED]  |
+--+
  */
-/* $Id: rand.c,v 1.25 2001/02/26 06:07:23 andi Exp $ */
+/* $Id: rand.c,v 1.26 2001/03/20 20:48:42 ohrn Exp $ */
 
 #include stdlib.h
 
@@ -235,7 +235,7 @@
convert_to_long_ex(p_max);
if ((*p_max)-value.lval-(*p_min)-value.lval  0) {
php_error(E_WARNING,"rand():  Invalid range:  
%ld..%ld", (*p_min)-value.lval, (*p_max)-value.lval);
-   }else if ((*p_max)-value.lval-(*p_min)-value.lval  
RAND_MAX){
+   }else if ((*p_max)-value.lval-(*p_min)-value.lval  
+PHP_RAND_MAX){
php3_error(E_WARNING,"rand():  Invalid range:  
%ld..%ld", (*p_min)-value.lval, (*p_max)-value.lval);
}
break;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/yp yp.c

2001-03-19 Thread Fredrik Öhrn

ohrnMon Mar 19 09:01:36 2001 EDT

  Modified files:  
/php4/ext/ypyp.c 
  Log:
  Removed redundant initialization.
  
  
Index: php4/ext/yp/yp.c
diff -u php4/ext/yp/yp.c:1.16 php4/ext/yp/yp.c:1.17
--- php4/ext/yp/yp.c:1.16   Sun Mar 18 14:16:46 2001
+++ php4/ext/yp/yp.cMon Mar 19 09:01:35 2001
@@ -16,7 +16,7 @@
|  Fredrik Ohrn|
+--+
  */
-/* $Id: yp.c,v 1.16 2001/03/18 22:16:46 ohrn Exp $ */
+/* $Id: yp.c,v 1.17 2001/03/19 17:01:35 ohrn Exp $ */
 
 #include "php.h"
 #include "ext/standard/info.h"
@@ -349,17 +349,10 @@
 }
 /* }}} */
 
-static void php_yp_init_globals(YPLS_D)
-{
-   YP(error) = 0;
-}
-
 PHP_MINIT_FUNCTION(yp)
 {
 #ifdef ZTS
-   yp_globals_id = ts_allocate_id(sizeof(php_yp_globals), (ts_allocate_ctor) 
php_yp_init_globals, NULL);
-#else
-   php_yp_init_globals(YPLS_C);
+   yp_globals_id = ts_allocate_id(sizeof(php_yp_globals), NULL, NULL);
 #endif
 
REGISTER_LONG_CONSTANT("YPERR_BADARGS", YPERR_BADARGS, CONST_CS | 
CONST_PERSISTENT);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-CVS] cvs: php4 /ext/yp CREDITS php_yp.h yp.c

2001-03-19 Thread Fredrik Ohrn

On Mon, 19 Mar 2001, Andi Gutmans wrote:

 Seems to me that you can nuke the following as it will always be done in RINIT:
 +static void php_yp_init_globals(YPLS_D)
 +{
 +   YP(error) = 0;
 +}
 +
 +PHP_MINIT_FUNCTION(yp)
 +{
 +#ifdef ZTS
 +   yp_globals_id = ts_allocate_id(sizeof(php_yp_globals),
 (ts_allocate_ctor) php_yp_init_globals, NULL);
 +#else
 +   php_yp_init_globals(YPLS_C);
 +#endif

 Andi


Yes, I just imitated the OCI8 module without much thougt. Is there any
docs available on the TSRM stuff, except for Use-the-source-Luke?

Does the id returned from ts_allocate_id need to be deallocated again in
PHP_MSHUTDOWN_FUNCTION or is that done automatically?


Regards,
Fredrik

-- 
Do fish get thirsty?

Fredrik hrn   Chalmers University of Technology
[EMAIL PROTECTED]  Sweden


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/cpdf php_cpdf.h

2001-03-18 Thread Fredrik Öhrn

ohrnSun Mar 18 10:32:58 2001 EDT

  Modified files:  
/php4/ext/cpdf  php_cpdf.h 
  Log:
  Solved compile failure due to clash bewteen IMAP and ClibPDF headers.
  
  
Index: php4/ext/cpdf/php_cpdf.h
diff -u php4/ext/cpdf/php_cpdf.h:1.6 php4/ext/cpdf/php_cpdf.h:1.7
--- php4/ext/cpdf/php_cpdf.h:1.6Sun Jul  2 16:46:38 2000
+++ php4/ext/cpdf/php_cpdf.hSun Mar 18 10:32:58 2001
@@ -26,12 +26,19 @@
| Authors: Uwe Steinmann   |
+--+
  */
-/* $Id: php_cpdf.h,v 1.6 2000/07/02 23:46:38 sas Exp $ */
+/* $Id: php_cpdf.h,v 1.7 2001/03/18 18:32:58 ohrn Exp $ */
 
 #ifndef PHP_CPDF_H
 #define PHP_CPDF_H
 
 #if HAVE_CPDFLIB
+
+/* The macro T is defined in the IMAP headers and clashes with a function
+   declaration here. Get rid of it. */
+
+#ifdef T
+#undef T
+#endif
 
 #include cpdflib.h
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-CVS] cvs: php4 /ext/cpdf php_cpdf.h

2001-03-18 Thread Fredrik Ohrn

On Sun, 18 Mar 2001, James Moore wrote:


Modified files:
  /php4/ext/cpdf  php_cpdf.h
Log:
Solved compile failure due to clash bewteen IMAP and ClibPDF headers.

 Does this need to be in 4.0.5 release?? if so please merge it into the
 release branch (PHP_4_0_5).

 James


Yes, it's a compilation showstopper that has been around since the very
beginning. I'll add it to 4.0.5.


Regards,
Fredrik

-- 
Do fish get thirsty?

Fredrik hrn   Chalmers University of Technology
[EMAIL PROTECTED]  Sweden


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4(PHP_4_0_5) /ext/cpdf php_cpdf.h

2001-03-18 Thread Fredrik Öhrn

ohrnSun Mar 18 10:45:25 2001 EDT

  Modified files:  (Branch: PHP_4_0_5)
/php4/ext/cpdf  php_cpdf.h 
  Log:
  Solved compile failure due to clash between IMAP and ClibPDF headers.
  
  
Index: php4/ext/cpdf/php_cpdf.h
diff -u php4/ext/cpdf/php_cpdf.h:1.6 php4/ext/cpdf/php_cpdf.h:1.6.4.1
--- php4/ext/cpdf/php_cpdf.h:1.6Sun Jul  2 16:46:38 2000
+++ php4/ext/cpdf/php_cpdf.hSun Mar 18 10:45:21 2001
@@ -26,12 +26,19 @@
| Authors: Uwe Steinmann   |
+--+
  */
-/* $Id: php_cpdf.h,v 1.6 2000/07/02 23:46:38 sas Exp $ */
+/* $Id: php_cpdf.h,v 1.6.4.1 2001/03/18 18:45:21 ohrn Exp $ */
 
 #ifndef PHP_CPDF_H
 #define PHP_CPDF_H
 
 #if HAVE_CPDFLIB
+
+/* The macro T is defined in the IMAP headers and clashes with a function
+   declaration here. Get rid of it. */
+
+#ifdef T
+#undef T
+#endif
 
 #include cpdflib.h
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-CVS] cvs: php4 /ext/yp CREDITS php_yp.h yp.c

2001-03-18 Thread Fredrik Öhrn

ohrnSun Mar 18 14:16:46 2001 EDT

  Modified files:  
/php4/ext/ypCREDITS php_yp.h yp.c 
  Log:
  Much needed cleanup and new functions added
  ---
  
  Cleaned up stringhandling for binary safeness.
  
  All functions now maintain a global 'errno' variable.
  
  All functions now print warning messages on failure.
  
  Added error code constants.
  
  Fixed bug #8041 while maintaining backward compatibility.
  
  New functions:
yp_all traverse a map
yp_cat retrive an entire map in one go
yp_errno   get last error code
yp_err_string  get a human readable error message
  
  
  

Index: php4/ext/yp/CREDITS
diff -u php4/ext/yp/CREDITS:1.1 php4/ext/yp/CREDITS:1.2
--- php4/ext/yp/CREDITS:1.1 Mon Nov 20 02:31:40 2000
+++ php4/ext/yp/CREDITS Sun Mar 18 14:16:46 2001
@@ -1,2 +1,2 @@
 Yellow Pages
-Stephanie Wehner
+Stephanie Wehner, Fredrik Ohrn
Index: php4/ext/yp/php_yp.h
diff -u php4/ext/yp/php_yp.h:1.8 php4/ext/yp/php_yp.h:1.9
--- php4/ext/yp/php_yp.h:1.8Sun Feb 25 22:07:30 2001
+++ php4/ext/yp/php_yp.hSun Mar 18 14:16:46 2001
@@ -13,16 +13,23 @@
| [EMAIL PROTECTED] so we can mail you a copy immediately.   |
+--+
| Authors: Stephanie Wehner [EMAIL PROTECTED]|
+   |  Fredrik Ohrn|
+--+
 */
 
-/* $Id: php_yp.h,v 1.8 2001/02/26 06:07:30 andi Exp $ */ 
+/* $Id: php_yp.h,v 1.9 2001/03/18 22:16:46 ohrn Exp $ */ 
 
 #ifndef PHP_YP_H
 #define PHP_YP_H
 
 #if HAVE_YP
 
+#ifdef PHP_WIN32
+#define PHP_YP_API __declspec(dllexport)
+#else
+#define PHP_YP_API
+#endif
+
 extern zend_module_entry yp_module_entry;
 #define yp_module_ptr yp_module_entry
 
@@ -33,7 +40,33 @@
 PHP_FUNCTION(yp_match);
 PHP_FUNCTION(yp_first);
 PHP_FUNCTION(yp_next);
+PHP_FUNCTION(yp_all);
+PHP_FUNCTION(yp_cat);
+PHP_FUNCTION(yp_errno);
+PHP_FUNCTION(yp_err_string);
+PHP_MINIT_FUNCTION(yp);
+PHP_RINIT_FUNCTION(yp);
 PHP_MINFO_FUNCTION(yp);
+
+typedef struct {
+   int error;
+} php_yp_globals;
+
+#ifdef ZTS
+#define YPLS_D php_yp_globals *yp_globals
+#define YPLS_DC , YPLS_D
+#define YPLS_C yp_globals
+#define YPLS_CC , YPLS_C
+#define YP(v) (yp_globals-v)
+#define YPLS_FETCH() php_yp_globals *yp_globals = ts_resource(yp_globals_id)
+#else
+#define YPLS_D
+#define YPLS_DC
+#define YPLS_C
+#define YPLS_CC
+#define YP(v) (yp_globals.v)
+#define YPLS_FETCH()
+#endif
 
 #else
 
Index: php4/ext/yp/yp.c
diff -u php4/ext/yp/yp.c:1.15 php4/ext/yp/yp.c:1.16
--- php4/ext/yp/yp.c:1.15   Sun Feb 25 22:07:30 2001
+++ php4/ext/yp/yp.cSun Mar 18 14:16:46 2001
@@ -13,9 +13,10 @@
| [EMAIL PROTECTED] so we can mail you a copy immediately.   |
+--+
| Authors: Stephanie Wehner [EMAIL PROTECTED]|
+   |  Fredrik Ohrn|
+--+
  */
-/* $Id: yp.c,v 1.15 2001/02/26 06:07:30 andi Exp $ */
+/* $Id: yp.c,v 1.16 2001/03/18 22:16:46 ohrn Exp $ */
 
 #include "php.h"
 #include "ext/standard/info.h"
@@ -26,6 +27,16 @@
 
 #include rpcsvc/ypclnt.h
 
+/* {{{ thread safety stuff */
+
+#ifdef ZTS
+int yp_globals_id;
+#else
+PHP_YP_API php_yp_globals yp_globals;
+#endif
+
+/* }}} */
+
 function_entry yp_functions[] = {
PHP_FE(yp_get_default_domain, NULL)
PHP_FE(yp_order, NULL)
@@ -33,16 +44,20 @@
PHP_FE(yp_match, NULL)
PHP_FE(yp_first, NULL)
PHP_FE(yp_next, NULL)
+   PHP_FE(yp_all, NULL)
+   PHP_FE(yp_cat, NULL)
+   PHP_FE(yp_errno, NULL)
+   PHP_FE(yp_err_string, NULL)
{NULL, NULL, NULL}
 };
 
 zend_module_entry yp_module_entry = {
"yp",
yp_functions,
+   PHP_MINIT(yp),
NULL,
+   PHP_RINIT(yp),
NULL,
-   NULL,
-   NULL,
PHP_MINFO(yp),
STANDARD_MODULE_PROPERTIES
 };
@@ -55,8 +70,10 @@
Returns the domain or false */
 PHP_FUNCTION(yp_get_default_domain) {
char *outdomain;
+   YPLS_FETCH();
 
-   if(yp_get_default_domain(outdomain)) {
+   if(YP(error) = yp_get_default_domain(outdomain)) {
+   php_error(E_WARNING, yperr_string (YP(error)));
RETURN_FALSE;
}
RETVAL_STRING(outdomain,1);
@@ -71,9 +88,11 @@
 #if SOLARIS_YP
unsigned long outval;
 #else
-  int outval;
+   int outval;
 #endif
 
+   YPLS_FETCH();
+
if((ZEND_NUM_ARGS() != 2) || zend_get_parameters_ex(2,domain,map) == 
FAILURE) {
WRONG_PARAM_COUNT;
}
@@ -81,7 +100,8 @@
convert_to_string_ex(domain);
convert_to_string_

Re: [PHP] Web Page/MySql

2001-03-13 Thread Fredrik Wahlberg

Read this (http://www.phpbuilder.com/columns/rod2221.php3) article 
over at phpbuilder which covers exactly that.

/Fredrik

 Ursprungligt meddelande 

Mike [EMAIL PROTECTED] skrev 2001-03-13, kl. 16:52:00 angende mnet 
[PHP] Web Page/MySql:


 I have a Mysql Database on a web site.On very large record retrieval I 
want
 to split the recorset so there is "Page 1, Page 2"links at the
 bottom.This is the only part I dont have.Any Suggestions?

 Thank
 Mike P
 [EMAIL PROTECTED]




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] RegExp help..

2001-03-12 Thread Fredrik Wahlberg

Try this:

$
ereg("^([0-9]{2})[0-9]{2}([0-9]{2}).*", $var, $hits)
if ($hits[1] == themonth  $hits[2] == theyear) {
do_the_stuff
}

What it does is that it puts the first two digitst into $hits[1], skips 
the two nextcoming digits and finally puts the next two numbers into $hits[2]

/Fredrik

 Ursprungligt meddelande 

John Vanderbeck [EMAIL PROTECTED] skrev 2001-03-12, kl. 02:40:25 
angende mnet [PHP] RegExp help..:


 I really wish I could figure these darn things out :)  I have a task I 
need
 to do, and i'm certain I could do this easily with a regexp..

 I have a file name in the format MMDDYY-*.txt...I need to parse it to
 determine if the month and year matches a specified month and year.  Day 
is
 irrelevant

 Can any of your regexp wizards help me?

 Thanks!

 - John Vanderbeck
 - Admin, GameDesign



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] File type not set

2001-03-01 Thread Fredrik Wahlberg

I'm uploading a file to my server, and I check the mime-type and file 
size before saving it. For some reason I get the file size, but not the 
file type. $userfile_type returns nothing and $userfile_size returns the 
correct size.

This works just fine on another server where I have the same script so 
the problem is not in the browser.

I'm running RedHat 7.0 with PHP rpm php-4.0.4pl1-3

Bug, feature or my fault?

/Fredrik 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] LDAP Listing

2001-02-28 Thread Fredrik Wahlberg

This is a small test I wrote a couple of days ago that does just that. 
Hope it works for you. 

/Fredrik

?php
$ldapserver = "orchide.habeebee.com";
$basedn = "dc=habeebee, dc=com";

$dir =ldap_connect($ldapserver);// Connect to server

if ($dir) {
  ldap_bind($dir);  // Bind to the server
  $result = ldap_search($dir, $basedn, "sn=*");  // query connection, set 
the base and look for any ”sn”

  $info = ldap_get_entries($dir, $result);  // The results get sent to 
the $info object

  for ($i=0; $i$info["count"]; $i++) { // Count is a ldap feature that 
contains the length of the resultset
echo $info[$i]["cn"][0];// choose any parameter you want see here
  }

  ldap_close($dir);
} 
?

 Ursprungligt meddelande 

Mike Tuller [EMAIL PROTECTED] skrev 2001-02-28, kl. 01:31:09 
angende mnet [PHP] LDAP Listing:


 I want to create a list of everyone on the LDAP server, and none of the
 examples I have in my books seems to work. What functions should I use to
 connect to the server, and list users in the LDAP to create a phone book
 type list to print out? Could someone also give me some sort of example 
that
 I can look at?

 Mike Tuller


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] copy() ??

2001-01-31 Thread Fredrik Arild Takle

I'm trying to upload i file through a webpage...

-- add.php3
FORM method="post" action="do_add.php3"
input type="file" size=40 name="userfile"
INPUT type="submit" name="pub" value="Publiser"
/form


-- do_add.php3
copy($userfile, "/imgs/artikler/test.jpg"); 
unlink($userfile);

-- ERROR msg..:
Warning: Unable to create '/imgs/artikler/test.jpg': No such file or directory in 
c:/programfiler/apache group/apache/htdocs/do_add.php3 on line 22

-- php.ini
upload_tmp_dir = c:\programfiler\apache group\apache\htdocs\temp\

Note: I'm currently running the webserver on Win98 (I know, it sucks!)

Any tips anyone? 

-
Fredrik A. Takle
Bergen, Norway
[EMAIL PROTECTED]




  1   2   >