php-general Digest 2 Feb 2002 19:00:01 -0000 Issue 1148

Topics (messages 83232 through 83249):

IP based redirection
        83232 by: PHPbin.dinsol.com

Parsing commands to a program
        83233 by: Liam MacKenzie
        83235 by: val petruchek
        83237 by: Liam MacKenzie
        83241 by: Jason Cox

script running under certain user
        83234 by: val petruchek

Re: Can this be done in PHP?
        83236 by: S.Murali Krishna

Re: Check Boxes and updating records. (HELP ME....)
        83238 by: Yogesh

Re: create xml document with PHP
        83239 by: hassan

[URGENT] PHP as an apache module on windows under cygwin
        83240 by: Stephano Mariani
        83243 by: David

Re: Attaching a file via MAIL()
        83242 by: DL Neil

HOT! - PHP4.1.x - Step by Step Installation manual
        83244 by: Andre Amaral

Adding 6 digits to a str?
        83245 by: Andy
        83247 by: Jeff Sheltren
        83248 by: Edward van Bilderbeek - Bean IT

Re: How to get the URL into a var?
        83246 by: Andy

Default mysql path
        83249 by: Uma Shankari T.

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 ---
Could you please help us, to redirect some of our pages to based on IP 
address.
We have used SmartRedirect program but it is not working on with some of 
our ISP's IP address. We are located at India, and like to have some 
language specific pages to be displayed to our Indian user while english 
language to other world.
Thanks,

Hemant Kumar
DInsol.com
http://www.dinsol.com/
--- End Message ---
--- Begin Message ---
Hello,

I was wondering, how would I pass commands to a program and print the
results on my screen?
For instance, to add an FTP user the command would be:
"pure-pw useradd joeblow -u ftpuser -d /home/joeblow"
How would I make a php script do that and display it's output when it's
done?

Thanks,
Liam




--- End Message ---
--- Begin Message ---
> Hello,
>
> I was wondering, how would I pass commands to a program and print the
> results on my screen?
> For instance, to add an FTP user the command would be:
> "pure-pw useradd joeblow -u ftpuser -d /home/joeblow"
> How would I make a php script do that and display it's output when it's
> done?
>


Try
<?php
echo `pure-pw useradd joeblow -u ftpuser -d /home/joeblow`; //not quotes by
ticks!
?>

but not sure about security allows u to do it

Valentin Petruchek (aki Zliy Pes)
Cut the beginning
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
Nope, can't get that to work.
Any more suggestions?

----- Original Message -----
From: "val petruchek" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, February 02, 2002 8:58 PM
Subject: Re: [PHP] Parsing commands to a program


> > Hello,
> >
> > I was wondering, how would I pass commands to a program and print the
> > results on my screen?
> > For instance, to add an FTP user the command would be:
> > "pure-pw useradd joeblow -u ftpuser -d /home/joeblow"
> > How would I make a php script do that and display it's output when it's
> > done?
> >
>
>
> Try
> <?php
> echo `pure-pw useradd joeblow -u ftpuser -d /home/joeblow`; //not quotes
by
> ticks!
> ?>
>
> but not sure about security allows u to do it
>
> Valentin Petruchek (aki Zliy Pes)
> Cut the beginning
> http://zliypes.com.ua
> mailto:[EMAIL PROTECTED]
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


--- End Message ---
--- Begin Message ---
How I've done it in the past is to dynamically build the command string and
then pass it through the exec function like so:

$cmdStr = "pure-pw useradd joeblow -u ftpuser -d /home/joeblow";
exec($cmdStr);

The exec call won't display output but I believe if you use system($cmdStr)
it will.  I don't think this method will work if the useradd program prompts
for a password.  The exec and system calls just execute the command and
exit.

Jason

----- Original Message -----
From: "Liam MacKenzie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 02, 2002 5:54 AM
Subject: Re: [PHP] Parsing commands to a program


> Nope, can't get that to work.
> Any more suggestions?
>
> ----- Original Message -----
> From: "val petruchek" <[EMAIL PROTECTED]>
> To: "PHP" <[EMAIL PROTECTED]>
> Sent: Saturday, February 02, 2002 8:58 PM
> Subject: Re: [PHP] Parsing commands to a program
>
>
> > > Hello,
> > >
> > > I was wondering, how would I pass commands to a program and print the
> > > results on my screen?
> > > For instance, to add an FTP user the command would be:
> > > "pure-pw useradd joeblow -u ftpuser -d /home/joeblow"
> > > How would I make a php script do that and display it's output when
it's
> > > done?
> > >
> >
> >
> > Try
> > <?php
> > echo `pure-pw useradd joeblow -u ftpuser -d /home/joeblow`; //not quotes
> by
> > ticks!
> > ?>
> >
> > but not sure about security allows u to do it
> >
> > Valentin Petruchek (aki Zliy Pes)
> > Cut the beginning
> > http://zliypes.com.ua
> > mailto:[EMAIL PROTECTED]
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>

--- End Message ---
--- Begin Message ---
Hello, php-world!

I know my question a little offtopic;), but:

we have apache running under user "nobody".

now we want to change this user to another one on certain folder.
We want php to run under this new user.

We cannot change set httpd.conf to do it.

can anyone give an example of such solution?

Thanks

Valentin Petruchek (aki Zliy Pes)
*** Cut the beginning ***
http://zliypes.com.ua
mailto:[EMAIL PROTECTED]



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

        Based on the GET_VARS you can identify the image and do some 
mapping stuffs to get the sitename. Then you can construct your header
accordingly with 'Location:' parameter to view that site.


On Fri, 1 Feb 2002, Lazor, Ed wrote:

> I'm trying to understand how this banner exchange works and whether it can
> be done in PHP.  Here's the HTML you put on your web page:
> 
> <a
> href="http://rpgx.rpgconsortium.com/xchange/engage.cgi?advert=NonSSI&page=XX
> "><img
> src="http://rpgx.rpgconsortium.com/xchange/engage.cgi?id=atfantasy&page=01";
> border="0" width="468" height="60"></a>
> 
> 
> It...
> - displays a random banner image
> - takes you to the site relating to the displayed image
> 
> How does it do that?  Any ideas on how to do this in PHP?
> 
> -Ed
> 
>  
> ****************************************************************************
> This message is intended for the sole use of the individual and entity to
> whom it is addressed, and may contain information that is privileged,
> confidential and exempt from disclosure under applicable law.  If you are
> not the intended addressee, nor authorized to receive for the intended
> addressee, you are hereby notified that you may not use, copy, disclose or
> distribute to anyone the message or any information contained in the
> message.  If you have received this message in error, please immediately
> advise the sender by reply email and delete the message.  Thank you very
> much.                                                                       
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

S.Murali Krishna
[EMAIL PROTECTED]  
===================================== 
We grow slow trying to be great
                                                                
                   - E. Stanley Jones
-------------------------------------

--- End Message ---
--- Begin Message ---
    Hi! I've developed something like this recently, i'll explain to you how
i proceeded, maybe that'll help you to solve your problem :-)

    Here goes:
I have the following tables:
1. users (primary key: user_id)
2. categories (primary key: category_id)

Now, the users may be in different categories, i.e. there is a many-to-many
relationship between users and categories, thus i create the table
user_category which contains the following fields:
1.user_id
2.category_id

Now, for the part where i display the users for modification, i first query
my table users, to display all my users

$all = "select * from users";
$result = mysql_query($all) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
    // i have a link on each user, e.g.
    echo '<a
href="modify.php?id='.$row['user_id'].'>'.$row['user_name'].'</a>';
}


Now on modify.php, i run the following queries

1. // get all details for that particular user (maybe you'll be needing to
display other user details on this page)
$query1 = "select * from users where user_id = '$id'";
$result = mysql_query($query) or die(mysql_error());


2. // query table user_category to get all the category_id that the user
selected
$query2 = "select category_id from user_category where user_id = '$id'";
$result2 = mysql_query($query2) or die(mysql_error());

while ($row = mysql_fetch_array($result2))
{
    $sel_cat_id[] = $row['category_id'];
}


3 . // select all categories and place them in an array (i'll display a list
of checkboxes for each category name and loop through each one to check only
those whose category_id correspond to what the user selected initially)

$category = "select * from category";
$result_category = mysql_query($category) or die(mysql_error());

while ($row = mysql_fetch_array($result_category))
{
    $cat_id[] = $row['category_id'];
    $cat_name[] = $row['category_name'];
}


Now, i display a list of the checkboxes (name of category followed by
checkbox)

for ($i = 0; $i < count($cat_id); $i++)
{
    echo $cat_name[$i]; // display the name of the category
    echo '<input type="checkbox" name="category[]"';

    // now to validate whose checkboxes category_id value corresponds to
that which the user selected

    for ($j = 0; $j < count($sel_cat_id); $j++)
    {
        if (sel_cat_id[$j] == cat_id[$i])  // i forgot if it's this way or
the other way round
        {
            echo "checked";
        }

    // closing your input tag
    echo ">";
    }

}


This should do the trick!
You can try it and modify it to suit your needs. :-)
Now you can check new values and post your form to process the modification.

If that still doesn't work, please let me know, and i'll give you the
solution on Monday cos my stuffs are on my pc at work :-)

Regards,

Yogesh Mahadnac,
Web Developer,
Sohonet Information Technology Ltd,
49, Maurel Lane,
Charles Lees Street,
Curepipe,
Mauritius.
Tel : +230 6704066
Fax: +230 6700511

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

another great way of doing what you want to do is to use templates

regards,
__________________________________
Hassan El Forkani
http://WarmAfrica.com EveryOne's Africa
__________________________________


At 21:20 29/01/02, you wrote:
>Hello,
>
>Rodrigo Peres wrote:
> >
> > Hi list,
> >
> > I'm new to the xml world, and I need to create a page with data retrieved
> > from my database using PHP. The process is the same of create an html 
> page??
> > I mean I can use echo to output the xml tags and values?? Since this page
> > will be dinamically generated what kind of headers I need to use to this
> > page become an xml???
>
>I don't think serving XML directly to the browser is a good idea because
>many browsers would not render it.
>
>
> > I saw many docs in web but all about parse an xml, but not in how to build
> > one.
>
>This PHP class does exactly what you need. See the documentation for a
>typical example.
>
>Regards,
>Manuel Lemos
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

__________________________________

hassan el forkani
http://WarmAfrica.com EveryOne's Africa
__________________________________

--- End Message ---
--- Begin Message ---
Hi!
I am very new to both windows and PHP (coming from a solaris
environment), so please excuse me if the answer is glaringly obvious.

I have built and installed apache (1.3.23) on a windows 2000
Professional (SP2, build 2195) box with cygwin (1.3.9, I believe). The
build supports many of the modules included with apache and supports
shared objects. Some of the modules are built as shared objects.

Is there a way to use the win32 binaries with apache? I keep getting a
win32 error when apache tries to dlopen the php module.

If not, how can I build php 4.1.1 as a shared object for apache? Please
assume no knowledge on my part.

TIA

Stephano Mariani



--- End Message ---
--- Begin Message ---
 why would you need cygwin am i missing something? there's Win32 binaries availiable 
for apache
check out: http://www.apache.org/dist/httpd/binaries/win32/

as for running it as a module for Apache(Win32), check this out: 
http://sg.php.net/manual/en/install.apache.php

many people prefer using the CGI option under Apache(Win32) thou...
----- Original Message ----- 
Hi!
I am very new to both windows and PHP (coming from a solaris
environment), so please excuse me if the answer is glaringly obvious.

I have built and installed apache (1.3.23) on a windows 2000
Professional (SP2, build 2195) box with cygwin (1.3.9, I believe). The
build supports many of the modules included with apache and supports
shared objects. Some of the modules are built as shared objects.

Is there a way to use the win32 binaries with apache? I keep getting a
win32 error when apache tries to dlopen the php module.

If not, how can I build php 4.1.1 as a shared object for apache? Please
assume no knowledge on my part.

TIA

Stephano Mariani




--- End Message ---
--- Begin Message ---
Dave and Mauricio,
(basically the same question!)

> How can I add an attachment to an email using MAIL().  So far I have been
> able to successfully send email by using:
> 
>  mail($to, $subject, $message, $headers);
> 
> Is there something I can add in the $headers to add an attachment??????

=check out the scripts at PHPguru.org
 
> I am running PHP 4 and apache under a windows 98 environment... if that
> helps any.

=you're a braver man than I !
=dn



--- End Message ---
--- Begin Message ---
Hi all. Here is my first attempt to make easy Step by Step installation
manual for PHP4.1.x on Windows 2000 based systems running IIS5 using CGI or
ISAPI. Here is the link that will ake a lot of people happy. :)
http://www.experttek.com/php/installation.php

Fell free to contact me. Contact info are in the manual.



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

I am trying to force a int to be 8 digits. If it is only 3 dig filling the
first ones with 0.

Anyhow I tryed it with type casting, but it does not matter what I try, I
always get an addition.

E.g:
  $member_id is: 136
   should be: 00000136

Here is the code, which is still returning 136:

   for($i=0;$i<count($member_id);$i++){
       $length = strlen($member_id[$i]);

        settype ($member_id[$i], "string");
        $zero = '0';
        settype ($zero, "string");

        $member_id[$i] = $zero + $member_id[$i];
        echo $member_id[$i];
   }

Does anybody know how to solve this thing??

Thanx Andy




--- End Message ---
--- Begin Message ---
Why is it that you want to represent an int with leading 0's?  Is it just 
to print it out that way?  If that is the case, then you can use the printf 
function for formatted printing.


Jeff

At 10:53 AM 2/2/2002 +0100, Andy wrote:
>Hi guys,
>
>I am trying to force a int to be 8 digits. If it is only 3 dig filling the
>first ones with 0.
>
>Anyhow I tryed it with type casting, but it does not matter what I try, I
>always get an addition.
>
>E.g:
>   $member_id is: 136
>    should be: 00000136
>
>Here is the code, which is still returning 136:
>
>    for($i=0;$i<count($member_id);$i++){
>        $length = strlen($member_id[$i]);
>
>         settype ($member_id[$i], "string");
>         $zero = '0';
>         settype ($zero, "string");
>
>         $member_id[$i] = $zero + $member_id[$i];
>         echo $member_id[$i];
>    }
>
>Does anybody know how to solve this thing??
>
>Thanx Andy


--- End Message ---
--- Begin Message ---
like this:

$digit = 122;
 $digits = sprintf ("%08d", $digit);
 print $digits;

Greets,

Edward


----- Original Message -----
From: "Jeff Sheltren" <[EMAIL PROTECTED]>
To: "Andy" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, February 02, 2002 6:41 PM
Subject: Re: [PHP] Adding 6 digits to a str?


> Why is it that you want to represent an int with leading 0's?  Is it just
> to print it out that way?  If that is the case, then you can use the
printf
> function for formatted printing.
>
>
> Jeff
>
> At 10:53 AM 2/2/2002 +0100, Andy wrote:
> >Hi guys,
> >
> >I am trying to force a int to be 8 digits. If it is only 3 dig filling
the
> >first ones with 0.
> >
> >Anyhow I tryed it with type casting, but it does not matter what I try, I
> >always get an addition.
> >
> >E.g:
> >   $member_id is: 136
> >    should be: 00000136
> >
> >Here is the code, which is still returning 136:
> >
> >    for($i=0;$i<count($member_id);$i++){
> >        $length = strlen($member_id[$i]);
> >
> >         settype ($member_id[$i], "string");
> >         $zero = '0';
> >         settype ($zero, "string");
> >
> >         $member_id[$i] = $zero + $member_id[$i];
> >         echo $member_id[$i];
> >    }
> >
> >Does anybody know how to solve this thing??
> >
> >Thanx Andy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


--- End Message ---
--- Begin Message ---
thanx works !


"Francois Jordaan" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I am trying to find out which dir the user is browsing. How
> > can I get the
> > URL into a var? I tryed path_info, but it only returns the filename.
>
> I'm quite new to PHP, but I've had to do the same thing recently.
> Someone mentioned
> http://www.php.net/manual/en/language.variables.predefined.php
> ...but as far as I could tell none of them would give only "subapp" in
> your example.
>
> This may work for you:
>
> $page_url = $REQUEST_URI;
> $url_array = parse_url ($page_url);
> $directory = dirname ($url_array["path"]);
> print("Dir the user is browsing: $directory");
>
> Hope that helps,
>
> francois
>


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


Hello,

  I have installed php and mysql in my machine.By default in which path
php check for mysql

Anyone can know this tell to me as soon as possible


-Uma

--- End Message ---

Reply via email to