php-general Digest 21 Sep 2002 11:59:56 -0000 Issue 1598

Topics (messages 117067 through 117086):

Re: java in php4 on debian testing distribution?
        117067 by: Monique Y. Herman
        117069 by: Sascha Cunz

Re: HTML 2 TEXT
        117068 by: Sascha Cunz

Re: my i ramble for a while?
        117070 by: Justin French

Date Time
        117071 by: Patrick
        117072 by: Tom Rogers
        117074 by: Sascha Cunz

Re: Dynamic HTML Email
        117073 by: Joseph Szobody

Attack of the ghost double slash??
        117075 by: Gerard Samuel
        117076 by: Chris Shiflett

Re: session & cookies
        117077 by: Jeff Bluemel
        117078 by: Chris Shiflett

Uploading problem
        117079 by: Ramesh Nagendra Pillai
        117080 by: Chris Shiflett

question about taking post to session
        117081 by: Randy Johnson
        117085 by: Leon Mergen

UDP socket_read() problem
        117082 by: Martin

Re: about forms with php
        117083 by: Chris Hewitt

Commenting out characters?
        117084 by: Chad Winger
        117086 by: Chad Winger

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 ---

I have java 1.4 installed, and I've put it in /usr/local/sun-j2sdk1.4.1
-- that's why I use the ini_set() method.  I've compiled and run apps
using this java installation, so I'm pretty sure all is kosher there.

I sincerely believe that the problem lies in my php installation, not in
my java installation, which is why I'm asking whether the debian php4
package in the testing distribution, which is more specifically
PHP/4.1.2 according to X-Powered-By in phpinfo(), has java support
compiled in, whether I need a particular extension library file (.so),
etc.

If there's a reason you believe my setting java.home using ini_set()
shouldn't work, please let me know.  From the ini_set docs, I gather I'm
using it appropriately.

Thanks,

monique
    
    
    Monique, 
    
    By default Debian does not come come with a recent JVM, due
    to the non-free-ness of Sun's license.
    
    So first thing is to see if you have any Java installed at 
    all...  When you type `java` at a shell it should give you 
    an error about missing parameters... if you get the following:
                  bash: java: command not found 
    then you need to install a Java package for PHP4 to work with.
    
    The most useful Java package for Debian, is blackdown.org's 
    non-free port of Java, do the following to get it do the 
    following: 
    
    to /etc/apt/sources.list add:
    # JDK -- mirrors @ http://www.blackdown.org/java-linux/mirrors.html
    deb http://www.mirror.ac.uk/sites/ftp.blackdown.org/ja
    va-linux/debian
    woody non-free
    
    then run:
    apt-get update; apt-get install j2sdk1.3 
    
    Once you've installed Blackdown's port of Java, your java.home
    var should be set (you may have to log-in again or reload your
    profile to see it).
    
    good luck,
    
    -Garth
    
    -----  "Monique Y. Herman" 
    -----  19 Sep 2002 19:48:01 -0400
    
    I'd like to play with using java classes from within php, as is
    described in http://www.php.net/manual/en/ref.java.php ... I'm using
    the
    apache and php4 packages from the debian testing distribution.
    
    All of the documentation I've found on the web about installing the
    java
    extension seems to be oriented toward windows, making me think that
    maybe I don't need to specify an extension library on linux?
    
    I tried simply using
    
            ini_set ("java.home", "/usr/local/sun-j2sdk1.4.1");
            $systemInfo = new Java("java.lang.System");
    
    and got the following:
    
            Fatal error: Cannot instantiate non-existent class: java
    
    That seems fairly straightforward: My php doesn't know java from
    adam.
    
    So my questions are: Do I need to get an extension library for this
    functionality on linux?  If not, does anyone know of a debian
    package of
    php4 that will give me this capability?  I rather like being able to
    use
    packages wherever possible.
    
    Thanks in advance for any insight!
    
    -- monique


--- End Message ---
--- Begin Message ---
> I sincerely believe that the problem lies in my php installation, not in
> my java installation, which is why I'm asking whether the debian php4
> package in the testing distribution, which is more specifically
> PHP/4.1.2 according to X-Powered-By in phpinfo(), has java support
> compiled in, whether I need a particular extension library file (.so),
> etc.

You need the extension either compiled in _OR_ the library.
<?php phpinfo(); ?> will tell you also, if the extension is loaded. (There 
must be a 2 column box saying "java support" and "enabled" in it's head).

Sascha

--- End Message ---
--- Begin Message ---
> what he really needs is to completely remove <script>...</script>, plus
> many many other examples.
>
> completely removing everything outside the body would be another option,
> perhaps saving the contents of <title>...</title>

since a <script> might also occur inside the body, this would not really work 
out as meant.

Sascha
--- End Message ---
--- Begin Message ---
If *I* were publishing data for others to USE in their own web sites (often
called a web service), I'd make the data available in one of a few ways:

- raw text -- let them format it as they see fit

- CSV a simple CSV file can hold a wealth of information, and it is easy for
the receiver to munch up the CSV into meaningful, formatted data on a web
page.  I have one client who supplies me with two 5MB CSV files daily for an
almost complete update of his site contents... easy.

eg:

Poole,125
greenman,35
hv,25
libert,25
loriwinslow,25
PHPnewbie,15
tunitas,15
bob,10
creed,10
malees,10


- XML, or some other form of structured data... even structure (but not
formatted) HTML/XHTML would be great, because people could then format it to
their own taste with style sheets, of which they could optionally download a
default style sheet or "skin" from you, or create their own.

eg

<users>
    <name>Poole</name><amount>125</amount>
    <name>greenman</name><amount>35</amount>
    <name>hv</name><amount>25</amount>
    <name>libert</name><amount>25</amount>
    ...
</users>

or some sort of unformatted HTML table with default classes.


- formatted, branded and "designed" HTML, ready to go.  I have a project on
the go at the moment, where it looks like i might provide content for free
to everyone, or at a cost to people who want to pay for me to design the
contnt specifically for them... if they want a green background and blue
text, then that's what the web service provides them each week.


It early in the morning here, so the might be plenty of other options i'm
not thinking of yet :)


Justin




on 21/09/02 4:32 AM, Lee Doolan ([EMAIL PROTECTED]) wrote:

> 
> 
> 
> I am posting this message to the php.general newsgroup because I used
> php to construct the dynamic portion of our site and because I value
> the opinions of many people who frequently post here.  I hope that
> this will not be viewed as off-topic --if it is, I will take it
> elsewhere.
> 
> At affero we are beginning to think in terms of publishing certain
> data to whomsoever might wish to use it for whatever reason.  Here's a
> first cut attempt to provide such a service:
> 
> http://pws.affero.net/hof/topPatrons
> 
> 
> returns an HTML <table> ... </table> structure suitable for use as,
> say, a server side include.
> 
> Another kind of data which we might publish is what we refer to as a
> 'dense reputation' or a 'reputation summary'.  For an example of a
> dense reputation you can point a browser at this URL
> 
> http://svcs.affero.net/user-history.php?u=Poole
> 
> the dense reputation appears highlighted after the user id on the top
> line of the page.
> 
> 
> 
> One of the things that concerns me lately is how to make data such as
> these available as widely as possible.
> 
> 
> I have looked in to RSS for a few days and, while I am somewhat
> confused, I have begun to come more or less to the conclusion that RSS
> is employed mainly for syndicated news feeds and probably is not
> appropriate for publishing tabular data and short strings.
> 
> 
> Maybe some kind of procedure call mechanism, eh?  SOAP and XML-RPC
> seem to be competing technologies, though.  If we support one of them,
> how many sites will be excluded from accessing the data which we wish
> to make available?  Should we support both?
> 
> 
> XML seems attractive because it can be styled into so many different
> kind of presentations, but I just can't tell if this would be
> appropriate.
> 
> 
> I was wondering if anyone might be able to share thoughts or opinions
> or experience related to such issues.
> 
> 
> 
> -lee
> 

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

my server is located in the US and i live in Sweden, so when i try to run
the following command i get a 8hour diffrence,, anyone got any idea of how
to solve this?

date("Y-m-j")


regards
Patrick


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

Saturday, September 21, 2002, 12:30:48 PM, you wrote:
P> Hi,,

P> my server is located in the US and i live in Sweden, so when i try to run
P> the following command i get a 8hour diffrence,, anyone got any idea of how
P> to solve this?

P> date("Y-m-j")


P> regards
P> Patrick


   A quick fix that won't account for daylight saving differences
   unless Sweden uses the same dates as the US...

   date("Y-m-j",strtotime(+8 hours));


-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
You have to add (or subtract) 28800 seconds to/from current time and use this 
as the 2nd input to date.

echo date("Y-m-j", strtotime("now") + 28800);

Sascha

> Hi,,
>
> my server is located in the US and i live in Sweden, so when i try to run
> the following command i get a 8hour diffrence,, anyone got any idea of how
> to solve this?
>
> date("Y-m-j")
>
>
> regards
> Patrick

--- End Message ---
--- Begin Message ---
Mike,

Here is how I send an HTML e-mail. Say I have a contact form with the values $name, 
$email, and $message. The form submits to.... say..... process.php.


<?
// process.php

$message = stripslashes(nl2br($message));
$date = Date("F d, Y h:i a");


$body = "
<p><font color='#990000' face='Arial, Helvetica, sans-serif'><strong>Contact Us 
Submitted $date</strong></font></p>
<table width='300' border='1' cellspacing='1' cellpadding='3'>
  <tr> 
    <td width='113'><font face='Arial, Helvetica, sans-serif'>Name:</font></td>
    <td width='187'><font face='Arial, Helvetica, sans-serif'>$name</font></td>
  </tr>
  <tr> 
    <td><font face='Arial, Helvetica, sans-serif'>E-mail address</font></td>
    <td><font face='Arial, Helvetica, sans-serif'>$email</font></td>
  </tr>
  <tr> 
    <td><font face='Arial, Helvetica, sans-serif'>&nbsp;</font></td>
    <td><font face='Arial, Helvetica, sans-serif'>&nbsp;</font></td>
  </tr>
  <tr> 
    <td><font face='Arial, Helvetica, sans-serif'>Message:</font></td>
    <td><font face='Arial, Helvetica, sans-serif'>$message</font></td>
  </tr>
</table>
";

$subject = "Contact Us submission from your website";
$to  = "John Doe <[EMAIL PROTECTED]>" . ", " ; //note the comma

/* To send HTML mail */
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* This sets the 'from' field to the Name and E-mail that was just submitted
$headers .= "From: ";
$headers .= $name;
$headers .= " <";
$headers .= $email;
$headers .= ">\r\n";

/* Send it!! */

mail($to, $subject, $body, $headers);

?>

That's it. The key part are the two header lines that set the MIME-Version, and the 
Content-type. Other than that it's the same.

Note... I changed all the double-quotes in the HTML code to single quotes. This way I 
could use double-quotes around the whole block of HTML, and simply insert the PHP 
variables where desired without have to chop apart the $body. (make sense?)

Hope this helps.

Joseph

--- End Message ---
--- Begin Message ---
A few months ago, I wrote a bit of code to stripslash() 
"PATH_TRANSLATED" on a w2k box, because,
php was reporting it with double slashes like C:\\winnt\\some_dir

Today I noticed that the code is broken because PATH_TRANSLATED is now 
reported with one slash like C:\winnt\some_dir
Does anyone know when paths contain double slashes on a w2k box, so that 
I can anticipate for them??

Thanks for any insight you may provide.

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/


--- End Message ---
--- Begin Message ---
Gerard,

The most likely reason is a php.ini configuration called magic_quotes. 
When enabled, PHP will automatically add slashes to single and double 
quotes, as well as slashes themselves (to escape them). This is helpful 
in some environments to help protect against attacks that can be used to 
execute arbitrary database commands. However, this particular setting is 
one of the more annoying ones, in my opinion, because it makes it more 
difficult to write portable code.

Hopefully this answers your question, and you can just check your 
php.ini. If you need to dynamically check the configuration, there is a 
function that will give you the setting of magic_quote. A quick 
reference in the manual will give it to you.

Oh, also, you cannot disable this per script, because the slashes are 
added perior to the data being given to PHP, hence prior to your 
script's execution.

Happy hacking.

Chris

Gerard Samuel wrote:

> A few months ago, I wrote a bit of code to stripslash() 
> "PATH_TRANSLATED" on a w2k box, because,
> php was reporting it with double slashes like C:\\winnt\\some_dir
>
> Today I noticed that the code is broken because PATH_TRANSLATED is now 
> reported with one slash like C:\winnt\some_dir
> Does anyone know when paths contain double slashes on a w2k box, so 
> that I can anticipate for them??
>
> Thanks for any insight you may provide.



--- End Message ---
--- Begin Message ---
still looking for some solutions on this - anybody else have any
suggestions?

"Jeff Bluemel" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> OK guys...
>
> here's my question - I'm using 4.2.3 and apache 1.3.26, and I've got
> sessions setup. however, it seems to be using an SID attached to the URL,
> and I want to force it to use a cookie that points to a transparent SID on
> my system.
>
> I've got the following options in my php.ini, but the system doesn't seem
to
> ever use a cookie, and the sessions don't die.  (that's my biggest concern
> is that the user has to login to the system EVERY time he visits the
site.)
>
> session.use_cookies = 1
> session.use_only_cookies = 1
> session.use_trans_sid = 1
>
>
>
>
>
> --
>
> Thanks,
>
> Jeff Bluemel
>
>


--- End Message ---
--- Begin Message ---
You've already posted this, and you never answered the questions that 
were asked. Thus, your question is every bit as unclear as the previous 
time.

Perhaps if you put forth a little effort, we might also.

Just a helpful suggestion,

Chris

Jeff Bluemel wrote:

>still looking for some solutions on this - anybody else have any
>suggestions?
>

--- End Message ---
--- Begin Message ---
Hai all

I had developed an application which uploads html
files to the server. My problem is after uploading
HTML files with images I tried to view it with read
file function, I am not getting the images in the HTML
file, I am using all php file uploading functiond for
uploading,

Please tell me how to overcome this problem ie I want
to view the images in the HTML file which I have
uploaded when I view it with readfile function

reagards
Ramesh N

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
Ramesh,

Images are not in HTML. Rather, they are only referenced in HTML.

So, if you are reading the file, the references to the images need to 
still be valid. Consider this:

<img src="./images/image.png">

If this is in HTML located at http://www.example.org/, then it means (if 
the image shows up) there is an image at:

http://www.example.org/images/image.png

If you read this HTML file and place it on your server:

http://www.ramesh.org/

Then you need to have an image here:

http://www.ramesh.org/images/images.png

Hopefully that helps explain it. PHP just gets the HTML for you in this 
case. It is your job to make sure the HTML is still valid. It might be 
easier for you to use a base tag to make all relative links refer to the 
original. For example:

<base href="http://www.example.org/";>

If you include this tag prior to reading the HTML file, relative URLs 
will use that as the base, thus the images will still be pulled from the 
original server.

Happy hacking.

Chris

Ramesh Nagendra Pillai wrote:

>I had developed an application which uploads html
>files to the server. My problem is after uploading
>HTML files with images I tried to view it with read
>file function, I am not getting the images in the HTML
>file, I am using all php file uploading functiond for
>uploading,
>

--- End Message ---
--- Begin Message ---
hello,

how could i take all the variables in $_POST[""] and move them to
$_SESSION[""]?

example

$_POST["name"]=$_SESSION["name"]


Thanks in advance


Randy


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

"Randy Johnson" <[EMAIL PROTECTED]> wrote in message
000901c2613d$e9223e30$c100a8c0@rjmarket">news:000901c2613d$e9223e30$c100a8c0@rjmarket...
> how could i take all the variables in $_POST[""] and move them to
> $_SESSION[""]?

If I understand correct, you will want something like this:

<?
$var     = $_POST["var"];
session_start();
session_register("var");
?>

And now, in all the scripts on your site, when you execute the
session_start() function, $_SESSION["var"] contains the original contents of
$_POST["var"] .

Grtz,

Leon


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

I created an UDP socket using $sock=socket_create(AF_INET,SOCK_DGRAM,SOL_UDP) 
successfully and then used socket_bind($sock,$address,$port), up to there, no 
problems, but when I try to $buff=socket_read($sock,3) it just stays there doing 
nothing forever.

What could be the problem?

What is the normal behaviour of socket_read() when the socket is empty?

I write to the socket (address/port) like crazy from the other side of the LAN, but 
nothing seems to be happening.

Thanks,

Martin

--- End Message ---
--- Begin Message ---
Meltem Demirkus wrote:

>?Because  when I tried to use them like this:
>
><form name="sign" method="POST" action="sign_up_.php"
>onSubmit="checkemail(email.value);return false" >
>
>and when I click submit.. javascript is working but it is not going to the
>sign_up_ page ......How can I manage it?..
>
Or simply leave off the "return false" and in your JS routine do
"document.forms[0].submit()"

HTH
Chris

--- End Message ---
--- Begin Message ---
Simple question for the newbie...I hope...

The following line is returning an error, and I can't figure out what and
how to comment out. I assumed I had to \ the parentheses...but it doesnt
work... any suggestion?

echo '<TD><A HREF="#"><IMG SRC="image.gif" WIDTH="62" HEIGHT="15" BORDER="0"
onClick="MM_showHideLayers('Layer5','','show','Layer4','','hide')"></A>'."\n
";


Thanks
-Tree


--- End Message ---
--- Begin Message ---
I figured it out...was the single quotes....

Disregard





Chad Winger <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Simple question for the newbie...I hope...
>
> The following line is returning an error, and I can't figure out what and
> how to comment out. I assumed I had to \ the parentheses...but it doesnt
> work... any suggestion?
>
> echo '<TD><A HREF="#"><IMG SRC="image.gif" WIDTH="62" HEIGHT="15"
BORDER="0"
>
onClick="MM_showHideLayers('Layer5','','show','Layer4','','hide')"></A>'."\n
> ";
>
>
> Thanks
> -Tree
>
>


--- End Message ---

Reply via email to