php-windows Digest 22 Mar 2002 13:59:51 -0000 Issue 1058
Topics (messages 12724 through 12728):
Seeing plain text instead of HTML!!!
12724 by: Sava jurisic
(help)random image??
12725 by: KONUS
12726 by: Rasmus Lerdorf
Problem with sql call (with W2K) but same call work fine under Win98
12727 by: Dominique van der Wal
Re: random elements of an array
12728 by: Svensson, B.A.T. (HKG)
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hey folks,
I'm running Win2K Adv. Server( s.p.2) \ IBM HTTP Server 1.3.19( Read
Apache ) ..... did everything correctly (at least I think so :) , but when I
try open *.php or *.php3 files, in my browser( IE 5.5 ) I can see ONLY plain
text.
Here is my httpd.conf content:
# PHP Config
LoadModule php4_module c:/php/sapi/php4apache.dll
AddModule mod_php4.c
#AddModule mod_php3.c
#AddModule mod_perl.c
#AddModule mod_php.c
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php3 .php3
............................................................................
...
Your help is much appreciated,
Sava
--- End Message ---
--- Begin Message ---
I was wondering is there a way to generate image random with php?
I need it...I am new to php, all i can do is only basic of php.
I also using MySQL for the database system.
Is there a site who explaining about this?
or someone know how to make the script?
Thank's
--Zeus--
Mutimedia staf of NGO KONUS,
www.konus.or.id
--- End Message ---
--- Begin Message ---
I actually just hacked one up. This hooks into a Gallery
(gallery.sourceforge.org) album directory and picks out files with the
string, "sized", in their filenames. It then creates an array such that
the more recent pictures get more entries in the array which means when I
pick a random image I am more likely to see a recent image.
<?
$base = '/some/dir/albums/name';
$dir = opendir($base);
$chance=0;
$i=0;
while($entry=readdir($dir)) {
if(strstr($entry,'sized')) {
if(!($i%3)) $chance++;
for($j=0; $j<$chance; $j++) {
$pics[]=$entry;
}
$i++;
}
}
closedir($dir);
$max = count($pics);
$val = rand(0,$max-1);
Header("Content-Type: image/jpeg");
$size = filesize($base.'/'.$pics[$val]);
Header("Content-Length: $size");
Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0");
Header("Pragma: no-cache");
readfile($base.'/'.$pics[$val]);
?>
On Thu, 14 Mar 2002, KONUS wrote:
> I was wondering is there a way to generate image random with php?
> I need it...I am new to php, all i can do is only basic of php.
> I also using MySQL for the database system.
>
> Is there a site who explaining about this?
> or someone know how to make the script?
>
> Thank's
>
> --Zeus--
>
> Mutimedia staf of NGO KONUS,
> www.konus.or.id
>
--- End Message ---
--- Begin Message ---
Hi,
I've install W2K and php (ver 4.1.2) on my pc and copy my scripts wich
are running under a W98 OS.
It work fine but with the following sql call I crash my webserver.
<?php
$db = odbc_connect("MyDB",'','');
$sql = "SELECT max(RegDate) FROM TDistribution";
$result = odbc_exec($db, $sql);
?>
The problem is with the max function.
Under the console, i receive the following message : FATAL : emalloc():
unable to allocate 214748599 bytes
Any idea to solve this problem under W2K (but same code run under W98)
Thank you in advance
Dominique van der Wal
--- End Message ---
--- Begin Message ---
You can completely randomize an array with n elements in n operations, by
using the following brute force approach:
void ScrambleIntList(int *pnElements, int nLen)
{
for (nLoop = 0, nLoop<nLen; nLopp++) {
// Pic a random element
int nRandomPic = nLen * rand();
//Swap current element with the random pic
int nTemp = pnElement[nLoop];
pnElement[nLoop] = Element[nRandomPic];
pnElement[nRandomPic] = nTemp;
}
}
/Anders
>-----Original Message-----
>From: Afan Pasalic [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, March 21, 2002 9:17 PM
>To: [EMAIL PROTECTED]
>Subject: [PHP-WIN] random elements of an array
>
>
>Hi,
>
>My problem is: if I have an array (e.g. 1, 2, 3, 4, 5, 6, 7,
>8, 9), how I can "shake" the array and get randomized order of
>the same array (e.g. 5, 8, 1, 9, 3, 4, 7, 2, 6)?
>
>Thanks for any help!
>
>
>Afan
>
--- End Message ---