OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 27 Oct 2003 17:01:58 -0000 Issue 2380

php-general-digest-helplists.php.net
Date: Mon Oct 27 2003 - 11:01:58 CST


php-general Digest 27 Oct 2003 17:01:58 -0000 Issue 2380

Topics (messages 167675 through 167745):

Re: copying a directory
        167675 by: Burhan Khalid
        167680 by: Shawn McKenzie
        167682 by: Gerard Samuel

Post variables getting lost
        167676 by: Joao Andrade
        167678 by: Binay
        167683 by: Eugene Lee
        167722 by: Chris Shiflett

Fairly simple array question
        167677 by: Terence Parker
        167721 by: Curt Zirzow

process forking?
        167679 by: Stephen Cronan
        167684 by: Ryan Thompson

Re: sockets - fine tunning
        167681 by: Cosmin
        167716 by: Curt Zirzow

Matchmaking System
        167685 by: Becoming Digital

Re: baffled on error_reporting
        167686 by: Marek Kilimajer
        167717 by: Curt Zirzow
        167724 by: Gerard Samuel

Re: XML/MySQL
        167687 by: Ian Williams

IMAP Package.
        167688 by: Michael Thompson

Accounting package
        167689 by: php4.nv.jakaranda.co.za
        167691 by: Justin French
        167719 by: Dan Joseph
        167720 by: Brian V Bonini

silly question about zend
        167690 by: Manisha Sathe

php://input
        167692 by: Dodi

Handling Notices
        167693 by: Nathan Taylor
        167708 by: Burhan Khalid

Converting a string to formatted html
        167694 by: Ian Gray
        167697 by: Ian Gray
        167699 by: Justin French

Change text size with GD
        167695 by: Cranky
        167703 by: chris.neale.somerfield.co.uk
        167710 by: Cranky

[Newbie Guide] For the benefit of new members
        167696 by: tech.leatherlink.net

Image created with GD does not appear
        167698 by: Cranky

Globals set to off - Sessions
        167700 by: Steve Jackson
        167705 by: pete M

Installation Fails
        167701 by: Michael Thompson

MP3 Ripping
        167702 by: Steve Vernon
        167707 by: Burhan Khalid
        167711 by: erythros
        167745 by: Steve Vernon

Randomizing 3 different numbers.
        167704 by: Ian Gray
        167726 by: Ray Hunter
        167734 by: Joachim
        167735 by: DvDmanDT
        167744 by: Tom

Re: Using php for non-web based applications
        167706 by: Jay Blanchard

Oh why won't it work
        167709 by: Tom Wollaston
        167714 by: Reidar Solberg
        167727 by: Curt Zirzow
        167729 by: David Otton

Re: Idea for new operator
        167712 by: DvDmanDT
        167718 by: Curt Zirzow

POST variables, funny thing
        167713 by: Joao Andrade
        167715 by: Jay Blanchard
        167723 by: Chris Shiflett

PhP/MySQL Search Results code
        167725 by: Robb Kerr
        167728 by: Jay Blanchard
        167730 by: Marek Kilimajer
        167731 by: Robb Kerr
        167733 by: Curt Zirzow

Files in /etc/php.d/
        167732 by: Todd Cary
        167736 by: Marek Kilimajer

register_globals
        167737 by: fanabe.tin.it
        167738 by: Jay Blanchard
        167739 by: Chris Shiflett
        167742 by: Chris Shiflett

Post variables and mysql queries
        167740 by: Luis Lebron
        167741 by: Chris Shiflett
        167743 by: pete M

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Shawn McKenzie wrote:

> I need to copy a directory from one location to the other. I didn't find a
> function for this. Is copy() supposed to work on directories as well as
> files, or is there another?

Unix :

cp -r /old/dir /new/dir

Windows :

xcopy /E c:\old\dir c:\new\dir

Use those with :

http://www.php.net/manual/en/function.exec.php

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

attached mail follows:


Thanks, but I was looking for a multi-platform way via a function.

I just bit the bullet and looped thru with readdir() and copied the files.

-Shawn

"Burhan Khalid" <phplistmeidomus.com> wrote in message
news:3F9CA3D2.3030607meidomus.com...
> Shawn McKenzie wrote:
>
> > I need to copy a directory from one location to the other. I didn't
find a
> > function for this. Is copy() supposed to work on directories as well as
> > files, or is there another?
>
> Unix :
>
> cp -r /old/dir /new/dir
>
> Windows :
>
> xcopy /E c:\old\dir c:\new\dir
>
> Use those with :
>
> http://www.php.net/manual/en/function.exec.php
>
>
>
> --
> Burhan Khalid
> phplist[at]meidomus[dot]com
> http://www.meidomus.com

attached mail follows:


On Monday 27 October 2003 12:58 am, Shawn McKenzie wrote:
> Thanks, but I was looking for a multi-platform way via a function.

rename()

attached mail follows:


    Hey people,

    Something odd is happening :) I've this form on a page:

<form method=post action="\basics\quotation-add">

<table>
<tr>
 <th>Author
 <td><input type=text size=30 name=author_name>
</tr>
<tr>
 <th>New Category
 <td><input type=text size=30 name=new>
</tr>
<tr>
 <th>Category
 <td><select name=category>
   <?php
   $categorias = mysql_query("SELECT DISTINCT category FROM quotations");
   $lincat = mysql_fetch_row ($categorias);
   while ($lincat != false){ //loop through the records enquanto ha linhas
      $cat = $lincat[0];
      echo "<option value=\"".$cat."\">".$cat ; //and place it in the select
      $lincat = mysql_fetch_row ($categorias);# pega uma linha
   }

   ?>
   </select>
</tr>
<tr>
 <th>Quotation
 <td><textarea name=quote cols=50 rows=8></textarea>
</tr>
</table>
<center>
<input type=submit value=Add>
</center>
</form>

    And then I have in quotations-add:

  echo $_POST['category'];
  echo $_POST['new'];
  echo $_POST['author_name'];

  echo $_POST['quote'];

    And what I get ist:

Notice: Undefined index: category in C:\Programme\Apache
Group\Apache2\htdocs\basics\quotation-add.php on line 85

Notice: Undefined index: new in C:\Programme\Apache
Group\Apache2\htdocs\basics\quotation-add.php on line 86
asdasdasdasd

    Where the 'author_name' and 'quote' POST variables are ok, why aren't
'new' and 'category' coming?

    Thanks again,

Joao Penna Andrade
Undergraduate, Mechanical Engineering
UNICAMP, Brazil

attached mail follows:


Change 'new' to something else say 'new1' as new is an operator so that
might be causing the problem which in turn affecting the category also ..

Hope this helps
cheers
Binay

----- Original Message -----
From: "Joao Andrade" <joao66bryahoo.com.br>
To: <php-generallists.php.net>
Sent: Monday, October 27, 2003 10:30 AM
Subject: [PHP] Post variables getting lost

>
> Hey people,
>
> Something odd is happening :) I've this form on a page:
>
> <form method=post action="\basics\quotation-add">
>
> <table>
> <tr>
> <th>Author
> <td><input type=text size=30 name=author_name>
> </tr>
> <tr>
> <th>New Category
> <td><input type=text size=30 name=new>
> </tr>
> <tr>
> <th>Category
> <td><select name=category>
> <?php
> $categorias = mysql_query("SELECT DISTINCT category FROM quotations");
> $lincat = mysql_fetch_row ($categorias);
> while ($lincat != false){ //loop through the records enquanto ha
linhas
> $cat = $lincat[0];
> echo "<option value=\"".$cat."\">".$cat ; //and place it in the
select
> $lincat = mysql_fetch_row ($categorias);# pega uma linha
> }
>
> ?>
> </select>
> </tr>
> <tr>
> <th>Quotation
> <td><textarea name=quote cols=50 rows=8></textarea>
> </tr>
> </table>
> <center>
> <input type=submit value=Add>
> </center>
> </form>
>
> And then I have in quotations-add:
>
> echo $_POST['category'];
> echo $_POST['new'];
> echo $_POST['author_name'];
>
> echo $_POST['quote'];
>
> And what I get ist:
>
> Notice: Undefined index: category in C:\Programme\Apache
> Group\Apache2\htdocs\basics\quotation-add.php on line 85
>
> Notice: Undefined index: new in C:\Programme\Apache
> Group\Apache2\htdocs\basics\quotation-add.php on line 86
> asdasdasdasd
>
> Where the 'author_name' and 'quote' POST variables are ok, why aren't
> 'new' and 'category' coming?
>
> Thanks again,
>
> Joao Penna Andrade
> Undergraduate, Mechanical Engineering
> UNICAMP, Brazil
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


On Mon, Oct 27, 2003 at 03:00:32AM -0200, Joao Andrade wrote:
:
: Hey people,
:
: Something odd is happening :) I've this form on a page:
:
: <form method=post action="\basics\quotation-add">

Backslashes are allowed?

attached mail follows:


--- Joao Andrade <joao66bryahoo.com.br> wrote:
> <form method=post action="\basics\quotation-add">

Windowsitis? Mind your slashes.

Also, you should quote HTML attributes (though this isn't your problem). So,
try this:

<form action="/basics/quotation-add" method="post">

> <td><input type=text size=30 name=author_name>
[snip]
> <td><input type=text size=30 name=new>

Same thing here. Quote your attributes.

Hope that helps.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

attached mail follows:


I'm retrieving results from a MySQL database - they would be of the form
  (form table 'usergroup'):

+----------+----------+
| username | group_id |
+----------+----------+
| tparker | 3 |
| tparker | 6 |
| tparker | 7 |
| tparker | 8 |
+----------+----------+

This SQL query is being carried out within another function that does a
query of the 'groups' table, and thus lists all groups. While listing
all groups, I want to check wither the current item to be listed is
equal to ANY of the group_id's in the result above (in other words, i'm
presenting the user with a list of group checkboxes, but with those
previously selected to be 'checked').

How is the best way to do this?

By using mysql_fetch_assoc or object for the 'usergroup' table result, I
have to check each item of the array for each item in the 'groups' list
- very inefficient.

How can I transfer the results above into an array such that I only need
to check $group_result->group_id against
$usergroup[$group_result->group_id] ? <-- I know that won't work
syntactically, it's an example only.

Or is there a better way of doing this? Is there a function that merely
asks if an item (say, '6') exists in ALL the results above?

Thanks in advance!

Terence

attached mail follows:


* Thus wrote Terence Parker (tparkerdeltapath.com):
> How can I transfer the results above into an array such that I only need
> to check $group_result->group_id against
> $usergroup[$group_result->group_id] ? <-- I know that won't work
> syntactically, it's an example only.
>
> Or is there a better way of doing this? Is there a function that merely
> asks if an item (say, '6') exists in ALL the results above?

An alterative is get the data you need back from the database then
you just have one result to go through in php.

select ug.username, g.*
  from groups g left join usergroup ug on (g.id = ug.group_id)
where ug.username = 'tparker';

+----------+---------------+
| username | g.id | g.name |
+----------+---------------+
| tparker | 3 | group3 |
| tparker | 6 | group6 |
| NULL | 1 | group1 |

if (empty($result->username)) {
  // not in group
} else {
  // in group
}

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


Hi All,
I've written a digital asset management system and my dilema is, to save a file from the sytem, i pass the files through a php script so i can change file names and keep the files out of the web tree.

I use a little popup window so they can select what format they want to download the file as, but the problem is when downloading a file it seems to halt the rest of the site from being able to do anything until the download is complete.

so i'm just trying to get the rest of the site to function while the download is in process, thank in advance. S.

attached mail follows:


This is a browser thing. So far as I know all browsers pretty much freeze
while a save dialog box is open. In some case things still happen. They just
aren't noticable until you close the dialog box.

On Monday 27 October 2003 00:33, Stephen Cronan wrote:
> Hi All,
> I've written a digital asset management system and my dilema is, to save a
> file from the sytem, i pass the files through a php script so i can change
> file names and keep the files out of the web tree.
>
> I use a little popup window so they can select what format they want to
> download the file as, but the problem is when downloading a file it seems
> to halt the rest of the site from being able to do anything until the
> download is complete.
>
> so i'm just trying to get the rest of the site to function while the
> download is in process, thank in advance. S.

--
Ryan Thompson
rthompsympatico.ca
http://osgw.sourceforge.net
==============================
"A computer scientist is someone who fixes
 things that aren't broken" --Unknown

attached mail follows:


On Sun, 2003-10-26 at 15:30, Raditha Dissanayake wrote:
> are you getting any 1xx status codes from the web server?

here are the full headers:
HTTP/1.1 200 OK
Date: Mon, 27 Oct 2003 06:15:30 GMT
Server: Apache/1.3.27 (Unix) PHP/4.3.3
X-Powered-By: PHP/4.3.3
Transfer-Encoding: chunked
Content-Type: text/xml

> Cosmin wrote:
>
> >I'm trying to make an application using XML-RPC, and I have the
> >following problem: I use fsockopen() to simulate a POST to my local
> >web-server. All goes very well except it's very very slow. Here is my
> >code maybe someone could tell me what I'm doing wrong:
> >=====================================
> >$url= parse_url($this->serverURL);
> >$requestString= "POST ".$url['path']." HTTP/1.1\r\nHost:
> >".$url['host']."\r\nContent-type:
> >application/x-www.form-urlencoded\r\nContent-length:
> >".strlen($this->requestData)."\r\n\r\n".$this->requestData;;
> > $fp = fsockopen($url['host'], 80, $err_num, $err_msg, 5);
> > if ($fp)
> > {
> > //make the request to the xml-rpc server
> > fputs($fp, $requestString);
> > //gets the result
> > while (!feof($fp))
> > {
> > $response .= fgets($fp, 1024);
> > }
> > fclose($fp);
> > $this->rawResponse=$response;
> > $this->error=false;
> > }
> > else
> > {
> > $this->error=true;
> > $this->errorMessage=$err_msg;
> > }
> >====================================
> >This is the slowest part of my script(about 16 seconds). The server's
> >execution time is only 0.00064206123352051 seconds. I don't know why it
> >takes so much to write a string to the socket and then to read the
> >response. Here are the execution times:
> > Server Start Server Stop
> > 1067090777.5339 1067090777.5346
> >
> > Client Start Client Stop
> > 1067090777.5303 1067090794.5286
> >
> >If someone knows a way on how to speed this up please tell me how to do
> >it.
> >
> >
> >Thank you for your time
> >
> >
> >
>
>
> --
> Raditha Dissanayake.
> ------------------------------------------------------------------------
> http://www.radinks.com/sftp/ | http://www.raditha/megaupload/
> Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
> Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


* Thus wrote Cosmin (cosminbas.ro):
> On Sun, 2003-10-26 at 15:30, Raditha Dissanayake wrote:
> > are you getting any 1xx status codes from the web server?
>
> here are the full headers:
>
> Transfer-Encoding: chunked

This is probably the problem. If you inspect your data, you'll
notice that it has extra characters in it right now. You can change your
protocol version to HTTP/1.0 or send a header to tell the server
you don't want chuncked (don't know that off hand).

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


A most amusing project has just come my way. I have a client who wishes to start an online matchmaking/dating service, one not unlike Match.com or Yahoo! Personals. There is a rather unique twist to this service, one that I cannot publicly discuss, but in general terms it is no different than any other such offering.

Is anyone aware of any pre-existing framework(s) for a matchmaking application? Perhaps someone knows of an article/tutorial regarding the design of such an app. I've no problem doing this from scratch, in fact the idea rather intrigues me, but I'm not one to re-invent the wheel if I can avoid it.

Thanks a lot to all those who respond.

Edward Dudlik
"Those who say it cannot be done
should not interrupt the person doing it."

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU

attached mail follows:


This should be reported at least as a documentation bug (if it's not
already mentioned, I'm lazy to search :)

Gerard Samuel wrote:
> Yes I know about turning off error reporting, but what happens after that
> point.
> An example.
>
> -- common.php --
> <?php
>
> // php.ini error reporting is set to E_ALL
>
> error_reporting( 0 ); // sets it to 0
>
> var_dump(error_reporting()); // Returns 0
>
> ?>
>
> -- foo.php --
> <?php
>
> require('./common.php'); // Here is the problem
>
> var_dump(error_reporting()); // Returns 2047
>
> ?>
>
> If I remove from require('./common.php'); in foo.php,
> the var_dump() then correctly reports it as 0 instead of 2047
>
> Kinda goofy if you ask me...
>

attached mail follows:


* Thus wrote Marek Kilimajer (kilimajerwebglobe.sk):
> This should be reported at least as a documentation bug (if it's not
> already mentioned, I'm lazy to search :)

I dunno, this seems like a php bug to me. The should only effect
the reporting status of the current line, not disabling certain
functions within the included file.

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


On Monday 27 October 2003 09:08 am, Curt Zirzow wrote:
> * Thus wrote Marek Kilimajer (kilimajerwebglobe.sk):
> > This should be reported at least as a documentation bug (if it's not
> > already mentioned, I'm lazy to search :)
>
> I dunno, this seems like a php bug to me. The should only effect
> the reporting status of the current line, not disabling certain
> functions within the included file.

Yeah, I believe its a bug, as the only should affect the line in question
at that instance, then go back to what it was previously.
At least I think thats how it was supposed to work.
Ill file a bug report and see what they say...

attached mail follows:


Thanks to everyone who has responded. I have a lot of useful suggestions,
and a warm feeling about this newsgroup ;-). I hope I can be of help to
everyone in the future.

cheers
ian

"Ian Williams" <ianfetcheveryone.com> wrote in message
news:20031026200941.63477.qmailpb1.pair.com...
> Apologies to anyone also subscribed to php.xml.dev, who will have read
this
> earlier, but it doesn't seem as frequently read as this news group... so I
> am reposting...
>
>
> Hi
> I want to write a function that will take any SQL query as a parameter,
and
> generate XML that represents the recordset.
>
> e.g. "SELECT * FROM Customers"
>
> returns:
>
> <recordset>
> <record id="1" name="Mr Smith" purchases="2"/>
> <record id="2" name="Mr Jones" purchases="25"/>
> <record id="3" name="Mr Davis" purchases="7"/>
> </recordset>
>
> There are two approaches I think. One is to use the XML DOM, the other is
> simply to join lots of strings together. What is the best approach?
>
> Thanks (and this is my first post to a newsgroup, and my first post to
this
> one, so excuse me if I've missed something vital!)
>
> cheers
> ian ;-)

attached mail follows:


Hi Php-general,

  How exactly do I install the IMAP Package?

  I have the default RedHat IMAP installed. Will installing this break
  that? Or is it possible to specify those controls in the make
  process? If so what path is it I need?

  Thanks for any help

  Michael

--

Best regards,
 Michael (mikethompsonmike.co.uk)
   
Driving People Insane:
 Five days in advance, tell your friends that you can't attend their party because you're not in the mood.

http://www.thompsonmike.co.uk/
PGP KeyID := 0xA9547E32

'To see a world in a grain of sand
And heaven in a wild flower
To hold infinity in the palm of your hand
And eternity in an hour'

Using TheBat! Version 2.00.6
Running On Windows XP (2600, Service Pack 1)
Sent From OneAndOne

attached mail follows:


Hi,

I have a need for a very simple financial accounting package which is webbased.

Is there any such thing around?

Thanks

Nico

attached mail follows:


On Monday, October 27, 2003, at 07:54 PM, php4nv.jakaranda.co.za
wrote:

> Hi,
>
> I have a need for a very simple financial accounting package which is
> webbased.
>
> Is there any such thing around?

Would anyone use one? I certainly wouldn't -- for security, speed,
usability and about 300 other reasons :)

Justin

attached mail follows:


Hi,

> I have a need for a very simple financial accounting package
> which is webbased.

        Although its not written in PHP, www.sql-ledger.org is a nice one.

-Dan Joseph

attached mail follows:


On Mon, 2003-10-27 at 09:19, Dan Joseph wrote:
> Hi,
>
> > I have a need for a very simple financial accounting package
> > which is webbased.
>
> Although its not written in PHP, www.sql-ledger.org is a nice one.
>

Ditto that...

attached mail follows:


I wanted some sort of IDE for PHP, so decided to use Zend (which i believe
quite popular).

I installed it on my redhat linux 8.0- both client and server components.
Instructions was smooth and gave me success msg, but now I do not know how
to open the IDE...

so stupid question.. but still want to know .. how to open Zend so that can
write PHP ?...

regards
manisha

attached mail follows:


Can anyone share about how to use php://input instead of
$HTTP_RAW_POST_DATA ?

______________________________________________________________
Mau ringtones yang gaya ? --> http://www.ponselgaya.com

attached mail follows:


Hey guys,

I was checking over one of my sites the other day trying to weed out the elusive notices that E_ALL turned up and I got some notices that I'm not too sure how to handle.

I know how to handle most of these errors however the ones that are snagging me up are the "Notice: Undefined index: _blah_ in _blah_." Most of these are array indices in super globals such a $_GET, $_SESSION, etc. How can I get rid of these little buggers?

Thanks,
Nathan Taylor

attached mail follows:


Nathan Taylor wrote:

> Hey guys,
>
> I was checking over one of my sites the other day trying to weed out the elusive notices that E_ALL turned up and I got some notices that I'm not too sure how to handle.
>
> I know how to handle most of these errors however the ones that are snagging me up are the "Notice: Undefined index: _blah_ in _blah_." Most of these are array indices in super globals such a $_GET, $_SESSION, etc. How can I get rid of these little buggers?

The notice is basically saying that you are trying to assign a value to
a variable for an index that doesn't exist (so the value of the variable
can't be guaranteed).

One way is to verify that the index exists before you assign its value
to a variable. This is my favorite way :

$var = isset($_POST['key']) ? $_POST['key'] : NULL;

You might also want to check out extract() -- which does the same thing.

By the way -- pat yourself on the back for going with
error_reporting(E_ALL). Its one of the first steps towards effective
programming. :)

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

attached mail follows:


Hi all,
 
I know this can be done somehow but I am not sure. I have a form being submitted to a php file and I wanted a textfield to be converted to formatted html. At the moment none of the line breaks are being submitted and inverted commas have slashes. I know the slashes can be removed using stripslashes function. I thought line breaks would come through with \n but that isn't being transmitted over the form. Can anyone help?
 
Best wishes,
 
Ian Gray

---------------------------------
Ian A. Gray
Manchester, UK
Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile: +44 (0) 7900 996 328
Business Enquiries: +44(0)870 770 8832
E-mail: ian.graydunelm.org.ukWebsites: www.baritone.uk.com (Performance) www.vocalstudio.co.uk (Vocal Tuition)www.selectperformers.com (Web design for professional musicians)
---------------------------------

attached mail follows:


(I'm re-submitting this 'cos I sent it in html- woops!)

Hi all,
 
I know this can be done somehow but I am not sure. I have
a form being
submitted to a php file and I wanted a textfield to be
converted to formatted html.
At the moment none of the line breaks are being submitted
and inverted commas
have slashes. I know the slashes can be removed using
stripslashes function. I
thought line breaks would come through with \n but that
isn't being transmitted
over the form. Can anyone help?
 
Best wishes,
 
Ian Gray

=====

---------------------------------
Ian A. Gray
Manchester, UK
Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile: +44 (0) 7900 996 328
Business Enquiries: +44(0)870 770 8832
E-mail: ian.graydunelm.org.ukWebsites: www.baritone.uk.com (Performance) www.vocalstudio.co.uk (Vocal Tuition)www.selectperformers.com (Web design for professional musicians)
---------------------------------

attached mail follows:


Ian,

PLEASE search the archives before asking the list -- this question is
asked every couple of days, which is quite frustrating.

See http://au.php,net/nl2br

Justin French

On Monday, October 27, 2003, at 09:15 PM, Ian Gray wrote:

> Hi all,
>
> I know this can be done somehow but I am not sure. I have a form
> being submitted to a php file and I wanted a textfield to be converted
> to formatted html. At the moment none of the line breaks are being
> submitted and inverted commas have slashes. I know the slashes can be
> removed using stripslashes function. I thought line breaks would come
> through with \n but that isn't being transmitted over the form. Can
> anyone help?

attached mail follows:


Hello,
I would like to draw text in a rectangle on an image.
The text must take all the place in the rectangle.

The trouble is that with imagestring(), there are only 5 fonts (1, 2, 3,
4, 5) and the bigger (5) is still too smaller for my rectangle.

Is there another way to change the size of the text ?

Thanks a lot

attached mail follows:


I use the function imageTTFtext allows you to specify a string with a font
and a font point size.

Hope that helps.

Chris

-----Original Message-----
From: Cranky [mailto:crankykong21hotmail.com]
Sent: 27 October 2003 10:16
To: php-generallists.php.net
Subject: [PHP] Change text size with GD

Hello,
I would like to draw text in a rectangle on an image.
The text must take all the place in the rectangle.

The trouble is that with imagestring(), there are only 5 fonts (1, 2, 3,
4, 5) and the bigger (5) is still too smaller for my rectangle.

Is there another way to change the size of the text ?

Thanks a lot

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield. Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

attached mail follows:


Thanks for your reply.
With this function is it possible to specify the size of the text with
width and height and not only with an integer ?

Because the size of the rectangle on which I want to draw the text is
various (I receive the size of the rectangle by parameter).

And other thing, I try to load a font to retrieve the width and height
with imagefontwidth and imagefontheight.
My code is like that :

<?php
$arial = imageloadfont('arial.ttf');
echo '<br>WF : '.imagefontwidth($arial);
echo '<br>HF : '.imagefontheight($arial);
?>

And the file arial.ttf is in the same directory as this script

But when I load the page, I have this error message :
Warning: ImageFontLoad: error reading font in....

Thanks for your help

Chris Neale wrote:

> I use the function imageTTFtext allows you to specify a string with a font
> and a font point size.
>
> Hope that helps.
>
> Chris
>
> -----Original Message-----
> From: Cranky [mailto:crankykong21hotmail.com]
> Sent: 27 October 2003 10:16
> To: php-generallists.php.net
> Subject: [PHP] Change text size with GD
>
>
> Hello,
> I would like to draw text in a rectangle on an image.
> The text must take all the place in the rectangle.
>
> The trouble is that with imagestring(), there are only 5 fonts (1, 2, 3,
> 4, 5) and the bigger (5) is still too smaller for my rectangle.
>
> Is there another way to change the size of the text ?
>
> Thanks a lot
>

attached mail follows:


=========================================================
This message is for the benefit of new subscribers and those new to PHP.
Those who do not want to be bothered just filter out the [Newbie Guide]
mails. Please feel free to add more points and send to the list.
==========================================================
1. If you have any queries/problems about PHP try http://www.php.net/manual/en
first. You can download a copy and use it offline also.

You can also try http://www.php.net/manual/faq.php to get answers to
frequently answered questions about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Try searching for "php YOUR QUERY" and you
may be lucky to get an answer within the first 10 results.

3. Glancing through the list archive you can find many of the common topics
discussed repeatedly and can get your answer from those discussions.

There is a new searchable archive (launched on October 21, 2003) at
http://phparch.com/mailinglists, which provides a comprehensive and
convenient search tool.

4. If you are stuck with a script and do not understand what is wrong, instead
of posting the whole script, try doing some research yourself. One useful
trick is to print the variable/sql query using print or echo command and
check whether you get what you expected.

After diagnosing the problem, send the details of your efforts (following
steps 1, 2 & 3) and ask for help.

5. Provide a clear descriptive subject line. Avoid general subjects like
"Help!!", "A Question" etc. Especially avoid blank subjects.

6. When you want to start a new topic, open a new mail and enter the mailing
list address php-generallists.php.net instead of replying to an existing
thread and replacing the subject and body with your message.

7. PHP is a server side scripting language. Whatever processing PHP does takes
place BEFORE the output reaches the client. Therefore, it is not possible to
access the users' computer related information (OS, screen size etc) using
PHP. You need to go for JavaScript and ask the question in a JavaScript
list.

(You can access information SENT by the user's browser while requesting pages
from your server. You can get the details about browser, OS etc as reported by
this request. - contributed by Wouter van Vliet)

8. It's always a good idea to post back to the list once you've solved
your problem. People usually add [SOLVED] to the subject line of their
email when posting solutions. By posting your solution you're helping
the next person with the same question. [contribued by Chris W Parker]

9. Ask smart questions http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

10. One of the repeatedly discussed question in the list is "Best PHP editor".
Everyone has his/her favourite editor. You can get all the opinions by going
through the list archives. If you want a list try this link :
http://phpeditors.linuxbackup.co.uk/ (contributed by Christophe Chisogne).

Hope you have a good time programming with PHP.

Best regards,
--
Integrated Management Tools for leather industry
----------------------------------
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

attached mail follows:


Hello,
I generate an image with GD in the file generate_image.php

<?php
// generate_image.php

require('config.php')
require('functions.php');
require('secure.php');

header('Content-Type: image/png');

$im = imagecreate(15, 15);

// generation of the image
// ...

imagepng($im);
imagedestroy($im);

?>

But when I call this page in an image tag like this :
<img src="generate_image.php" border="0">

The image is not found (I have the small red cross).

If I drop the 3 lines (require) at the beginning of the page then it
works fine. The image is well displayed.
So I tought it was a problem with the headers, but I have verified, the
3 included files doesn't send any header.

That's very strange because if I have the 3 includes files in the code
and then I go direct to the location of the file generate_file.php (and
so I don't call it with a tag), then the image is well displayed.

Did you have an idea why the imaeg is not displayed when I call it with
an img tag ?

Thanks a lot

attached mail follows:


I am not sure what I have to do in order to control sessions in PHP
4.33 when globals are set to off.
I used to use the following function to check if the user was of admin
status;

function check_admin_user()
// see if somebody is logged in as admin and notify them if not
{
  global $admin_user;
  if ( (session_is_registered("admin_user")) && (isset($admin_user)) )
    return true;
  else
    return false;
}

Then in my protected pages I would say;
if (check_admin_user())
// if you're an admin user display the following
{
Session_register("admin_user");
// Do admin functions
}
Else
{
//Do login form
}

How do I adapt the check_admin_user() function and the pages to work in
4.33?
Thanks,

Steve Jackson
Web Development and Marketing
Viola Systems Ltd.
http://www.violasystems.com
stephen.jacksonviolasystems.com
Mobile +358 50 343 5159

attached mail follows:


function check_admin_user()
{
//global $admin_user;
// if ( (session_is_registered("admin_user")) && (isset($admin_user)) )
if ( isset($_SESSION['admin_user']) )
      return true;
    else
      return false;

}

Steve Jackson wrote:
> I am not sure what I have to do in order to control sessions in PHP
> 4.33 when globals are set to off.
> I used to use the following function to check if the user was of admin
> status;
>
> function check_admin_user()
> // see if somebody is logged in as admin and notify them if not
> {
> global $admin_user;
> if ( (session_is_registered("admin_user")) && (isset($admin_user)) )
> return true;
> else
> return false;
> }
>
> Then in my protected pages I would say;
> if (check_admin_user())
> // if you're an admin user display the following
> {
> Session_register("admin_user");
> // Do admin functions
> }
> Else
> {
> //Do login form
> }
>
> How do I adapt the check_admin_user() function and the pages to work in
> 4.33?
> Thanks,
>
> Steve Jackson
> Web Development and Marketing
> Viola Systems Ltd.
> http://www.violasystems.com
> stephen.jacksonviolasystems.com
> Mobile +358 50 343 5159

attached mail follows:


Hi PHP,

  I am trying to re-install my PHP system after rebuilding with IMAP
  controls built, and now I am getting the following error:

  line 1: re2c: command not found

  this is on php-4.3.3/ext/standard/var_unserializer.c
  
  I am using the following ./configure

  ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
  --with-imap=/usr/local/imap-2000e

  this worked perfectly well before, cant understand why its falling
  over here.

  Any help welcomed!!!!
  
--

Best regards,
 Michael (mikethompsonmike.co.uk)
   
We'll give you piece de resistance and a tour de force

http://www.thompsonmike.co.uk/
PGP KeyID := 0xA9547E32

'To see a world in a grain of sand
And heaven in a wild flower
To hold infinity in the palm of your hand
And eternity in an hour'

Using TheBat! Version 2.00.6
Running On Windows XP (2600, Service Pack 1)
Sent From OneAndOne

attached mail follows:


(Windows 2k, Apache, PHP, MySQL, Large Computer with Raid Array and Big
Drives!!!)
(Appology if this is been asked before, but I couldnt see it)

Hello,

First of all I had better say I don't think I am doing anything illegal. I
have over a thousand origional CD's, and would basically like not having to
swap the CD's etc. It's amazing some of the tracks I love but never play. I
end up playing the albums, and not the singles etc. What I basically would
like is to have a form of automatic jukebox on my computer.

So what I have done is made a MySQL database with all the Artist, Genre,
CD's and Tracks (including mixes). I have typed in all the information into
this, and checked it as much as possible.

What I would like is to put the music track in a blob field, rather than a
file. Is there someway that PHP can read the CD and rip the files??? Or
would I need to rip the tracks in a program, and then basically upload them
in a form? (The second option would take longer for me of course)

Now I could write some sort of C++ or Java program that uses this data and
plays the CDs with some fancy choosing of artists and genre etc. But can
anyone think of a way to do it from PHP? Someone said WinAmp had a command
line interface, perhaps send it tracks from a PHP file. Not sure if it
returns informaiton to PHP.

One thing I did think was learning the PHP-GTK, with this project as a goal.
But I know I can do what I want to do in Java, just not sure if there are
any good mp3 modules etc for PHP.

Any help would be appreciated!

Steve

attached mail follows:


Steve Vernon wrote:

[ snipped ]

> So what I have done is made a MySQL database with all the Artist, Genre,
> CD's and Tracks (including mixes). I have typed in all the information into
> this, and checked it as much as possible.
>
> What I would like is to put the music track in a blob field, rather than a
> file. Is there someway that PHP can read the CD and rip the files??? Or
> would I need to rip the tracks in a program, and then basically upload them
> in a form? (The second option would take longer for me of course)

The track itself? You mean the contents of the mp3 file?!

*shake head*

I don't know why you would want to do that -- other than probably giving
mysql and your hard disks a good workout, this will not lead to any
efficiency.

> Now I could write some sort of C++ or Java program that uses this data and
> plays the CDs with some fancy choosing of artists and genre etc. But can
> anyone think of a way to do it from PHP? Someone said WinAmp had a command
> line interface, perhaps send it tracks from a PHP file. Not sure if it
> returns informaiton to PHP.

I'm going to entertain this idea just because I need a break from
babysitting my X emerge...

If you want to send the file -- I suppose you could stream it to Winamp
-- or use the command line interface to winamp and just pass it a file
through the browser. But again, why do you want to do this through a
browser? There are a few thousand mp3 ripping and cataloging programs
out there. Windows Media Player (with third party plugins) will also rip
Mp3s and catalog them. Winamp also rips and encodes. LAME is a very
good free ripper.

>
> One thing I did think was learning the PHP-GTK, with this project as a goal.
> But I know I can do what I want to do in Java, just not sure if there are
> any good mp3 modules etc for PHP.

I know of a few that are for reading track information from mp3s, but
not one that does what you want. I suppose you can customize one of
those to your liking.

Tell me why you want to do this via PHP + Web Server + MySQL + Web
Browser again?

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

attached mail follows:


dont need php - mysql to do this. there is a mp3 streaming sever built for
winamp. look for shoutcast. it'll everything you need, with little leg work
from you.

"Burhan Khalid" <phplistmeidomus.com> wrote in message
news:3F9D12E1.9050300meidomus.com...
> Steve Vernon wrote:
>
> [ snipped ]
>
> > So what I have done is made a MySQL database with all the Artist, Genre,
> > CD's and Tracks (including mixes). I have typed in all the information
into
> > this, and checked it as much as possible.
> >
> > What I would like is to put the music track in a blob field, rather than
a
> > file. Is there someway that PHP can read the CD and rip the files??? Or
> > would I need to rip the tracks in a program, and then basically upload
them
> > in a form? (The second option would take longer for me of course)
>
> The track itself? You mean the contents of the mp3 file?!
>
> *shake head*
>
> I don't know why you would want to do that -- other than probably giving
> mysql and your hard disks a good workout, this will not lead to any
> efficiency.
>
> > Now I could write some sort of C++ or Java program that uses this data
and
> > plays the CDs with some fancy choosing of artists and genre etc. But can
> > anyone think of a way to do it from PHP? Someone said WinAmp had a
command
> > line interface, perhaps send it tracks from a PHP file. Not sure if it
> > returns informaiton to PHP.
>
> I'm going to entertain this idea just because I need a break from
> babysitting my X emerge...
>
> If you want to send the file -- I suppose you could stream it to Winamp
> -- or use the command line interface to winamp and just pass it a file
> through the browser. But again, why do you want to do this through a
> browser? There are a few thousand mp3 ripping and cataloging programs
> out there. Windows Media Player (with third party plugins) will also rip
> Mp3s and catalog them. Winamp also rips and encodes. LAME is a very
> good free ripper.
>
> >
> > One thing I did think was learning the PHP-GTK, with this project as a
goal.
> > But I know I can do what I want to do in Java, just not sure if there
are
> > any good mp3 modules etc for PHP.
>
> I know of a few that are for reading track information from mp3s, but
> not one that does what you want. I suppose you can customize one of
> those to your liking.
>
> Tell me why you want to do this via PHP + Web Server + MySQL + Web
> Browser again?
>
> --
> Burhan Khalid
> phplist[at]meidomus[dot]com
> http://www.meidomus.com

attached mail follows:


erythros and Burhan,

Thanks for the reply.

Basically I started putting my music into a program , and the program I did
it on didn't like the amount of tracks (kept crashing), and didn't give me
as many options as I would like. I'm not worried about a fancy interface and
graphical displays of the music.

What I could do is make a folder inside a folder with the artist name and
the CD, and then the MP3 files inside with the name (and possibly mix) as
part of the name. But what if the CD has music from different artists? What
if the program does not like a high number of files? What if the file name
gets to be more than 255 characters? What if I want to do something bit more
advanced with a catelouged set of data.

The last sentence relates to a project I did at Uni, to do with automatic
mixing between tracks. I realise the code I did then is copyright, but I
have a few ideas I want to try out. I sometimes do a bit of DJing at a local
bar/club, but for the first couple of hours we just play a couple of mix
CD's, before I get up and DJ. What I was thinking was letting the computer
DJ itself, and letting people using a simple interface select some songs.
But I would want to limit the type of songs, because some songs don't work
at certain times of the night. Just would be nice to have it all using
MySQL, so people can see pics of the artists etc. There are some quiet
nights where basically either mix cd's or the radio is used all night.

A database is there to hold your data, and basically display it in a format
when asked, that you asked for. (Ok not a dictionary definition). Basically
a file system is a simple database, but just to hold files. I know the load
on the server would be crazy, but I'm not worried about that. All I plan to
do at the moment is to output to a tempoary file, and then feed it into a
program such as WinAmp to play the file. I don't want to do any Streaming-
well perhaps some screaming!

Ideally there would be a software product out there to do all this, but I
don't think so, not with some of the ideas I have which I haven't even
listed!!! So is there ANY way from PHP to read a CD, rip the tracks and
place them in BLOB fields in MySQL? Or do I have to write something in C++
or Java? Just would be nice if there was something in PHP.

Thanks,

Steve

attached mail follows:


I am tring to output 3 different random numbers between 1
and 20 into 3 different strings. Using Rand() for each
string isn't sufficient as I may get the same number
repeated for one of the other strings- eg 1,1,3 or 5,3,3 .
It's important that I get three different numbers outputted
into for example $one, $two, $three.

Can anyone help?

Ian

=====

---------------------------------
Ian A. Gray
Manchester, UK
Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile: +44 (0) 7900 996 328
Business Enquiries: +44(0)870 770 8832
E-mail: ian.graydunelm.org.ukWebsites: www.baritone.uk.com (Performance) www.vocalstudio.co.uk (Vocal Tuition)www.selectperformers.com (Web design for professional musicians)
---------------------------------

attached mail follows:


Before you add a number to a string make sure that the number is not in
any of the other ones if they exist.

Use a do-while loop on it...

$one = rand( 1,20 );
do {
  $two = rand( 1, 20 );
}while( $two == $one );

do {
  $three = rand( 1, 20 );
}while( ($three == $one) && ($three == $two) );

echo "One: $one\n";
echo "Two: $two\n";
echo "Three: $three\n";

HTH

--
Ray

On Mon, 2003-10-27 at 05:26, Ian Gray wrote:
> I am tring to output 3 different random numbers between 1
> and 20 into 3 different strings. Using Rand() for each
> string isn't sufficient as I may get the same number
> repeated for one of the other strings- eg 1,1,3 or 5,3,3 .
> It's important that I get three different numbers outputted
> into for example $one, $two, $three.
>
> Can anyone help?
>
> Ian
>
> =====
>
> ---------------------------------
> Ian A. Gray
> Manchester, UK
> Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile: +44 (0) 7900 996 328
> Business Enquiries: +44(0)870 770 8832
> E-mail: ian.graydunelm.org.ukWebsites: www.baritone.uk.com (Performance) www.vocalstudio.co.uk (Vocal Tuition)www.selectperformers.com (Web design for professional musicians)
> ---------------------------------

attached mail follows:


Sorry for top-posting, gotta configure my mail client better later.
Small error here:
}while( ($three == $one) && ($three == $two) );
Change to:
}while( ($three == $one) || ($three == $two) );

-----Original Message-----
From: Ray Hunter [mailto:bigdogventicon.com]
Sent: den 27 oktober 2003 15:56
To: php-generallists.php.net
Subject: Re: [PHP] Randomizing 3 different numbers.

Before you add a number to a string make sure that the number is not in
any of the other ones if they exist.

Use a do-while loop on it...

$one = rand( 1,20 );
do {
  $two = rand( 1, 20 );
}while( $two == $one );

do {
  $three = rand( 1, 20 );
}while( ($three == $one) && ($three == $two) );

echo "One: $one\n";
echo "Two: $two\n";
echo "Three: $three\n";

HTH

--
Ray

On Mon, 2003-10-27 at 05:26, Ian Gray wrote:
> I am tring to output 3 different random numbers between 1
> and 20 into 3 different strings. Using Rand() for each
> string isn't sufficient as I may get the same number
> repeated for one of the other strings- eg 1,1,3 or 5,3,3 .
> It's important that I get three different numbers outputted
> into for example $one, $two, $three.
>
> Can anyone help?
>
> Ian
>
> =====
>
> ---------------------------------
> Ian A. Gray
> Manchester, UK
> Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile:
+44 (0) 7900 996 328
> Business Enquiries: +44(0)870 770 8832
> E-mail: ian.graydunelm.org.ukWebsites: www.baritone.uk.com
(Performance) www.vocalstudio.co.uk (Vocal
Tuition)www.selectperformers.com (Web design for professional
musicians)
> ---------------------------------

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

attached mail follows:


Dont you mean || at the last loop? You loop as long as 3 is equal to both 1
and 2, || would cause it to loop while it's equal to any of them..

--
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
##########################
Please, if you are using windows, you may be infected by Swen. Please go
here to find out more:
http://us.mcafee.com/virusInfo/default.asp?id=helpCenter&hcName=swen
http://securityresponse.symantec.com/avcenter/venc/data/w32.swen.amm.html
##########################
"Ray Hunter" <bigdogventicon.com> skrev i meddelandet
news:1067266531.26454.16.camelbigdog.info.trw.com...
> Before you add a number to a string make sure that the number is not in
> any of the other ones if they exist.
>
> Use a do-while loop on it...
>
> $one = rand( 1,20 );
> do {
> $two = rand( 1, 20 );
> }while( $two == $one );
>
> do {
> $three = rand( 1, 20 );
> }while( ($three == $one) && ($three == $two) );
>
> echo "One: $one\n";
> echo "Two: $two\n";
> echo "Three: $three\n";
>
> HTH
>
> --
> Ray
>
> On Mon, 2003-10-27 at 05:26, Ian Gray wrote:
> > I am tring to output 3 different random numbers between 1
> > and 20 into 3 different strings. Using Rand() for each
> > string isn't sufficient as I may get the same number
> > repeated for one of the other strings- eg 1,1,3 or 5,3,3 .
> > It's important that I get three different numbers outputted
> > into for example $one, $two, $three.
> >
> > Can anyone help?
> >
> > Ian
> >
> > =====
> >
> > ---------------------------------
> > Ian A. Gray
> > Manchester, UK
> > Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile:
+44 (0) 7900 996 328
> > Business Enquiries: +44(0)870 770 8832
> > E-mail: ian.graydunelm.org.ukWebsites: www.baritone.uk.com
(Performance) www.vocalstudio.co.uk (Vocal
Tuition)www.selectperformers.com (Web design for professional musicians)
> > ---------------------------------

attached mail follows:


Just to give you something to chew on, try the code below.

<?php
$myResultsArray = array();
$numberOfRandNumbersToGet = 3;
$randomNumberRange = 20;

while(count($myResultsArray) < $numberOfRandNumbersToGet)
{
    do {
        $rand = rand(1, $randomNumberRange);
    }while(in_array($rand, $myResultsArray));

    $myResultsArray[] = $rand;
}
print_r($myResultsArray);

// If you really want $one, $two, $three for exactly three results:
list($one, $two, $three) = $myResultsArray;
echo "1: $one\n2: $two\n3: $three\n";
?>

It is slightly more generic, and you can change things a little
without having to modify a whole bunch of if() statements.

-----Original Message-----
From: Ian Gray [mailto:ian_a_grayyahoo.co.uk]
Sent: 27 October 2003 12:26
To: php-generallists.php.net
Subject: [PHP] Randomizing 3 different numbers.

I am tring to output 3 different random numbers between 1
and 20 into 3 different strings. Using Rand() for each
string isn't sufficient as I may get the same number
repeated for one of the other strings- eg 1,1,3 or 5,3,3 .
It's important that I get three different numbers outputted
into for example $one, $two, $three.

Can anyone help?

Ian

=====

---------------------------------
Ian A. Gray
Manchester, UK
Telephone: +44 (0) 161 224 1635 - Fax: +44 (0) 870 135 0061 - Mobile:
+44 (0) 7900 996 328
Business Enquiries: +44(0)870 770 8832
E-mail: ian.graydunelm.org.ukWebsites: www.baritone.uk.com
(Performance) www.vocalstudio.co.uk (Vocal
Tuition)www.selectperformers.com (Web design for professional
musicians)
---------------------------------

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

attached mail follows:


[snip]
I am not sure if this is the right list to post to as most of you guys
are
probably run php as an Apache module. However, I am currently using my
own xml data format for a non-web based application and I would like to
be
able to embed php within it. Is there a C/C++ library that I can link
against to execute the <?php ... ?> inside my xml when I load it? Can
someone point me in the right direction?
[/snip]

This may help http://www.priadoblender.com/

attached mail follows:


I am having problems sorting stuff into an array. It doesn't seem to work
quite how everything I read says it should. It is probably my understanding
of it but either way I don't really know whats going on.

I am trying to put everything out of a table into an array so I can call up
the individual rows by a sequential number and then the information in each
row by a colume heading. so for the name value in row 1 I want to have
$null[1][name].

The purpose of this is to amke a menu system where it automatically sorts
the rows into the relevent order. The parentid associates a row with another
to signify that it comes under that menu heading. I want it to have 3
levels, so I have included 3 loops all looking for data whos parent id is
the same as the previous ones id. If that makes any sence.

But when I run this script, it looses the first row and doesn't really
output anything logical. For now I have commented out 2 of the loops to try
and make it easier to see where I have gone wrong.

To see what output I get http://www.busc.net/bristol/website/admin.php is
the code that I have included underneath.

Thanks

<html>
<head>
<title>Bristol University Skiclub Admin Section</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="600" height="181" border="0" align="center">
  <tr>
    <td>
    <?php
 include "includes/constants.php";

 $link = mysql_connect($DB_server, $DB_user, $DB_pwd) or die ("Could not
connect");
 mysql_select_db($DB_user) or die ("Could not select database");
 $n = 1;
 $null=getinfo('0');

 for ($i=1; $i<=sizeof($null); $i++);
  {
  print_r($null);
 /* print $nul[$i]['name'];
  $j=$null[$i]['id'];
  /*$fisrt=getinfo["1"];
   for ($k=1; $k<=sizeof($first); $k++);
    {
    echo $first[$k]['name'];
    $l=$first[$k]['id'];
    $second=getinfo['$m'];
     for ($m=1; $m<=sizeof($second); $m++);
     {
     echo $second[$m]['name']<br>;
     }
    }*/
  }
   ?>
      </td>
    &nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>
<?php
function getinfo($pid)
{
 $query = "SELECT name,parentid FROM ubsc_menu WHERE parentid='$pid' ORDER
BY parentid";
 $result = mysql_query ($query) or die ("Query failed");
 $row=mysql_fetch_array($result,MYSQL_ASSOC);

 while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
 {

  foreach ($row as $colname => $value)
  {
   $array[$n][$colname] = $value;
  }
  $n++;
 }
 return $array;

}
?>

attached mail follows:


Without going too deep into your code, I think I see (parts of) your
problem.

In a nearly similar case, I used this code to deal with the problem.

// This example is putting the data from a table into a 2-dimentional
array:

// When using mysql_data_seek(....) you have all the selections from the
query in an array, an you can point to which row you want at any time.
// Remember: the rowpointer "row_num" starts at 0 and runs to "max_rows" -
1.

 $query = "SELECT *.....

 $max_rows = mysql_num_rows($result);
 $row = mysql_fetch_array($result);
  $row_num = 0;
  $ix = 0;
  while ($row_num <= $max_rows-1) {
      mysql_data_seek($result,$row_num);
   $row = mysql_fetch_array($result);
   $ix++;
   $array[$ix] [1]= $row[1];
   $array[$ix] [2]= $row[2];
   $array[$ix] [3]= $row[3];
  $row_num++;
  }

Hopes this helps a bit.

Regards
Reidar Solberg

"Tom Wollaston" <tombusc.net> skrev i melding
news:20031027130019.58145.qmailpb1.pair.com...
> I am having problems sorting stuff into an array. It doesn't seem to work
> quite how everything I read says it should. It is probably my
understanding
> of it but either way I don't really know whats going on.
>
> I am trying to put everything out of a table into an array so I can call
up
> the individual rows by a sequential number and then the information in
each
> row by a colume heading. so for the name value in row 1 I want to have
> $null[1][name].
>
> The purpose of this is to amke a menu system where it automatically sorts
> the rows into the relevent order. The parentid associates a row with
another
> to signify that it comes under that menu heading. I want it to have 3
> levels, so I have included 3 loops all looking for data whos parent id is
> the same as the previous ones id. If that makes any sence.
>
> But when I run this script, it looses the first row and doesn't really
> output anything logical. For now I have commented out 2 of the loops to
try
> and make it easier to see where I have gone wrong.
>
> To see what output I get http://www.busc.net/bristol/website/admin.php is
> the code that I have included underneath.
>
> Thanks
>
> <html>
> <head>
> <title>Bristol University Skiclub Admin Section</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body>
> <table width="600" height="181" border="0" align="center">
> <tr>
> <td>
> <?php
> include "includes/constants.php";
>
> $link = mysql_connect($DB_server, $DB_user, $DB_pwd) or die ("Could not
> connect");
> mysql_select_db($DB_user) or die ("Could not select database");
> $n = 1;
> $null=getinfo('0');
>
> for ($i=1; $i<=sizeof($null); $i++);
> {
> print_r($null);
> /* print $nul[$i]['name'];
> $j=$null[$i]['id'];
> /*$fisrt=getinfo["1"];
> for ($k=1; $k<=sizeof($first); $k++);
> {
> echo $first[$k]['name'];
> $l=$first[$k]['id'];
> $second=getinfo['$m'];
> for ($m=1; $m<=sizeof($second); $m++);
> {
> echo $second[$m]['name']<br>;
> }
> }*/
> }
> ?>
> </td>
> &nbsp;</td>
> <td>&nbsp;</td>
> </tr>
> </table>
> </body>
> </html>
> <?php
> function getinfo($pid)
> {
> $query = "SELECT name,parentid FROM ubsc_menu WHERE parentid='$pid' ORDER
> BY parentid";
> $result = mysql_query ($query) or die ("Query failed");
> $row=mysql_fetch_array($result,MYSQL_ASSOC);
>
>
> while ($row=mysql_fetch_array($result,MYSQL_ASSOC))
> {
>
> foreach ($row as $colname => $value)
> {
> $array[$n][$colname] = $value;
> }
> $n++;
> }
> return $array;
>
> }
> ?>

attached mail follows:


* Thus wrote Tom Wollaston (tombusc.net):
> I am having problems sorting stuff into an array. It doesn't seem to work
> quite how everything I read says it should. It is probably my understanding
> of it but either way I don't really know whats going on.

Did you not read my response to your question about this earlier?
You have the same exact code you posted a few days ago that will
not work.

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


On Mon, 27 Oct 2003 13:00:19 -0000, you wrote:

$n is created /outside/ the function.

> $n = 1;

So you can't use it here. It's not in scope.

> $array[$n][$colname] = $value;

>But when I run this script, it looses the first row and doesn't really

That's because you get the first row here.

> $row=mysql_fetch_array($result,MYSQL_ASSOC);

And immediately throw it away as you enter the loop.

> while ($row=mysql_fetch_array($result,MYSQL_ASSOC))

I answered thia (and fixed your code) last time you posted.

attached mail follows:


Will he get one?

--
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
##########################
Please, if you are using windows, you may be infected by Swen. Please go
here to find out more:
http://us.mcafee.com/virusInfo/default.asp?id=helpCenter&hcName=swen
http://securityresponse.symantec.com/avcenter/venc/data/w32.swen.amm.html
##########################
"Leif K-Brooks" <eurleifbuyer-brokerage.com> skrev i meddelandet
news:3F9CA452.5020500buyer-brokerage.com...
> Larry E. Ullman wrote:
>
> > I was feeling generous so I went back in time and added this
> > functionality to PHP as of version 3. I call it the "strcasecmp"
> > function. I placed the description and usage of the function in the
> > PHP manual: http://www.php.net/strcasecmp
>
> That was nice of you, but he wanted an operator.
>
> --
> The above message is encrypted with double rot13 encoding. Any
unauthorized attempt to decrypt it will be prosecuted to the full extent of
the law.

attached mail follows:


* Thus wrote DvDmanDT (dvdmandttelia.com):
> Will he get one?

I doubt it.

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


    A funny thing was happeng with a GET variable here, after testing it
with an if clause, it would be set to 1, like this, after that:

     if ( $_POST['nova'] =! "")

    $_POST['nova'] = 1... Is that alright?

attached mail follows:


[snip]
    A funny thing was happeng with a GET variable here, after testing it
with an if clause, it would be set to 1, like this, after that:

     if ( $_POST['nova'] =! "")

    $_POST['nova'] = 1... Is that alright?
[/snip]

GET (see your question) or POST....not that it matters.

if($_POST['nova'] != ""){
        $_POST['nova'] = 1;
}

will work (note the change of the "not equal to" operator)

attached mail follows:


--- Joao Andrade <joao66bryahoo.com.br> wrote:
> if ( $_POST['nova'] =! "")

Equal not? Perhaps you mean not equal? :-)

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

attached mail follows:


Newbie question - please excuse. I'm using Dreamweaver to generate most of
my PhP. I have created a search page and am trying to generate the results
page. The search form is using the GET function and the form field name is
"manufacturer". The following code is generated by DW in the results
page...

<?php
$vManufacturer_rs_RobesonResultsList = "Reece";
if (isset(manufacturer)) {
  $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
manufacturer : addslashes(manufacturer);
}
mysql_select_db($database_VandyDivAddresses, $VandyDivAddresses);
$query_rs_RobesonResultsList = sprintf("SELECT robeson_inv.manufacturer,
robeson_inv.model, robeson_inv.specs, robeson_inv.qty FROM robeson_inv
WHERE robeson_inv.manufacturer = '%s' ORDER BY robeson_inv.model",
$vManufacturer_rs_RobesonResultsList);
$rs_RobesonResultsList = mysql_query($query_rs_RobesonResultsList,
$VandyDivAddresses) or die(mysql_error());
$row_rs_RobesonResultsList = mysql_fetch_assoc($rs_RobesonResultsList);
$totalRows_rs_RobesonResultsList = mysql_num_rows($rs_RobesonResultsList);
?>

I'm always getting an error when testing the page. The error is...

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
/home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4

The line to which it refers is the line stating,
"$vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
manufacturer : addslashes(manufacturer);"

Anyone know what the problem may be?

Thanx in advance for any help provided,
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

attached mail follows:


[snip]
if (isset(manufacturer)) {
  $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
manufacturer : addslashes(manufacturer);
}

Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
/home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4
[/snip]

Looks like 'manufacturer' needs a $ in fromt of it to make it a variable

if (isset($manufacturer)) {
  $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
$manufacturer : addslashes($manufacturer);
}

HTH

attached mail follows:


The line should be
$vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
  $manufacturer : addslashes($manufacturer);

Robb Kerr wrote:

> Newbie question - please excuse. I'm using Dreamweaver to generate most of
> my PhP. I have created a search page and am trying to generate the results
> page. The search form is using the GET function and the form field name is
> "manufacturer". The following code is generated by DW in the results
> page...
>
> <?php
> $vManufacturer_rs_RobesonResultsList = "Reece";
> if (isset(manufacturer)) {
> $vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
> manufacturer : addslashes(manufacturer);
> }
> mysql_select_db($database_VandyDivAddresses, $VandyDivAddresses);
> $query_rs_RobesonResultsList = sprintf("SELECT robeson_inv.manufacturer,
> robeson_inv.model, robeson_inv.specs, robeson_inv.qty FROM robeson_inv
> WHERE robeson_inv.manufacturer = '%s' ORDER BY robeson_inv.model",
> $vManufacturer_rs_RobesonResultsList);
> $rs_RobesonResultsList = mysql_query($query_rs_RobesonResultsList,
> $VandyDivAddresses) or die(mysql_error());
> $row_rs_RobesonResultsList = mysql_fetch_assoc($rs_RobesonResultsList);
> $totalRows_rs_RobesonResultsList = mysql_num_rows($rs_RobesonResultsList);
> ?>
>
> I'm always getting an error when testing the page. The error is...
>
> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> /home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4
>
> The line to which it refers is the line stating,
> "$vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
> manufacturer : addslashes(manufacturer);"
>
> Anyone know what the problem may be?
>
> Thanx in advance for any help provided,
> Robb Kerr
> Digital IGUANA
> Helping Digital Artists Achieve their Dreams
> http://www.digitaliguana.com
> http://www.cancerreallysucks.org
>

attached mail follows:


That was it! Thanx for the help. This board has proven invaluable to me.

Robb

attached mail follows:


* Thus wrote Robb Kerr (rkerrdigitaliguana.com):
>
> I'm always getting an error when testing the page. The error is...
>
> Parse error: parse error, expecting `T_VARIABLE' or `'$'' in
> /home/s/k/user992816/html/RobesonWeb/TMP4np9nf7zp.php on line 4
>
> The line to which it refers is the line stating,
> "$vManufacturer_rs_RobesonResultsList = (get_magic_quotes_gpc()) ?
> manufacturer : addslashes(manufacturer);"
>

hmm.. what part of line 4? take the php line and put it on 4
different lines

$vManufacturer_rs_RobesonResultsList =
  (get_magic_quotes_gpc()) ?
   manufacturer :
   addslashes(manufacturer);

What line is the error on now? line 6? ah.. so what exacly is
manufacturer? A variable, constant, string or number? I'm going to
make the assumption that it is a variable. So you need to prepend a
$ to the word manufacturer ($manufacturer).

If you test it now, you'll probaly get a notice/warning about line
7 (depending on php's error_reporting level). You'll probably want
to make that manufacturer a variable also.

Curt
--
"My PHP key is worn out"

  PHP List stats since 1997:
    http://zirzow.dyndns.org/html/mlists/

attached mail follows:


About a year ago, I installed RH 9.0 and in the process
installed/updated php 4.2.2. The directory, /etc/php.d/ contains many
ini files instructing php to load modules including mysql.so and
interbase.so. phpinfo() shows that they have been included.

Not being a Linux guru - in fact, knowing just enough to keep it running
as my http and ftp server - and having lost my notes, I cannot remember
what I did to get this configuration.

In loading RH 9 onto another computer, the /etc/php.d/ directory does
not contain these files *and* phpinfo() does not show mysql or interbase.

Can someone help me get my bearings? Do I need to get the latest php
rpm and run configure using the "--with-xxx" flag for each of the
modules I want included?

Lost.....

Todd

attached mail follows:


I supose you need to install php-mysql, php-interbase ...

Todd Cary wrote:

> About a year ago, I installed RH 9.0 and in the process
> installed/updated php 4.2.2. The directory, /etc/php.d/ contains many
> ini files instructing php to load modules including mysql.so and
> interbase.so. phpinfo() shows that they have been included.
>
> Not being a Linux guru - in fact, knowing just enough to keep it running
> as my http and ftp server - and having lost my notes, I cannot remember
> what I did to get this configuration.
>
> In loading RH 9 onto another computer, the /etc/php.d/ directory does
> not contain these files *and* phpinfo() does not show mysql or interbase.
>
> Can someone help me get my bearings? Do I need to get the latest php
> rpm and run configure using the "--with-xxx" flag for each of the
> modules I want included?
>
> Lost.....
>
> Todd
>

attached mail follows:


Hi all,

I use suse8.2 professional
I have upgraded php 4.3.1 to 4.3.3 with rpm suse project.

In the php.ini I have set the registr_globals=3D Off and Ih th directory

/srv/www/html/mysites1 I have created the file .htaccess with:

php_flag register_globals on for only this site.

With the function phpinfo I have see that the Master Value is Off and the=

Load Value is On but the site don't running successfully.
With suse8.1 with php4.2.2 I have nothing problem.
Any idea ?

Thankind in advance and sorry for my english.

Giuliano.

attached mail follows:


[snip]
With the function phpinfo I have see that the Master Value is Off and
the=

Load Value is On but the site don't running successfully.
With suse8.1 with php4.2.2 I have nothing problem.
Any idea ?
[/snip]

Does the site rely on files outside of that directory? Do you 'allow
overrides' for the directory in Apache? (httpd.conf)

attached mail follows:


--- fanabetin.it wrote:
> In the php.ini I have set the registr_globals=3D Off

I'm assuming that 3D was put in there by some faulty mail client? Also, make
sure you spell it register_globals.

> php_flag register_globals on for only this site.
>
> With the function phpinfo I have see that the Master Value is Off
> and the Load Value is On but the site don't running successfully.

Well, that sounds like what you are trying to do? What is wrong exactly? Not
every error is the fault of register_globals, after all. :-)

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

attached mail follows:


--- fanabetin.it wrote:
>
> The problem concern:
>
> The correct site is: www.gardafun.com with apache.1.3.27 and
> php-4.0.6 with register_globals = On
>
> The new webserver is 213.21.138.119 with suse8.2 apache1.3.27 and
> php-4.3.3 with register_globals=off in the php.ini and in the
> .htaccess the directive: php_flag register_globals on
>
> The same sites don't work in the new websites but with the phpinfo
> I see that the Load Value for register_globals for this site is On.

You need to explain what is wrong. You seem confident that register_globals is
your problem, but you've not told us why you think so.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

attached mail follows:


This may be a dumb question but here goes. I have been trying to use $_POST
globals in sql queries.

If I use the following query string it does not work
$query="Select * from users where userid='$_POST['userid']'";

However, this works
$userid=$_POST["userid"]
$query="Select * from users where userid='$userid'";

Is there a mistake in my syntax?

thanks,

Luis R. Lebron
Sigmatech, Inc

attached mail follows:


--- Luis Lebron <llebronsigmatech.com> wrote:
> $query="Select * from users where userid='$_POST['userid']'";

Use curly braces:

$query = "select * from users where userid = '{$_POST['userid']}'";

Hope that helps.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

attached mail follows:


$query="Select * from users where userid='".$_POST['userid']."'";

;-)
pete

Luis Lebron wrote:

> This may be a dumb question but here goes. I have been trying to use $_POST
> globals in sql queries.
>
> If I use the following query string it does not work
> $query="Select * from users where userid='$_POST['userid']'";
>
> However, this works
> $userid=$_POST["userid"]
> $query="Select * from users where userid='$userid'";
>
> Is there a mistake in my syntax?
>
> thanks,
>
>
> Luis R. Lebron
> Sigmatech, Inc
>