php-general Digest 21 Oct 2004 09:21:17 -0000 Issue 3065

Topics (messages 199940 through 199960):

Re: Mac OS X and Editor
        199940 by: James McGlinn
        199943 by: Larry E. Ullman
        199944 by: Daniel Schierbeck
        199945 by: Daniel Schierbeck
        199946 by: Brent Baisley
        199947 by: Michael Sims

Re: remote file existance when protected by a .htaccess
        199941 by: Mag
        199948 by: Matt M.
        199949 by: Robby Russell
        199950 by: Matt M.

Announce:ASPA 1.1
        199942 by: Anakreon

Moving uploaded image tmp file problem
        199951 by: Dave Grant

A better way to do this in php???
        199952 by: bclem.imaginative-enterprises.com
        199954 by: trenton.southfamily.com
        199955 by: Robert Cummings

File Upload Problem
        199953 by: Nathan Mealey
        199956 by: Robby Russell
        199957 by: Robby Russell

Re: url
        199958 by: Zareef Ahmed

Re: Send variable in include()
        199959 by: Zareef Ahmed

Re: Validation problem with array.
        199960 by: Stuart Felenstein

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 ---
Hi Jonel,

Hi guys, I just like to ask those using Macs here as to what editor and/or
IDE they are using for writing PHP codes.

I'm using Zend Studio (ZDE) - it works as well as any I've tried. It's significantly faster than Eclipse too (on a G4 PowerBook 1.33Ghz/512MB RAM).


James McGlinn Project Manager BCom, BSc, Zend Certified Engineer (PHP)

Servers.co.nz Ltd
68 Shortland St, Auckland PO Box 3688 Shortland St, Auckland, New Zealand
Phone: 0800 4 SERVERS Fax: +64 9 358 5187
--- End Message ---
--- Begin Message ---
Hi guys, I just like to ask those using Macs here as to what editor and/or
IDE they are using for writing PHP codes.

BBEdit is generally consider to be one of the best (note: I said "one of the best", not "best", so let's not start about how emacs, vi, and vim are better) text editors available on any platform. It's very easy to use yet powerful (supports grep, works with Xcode, has command line tools, etc). The new version 8 ties into Apache, letting you test PHP scripts in the application. It's a text editor, not an IDE, though. There are PHP- and SQL-specific libraries built in so that it recognizes function names and such.

Larry
--- End Message ---
--- Begin Message --- Jonel Rienton wrote:
Hi guys, I just like to ask those using Macs here as to what editor and/or
IDE they are using for writing PHP codes.

Thanks and regards to all.

Jonel
I use the Eclipse IDE (www.eclipse.org) with phpEclipse (www.phpeclipse.org) or Xored Trustudio (www.xored.com) on Windows (hey, I'm poor), but the Eclipse IDE is cross-platform (so are the plugins as far is I know.)

--
Daniel Schierbeck

Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/register&r=6584
--- End Message ---
--- Begin Message ---
James McGlinn wrote:

I'm using Zend Studio (ZDE) - it works as well as any I've tried. It's significantly faster than Eclipse too (on a G4 PowerBook 1.33Ghz/512MB RAM).

Hmm, maybe (have you tried out Eclipse 3.0?), but I still find the interface of Eclipse superior to Zend Studio's (that's just plain ugly and confusing) - plus, it's free! And open-source! Yay!


-- Daniel Schierbeck

Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/register&r=6584
--- End Message ---
--- Begin Message --- BBEdit, of course. I use it for just about all my coding, not just php. Not free, but a free fully functional demo is available. I forget if the demo is a certain number of launches or a time limit.
I have looked into Zend Studio and Eclipse, but they are a bit slow on a laptop.


On Oct 20, 2004, at 4:12 PM, Jonel Rienton wrote:

Hi guys, I just like to ask those using Macs here as to what editor and/or
IDE they are using for writing PHP codes.

Thanks and regards to all.

Jonel

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


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

--- End Message ---
--- Begin Message ---
Jonel Rienton wrote:
> Hi guys, I just like to ask those using Macs here as to what editor
> and/or IDE they are using for writing PHP codes.

I don't personally use Mac OS X, but let me throw in a recommendation for jEdit
(www.jedit.org).  It's Java based, hence cross-platform, and extremely powerful.  I
use it on Windows and couldn't live without it.  I have installed it on my friend's
iMac long enough to see that it works, but not long enough to know of any
platform-specific issues and/or gotchas.

--- End Message ---
--- Begin Message ---
> > which works great except I have been getting some
> 403
> > access denied errors for some sites, checking I
> see
> > that they are protected by a htaccess file (that
> > checks the referrer) so i tried putting
> > 
> > header('referer: domain')
> > 
> > where domain is the parse_url['host'] of
> $remote_file
> > but that too has failed...
> > 
> > Any ideas?
> 
> 
> might want to try
> http://pear.php.net/package/HTTP_Client

Nope, no PEAR allowed....any other options?

Thanks,
Mag

=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

--- End Message ---
--- Begin Message ---
> Nope, no PEAR allowed....any other options?

curl, Is that available to you?

http://us2.php.net/curl

--- End Message ---
--- Begin Message ---
On Wed, 2004-10-20 at 09:53 -0700, Mag wrote:
> > > which works great except I have been getting some
> > 403
> > > access denied errors for some sites, checking I
> > see
> > > that they are protected by a htaccess file (that
> > > checks the referrer) so i tried putting
> > > 
> > > header('referer: domain')
> > > 
> > > where domain is the parse_url['host'] of
> > $remote_file
> > > but that too has failed...
> > > 
> > > Any ideas?
> > 
> > 
> > might want to try
> > http://pear.php.net/package/HTTP_Client
> 
> Nope, no PEAR allowed....any other options?

No PEAR allowed?

Why not? You can include the libraries in your own paths...

-Robby


-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
> > Nope, no PEAR allowed....any other options?

also 

http://us2.php.net/fsockopen

check the user comments for setting referer

--- End Message ---
--- Begin Message --- Hello.
I'd like to announce the release of version 1.1 of ASPA.
ASPA is an ASP to PHP translator. It uses syntax and schematic analysis in order to produce PHP code of equivalent functionality with the original
ASP code. It supports both JS and VB script.

For more info see:http://storm.cs.unipi.gr/~anakreon/aspa.html

Anakreon.
--- End Message ---
--- Begin Message ---
Hello, I wonder if someone has ran into a problem similar to or related to 
this before.

I have a rather large form that, among other things, allows the user to 
upload 2 images, one small, the other slighly larger.  They upload just 
fine, they show up in the $_FILES array, and I do error checking on them 
which seems to pass.

Then I move them with the following code:

$thumbPath = $GLOBALS["dvdimgpath"].$_POST["gameId"]."_thumb.jpg";
$fullPath = $GLOBALS["dvdimgpath"].$_POST["gameId"]."_full.jpg";
if ($DEBUG) echo "Thumb image uploaded to ".$thumbPath."<br />\n";
if (!move_uploaded_file($_FILES["thumbImage"]["tmp_name"], $thumbPath)) {
        echo "Image file could not moved to the images dir.  Please try 
again";
}
if ($DEBUG) echo "Full image uploaded to ".$fullPath."<br />\n";
if (!move_uploaded_file($_FILES["fullImage"]["tmp_name"], $fullPath)) {
        echo "Image file could not moved to the images dir.  Please try 
again";
}

The images are not there when I go to look for them in the destination 
directory.  Any suggestions or ideas?  Thanks. 

--- End Message ---
--- Begin Message ---
I need to find the exact time of day using "minutes since midnight".

What is the easiest and/or better way to do this in php?

This is how I'm doing it now.

// $iMinutes is the total number of minutes since midnight/12am
// 0 = midnight/12am
// 1439 = 11:59pm

$iMinutes = 1230;

if ($iMinutes < 0 || $iMinutes > 1439) {
        $restime = "??:??";
} else {
        $iHour = $iMinutes / 60;
        $iMins = ($iMinutes - (60*$iHour)) % 60;

        if ($iHour <= 12) {
                $restime .= $iHour . ":";
        } else {
                $restime .= $iHour-12 . ":";
        }

        if ($iMins < 10) {
                $restime .= "0" . $iMins;
        } else {
                $restime .= $iMins;
        }
        if ($iHour < 12) {
                $restime .= " a.m.";
        } else if ($iHour==12 && $iMins==0) {
                $restime .= " noon";
        } else {
                $restime .= " pm";
        }
}


Thanks, Brent


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

--- End Message ---
--- Begin Message ---
Why not use the date function?

date("g:i a");

Trenton

> I need to find the exact time of day using "minutes since midnight".
>
> What is the easiest and/or better way to do this in php?
>
> This is how I'm doing it now.
>
> // $iMinutes is the total number of minutes since midnight/12am
> // 0 = midnight/12am
> // 1439 = 11:59pm
>
> $iMinutes = 1230;
>
> if ($iMinutes < 0 || $iMinutes > 1439) {
>         $restime = "??:??";
> } else {
>         $iHour = $iMinutes / 60;
>         $iMins = ($iMinutes - (60*$iHour)) % 60;
>
>         if ($iHour <= 12) {
>                 $restime .= $iHour . ":";
>         } else {
>                 $restime .= $iHour-12 . ":";
>         }
>
>         if ($iMins < 10) {
>                 $restime .= "0" . $iMins;
>         } else {
>                 $restime .= $iMins;
>         }
>         if ($iHour < 12) {
>                 $restime .= " a.m.";
>         } else if ($iHour==12 && $iMins==0) {
>                 $restime .= " noon";
>         } else {
>                 $restime .= " pm";
>         }
> }
>
>
> Thanks, Brent
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
On Wed, 2004-10-20 at 19:37, [EMAIL PROTECTED] wrote:
> Why not use the date function?
> 
> date("g:i a");

The OP wants to get the time based on a value indicating the number of
minutes since midnight. He doesn't want the current time. The following
should give him what he needs:

----
$iMinutes = 800;

$midnight = mktime( 0, 0, 0, date( 'm' ), date( 'd' ), date( 'Y' ) );
echo date( 'g:ia', $midnight + ($iMinutes * 60 ) );
----

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
This file upload problem has me very confused.

The code is:

$upload_dir = '/articles_store/';
$uploadfile = $upload_dir . basename($_FILES['userfile']['name']);

if (move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile)) {
} else { die ("Cannot upload file");
}

(this code is practically verbatim the example from php.net)

The directory '/articles_store' has permissions 777. And the user is and group are 'www' (the Apache user).

But I keep getting the following error:

[Wed Oct 20 19:01:34 2004] [error] PHP Warning: move_uploaded_file(/articles_store/case_for_base.pdf) [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: failed to open stream: No such file or directory in /usr/local/www/data-dist/cycle-smart/www/Articles/admin/ articleinsert.php on line 50
[Wed Oct 20 19:01:34 2004] [error] PHP Warning: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/var/tmp/phpibRXhc' to '/articles_store/case_for_base.pdf' in /usr/local/www/data-dist/cycle-smart/www/Articles/admin/ articleinsert.php on line 50

Any help is very, very much appreciated.

NM
--
Nathan Mealey
Director of Operations
Cycle-Smart, Inc.
P.O. Box 1482
Northampton, MA
01061-1482
[EMAIL PROTECTED]
(413) 587-3133
(413) 210-7984 Mobile
(512) 681-7043 Fax

--- End Message ---
--- Begin Message ---
On Wed, 2004-10-20 at 19:27 -0400, Nathan Mealey wrote:
> This file upload problem has me very confused.
> 
> The code is:
> 
> $upload_dir = '/articles_store/';
> $uploadfile = $upload_dir . basename($_FILES['userfile']['name']);
> 
> if (move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile)) {
> } else { die ("Cannot upload file");
> }
> 
> (this code is practically verbatim the example from php.net)
> 
> The directory '/articles_store' has permissions 777.  And the user is  
> and group are 'www' (the Apache user).

Are you sure that this is the correct path? Did you create a new path in
your root level as /articles_store ?

so, if I go on your machine and type in:
$ cd /
$ ls 

it'll show
/articles_store
/dev
/etc
/var

...etc?


-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
On Wed, 2004-10-20 at 17:00 -0700, Robby Russell wrote:
> On Wed, 2004-10-20 at 19:27 -0400, Nathan Mealey wrote:
> > This file upload problem has me very confused.
> > 
> > The code is:
> > 
> > $upload_dir = '/articles_store/';
> > $uploadfile = $upload_dir . basename($_FILES['userfile']['name']);
> > 
> > if (move_uploaded_file($_FILES['userfile']['tmp_name'],$uploadfile)) {
> > } else { die ("Cannot upload file");
> > }
> > 
> > (this code is practically verbatim the example from php.net)
> > 
> > The directory '/articles_store' has permissions 777.  And the user is  
> > and group are 'www' (the Apache user).
> 
> Are you sure that this is the correct path? Did you create a new path in
> your root level as /articles_store ?
> 
> so, if I go on your machine and type in:
> $ cd /
> $ ls 
> 
> it'll show
> /articles_store
> /dev
> /etc
> /var
> 

Basically, my first guess is that you are not understanding the
directory structures properly. You need to give it the full path if
you're going to have a / at the beginning of your directory path.

/foo != yousite.com/foo in the system level.

hth,

Robby


-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
****************************************/

Attachment: signature.asc
Description: This is a digitally signed message part


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

-----Original Message-----
From: Dan McCullough [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 20, 2004 10:38 PM
To: PHP General List
Subject: [PHP] url

I have this old script I wrote 2-3 years back.  I gets arguments from
the url.  index.php?area=blah

  Dear, you forgot to update yourself about a major change in PHP's
default behavior in these years, Now register global are by default
disabled.

NEXT thing to watch  
-------------------
$_HTTP_*_VARS    is also deprecated in php5. By default they are enable
as of now but who can say about the future.



The client moved the code to another server and some odd happened.
Nothing seems to be parsing from the URL anymore.
 
The top code is 
 
<? if (!isset($area)) { ?>
HTML
 
THis code no longer seems to work and I am racking my brain trying to
figure out what.


--------------------------------------------------------
"Theres no such thing as a problem unless the servers are on fire!"

I think this should be changed to....
"There no such thing as a problem unless the servers are on change" ;)

Zareef Ahmed 
                
 

--------------------------------------------
Zareef ahmed :: a php developer in delhi (India)
Homepage :: http://www.zasaifi.com 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
 

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

-----Original Message-----
From: Pete [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 20, 2004 10:36 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Send variable in include()

I'm trying to send a variable an include that is recieve from another
page:

- navi.php-
<a href =\"'http://www.example.com/view.php?offset=0\";>Test</a>

- view.php -
I recieve $offset with avalue of "0" nicely, "echo ("$offset");" will
show a 
value.
Now a do this:
include
'http://www.example.com/guestbook.php?option=view&offset=$offset';
>>> change your single quotes to double quotes.


- guestbook.php -
$offset gets value "$offset" instead of "0"
$option has correct value, "view"

How do I write my include so it works?
Would appriciate som help.

Regards,

Pete

---------------------------------------------
Zareef Ahmed :: A PHP Developer in Delhi (India)
Homepage :: http://www.zasaifi.com


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 10/15/2004
 

--- End Message ---
--- Begin Message ---
See below:
--- Graham Cossey <[EMAIL PROTECTED]> wrote:

> Also, this line :
> foreach($_SESSION['skills'] as $key => $skill)
> could read
> foreach($skills as $key => $skill)
> as you have the line:
> $skills = $_SESSION['skills'];
> Same for skys and slus.
> Graham

Graham, 
I've read this over and over and I must be dense
because I"m not totally comprehending it.

Let me show you how I set it all up. Remember it's  a
multi page form:
So the form elements are: skills[], skys[], slus[]
Then on the next page I have to still pass the session
variables, and so:

$_SESSION['skills'] = $_POST['skill']; 
$_SESSION['skys'] = $_POST['sky']; 
$_SESSION['slus'] = $_POST['slu']; 

Now the transcation script:

$skills = $_SESSION['skills'];
$skys = $_SESSION['skys'];
$slus = $_SESSION['slus'];

foreach($_SESSION['skills'] as $key => $skill)
{
$query = "INSERT INTO LurkProfiles_Skicerts
(SkicertID, ProfileID, SkilCerts, NumYear, Lused) 
VALUES (null, $LID, '$skill',
{$_SESSION['skys'][$key]},{$_SESSION['slus'][$key]})";
//$result = mysql_query($query);
$res6 = run_query($query);
echo $query;
}

I understand that in the insert statement I need not
repeat $_SESSION.
The rest though is fuzzy. 
It was working, now I'm getting some really odd
behaviour, in that, unless i fill in every field in
the form, I get a mysql syntax error.

Stuart

--- End Message ---

Reply via email to