php-general Digest 10 May 2004 05:31:41 -0000 Issue 2754

Topics (messages 185748 through 185774):

Re: Putting a stop in a foreach
        185748 by: Curt Zirzow
        185752 by: Curt Zirzow
        185755 by: Torsten Roehr

Re: protecting web page
        185749 by: Curt Zirzow

Re: Strange mails...
        185750 by: Daniel Clark

feof Question
        185751 by: Harish
        185753 by: Petr U.
        185754 by: Curt Zirzow

Re: Putting a stop in a foreach - SOLVED
        185756 by: Verdon Vaillancourt

Re: Graphical calendar
        185757 by: Manuel Lemos

hash with RIPEMD-160
        185758 by: Dennis Gearon

Clean Open Source PHP extranet app?
        185759 by: david david
        185761 by: John W. Holmes
        185763 by: Justin French

Curl & cookies
        185760 by: Jason Morehouse
        185770 by: Curt Zirzow

Does this "directory detection" script work for you?
        185762 by: John W. Holmes
        185768 by: Richard Harb
        185771 by: Curt Zirzow

PHP /\ UML
        185764 by: Matthias H. Risse

exclude_once(); ?
        185765 by: Matthias H. Risse
        185767 by: Justin French

Re: using cookies
        185766 by: David T-G

thumbnail problems
        185769 by: Ninti Systems
        185772 by: Curt Zirzow

List() help
        185773 by: PHPDiscuss - PHP Newsgroups and mailing lists

$_SESSION <- Learning
        185774 by: Ross Bateman

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 ---
* Thus wrote Verdon Vaillancourt ([EMAIL PROTECTED]):
> Hi :)
> 
> This is the original statement that works...
> 
> foreach ($this->_content as $item) {
>     if ($item['type'] == 'item'){
> ..

ok. good so far.

> 
> 
> This is my attempt to count items and put a stop in the foreach so it only
> returns 5 items.
> 
> foreach ($this->_content as $n => $item) {
>     if ($n=="5") { 
>         break;
>     } else { 
>         if ($this->_content[$n] => $item['type'] == 'item'){

I'm  not sure why  you  changed all this.

All you have to do is a simple foreach loop with a counter, and
break when the counter reaches your condition:

$need = 5; /* how many we want */

foreach($this->_content as $index => $item) {

  if ($item['type'] == 'item') {
    //...

    /* only decrement if its an 'item' */
    $need--;
  }
  if (! $need) break; /* we got everything we needed */
}


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
* Thus wrote Torsten Roehr ([EMAIL PROTECTED]):
> 
> Sorry, I mixed up the for and the foreach syntaxes. Here my (hopefully
> correct) loop proposal:
> 
> for ($i; $i < 5; $i++) {

for($i=0; ...)

I wouldn't suggest this method, it is making the assumption that
the indexes are numeric and sequenced from 0..5


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
"Curt Zirzow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> * Thus wrote Torsten Roehr ([EMAIL PROTECTED]):
> >
> > Sorry, I mixed up the for and the foreach syntaxes. Here my (hopefully
> > correct) loop proposal:
> >
> > for ($i; $i < 5; $i++) {
>
> for($i=0; ...)
>
> I wouldn't suggest this method, it is making the assumption that
> the indexes are numeric and sequenced from 0..5

Correct, I forgot =0. But as far as I have seen his indices are numeric.

Regards, Torsten

>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
* Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> Hi,
> 
> i'm designing a web application and i want to protect my web page from
> printing and if possible want to protect source code too.

You can prevent the average joe from printing by putting some css
in your document:

@media print { body { display:  none; } }



Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Yep.  I'm getting it too.

>>Each time I post a message on p.general, i receive two strange mails 
>>from ADVANCE CREDIT SUISSE BANK.
>>
>>What's this spam ? It looks like an auto-responder is subscribed on the 
>>newsgroup. Spammers really s*x !
>>
>>Greg

--- End Message ---
--- Begin Message ---
Hi
                                
I am using Linux, Apache, MySql, PHP. In the below mentioned code example when the 
counter data that is displayed on the screen going to a indefinite loop. The file that 
is read has got sufficient permissions.

What are the reasons and how do I tackle the problem?

<?php
$fp = fopen( 't.txt', 'r' );

while( !feof( $fp ) )
{
   print fgets( $fp );
   echo $counterval++;
   if($counterval%100==0)
   {
      flush();
   }            
}
fclose( $fp );
?>



Regards,
Harish Rao K

--- End Message ---
--- Begin Message ---
On Sun, 9 May 2004 22:00:53 +0530
"Harish" <[EMAIL PROTECTED]> wrote:

 > <?php
 > $fp = fopen( 't.txt', 'r' );
 > 
 > while( !feof( $fp ) )
 > {
 >    print fgets( $fp );
 >    echo $counterval++;
 >    if($counterval%100==0)
 >    {
 >       flush();
 >    }         
 > }
 > fclose( $fp );
 > ?>

Modify your code like this and send it's output.. 

/* or ini_set('error_reporting', E_ALL);  if your version
 * of php don't know error_reporting() */
error_reporting(E_ALL);

$fp = fopen('t.txt', 'r');
if (! $fp) {
    die('Some error here!');
}

-- 
Petr U.

--- End Message ---
--- Begin Message ---
* Thus wrote Harish ([EMAIL PROTECTED]):
> 
> Hi
>                               
> I am using Linux, Apache, MySql, PHP. In the below mentioned code example when the 
> counter data that is displayed on the screen going to a indefinite loop. The file 
> that is read has got sufficient permissions.
> 
> What are the reasons and how do I tackle the problem?
> 
> <?php
> $fp = fopen( 't.txt', 'r' );

if ($fp === false) {
  die('cant open file');
}

always check the result of an fopen. feof() will only work on a
valid file handle.

$fp = false;
while (!feof($fp) ) {
  //infinite loop
}

and you'll never know what hit you if your error_reporting is to
low; ensure that at minimum, E_WARNING is on.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
Hi Torsten, Aidan and Matt

Both of Torsten's and Aidan's suggestions worked, though the number of
returned results using Aidan's method isn't what I expected. This could be
the result of something else and I'm trying to puzzle out why. Matt helped
clarify my basic misunderstanding in what the foreach statement was doing.

Conceptually though, Torsten's and Aidan's suggestions both work.

On 5/9/04 12:11 PM, Torsten Roehr wrote:

> Sorry, I mixed up the for and the foreach syntaxes. Here my (hopefully
> correct) loop proposal:
> 
> for ($i; $i < 5; $i++) {
> 
>    if (is_array($this->_content) && is_array($this->_content[$i]) &&
> $this->_content[$i]['type'] == 'item') {
>      $elements['ITEM_LINK']  = $this->_content[$i]['link'];
>      $elements['ITEM_TITLE'] = $this->_content[$i]['title'];
>      $elements['TARGET']     = $this->_target;
>      $items .= PHPWS_Template::processTemplate($elements, 'phpwsrssfeeds',
> 'block_item.tpl');
>   }
> }
> 
> $elements and items should be initialized before the loop.
> 
>> 
>> Please try and report if it helped.
>> 
>> Regards, Torsten



On 5/9/04 12:11 PM, Aidan Lister wrote:>

> Simple!
> 
> $i = 0;
> foreach ($foos as $foo)
> {
> // do stuff
> 
>   $i++;
>   if ($i > 5) break;
> }
> 
> Cheers
> 
> 
> "Verdon Vaillancourt" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> Hi :)
>> 
>> I'm trying to put a stop in a foreach statement following the user
>> suggestion here, php.net/manual/en/control-structures.foreach.php
>> 
>> Not really knowing what I am doing, I am running into some synatx
> problems.
>> I'm sure I'm doing something really stupid, can anybody point it out?
>> 
>> This is the original statement that works...
>> 
>> foreach ($this->_content as $item) {
>>     if ($item['type'] == 'item'){
>>         $elements['ITEM_LINK'] = $item['link'];
>>         $elements['ITEM_TITLE'] = $item['title'];
>>         $elements["TARGET"] = $this->_target;
>>         $items .= PHPWS_Template::processTemplate($elements,
>> "phpwsrssfeeds", "block_item.tpl");
>>     }
>> }
>> 
>> 
>> This is my attempt to count items and put a stop in the foreach so it only
>> returns 5 items.
>> 
>> foreach ($this->_content as $n => $item) {
>>     if ($n=="5") {
>>         break;
>>     } else {
>>         if ($this->_content[$n] => $item['type'] == 'item'){
>>             $elements['ITEM_LINK'] = $this->_content[$n] => $item['link'];
>>             $elements['ITEM_TITLE'] = $this->_content[$n] =>
> $item['title'];
>>             $elements["TARGET"] = $this->_target;
>>             $items .= PHPWS_Template::processTemplate($elements,
>> "phpwsrssfeeds", "block_item.tpl");
>>         }
>>     }
>> }
>> 
>> Php doesn't like the syntax on any of the,
>> $this->_content[$n] => $item['type']
>> , etc lines
>> 

--- End Message ---
--- Begin Message --- Hello,

On 05/08/2004 02:59 PM, Todd Cary wrote:
Works like a champ!

Question: has anyone extended the class so that when one clicks on a day, the year, month, day is returned?

You can use the example sub-class and change it to change the cell data that is stored in $columndata["data"] to be a link to some page that will display whatever you want about the day. The class variables $this->year, $this-month and $this->day contain the date of the day of the current cell.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message --- Please CC me as I am on digest.

Anyone using RIPEMD-160 for hashing in PHP? Is it part of Apache or the underlying OS?
--- End Message ---
--- Begin Message ---
Hello,

I am looking to create a simple "extranet" type
application similar to http://www.basecamphq.com/
written by 37signals.

Basically I just need a way for users to share
files/projects/messages.  

In fact, I would just go ahead and pay for Basecamp
except that it's closed source and it's only available
as a hosted service. (??!?)

Is there a similar open source application written in
PHP/MySQL?

Googling for such a project just returned a bunch of
PHPnuke/Portal type applications.  Not at all what I
need.

Any ideas?

Thanks,
David


        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

--- End Message ---
--- Begin Message --- david david wrote:

I am looking to create a simple "extranet" type
application similar to http://www.basecamphq.com/
written by 37signals.

Basically I just need a way for users to share
files/projects/messages.

Maybe PHProjekt?

http://www.phprojekt.com/

I'm sure hotscripts.com will have others.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
On 10/05/2004, at 9:11 AM, david david wrote:

Hello,

I am looking to create a simple "extranet" type
application similar to http://www.basecamphq.com/
written by 37signals.

Basically I just need a way for users to share
files/projects/messages.

In fact, I would just go ahead and pay for Basecamp
except that it's closed source and it's only available
as a hosted service. (??!?)

Is there a similar open source application written in
PHP/MySQL?

Googling for such a project just returned a bunch of
PHPnuke/Portal type applications.  Not at all what I
need.

Any ideas?

There's a few under "Groupware" at http://www.opensourcecms.com/, but I have no idea what any of them are like... lucky this site has demo's of them all :)

I don't think you'll find anything as good as Basecamp though, which is VERY slick.


--- Justin French http://indent.com.au

--- End Message ---
--- Begin Message --- Has anyone tried using curl to fetch a web page and cookies?


<?
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'http://www.php.net');
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_COOKIEJAR,'cookie.txt');
curl_setopt ($ch, CURLOPT_COOKIE,1);
$content = curl_exec ($ch);
curl_close ($ch);
$cookie = file_get_contents('cookie.txt');
print $cookie;
?>


This works fine, and the cookie gets stored in the cookie.txt file, but it
only ever returns 1 cookie. There should be 2 for php.net. Same with
pretty much any other site. Are there any configuration items I'm missing
for the cookie jar?


--
Jason Morehouse ([EMAIL PROTECTED])
Netconcepts LTD - Auckland, New Zealand

--- End Message ---
--- Begin Message ---
* Thus wrote Jason Morehouse ([EMAIL PROTECTED]):
> Has anyone tried using curl to fetch a web page and cookies?
> 
> <?
> $ch = curl_init();
> curl_setopt ($ch, CURLOPT_URL, 'http://www.php.net');
> curl_setopt ($ch, CURLOPT_HEADER, 0);
> curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt ($ch, CURLOPT_COOKIEJAR,'cookie.txt');
> curl_setopt ($ch, CURLOPT_COOKIE,1);
> $content = curl_exec ($ch);
> curl_close ($ch);
> $cookie = file_get_contents('cookie.txt');
> print $cookie;
> ?>
>
> 
> This works fine, and the cookie gets stored in the cookie.txt file, but it
> only ever returns 1 cookie.  There should be 2 for php.net.  Same with
> pretty much any other site.  Are there any configuration items I'm missing
> for the cookie jar?

php's front page will only set one cookie, only in certain
conditions will it set other cookies. I have 4 total from php.net:
  LAST_SEARCH, MYPHPNET, LAST_LANG, COUNTRY

php only set's one cookie on the front page.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message --- Hello. I'm relying on the following code so that a script can automatically detect where it's installed and create paths and URLs from the information. This way absolute paths and URLs are always used.

I've had a couple people report that the script wasn't finding the paths correctly, though, so I'm asking if people could test this out on their server and see if it detects the paths or not.

<?php
        //Install path (path to survey.class.php)
        $path = dirname($_SERVER['PATH_TRANSLATED']);

//Determine protocol of web pages
if(isset($_SERVER['HTTPS']) && strcasecmp($_SERVER['HTTPS'],'ON') == 0)
{ $protocol = 'https://'; }
else
{ $protocol = 'http://'; }

        //HTML address of this program
        $dir_name = dirname($_SERVER['SCRIPT_NAME']);
        if($dir_name == '\\')
        { $dir_name = ''; }

$html = $protocol . $_SERVER['SERVER_NAME'] . $dir_name;

//Determine web address of current page
$current_page = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];

        echo "Path to script: $path<br />";
        echo "URL to script directory: $html<br />";
        echo "URL to current script: $current_page";
?>

It should print out the file system path to where the script was placed as well as a URL to the directory it was placed and a URL to the file itself.

I've never had an issue with it personally and I've tested it on Apache and IIS on both Windows and Linux. So maybe it's some obscure CGI or OS configuration where this isn't working? I just need to know so I can plan accordingly.

The only two substitutions that can be made (that I know of) are:

$_SERVER['SCRIPT_NAME'] => $_SERVER['PHP_SELF']
and
$_SERVER['PATH_TRANSLATED'] => $_SERVER['SCRIPT_FILENAME']

If it doesn't work for you, does it work if you do one of those substitutions?

Also, this will test if the script is in subdirectories or not, also, so testing it within one and seeing if that works, too, is appreciated.

Thanks for any help and time you're willing to provide.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com
--- End Message ---
--- Begin Message ---
Hello,

I see one potential problem with this detection in one special case.

This will only occur if you use Apache's feature PATH_INFO.

There $current_page will be inaccurate as the scriptname might
be /index.php but the URL could be /index.php/path/to/mypage or just
/index/path/to/mypage - depending on Apache's configuration and link
presentation.

I mention this because I have used this extensively to work around
having to rely on mod_rewrite.

Richard


-----Original Message-----
From: John W. Holmes
Sent: Monday, May 10, 2004, 2:21:36 AM
> Hello. I'm relying on the following code so that a script can 
> automatically detect where it's installed and create paths and URLs from
> the information. This way absolute paths and URLs are always used.

> I've had a couple people report that the script wasn't finding the paths
> correctly, though, so I'm asking if people could test this out on their
> server and see if it detects the paths or not.

> <?php
>          //Install path (path to survey.class.php)
>          $path = dirname($_SERVER['PATH_TRANSLATED']);

>          //Determine protocol of web pages
>          if(isset($_SERVER['HTTPS']) && 
> strcasecmp($_SERVER['HTTPS'],'ON') == 0)
>          { $protocol = 'https://'; }
>          else
>          { $protocol = 'http://'; }

>          //HTML address of this program
>          $dir_name = dirname($_SERVER['SCRIPT_NAME']);
>          if($dir_name == '\\')
>          { $dir_name = ''; }

>          $html = $protocol . $_SERVER['SERVER_NAME'] . $dir_name;

>          //Determine web address of current page
>          $current_page = $protocol . $_SERVER['SERVER_NAME'] . 
> $_SERVER['SCRIPT_NAME'];

>          echo "Path to script: $path<br />";
>          echo "URL to script directory: $html<br />";
>          echo "URL to current script: $current_page";
?>>

> It should print out the file system path to where the script was placed
> as well as a URL to the directory it was placed and a URL to the file
> itself.

> I've never had an issue with it personally and I've tested it on Apache
> and IIS on both Windows and Linux. So maybe it's some obscure CGI or OS
> configuration where this isn't working? I just need to know so I can
> plan accordingly.

> The only two substitutions that can be made (that I know of) are:

> $_SERVER['SCRIPT_NAME'] => $_SERVER['PHP_SELF']
> and
> $_SERVER['PATH_TRANSLATED'] => $_SERVER['SCRIPT_FILENAME']

> If it doesn't work for you, does it work if you do one of those 
> substitutions?

> Also, this will test if the script is in subdirectories or not, also, so
> testing it within one and seeing if that works, too, is appreciated.

> Thanks for any help and time you're willing to provide.

> -- 
> ---John Holmes...



--- End Message ---
--- Begin Message ---
* Thus wrote John W. Holmes ([EMAIL PROTECTED]):
> 
> I've had a couple people report that the script wasn't finding the paths 
> correctly, though, so I'm asking if people could test this out on their 
> server and see if it detects the paths or not.

works fine with freebsd/apache-1.3.x/php5rc1

> 
> <?php
>         //Install path (path to survey.class.php)
>         $path = dirname($_SERVER['PATH_TRANSLATED']);

This might be a problem, IIRC, some web servers will not set
PATH_TRANSLATED if no PATH_INFO is being passed.


Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message --- Hi,

I wonder if anyone here is aware of UML Tools
for PHP? I know of ArgoUML whichs PHP-codegenerator
seems to be very beta.

Maybe there are or are planned and well intergrated plugins for Zend Studio, PHPEd, TruStudio/Eclipse or alike? Basically I would be interrested in a solution that really makes it possible to use UML in the design and implementation process and which works both ways (code->uml, uml->code)..

I hope this is not offtopic for this list, but I couldnt find
any public OO-related one.

Yours,
Matthias

--- End Message ---
--- Begin Message ---
Hi again!

Question:
Does anyone know of a possibility to exclude files which
have been included _before_ my script starts on the
fly (e.g. at the first lines after the entrypoint) ?

Reasons:
This ISP of my customer somehow includes a bunch of
old PEAR files by default which I dont need or of which I
need in a later version. So when several PEAR-packages
perform a require_once('HTML/foo.php') PHP recognizes that
it has already included foo.php and does not overload with
the one specified in my "user space" code.

Maybe there is a general possibility from blocking
my ISP including some files by default?

Anyone knows why this has become practice by some
ISPs? (Doesnt make sense to me to have overhead
for dozens of requests which scripts most of the
dont require those classes to be used).

Yours,
M

--- End Message ---
--- Begin Message --- On 10/05/2004, at 11:27 AM, Matthias H. Risse wrote:


Hi again!

Question:
Does anyone know of a possibility to exclude files which
have been included _before_ my script starts on the
fly (e.g. at the first lines after the entrypoint) ?

Reasons:
This ISP of my customer somehow includes a bunch of
old PEAR files by default which I dont need or of which I
need in a later version. So when several PEAR-packages
perform a require_once('HTML/foo.php') PHP recognizes that
it has already included foo.php and does not overload with
the one specified in my "user space" code.

Yuk. That's awful. The host should NOT have this set. The host should allow it as an option, but not as a default.

http://www.php.net/ini_set
You can override the auto_append_file value of php.ini with a per-directory .htaccess file, with something like (untested):

<IfModule mod_php4.c>
        php_value auto_append_file ''
</IfModule>

OR

<IfModule mod_php4.c>
        php_value auto_append_file NULL
</IfModule>

... placed in your http document root should do the trick. Of course, if the host doesn't allow per-dir .htaccess files, then you're screwed. I'd move hosts very quick.


--- Justin French http://indent.com.au

--- End Message ---
--- Begin Message ---
Aidan (and Richard and others) --

...and then Aidan Lister said...
% 
% Hi,

Hi!


% 
% Richards email was kinda wierd, so I'll reply to your email directly

Thanks :-)  And, while I appreciated it, I didn't get a lot from it.

Of course, this one basically says "just read the manual", so I'm not
getting a *whole* lot from it, either!


% 
...
% Okay, simple:
% 
% <?php
% if (isset($_COOKIE['yourcookie'])) { // they have the login cookie, so do
% what you called "log them in", whatever that means }
% else { // they are not logged in, so include your login page }
% ?>

Aha!  Perhaps I was unclear.  I'm sorry; it was late :-)

When the surfer returns to the page tomorrow or next week or in a month,
I want to see that I have stored his acct info in a cookie on his machine
so that I can automatically log him in rather than requiring that he type
his name and pass again.  There is a "remember me" type of checkbox on
the login page so that he can tell me to save the info for next time.

*That* is what I can't seem to grasp...  If I set the cookie, then I'm
stepping on the old value and so I can't automatically log him in (or
at least as I understand it, and I certainly haven't seen anything in
$_COOKIE to make me think otherwise).

Perhaps now I've given everyone better info on which to base a response :-)


TIA again & HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
I've searched the archives on this and, while I have turned up some
tips, they don't seem to solve my problem.

I an building a website for an indigenous organisation where jpg images
are uploaded, resized to a standard format, and thumbnails also
generated at the same time (so that is two resizes for each image). Most
of the time this works OK, but there are a lot of pages where many
thumbnails are just blacked out, eg:

http://waru.org/arakuwaritja.php?p=63

On some pages, all images are blacked out, eg:

http://waru.org/arakuwaritja.php?p=36

whereas on others they're all OK, eg:

http://waru.org/arakuwaritja.php?p=43

The people in the field taking and uploading the photos insist that the
format, color depth, etc, is not changing from photo to photo, and I
can't discern any differences. Yet some work, some don't.

I read somewhere that memory limitations could cause this, but still, it
only happens sometimes and not others. We are on a crowded shared server
I think.

I'm use ImageCreateTrueColor() after checking with ImageIsTrueColor(),
otherwise just ImageCreate(). The initial resizes almost always work
(down from 640x480 to 400x300), with the thumbnails it is looking like a
50% failure rate.

Thanks in advance for any assistance.

Michael Hall

--- End Message ---
--- Begin Message ---
* Thus wrote Ninti Systems ([EMAIL PROTECTED]):
> 
> I read somewhere that memory limitations could cause this, but still, it
> only happens sometimes and not others. We are on a crowded shared server
> I think.

A quick sample of sizes of images does back this thoery up.  Most
pictures I sampled, the full picture's that resized properly were
~16KB, the black icon images original size were ~24KB - ~35KB

I would think that the GD library will complain at some point if
there are memory problems, make sure your settings (on the page
that generates the thumbnails) has error_reporting(E_ALL), and
monitor any errors that occure there.

Curt
-- 
"I used to think I was indecisive, but now I'm not so sure."

--- End Message ---
--- Begin Message ---
I'm using list like
list($a,$b,$c,$d) = $MyArray
MyArray holds more than three items, 0-4 more,
my problem is that $d only gets one and I lose the others if more tha one
extra. I know I can just add more $e,f,g,h,i but how do I get the extras
into an array?

TIA
RGauthier

--- End Message ---
--- Begin Message ---
Hi

I am finally starting to try and use register_globals = off on my Servers.
This means a lot of code that has to be checked and changed.

Unfortunatly I am struggeling to come to grips with this new concept (new to
me that is) and was wondering if anybody could give me some pointers.

Getting stumped at my login script.
Once I have checked user and passwords, I pass a few SESSION vars to use
throughout my app.

<snip>
if ($status == 1)
   {
       //initiate a session
       session_start();
       //register session variables
       $_SESSION['SESSION'];
       //Get DataBase details and connect to it
       include($root_path . "include/vars.php");
       $query = "SELECT * FROM admin WHERE user_name = '$user'";
       $result = mysql_query($query);
       $row = mysql_fetch_object($result);
       //include the username
       $_SESSION['SESSION_UNAME'] = $row->user;
       //include the user id
       $_SESSION['SESSION_UID'] = $row->admin_id;
       //set the SecLevel Session Var
       $_SESSION['SESSION_SEC'] = $row->sec_level;
       //Now do the redirect
               //redirect to Admin Page
               header("Location: ./admin_main.php");
       exit();

   }
else
</snip>

Where ever I have the $SESSION['var_name'] I used to have a
session_register("SESSION_VAR");
$SESSION_VAR = $row->user;

I then redirect to my app main page and check if a session is registerd to
make sure a user is logged in:

//check that each page is secure
session_start();
//OLD CODE IN SCRIPT = if (!session_is_registered("SESSION"))
if(isset($_SESSION['SESSION']))
   {
       //if session check fails, invoke error handler
       header("Location: ./../error.php?e=2");
       exit();
   }
?>

That all works fine, but when I finaly start to display data on the main
page, nothing shows up.

One of the things I try to display is the name of the user logged in:
>From the login script
//include the username
$_SESSION['SESSION_UNAME'] = $row->user;

then on my main page
echo "logged in as <b>" . $_SESSION['SESSION_UNAME'] . "</b> ";

Needless to say, no data is displayed..... anybody able to point out what I
am getting wrong here. It used to work fine before the old way with
register_globals = on.

SIDE Note:
On a Windows PC with Apache, PHP and MySQL installed, even with the
register_globals = on set, the SESSION vars do not work.

Thanks and sorry for the long post,

Ross

--- End Message ---

Reply via email to