php-general Digest 20 Nov 2004 11:41:43 -0000 Issue 3123

Topics (messages 202541 through 202555):

Re: I am new - Having problems displaying something
        202541 by: Jed Smith
        202544 by: Brian Heibert

Re: HTML form online
        202542 by: Jed Smith
        202543 by: Jed Smith

Re: Sort $_FILE['userfile']['name'] by ascending abc order...
        202545 by: M. Sokolewicz

ending a session
        202546 by: Hans J.J. Prins
        202547 by: Jed Smith
        202550 by: Hans J.J. Prins

Re: ERP - CRM implemented  in PHP
        202548 by: Yann Larrivée

Re: Is Perl faster than PHP?
        202549 by: Justin French

Re: how to parse a string parse with ereg
        202551 by: Jason Wong

PHP & Affiliate & Login
        202552 by: Johan van Zyl
        202555 by: Richard Davey

Warning: Unknown list entry type in request shutdown (0) in Unknown on line 0
        202553 by: Manoj Kumar

Limit to the number of sockets socket_select can supervise?
        202554 by: Hans-Christian Jehg

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 ---
passthru()'s prototype is actually:

        void passthru(string cmd[, int &return)
          http://php.net/passthru

Meaning using passthru() with the concatenation operator . will produce unexpected results, as the product of the passthru call is actually printed directly out to the page, as is. Nothing is returned. If you wish to snag the output of an external command into a variable, or modify it further using another function, consider the backtick operator (`):

     $output = `osascript /Library/WebServer...`;
     printf("Current song: %s\n", $output);

If you have trouble finding the backtick ` -- remember, it's not a single-quote mark, it's a backtick, usually on the ~ key -- system() will accomplish the same thing in a functional fashion. Or, you can keep passthru(), and just use it differently:

     Current song: <?php passthru("osascript /Library/WebServer..."); ?>

If this doesn't work, check to make sure osascript is printing to stdout. I'm not sure how osascript works, as I'm not a Mac user, but I'm assuming this is OS X (from the pathnames) -- therefore, I *imagine* there's a stdout on OS X.

passthru() should grab whatever goes to stdout. If it still doesn't work for you, check the page source to see if passthru() drops anything but it's formatted out (hey, I have to say it). Oh, and make sure Apache can run osascript. If Apache can't run osascript, that's another problem. (I would imagine it'd have to be able to access your Applescript file as well.)

Good luck! HTH

Jed


Brian Heibert wrote:
Hi,

I am new to this list.  I am trying to do a php script that will say what
song is currently playing in iTunes/NiceCast Internet Radio broadcaster
Onto my website

Every attempt I have made so far has failed

I got a file called playing.php
With this text inside it:
<?php

echo "Current Song: ".passthru("osascript
/Library/WebServer/Documents/christiantoplist/whattrack.scpt");

?>


And a file called whattrack.scpt (AppleScript file) with this in it tell application "iTunes" set trk to current track set tle to name of trk set art to artist of trk set albm to album of trk return tle & " - " & art & ", " & albm end tell

But it is not displaying what song is playing on my website
All it says is Current Song: and then it doesn't say the song

Brian Heibert

PS: I have a iMac G4 800mhz OS 10.3.6 running Apple's webserver system
preference which is there version of Apache I think


--
     _
    (_)___    Jed Smith, Code Ninja
    | / __|   RFBs: [email for info]
    | \__ \   +1 (541) 606-4145
   _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
  |__/        http://personal.jed.bz/keys/jedsmith.asc

--- End Message ---
--- Begin Message ---
I tried adding a ip addresss:

<EMBED SRC="http://4.10.69.244/christiantoplist/playing.php"; WIDTH="256"
HEIGHT="256" ALIGN="BOTTOM">

The domain I have christiantoplist.org forwards to
http://4.10.69.244/christiantoplist/index.html

But it still doesn't work
It says: Current Song: and then it's blank

Brian

On 11/19/04 1:17 AM, "Warren Vail" <[EMAIL PROTECTED]> wrote:

> Looks like the URL you are trying to passthru is missing a domain, No?  ;-)
> 
> Warren Vail
> 
>> -----Original Message-----
>> From: Brian Heibert [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, November 18, 2004 9:33 PM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP] I am new - Having problems displaying something
>> 
>> 
>> Hi,
>> 
>> I am new to this list.  I am trying to do a php script that will say what
>> song is currently playing in iTunes/NiceCast Internet Radio broadcaster
>> Onto my website
>> 
>> Every attempt I have made so far has failed
>> 
>> I got a file called playing.php
>> With this text inside it:
>> <?php
>> 
>> echo "Current Song: ".passthru("osascript
>> /Library/WebServer/Documents/christiantoplist/whattrack.scpt");
>> 
>> ?>
>> 
>> 
>> And a file called whattrack.scpt (AppleScript file) with this in it
>> tell application "iTunes"
>> set trk to current track
>> set tle to name of trk
>> set art to artist of trk
>> set albm to album of trk
>>  return tle & " - " & art & ", " & albm
>>  end tell
>> 
>> But it is not displaying what song is playing on my website
>> All it says is Current Song: and then it doesn't say the song
>> 
>> Brian Heibert
>> 
>> PS: I have a iMac G4 800mhz OS 10.3.6 running Apple's webserver system
>> preference which is there version of Apache I think
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
>> 
>> 

--- End Message ---
--- Begin Message --- Jerry Swanson wrote:
I want to write php script that fill out HTML form online. Any ideas
how to do it?

If you want to fill a form *remotely*, that's a little tougher. You'll need cooperation from the server-side code on the site you want to fill the form on. As Matthew noted, the VALUE attribute of an INPUT tag is what you are seeking to modify.


Perhaps POST variables that PHP parses and sets the VALUE attribute to?

Otherwise, if you *won't* have cooperation from the other server's code, it becomes a client-side, userspace app, since it'd be a matter of pretending the user is typing. (Think Mozilla, Gator, et. al.) PHP can do that, but I don't believe that's a solution for you.

HTH

--
     _
    (_)___    Jed Smith, Code Ninja
    | / __|   RFBs: [email for info]
    | \__ \   +1 (541) 606-4145
   _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
  |__/        http://personal.jed.bz/keys/jedsmith.asc

--- End Message ---
--- Begin Message --- Warren Vail wrote:
If so you probably want to start here;

http://www.php.net/manual/en/ref.curl.php

cURL can do that?

--
     _
    (_)___    Jed Smith, Code Ninja
    | / __|   RFBs: [email for info]
    | \__ \   +1 (541) 606-4145
   _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
  |__/        http://personal.jed.bz/keys/jedsmith.asc

--- End Message ---
--- Begin Message --- Scott Fletcher wrote:
Um, let's see, what would be the way to go in sorting the dual array

--snip--
 $_FILES['userfile']['name']
$_FILES['userfile']['type']
$_FILES['userfile']['size']
$_FILES['userfile']['tmp_name']
$_FILES['userfile']['error']
--snip--

where $_FILES['userfile']['name'] would be in ascending abc order while all
other like $_FILES['userfile']['type'], $_FILES['userfile']['size'], etc...
would be correctly be side-by-side with the $_FILE['userfile']['name'] in
that order?

$file = $_FILE['userfile'];

$file = array_multisort($file['name'], SORT_ASC );

Is that right??

THanks,
 Scott
try it, the you won'y have to ask ;)
--- End Message ---
--- Begin Message ---
Hello,

I started a session at www.mydomain.com:2222/myscript.php

I want to destroy the session at www.mydomain.com/myscript.php

I seem to not be able to destroy it though. Does the different port have
anything to do with it?

Thx,

H J.J. P

--- End Message ---
--- Begin Message --- Hans J.J. Prins wrote:
Hello,

I started a session at www.mydomain.com:2222/myscript.php

I want to destroy the session at www.mydomain.com/myscript.php

I seem to not be able to destroy it though. Does the different port have
anything to do with it?

Thx,

H J.J. P

Although I've never encountered this situation before, I'll try.

More information about the platform in question will be necessary, but I'm going to go ahead and venture a "yes" here. It is safe to assume that different copies of PHP end up being run when you request something on 2222 and on 80.

Different copies of PHP don't (?) share session states. A custom session handler might be necessary for you. (Let me clarify that: PHP attached to *different servers* shouldn't share session states.)

Questions:

   1. What are you running on 2222?
   2. What are you running on 80?
   3. Is it the same copy of PHP? Same php.ini, same PHP SAPI?

   (If Apache for 1 & 2)

   4. Same Apache?
   5. What's your Listen directive look like, if YES for number 4?
   6. Vhosts?

This also may be a security feature, but I've personally never tackled the problem. Tough to say.

I'll leave my advice at that for now pending further information.

--
     _
    (_)___    Jed Smith, Code Ninja
    | / __|   RFBs: [email for info]
    | \__ \   +1 (541) 606-4145
   _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
  |__/        http://personal.jed.bz/keys/jedsmith.asc

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

Thx for your response.

>     1. What are you running on 2222?
1) FreeBSD with Apache
2) Also Directadmin (hosting control panel)


>     2. What are you running on 80?
1) FreeBSD with Apache
2) A login form into directadmin. I do this because I wanted to skin the
login form but cant skin the login form on directadmin itself. I am not an
owner,  just a user of the controlpanel thus giving me limited access.


>     3. Is it the same copy of PHP? Same php.ini, same PHP SAPI?
I really don't know I would have to find out later.


>     4. Same Apache?
How do I find out?


>     5. What's your Listen directive look like, if YES for number 4?
Sorry, don't know what you mean by that.


>     6. Vhosts?
Does that mean virtual hosts? In that case yes


"Jed Smith" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Hans J.J. Prins wrote:
> > Hello,
> >
> > I started a session at www.mydomain.com:2222/myscript.php
> >
> > I want to destroy the session at www.mydomain.com/myscript.php
> >
> > I seem to not be able to destroy it though. Does the different port have
> > anything to do with it?
> >
> > Thx,
> >
> > H J.J. P
>
> Although I've never encountered this situation before, I'll try.
>
> More information about the platform in question will be necessary, but
> I'm going to go ahead and venture a "yes" here. It is safe to assume
> that different copies of PHP end up being run when you request something
> on 2222 and on 80.
>
> Different copies of PHP don't (?) share session states. A custom session
> handler might be necessary for you. (Let me clarify that: PHP attached
> to *different servers* shouldn't share session states.)
>
> Questions:
>
>     1. What are you running on 2222?
>     2. What are you running on 80?
>     3. Is it the same copy of PHP? Same php.ini, same PHP SAPI?
>
>     (If Apache for 1 & 2)
>
>     4. Same Apache?
>     5. What's your Listen directive look like, if YES for number 4?
>     6. Vhosts?
>
> This also may be a security feature, but I've personally never tackled
> the problem. Tough to say.
>
> I'll leave my advice at that for now pending further information.
>
> -- 
>       _
>      (_)___    Jed Smith, Code Ninja
>      | / __|   RFBs: [email for info]
>      | \__ \   +1 (541) 606-4145
>     _/ |___/   [EMAIL PROTECTED] (Signed mail preferred: PGP 0x703F9124)
>    |__/        http://personal.jed.bz/keys/jedsmith.asc

--- End Message ---
--- Begin Message ---
I would sugest Dollibar http://freshmeat.net/projects/dolibarr/

Wich has all the crm, ERP fonctionalities. And hostly up to now i haven't 
rellay seen a groupware made in PHP that is really clean (code wise) and easy 
to use.

Has gropware there is OpenGroupeware but the api is write-en in objective-c 
however there is a PHP front-end :)
http://www.opengroupware.org

At my work we are going to choose this one.

Yann

On November 19, 2004 09:14, Manoj Kumar wrote:
> Hi   folks,
>   Would you please suggest me the name of ERP - CRM software solely
> implemented in PHP .
>
> -- Manoj Kr. Sheoran

--- End Message ---
--- Begin Message ---
On 17/11/2004, at 2:54 AM, Merlin wrote:

it came to my attention that most of the high traffic portals are using perl in the backend. Those sites do also apear to me to be very fast in comparison to most php sites. Are there any known performance comperissons between the two available? Or can one say that PHP or Perl is faster about x percent in general compared to the other one?

Unless you compare the same site written and optimised for the two languages, written by a developer who is equally skilled in both languages, hosted on servers of equal performance, with equal traffic, you can't compare the sites and make a bold assumption like "Perl must be faster".


When you compare two website's performance, you're not just comparing code at all... you're comparing traffic, server load, the programmer's skills, the server set-up, bandwidth, connectivity, etc etc.

Would you compare a Ferrari to a Volkswagon? They're both cars, right? :)

For what it's worth, PHP5 under FastCGI on a nice server with a good sysadmin is *incredibly* fast. Shameless plug: TextDrive.com (a hosting company in the US that just hired me) offers exactly that -- blindingly fast PHP5 shared hosting with the works.

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

--- End Message ---
--- Begin Message ---
On Friday 19 November 2004 01:50, [EMAIL PROTECTED] wrote:

> > Then you can process each line separately but in groups 3 lines at a time
> > (assuming they're supposed to be groups of 3).
>
> but what happen's in the case a user drop down every line in a web
> form without a ELO character ?

Not quite sure what you mean here. In a <textarea> pressing ENTER/RETURN will 
generate an EOL character. If they have a habit of not pressing ENTER/RETURN 
when they should then you can run a simple check on the length of a line and 
reject and/or ask them to enter again.

In any case if you want to force the user to enter lines separately use a 
bunch of <input type="text" ...> instead of <textarea>.

The point here is that doing relatively simple checks early on in the data 
entry stage to ensure that you get sane data means you don't have to trawl 
through garbage in the data processing stage trying to figure out all the 
ways in which a user could have entered incorrect data.

> > If you state clearly, in detail, what exactly you want the regex
> > to match then
> > maybe someone could construct a better one for you.
>
> Ok, at the moment I verify the assuming missed device with a difference
> of the following both block's:

[...]

You're telling us what you're *doing*, not what you *want* your code to do. We 
need to know what you *want* your code to do before we can suggest 
improvements or whatever.

Anyway here's a PCRE to match a single IP address:

(([0-9])|([1-9][0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))\.(([0-9])|([1-9]
[0-9])|(1[0-9][0-9])|(2[0-4][0-9])|(25[0-5]))\.(([0-9])|([1-9][0-9])|(1[0-9]
[0-9])|(2[0-4][0-9])|(25[0-5]))\.(([0-9])|([1-9][0-9])|(1[0-9][0-9])|(2[0-4]
[0-9])|(25[0-5]))

It will validate an IP address of the form:

  (0-255).(0-255).(0-255).(0-255)

No leading zeros allowed.

> <?
> $INET_NUM_exp = ereg_replace("[\
> ]+([a-z]+)([0-9]{1})","\\1\\2_XrR",$INET_NUM); $sorter =
> explode("_XrR",$INET_NUM_exp);
> $result = count($sorter);
> $result = $result-1;

Instead of doing this bit of code (which I don't understand), I suggest that 
you incorporate some simple check for interface into your regex:

(((eth|ppp)\d{1,2})|lo)


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Bloom's Seventh Law of Litigation:
 The judge's jokes are always funny.
*/

--- End Message ---
--- Begin Message ---
Hi
How difficult would it be to write Affiliate software, using PHP,
Dreamweaver & FireBird hosted on Linux(SME)
like
http://www.myreferer.com/content/en/order.shtml
It does not have to be that sophisticated, I would just like to know who
visited my page and where were they directed from.

Also, have you got any sample code for this scenario:
People accessing this URL must get a screen where they can either with a
login and password gain access to other pages, or they can register. When
they click register, they must supply a login name and their e-mail address.
This will then trigger a SP in firebird that will generate a password and
e-mail it back to them. They can now login with this password and must be
able to change their password.

Thx

========================
Johan van Zyl
JVZ Systems CC
Box 3469
Somerset West
7129
[EMAIL PROTECTED]
http://www.jvz.co.za
+27 (0)82 875 4238
+27 (0)21 851 7205
Fax 088 021 852 2387


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.799 / Virus Database: 543 - Release Date: 2004/11/19

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

Saturday, November 20, 2004, 9:06:23 AM, you wrote:

JvZ> It does not have to be that sophisticated, I would just like to
JvZ> know who visited my page and where were they directed from.

If that's all you need, why not just check your log files?

JvZ> Also, have you got any sample code for this scenario:
<scenario snipped>

Err, there must be loads of examples of those out there. Try starting
on hotscripts.com, probably under "user management" (or similar).

The Firebird requirement will be your biggest issue though.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

--- End Message ---
--- Begin Message ---
Hi folks , 
 
     What is the case of following warning ...
     Warning: Unknown list entry type in request shutdown (0) in Unknown on
line 0       
 
 
-- Manoj Kr. Sheoran 
  www.daffodildb.com <BLOCKED::http://www.daffodildb.com> 
 
 
 

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

Im building a TCP server in PHP 5.0.2 on Windows. It will have to serve a lot of clients (500+) with low traffic.

During this I have noticed that socket_select seems unable to supervise more than 64 connections at a time (Not good when I need 500+). It stops with a message that

"Socket select failed, error code is: 10038, error message is: An operation was at tempted on something that is not a socket."

These are the outputs of socket_last_error() and socket_strerror(socket_last_error()).

And now forthe questions:

Does any of you have the same experience?

Is it something to do with Windows? Does this limitation exist on Linux?

Is it just a bug?

Any good suggestions?

Best regards
and thanx in advance

HC
--- End Message ---

Reply via email to