php-general Digest 28 Jul 2003 09:50:14 -0000 Issue 2202

Topics (messages 157105 through 157149):

Re: Recompiling the PHP Binary with PCNTL
        157105 by: DvDmanDT
        157127 by: Jason Wong

Flash Variables
        157106 by: Taylor Smith
        157108 by: skate

Re: Your E-Book
        157107 by: Paul McNally
        157109 by: Curt Zirzow

How is this possible?
        157110 by: Ryan A
        157112 by: Robert Cummings
        157113 by: Curt Zirzow
        157115 by: Ryan A
        157119 by: Curt Zirzow
        157120 by: skate
        157121 by: skate
        157122 by: Ryan A
        157123 by: Curt Zirzow

Re: Sessions GET vs. Cookies
        157111 by: Nicholas Robinson

Including a https .aspx form/response in a PHP page - Tricky?
        157114 by: Paul Fitz
        157117 by: Curt Zirzow

The session finishes unexpectedly
        157116 by: Tomás Liendo
        157118 by: Curt Zirzow

Array help
        157124 by: Ryan A
        157130 by: Jason Wong

Get Local IP Address
        157125 by: Chris Lee
        157128 by: Tom Rogers
        157134 by: Chris Lee
        157135 by: Tom Rogers

Local IP Address
        157126 by: Chris Lee

POST/GET using a proxy server
        157129 by: David Yee
        157132 by: Andrew Brampton

Problem setting variables.
        157131 by: Jason Martyn

Re: Configure vpopmail with php
        157133 by: Haseeb

Re: Will register_globals be an option or not - or hasn't it been decided yet?
        157136 by: Tommy Ipsen

variable in function parameter
        157137 by: 386-DX
        157145 by: Marek Kilimajer

$_GET['sort'] & argument separator
        157138 by: Ow Mun Heng
        157142 by: Nicholas Robinson

using SESSIONS to store page 2 page variables
        157139 by: Ow Mun Heng
        157141 by: Marek Kilimajer

Re: Set Cookie in PHP and call with Perl
        157140 by: TWSC HQ
        157143 by: Jason Wong

IMAP and NNTP
        157144 by: {R}ichard Ashton

Re: Half solved...............what the @#%# is PHPSESSID?
        157146 by: Ford, Mike               [LSS]

Re: incrementing string value
        157147 by: Ford, Mike               [LSS]

Re: replacing & but not special chars
        157148 by: Ford, Mike               [LSS]

Mail Authentication or redirection of SMTP server
        157149 by: Ron Allen

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 ---
Windows or linux?

Under windows you need like visual studio to compile it... But how to add
parameters there is not my area...

-- 
// DvDmanDT
MSN: [EMAIL PROTECTED]
Mail: [EMAIL PROTECTED]
"David Goodchild" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Hi all,
>
> I have a webserver using Ensim, some of you may or may not know of it.
PHP
> is installed and Apache is using PHP as a module.  The server also has the
> php binary.  I would liek to recompile the current PHP Binary
> using --with-pcntl and whatever it was originally compiled with ....
>
> How do I go about doing this?
>
> Dave
>
>



--- End Message ---
--- Begin Message ---
On Monday 28 July 2003 03:13, David Goodchild wrote:

> My exact problem is this: I do not know how to recompile an already
> installed PHP binary with the option --with-pcntl ...

1) Download the php source
2) Extract, and change into the extracted directory
3) Figure out what the existing php binary was compiled with (see previous 
post)
4) Then run:

   ./configure [all the previous configure options] --enable-pcntl

5) If no errors then:

   make 

6) If no errors then:

   make install

7) Congratulate yourself on a job well done.

-- 
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
------------------------------------------
/*
Marriage is the sole cause of divorce.
*/


--- End Message ---
--- Begin Message ---
Hi Everone, I had a question about PHP and Flash. I have a navbar buttons
that I made in Flash MX, but the PHP script I want it to be displayed for is
an auto-generated photoalbum, so the "Next" and "Previous" buttons have need
to change meaning at every pageload. I was wondering if there is a way to
pass a variable on with the script to that I can program the button to
"getURL $nextpage" or something of the sort. Thanks a bunch,
Taylor Smith


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


> Hi Everone, I had a question about PHP and Flash. I have a navbar buttons
> that I made in Flash MX, but the PHP script I want it to be displayed for
is
> an auto-generated photoalbum, so the "Next" and "Previous" buttons have
need
> to change meaning at every pageload. I was wondering if there is a way to
> pass a variable on with the script to that I can program the button to
> "getURL $nextpage" or something of the sort. Thanks a bunch,
> Taylor Smith
>

when your loading your flash movie, inside the param and embed tags, after
the filename, include your variables as you would using GET...

<object ..............>
        <param name="movie" value="main.swf?pagenum=1&display=15">
        ................
        <embed src="main.swf?pagenum=1&display=15" ...................... >
        </embed>
</object>

this will pass the variables directly into _root in your flash movie where
you can utilise them from there. this should solve your problem. although
please excuse any syntax errors, this is straight from the top of my head...

-skate-


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



--- End Message ---
--- Begin Message ---
This is not spam. 

> Please stop responding to spam with spam! And if you really cannot resist the 
> urge to respond at least have the courtesy to trim your response so that we 
> don't have to see the spam over and over again.
 
> */
> 


--- End Message ---
--- Begin Message ---
* Thus wrote Paul McNally ([EMAIL PROTECTED]):
> This is not spam. 

I beg to differ.  spam has many different meanings one of them is:
  Any large, annoying, quantity of output.


> 
> > Please stop responding to spam with spam! And if you really cannot resist the 
> > urge to respond at least have the courtesy to trim your response so that we 
> > don't have to see the spam over and over again.
>  


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

--- End Message ---
--- Begin Message ---
Hi,
I am trying to get my data into a very similar layout as this:
http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=546&IntVal3=605
see the table with the plans...how is he getting that in one table? what
kind of logic is that? the best I can do is for each column I have to use
another table (nested tables) but he has somehow managed to get all in
one... is this a special ASP thing?

This is my implemption of it:
http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2&id%5B%5D=4&id%5B
%5D=5&id%5B%5D=13&type=1

Its much slower, because it uses more tables and nested tables...but its in
php :-)


I just cant understand it...any ideas?

Cheers,
-Ryan


--- End Message ---
--- Begin Message ---
ASP merely outputs HTML. His table is basic HTML dynamically rendered
perhaps by an ASP component. This is also trivial to do in PHP.

Cheers,
Rob.


On Sun, 2003-07-27 at 18:38, Ryan A wrote:
> Hi,
> I am trying to get my data into a very similar layout as this:
> http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=546&IntVal3=605
> see the table with the plans...how is he getting that in one table? what
> kind of logic is that? the best I can do is for each column I have to use
> another table (nested tables) but he has somehow managed to get all in
> one... is this a special ASP thing?
> 
> This is my implemption of it:
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2&id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1
> 
> Its much slower, because it uses more tables and nested tables...but its in
> php :-)
> 
> 
> I just cant understand it...any ideas?
> 
> Cheers,
> -Ryan
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org   |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the  |
| stuff of nightmares grasp for your soul.    |
`---------------------------------------------'

--- End Message ---
--- Begin Message ---
* Thus wrote Ryan A ([EMAIL PROTECTED]):
> Hi,
> I am trying to get my data into a very similar layout as this:
> http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=546&IntVal3=605
> see the table with the plans...how is he getting that in one table? what
> kind of logic is that? the best I can do is for each column I have to use
> another table (nested tables) but he has somehow managed to get all in
> one... is this a special ASP thing?

Nothing special html wise.

> 
> This is my implemption of it:
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2&id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1
I get an notice and and  error when I go there:
Notice: Undefined variable: p5 in
/home/bestweb/public_html/compare.php on line 65

Query failed, ryan queryYou have an error in your SQL syntax. Check
the manual that corresponds to your MySQL server version for the
right syntax to use near 'order by plan_id' at line 1

> 
> I just cant understand it...any ideas?

There are different ways you can do this it could help to know what
kind of data structure you have.


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

--- End Message ---
--- Begin Message ---
Hi,
Thanks for replying.

You say: Nothing special html wise.
then can you tell me how its done?

The content is dynamic being pulled from the database..how do i get it in
one table in that layout?

> There are different ways you can do this it could help to know what
> kind of data structure you have.

Heres the link again, you can see the datastructure (hopefully)
http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2&id%5B%5D=4&id%5B
%5D=5&id%5B%5D=13&type=1

Kindly reply,
-Ryan


> * Thus wrote Ryan A ([EMAIL PROTECTED]):
> > Hi,
> > I am trying to get my data into a very similar layout as this:
> >
http://hostfilter.com/ComparePlan.asp?IntVal1=389&IntVal2=546&IntVal3=605
> > see the table with the plans...how is he getting that in one table? what
> > kind of logic is that? the best I can do is for each column I have to
use
> > another table (nested tables) but he has somehow managed to get all in
> > one... is this a special ASP thing?
>
> Nothing special html wise.
>
> >
> > This is my implemption of it:
> >
http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2&id%5B%5D=4&id%5B
> > %5D=5&id%5B%5D=13&type=1
> I get an notice and and  error when I go there:
> Notice: Undefined variable: p5 in
> /home/bestweb/public_html/compare.php on line 65
>
> Query failed, ryan queryYou have an error in your SQL syntax. Check
> the manual that corresponds to your MySQL server version for the
> right syntax to use near 'order by plan_id' at line 1
>
> >
> > I just cant understand it...any ideas?
>
> There are different ways you can do this it could help to know what
> kind of data structure you have.
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
* Thus wrote Ryan A ([EMAIL PROTECTED]):
> Hi,
> Thanks for replying.
> 
> You say: Nothing special html wise.
> then can you tell me how its done?
> 
> The content is dynamic being pulled from the database..how do i get it in
> one table in that layout?
> 
> > There are different ways you can do this it could help to know what
> > kind of data structure you have.
> 
> Heres the link again, you can see the datastructure (hopefully)
> http://bestwebhosters.com/compare.php?id%5B%5D=1&id%5B%5D=2&id%5B%5D=4&id%5B
> %5D=5&id%5B%5D=13&type=1

I had to add a &p5=1 to the thing to make it work.

What I was wondering about structure was do you have the data set
up with a many to many relationship? or is it just one big table
where you have all the attributes set for the one company?


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

--- End Message ---
--- Begin Message ---
> You say: Nothing special html wise.
> then can you tell me how its done?

there's some nice simple CSS behind it to give the nice border and colour
changes, but yes, nothing special HTML wise. it's a simple table

>
> The content is dynamic being pulled from the database..how do i get it in
> one table in that layout?

the best way is gonna be to put all your db content into an array and then
sort through it from there. if you use an associative array, you can put
each table row together...

display[setupfee][] = $result[0][0];
display[setupfee][] = $result[0][1];
display[monthlyfee][] = $result[1][0];
display[monthlyfee][] = $result[1][1];

... and so on.

not sure if i'm explaining this very well, or with the greatest syntax, but
hopefully you get the idea...

-skate-



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

> Hi,
> Thanks for replying.

no probs...

>
> I have not worked with arrays much other than simple arrays like the $_get
> or $_post and the database ones...can you give me a another emample on how
> to do this please?
> like how to put my db into an array and then call each part....
>

sorry, i'm probably not the best person to give a full working example. my
code works for me, but it's a little sloppy. check the php manual. look-up
associative arrays.

lets see if i can't give you a quick example tho...

<?

$n = 0;
$result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY date
DESC" );
while ($rows = mysql_fetch_array($result)) {
  if( $rows == "" ){
   continue;
  }
  extract( $rows );   ///extract our result into variables named after our
fields
  $content[id][$n] = $id;
  $content[title][$n] = $title;
  $content[text][$n] = $text;
  $content[date][$n] = $date;
  $n++; //increment our number for next time...
 }

//this next bit is sloppy coz i'm just gonna make it up for an example

print "<table>"
for( $c=0; $c<4; $c++ )   //4 coz there's 4 key fields
{
//print the id's
    print "<tr>";
    print "<td>ID</td>";
    for( $i=0; $i<$n; $i++ )
        print "<td>".$content[id][$i]."</td>";
    print "</tr>";
//print the titles
    print "<tr>";
    print "<td>TITLE</td>";
    for( $i=0; $i<$n; $i++ )
        print "<td>".$content[title][$i]."</td>";
    print "</tr>";
//print the text
    print "<tr>";
    print "<td>TEXT</td>";
    for( $i=0; $i<$n; $i++ )
        print "<td>".$content[text][$i]."</td>";
    print "</tr>";
//print the date
    print "<tr>";
    print "<td>DATE</td>";
    for( $i=0; $i<$n; $i++ )
        print "<td>".$content[date][$i]."</td>";
    print "</tr>";
}
print "</table>";

?>

like i said, this isn't the most glamorous way of doing it, and you really
should look this all up in the manual before trying it out. but if you run
this code (and you have a db to back it up) you should get a table with the
format i think your after...


>
> Thanks,
> -Ryan
>

no probs, hope my sloppy code helps you a little ;)

-skate-



--- End Message ---
--- Begin Message ---
Hey,
Thanks again.

It should take me around an hour or two just to figure out what you
wrote...:-D
I guess i have to hit the manual quite a bit.

Thanks,
-Ryan

> > Hi,
> > Thanks for replying.
>
> no probs...
>
> >
> > I have not worked with arrays much other than simple arrays like the
$_get
> > or $_post and the database ones...can you give me a another emample on
how
> > to do this please?
> > like how to put my db into an array and then call each part....
> >
>
> sorry, i'm probably not the best person to give a full working example. my
> code works for me, but it's a little sloppy. check the php manual. look-up
> associative arrays.
>
> lets see if i can't give you a quick example tho...
>
> <?
>
> $n = 0;
> $result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY
date
> DESC" );
> while ($rows = mysql_fetch_array($result)) {
>   if( $rows == "" ){
>    continue;
>   }
>   extract( $rows );   ///extract our result into variables named after our
> fields
>   $content[id][$n] = $id;
>   $content[title][$n] = $title;
>   $content[text][$n] = $text;
>   $content[date][$n] = $date;
>   $n++; //increment our number for next time...
>  }
>
> //this next bit is sloppy coz i'm just gonna make it up for an example
>
> print "<table>"
> for( $c=0; $c<4; $c++ )   //4 coz there's 4 key fields
> {
> //print the id's
>     print "<tr>";
>     print "<td>ID</td>";
>     for( $i=0; $i<$n; $i++ )
>         print "<td>".$content[id][$i]."</td>";
>     print "</tr>";
> //print the titles
>     print "<tr>";
>     print "<td>TITLE</td>";
>     for( $i=0; $i<$n; $i++ )
>         print "<td>".$content[title][$i]."</td>";
>     print "</tr>";
> //print the text
>     print "<tr>";
>     print "<td>TEXT</td>";
>     for( $i=0; $i<$n; $i++ )
>         print "<td>".$content[text][$i]."</td>";
>     print "</tr>";
> //print the date
>     print "<tr>";
>     print "<td>DATE</td>";
>     for( $i=0; $i<$n; $i++ )
>         print "<td>".$content[date][$i]."</td>";
>     print "</tr>";
> }
> print "</table>";
>
> ?>
>
> like i said, this isn't the most glamorous way of doing it, and you really
> should look this all up in the manual before trying it out. but if you run
> this code (and you have a db to back it up) you should get a table with
the
> format i think your after...
>
>
> >
> > Thanks,
> > -Ryan
> >
>
> no probs, hope my sloppy code helps you a little ;)
>
> -skate-
>
>


--- End Message ---
--- Begin Message ---
* Thus wrote Ryan A ([EMAIL PROTECTED]):
> Hi,
> Thanks for replying.
> 
> You say: Nothing special html wise.
> then can you tell me how its done?
The basic logic is like this:

<table>

foreach option_of_hosting_service
  <tr>
  <td>name_of_service</td>

  foreach hosting_company_service
    <td>hosting_value_of_service</td>

  </tr>

</table>

Now how you fetch your data is where it gets a little tricky. I
can't really help you there cause I'm not sure how you store the
data for the hosting services.

HTH at least a little.

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

--- End Message ---
--- Begin Message ---
Many thanks, that's fixed it!

On Sunday 27 Jul 2003 10:42 pm, Chris Shiflett wrote:
> --- Nicholas Robinson <[EMAIL PROTECTED]> wrote:
> > I've noticed that links in my pages are getting the sessionid
> > added as a GET parameter.
>
> The session.use_trans_sid directive is enabled in your php.ini. Disable it
> if you do not want this behavior.
>
> Hope that helps.
>
> Chris
>
> =====
> Become a better Web developer with the HTTP Developer's Handbook
> http://httphandbook.org/


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

I have a dilemma where I have to include a form found in a .aspx page into a
php page -
The form is an ADSL phone check (checks to see if ADSL is available based
upon phone number).

I need to send the form some basic variables and get the response into my
PHP page
The form -
https://adsl-wholesale.datafast.net.au/EndUser/ADSLAvailability.aspx

I have tried the bellow with no success
(firstly I use a form in one of PHP pages gathering the same $_POST variable
names as the .aspx form, then send it to the below action page)-
I have also tried sending the variables as $_GET.

I have a feeling I may have to use the CURL library here?  Any suggestions
are greatly appreciated.

Cheers,
Paul


<?php

    //  Post variables already collected, now do this action

    $url =
"http://adsl-wholesale.datafast.net.au/EndUser/ADSLAvailability.aspx";;
        $file = fopen ($url, "r");
    if (!$file) {
        echo "<p>Unable to open remote file.\n";
        exit;
        }
        while (!feof ($file)) {
                $line = fgets ($file, 1024);
          // This only works if the title and its tags are on one line
                if (eregi ("<title>(.*)</title>", $line, $out)) {
                        $title = $out[1];
                        break;
                }
    }
    fclose($file);
?>





--- End Message ---
--- Begin Message ---
* Thus wrote Paul Fitz ([EMAIL PROTECTED]):
> 
> Hi All,

Hello.

> 
> I have tried the bellow with no success
> (firstly I use a form in one of PHP pages gathering the same $_POST variable
> names as the .aspx form, then send it to the below action page)-
> I have also tried sending the variables as $_GET.
> 
> I have a feeling I may have to use the CURL library here?  Any suggestions
> are greatly appreciated.

Yes, curl would make your life a whole lot easier.

> <?php
> 
>     //  Post variables already collected, now do this action
> 
>     $url =
> "http://adsl-wholesale.datafast.net.au/EndUser/ADSLAvailability.aspx";;
>       $file = fopen ($url, "r");

The POST vars don't get sent to the webpage your retrieving from
your php script.

HTH,

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

--- End Message ---
--- Begin Message ---
Hi people, I made a system in PHP wich uses sessions. While I'm testing the
system some times the session finishes unexpectedly. Some times the system
works during one hour without problems but other times the system finishes
after five minutes and return to the login page.
I think that the session variables "forget" their values for some reason.
Something in the PHP configuration may be? But the time is not always the
same.
Well, I hope you can guide me with this problem. Ahead of time, thank you
very much.

Tom.





--- End Message ---
--- Begin Message ---
* Thus wrote Tomás Liendo ([EMAIL PROTECTED]):
> Hi people, I made a system in PHP wich uses sessions. While I'm testing the
> system some times the session finishes unexpectedly. Some times the system
> works during one hour without problems but other times the system finishes
> after five minutes and return to the login page.
> I think that the session variables "forget" their values for some reason.
> Something in the PHP configuration may be? But the time is not always the
> same.
> Well, I hope you can guide me with this problem. Ahead of time, thank you
> very much.

Are you using cookies or GET method for passing the session around?



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

--- End Message ---
--- Begin Message ---
Hi,
After asking for help on the list Skate gave me the following code as an
example:
**************
$n = 0;
$result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY date
DESC" );
while ($rows = mysql_fetch_array($result)) {
  if( $rows == "" ){  continue;  }
  extract( $rows );   ///extract our result into variables named after our
fields
  $content[id][$n] = $id;
  $content[title][$n] = $title;
  $content[text][$n] = $text;
  $content[date][$n] = $date;
  $n++; //increment our number for next time...
 }
**************
My question is: is there anyway I can use a "select * from...." to do the
same thing and then dump as usual to
$content[id][$n] = $id; $content[title][$n] = $title; instead of a "select
id, title, text, date" because in reality I don't have just these 4 fields
but 43 fields in one table that have to be taken. "Select *..." seems a much
easier way to get it....

Am a newbie at associative arrays so kindly excuse.

Any suggestions/comments welcome or even links...I don't mind reading for
the next 2 hours or so to get this working.

Thanks,
-Ryan


--- End Message ---
--- Begin Message ---
On Monday 28 July 2003 10:19, Ryan A wrote:

> After asking for help on the list Skate gave me the following code as an
> example:
> **************
> $n = 0;
> $result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY
> date DESC" );
> while ($rows = mysql_fetch_array($result)) {
>   if( $rows == "" ){  continue;  }
>   extract( $rows );   ///extract our result into variables named after our
> fields
>   $content[id][$n] = $id;
>   $content[title][$n] = $title;
>   $content[text][$n] = $text;
>   $content[date][$n] = $date;
>   $n++; //increment our number for next time...
>  }
> **************
> My question is: is there anyway I can use a "select * from...." to do the
> same thing and then dump as usual to
> $content[id][$n] = $id; $content[title][$n] = $title; instead of a "select
> id, title, text, date" because in reality I don't have just these 4 fields
> but 43 fields in one table that have to be taken. "Select *..." seems a
> much easier way to get it....

*** Untried and untested ***

  $query = "SELECT * FROM table";
  $result = mysql_query($query) or die("Query failed");
  $n = 0;
  while ($line = mysql_fetch_assoc($result)) {
    foreach ($line as $field => $value) {
      $data[$field][$n] = $value;
    }
    $n++;
  }
  print_r($data);

Season to taste.

-- 
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
------------------------------------------
/*
What one believes to be true either is true or becomes true.
                -- John Lilly
*/


--- End Message ---
--- Begin Message --- How can I get the local Computer IP Address when running PHP program in Windows command line (i.e. php getmyip.php)

** Since the PHP did not are run on Webserver, so _SERVER["SERVER_ADDR"] won't work.

Many thanks in advance.

Regards,
Chris


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

Monday, July 28, 2003, 12:21:06 PM, you wrote:
CL> How can I get the local Computer IP Address when running PHP program in 
CL> Windows command line (i.e. php getmyip.php)

CL> ** Since the PHP did not are run on Webserver, so _SERVER["SERVER_ADDR"] 
CL> won't work.

CL> Many thanks in advance.

CL> Regards,
CL> Chris

Try this:

<?php
exec('ipconfig',$catch);
foreach($catch as $line){
        if(eregi('IP Address',$line)){
                list($t,$ip) = split(':',$line);
                echo 'IP is '.$ip."\n";
        }
}
?>

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
>Try this:
><?php
>exec('ipconfig',$catch);
>foreach($catch as $line){
>        if(eregi('IP Address',$line)){
>                list($t,$ip) = split(':',$line);
>                echo 'IP is '.$ip."\n";
>        }
>}
>?>

Thanks Tom, but I think it only work for Win NT, how about Win 9x?



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

Monday, July 28, 2003, 4:29:46 PM, you wrote:
>>Try this:
>><?php
>>exec('ipconfig',$catch);
>>foreach($catch as $line){
>>        if(eregi('IP Address',$line)){
>>                list($t,$ip) = split(':',$line);
>>                echo 'IP is '.$ip."\n";
>>        }
>>}
>>?>

CL> Thanks Tom, but I think it only work for Win NT, how about Win 9x?


There is ipconfig.exe in win98 SE thats about all I know.

-- 
regards,
Tom


--- End Message ---
--- Begin Message --- How can I get the local Computer IP Address when running PHP program in Windows command line (i.e. php getmyip.php)

** Since the PHP did not are run on Webserver, so _SERVER["SERVER_ADDR"] won't work.

Many thanks in advance.

Regards,
Chris


--- End Message ---
--- Begin Message ---
Hi all- how do I modify the following function to work over a proxy server?
Thanks for any help.

David


/* sendToHost
 * ~~~~~~~~~~
 * Params:
 *   $host      - Just the hostname.  No http:// or
                  /path/to/file.html portions
 *   $method    - get or post, case-insensitive
 *   $path      - The /path/to/file.html part
 *   $data      - The query string, without initial question mark
 *   $useragent - If true, 'MSIE' will be sent as
                  the User-Agent (optional)
 *
 * Examples:
 *   sendToHost('www.google.com','get','/search','q=php_imlib');
 *   sendToHost('www.example.com','post','/some_script.cgi',
 *              'param=First+Param&second=Second+param');
 */

function sendToHost($host,$method,$path,$data,$useragent=0)
{
    // Supply a default method of GET if the one passed was empty
    if (empty($method)) {
        $method = 'GET';
    }
    $method = strtoupper($method);
    $fp = fsockopen($host, 80);
    if ($method == 'GET') {
      $path .= '?' . $data;
    }
    fputs($fp, "$method $path HTTP/1.1\r\n");
    fputs($fp, "Host: $host\r\n");
    if ($useragent) {
      fputs($fp, "User-Agent: MSIE\r\n");
    }
    if ($method == 'POST') {
      fputs($fp,"Content-type: application/x-www-form-urlencoded\r\n");
      fputs($fp, "Content-length: " . strlen($data) . "\r\n");
    }
    fputs($fp, "Connection: close\r\n\r\n");
    if ($method == 'POST') {
        fputs($fp, $data);
    }

    while (!feof($fp)) {
        $buf .= fgets($fp,128);
    }
    fclose($fp);
    return $buf;
}


--- End Message ---
--- Begin Message ---
Something like so:

/* sendToHost
 * ~~~~~~~~~~
 * Params:
 *   $proxy     - Proxy you want to use
 *   $host      - Just the hostname.  No http:// or
                  /path/to/file.html portions
 *   $method    - get or post, case-insensitive
 *   $path      - The /path/to/file.html part
 *   $data      - The query string, without initial question mark
 *   $useragent - If true, 'MSIE' will be sent as
                  the User-Agent (optional)
 *
 * Examples:
 *   sendToHost('webcache', 'www.google.com','get','/search','q=php_imlib');
 *   sendToHost('localhost', 'www.example.com','post','/some_script.cgi',
 *              'param=First+Param&second=Second+param');
 */

function sendToHost($proxy, $host,$method,$path,$data,$useragent=0)
{
    // Supply a default method of GET if the one passed was empty
    if (empty($method)) {
        $method = 'GET';
    }
    $method = strtoupper($method);
    $fp = fsockopen($proxy, 8080);
    if ($method == 'GET') {
      $path .= '?' . $data;
    }
    fputs($fp, "$method http://$host/$path HTTP/1.0\r\n");
    fputs($fp, "Host: $host\r\n");
    if ($useragent) {
      fputs($fp, "User-Agent: MSIE\r\n");
    }
    if ($method == 'POST') {
      fputs($fp,"Content-type: application/x-www-form-urlencoded\r\n");
      fputs($fp, "Content-length: " . strlen($data) . "\r\n");
    }
    fputs($fp, "Connection: close\r\n\r\n");
    if ($method == 'POST') {
        fputs($fp, $data);
    }

    while (!feof($fp)) {
        $buf .= fgets($fp,128);
    }
    fclose($fp);
    return $buf;
}

I've not tried this code, but I think I got it right :)
Also please note that this connects to proxys on port 8080, you might need
to change that.
Oh and I changed the http/1.1 to 1.0 because I find it has less problems :)

Hope this works/helps
Andrew
----- Original Message -----
From: "David Yee" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 3:44 AM
Subject: [PHP] POST/GET using a proxy server


> Hi all- how do I modify the following function to work over a proxy
server?
> Thanks for any help.
>
> David


--- End Message ---
--- Begin Message ---
I'm creating a script that filters the table of results from a database based on the 
configuration set by the user (config stored in database as well).

For example a table has 30 columns. However the user need only see 5. Every user is 
different so a user configuration is stored in the database.

The database has 2 columns: field_name and show_field. 
field_name is the name of the field (obviously) that is shown in the table.
show_field can either be a 1 or a 0. 1 = show field. 0 = don't show field.

I'm getting to a certain point. But I'm not sure how I can go about setting variables 
for each field_name that has a show_field value of 1.

Heres the code.
<?php
 function Interactive()
 {
 //Database Variables
 include ( "include/db_config.inc" );
 
 //Database connection.
 $connect = mysql_connect($host, $login, $passwd)
  OR die("Could not connect to MySQL Database: ".mysql_error()."");
 mysql_select_db("admin", $connect)
  OR die("Could not select Database: ".mysql_error()."");
 
 //Find User Configuration
 $sql = mysql_query("SELECT field_name FROM config WHERE show_field=1")
  OR die("Could not query database: ".mysql_error()."");
 $result = mysql_fetch_array($sql, MYSQL_ASSOC); 

 //Make sure there are fields to be shown.
 if(count($result) > 0)
 {


    //*****************************************************//
    // Here is where I would like to set variables.
    // I first thought of using a for statement, but
    // realized that variables cannot begin with a
    // number. Is there any possible way to set
    // variables for the array results of my query?
    //*****************************************************//

 }

else
 {
  die("Please select at least 1 field to be shown.");
 } 

 }
 
?>

Thanks,
Jason

--- End Message ---
--- Begin Message ---
hi,
i have compiled php with vpopmail and i didn't get any error but when i try accessing vpopmail functions i get call to undefined function error.
soo wha i am doing wrong,
Haseeb 
 
-------Original Message-------
 
Date: Saturday, July 26, 2003 10:06:37 PM
Subject: Re: [PHP] Configure vpopmail with php
 
* Thus wrote Haseeb ([EMAIL PROTECTED]):
>
> the detail in not enough in the FM :)
> Haseeb
 
Just curious how this line isn't enough:
 
In PHP 4, these functions are only available if PHP was configured
with --with-vpopmail[=DIR].
 
HTH,
 
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
 
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
____________________________________________________
  IncrediMail - Email has finally evolved - Click Here

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

I would like to know if it has been decided whether or not register_global will continue to be an option in PHP5.

Cheers,

Tommy Ipsen


--- End Message ---
--- Begin Message ---
Hello. Let's say I have something like this:

function aa($test) {
    $a = 8;
    echo $test;
}

$a = 2;
aa("a is ". ($a>5?"greater":"equal to or less"). " than 5".);


I want this to output "a is greater than 5".. how can i modify the code so
that the function parameter is evaluated inside the function?



--- End Message ---
--- Begin Message --- www.php.net/variables.scope

You need "global $a;" as the first line in your function.

386-DX wrote:

Hello. Let's say I have something like this:

function aa($test) {
    $a = 8;
    echo $test;
}

$a = 2;
aa("a is ". ($a>5?"greater":"equal to or less"). " than 5".);


I want this to output "a is greater than 5".. how can i modify the code so that the function parameter is evaluated inside the function?





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

        I have this problem, which could easily be solved through a name
change but I would like to learn more.

There's a table set up from a MySQL query like this

row1)   Eval #  Title           # Heads         My Findings
row2)   P1000           Title1    6                     This is my findings
row3)   P1223           Eg 2              3                     2nd findings

row1 is the header columns, the title names are derived from sql statement
executed as SELECT eval_no as "Eval #" etc..

row1 is also set up such that if the user clicks the link, it will trigger a
SQL comand to sort it.

The problem here is the '#' sign/key. spaces are no problem. the
$_GET['sort'] is not able to get the whole field, as such "Eval #" can only
be recognised as "Eval" and thus sql is not able to sort it.

I've looked at the php.ini file and tried setting these 2 configs

<snip from php manual>
arg_separator.output string
The separator used in PHP generated URLs to separate arguments. 

arg_separator.input string
List of separator(s) used by PHP to parse input URLs into variables. 
Note: Every character in this directive is considered as separator! 
</snip>

but it still does not work..

<snip>
This is how the link looks like
http://10.0.0.1/trackit/trackit-2003-07-28/view_set_tracker.php?sort=Eval%20
#&dir=ASC


Help... Please...

==========view_tracker.php==============
$l_column_header = nl2br(mysql_field_name($l_results,$k));

echo nl2br(sql_sort_by_header($l_column_header, $l_column_header,
sql_sort_cat, $sql_sort_dir) );

=============sql_functions===========
function sql_sort_by_header( $p_string, $p_sort_field, $p_sort, $p_dir ) {
        if ( $p_sort_field == $p_sort ) {
            # we toggle between ASC and DESC if the user clicks the same
sort order
            if ( 'ASC' == $p_dir ) {
                $p_dir = 'DESC';
            } else {
                $p_dir = 'ASC';
            }
        }
echo '<a href="view_set_tracker.php?sort=' . $p_sort_field . '&amp;dir=' .
$p_dir . '">'. $p_string .'</a>';
    }
=================view_set_tracker.php================
        $_SESSION['sql_sort_cat']       = '';
        $_SESSION['sql_sort_dir']       =
$GLOBALS['g_default_sql_sort_dir'];
        $_SESSION['sql_sort_cat']       = $_GET['sort'];

        if (!empty( $_GET['dir'] ))
        {
                $sql_sort_dir = $_GET['dir'];
        }

        header_redirect_html("view_tracker.php");
}

?>

=================================

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168

--- End Message ---
--- Begin Message ---
What happens if you use a non-breaking html space instead? I.e Eval&nbsp#

HTH

Nick
On Monday 28 Jul 2003 9:06 am, Ow Mun Heng wrote:
> Hi,
>
>       I have this problem, which could easily be solved through a name
> change but I would like to learn more.
>
> There's a table set up from a MySQL query like this
>
> row1) Eval #  Title           # Heads         My Findings
> row2) P1000           Title1    6                     This is my findings
> row3) P1223           Eg 2              3                     2nd findings
>
> row1 is the header columns, the title names are derived from sql statement
> executed as SELECT eval_no as "Eval #" etc..
>
> row1 is also set up such that if the user clicks the link, it will trigger
> a SQL comand to sort it.
>
> The problem here is the '#' sign/key. spaces are no problem. the
> $_GET['sort'] is not able to get the whole field, as such "Eval #" can only
> be recognised as "Eval" and thus sql is not able to sort it.
>
> I've looked at the php.ini file and tried setting these 2 configs
>
> <snip from php manual>
> arg_separator.output string
> The separator used in PHP generated URLs to separate arguments.
>
> arg_separator.input string
> List of separator(s) used by PHP to parse input URLs into variables.
> Note: Every character in this directive is considered as separator!
> </snip>
>
> but it still does not work..
>
> <snip>
> This is how the link looks like
> http://10.0.0.1/trackit/trackit-2003-07-28/view_set_tracker.php?sort=Eval%2
>0 #&dir=ASC
>
>
> Help... Please...
>
> ==========view_tracker.php==============
> $l_column_header = nl2br(mysql_field_name($l_results,$k));
>
> echo nl2br(sql_sort_by_header($l_column_header, $l_column_header,
> sql_sort_cat, $sql_sort_dir) );
>
> =============sql_functions===========
> function sql_sort_by_header( $p_string, $p_sort_field, $p_sort, $p_dir ) {
>         if ( $p_sort_field == $p_sort ) {
>             # we toggle between ASC and DESC if the user clicks the same
> sort order
>             if ( 'ASC' == $p_dir ) {
>                 $p_dir = 'DESC';
>             } else {
>                 $p_dir = 'ASC';
>             }
>         }
> echo '<a href="view_set_tracker.php?sort=' . $p_sort_field . '&amp;dir=' .
> $p_dir . '">'. $p_string .'</a>';
>     }
> =================view_set_tracker.php================
>       $_SESSION['sql_sort_cat']       = '';
>       $_SESSION['sql_sort_dir']       =
> $GLOBALS['g_default_sql_sort_dir'];
>       $_SESSION['sql_sort_cat']       = $_GET['sort'];
>
>       if (!empty( $_GET['dir'] ))
>       {
>               $sql_sort_dir = $_GET['dir'];
>       }
>
>       header_redirect_html("view_tracker.php");
> }
>
> ?>
>
> =================================
>
> Cheers,
> Mun Heng, Ow
> H/M Engineering
> Western Digital M'sia
> DID : 03-7870 5168


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

        Is it advisable to use SESSIONS to store variable from one page to
another page instead of using something like a hidden field?

eg: 
$_SESSION['sql_sort_cat']
$_SESSIOn['sql_sort_dir']

instead of

<input type=hidden value=<?php $sql_sort_cat?> >


Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia 
DID : 03-7870 5168

--- End Message ---
--- Begin Message --- No problem, but remember the user might want to bookmark the page.

Ow Mun Heng wrote:
Hi,

        Is it advisable to use SESSIONS to store variable from one page to
another page instead of using something like a hidden field?

eg: $_SESSION['sql_sort_cat']
$_SESSIOn['sql_sort_dir']


instead of

<input type=hidden value=<?php $sql_sort_cat?> >


Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia DID : 03-7870 5168




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

Sorry - by caling I meant to echo the cookie value on a .pl page - and
include it (the cookie value)then in an email.

Any help would be appreciated because the PERL list people said I must try a
PHP list -

Thanks
August

>Is this possible :
>How do i call the cookie value (surname) with Perl if it was set with PHP?
>
>SAMPLE:
>
PHP Cookie set:
>
><?
>setcookie("surname", "mc Seveney", time()+31536000, "/","",0);
>?>
>
>Need to call this cookie with a .pl extension file (perl)




--- End Message ---
--- Begin Message ---
On Monday 28 July 2003 13:52, TWSC HQ wrote:

> Sorry - by caling I meant to echo the cookie value on a .pl page - and
> include it (the cookie value)then in an email.
>
> Any help would be appreciated because the PERL list people said I must try
> a PHP list -

A cookie is a cookie regardless of what mechanism was used to set/create it.

Just ask on the perl list how to read a cookie (no need to mention php).

-- 
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
------------------------------------------
/*
Our business is run on trust.  We trust you will pay in advance.
*/


--- End Message ---
--- Begin Message ---
The manual says that the majority of IMAP commands can be used for NNTP
access.

This code works fine.
$status =
imap_status($nntp,"{news.gradwell.net:119/nntp}#news.gradwell.
lists.test",SA_ALL);

if($status) 
{
  print("Messages:   ". $status->messages   )."<br>\n";
  print("Recent:     ". $status->recent     )."<br>\n";
  print("Unseen:     ". $status->unseen     )."<br>\n";
  print("UIDnext:    ". $status->uidnext    )."<br>\n";
  print("UIDvalidity:". $status->uidvalidity)."<br>\n"; 

This produces the following output.

Messages: 7
Recent: 7
Unseen: 7
UIDnext: 111
UIDvalidity:-1091568946

The 111 is reasonable as there are 6 messages on the server, numbered
104-109 on the server.

The code $msgno = imap_msgno($nntp, '106');
echo " msgno is: $msgno <br>\n";

outputs msgno is: 2 

the inverse

$uidno = imap_uid($nntp, $msgno);
echo " uidno is: $uidno <br>\n"; 

outputs 

Warning: Bad message number in /nfs1/corixa/webs/cgi-user/news/news.php
on line 60
uidno is: 

So it appears that 106 looks up as 2, but 2 doesn't produce 106, but an
error instead.

Has anybody honestly used the IMAP functions to drive and NNTP server
or am I wasting my time.

{R}


--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Ryan A [mailto:[EMAIL PROTECTED]
> Sent: 26 July 2003 21:16
> 
> Hey John,
> I dont think its the browser because I have tried this with 
> opera 6,opera 7,
> IE and NN with the same results...
> But when i checked the phpinfo() it says that cookies are 
> enabled....Do you
> think its worth it to search and replace each Location header 
> with .SID?

Absolutely: just consider a user who has deliberately blocked all cookies in their 
browser options -- even if your server is set to use cookies by default, if 
session.use_trans_sid has not been disabled, PHP will detect that the user is blocking 
cookies and revert to passing the SID (aka PHPSESSID) in the URL.  If you have a URL 
that PHP is unable to rewrite for any reason (such as because it's in a 
header('Redirect: ...') string), if you haven't manually concatenated the SID constant 
to that URL, the session will "disappear" at that point.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Curt Zirzow [mailto:[EMAIL PROTECTED]
> Sent: 26 July 2003 01:14
> 
> * Thus wrote Curt Zirzow ([EMAIL PROTECTED]):
> > * Thus wrote Jeremy ([EMAIL PROTECTED]):
> > > let me make sure I understand...
> > > 
> > > $var = 'a';
> > > $var++
> > > print($var);
> > > 
> > > would print "b" to the screen?
> > 
> > um.. ignore my post ealier.. yes it does print 'b'
> 
> I forgot to mention, be sure to check how far you are in your loop
> cause last time i checked:
> 
> ...
> var z[];
> var {[];
> 
> will produce a javascript error.

That shouldn't be a consideration, since:

<?php
   $x = 'z';
   $x++;
?>

will set $x to 'aa' (IIRC).

This is also why

    for ($x='a'; $x<='z'; $x++)

doesn't do what you might expect.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Shawn McKenzie [mailto:[EMAIL PROTECTED]
> Sent: 27 July 2003 08:36
> 
> I have some URLs in hrefs that have an &.  This does not 
> validate HTM4.01
> transitional, so I want to replace them with &amp;
> 
> So I buffer the output and do a replace, but suppose there is 
> already an
> &amp; then I get &amp;amp; or if I have anything else like 
> &quot; then I get
> &amp;quot;

Why can't you just put &amp; in the href string?  Seems like the simplest
way to me.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

--- End Message ---
--- Begin Message ---
Here is my problem.  When I send emails locally theough the Exchange Server
I have no problems sending mail.  When I try to send emails to another site
through the MTA funtion_mail pops up.  One of two things came to mind.
First is that we have anonymous forwarding of emails turned off for
security, meaning that I need to login to the Exchange server in order to
send emails.  Or the second part as I have seen on so many PHP sites is that
I need a valid email address to send from.  My question on the valid email
address is if it has to be the primary or can it be the secondary address
for an Exchange account?  I created a secondary address and it still does
not work. Any clues on what to do? Do I need to login into the server for
this?
Please Help me on this!



--- End Message ---

Reply via email to