php-general Digest 18 Jun 2005 13:09:47 -0000 Issue 3519
Topics (messages 217164 through 217171):
Re: possible jscript/php/frames question!!
217164 by: Chris W. Parker
217166 by: Tom Rogers
Re: Problems with header()
217165 by: Tom Rogers
217171 by: Martín Marqués
Re: your script: Telling human and machines apart
217167 by: Burhan Khalid
comparing two texts
217168 by: jenny mathew
rename
217169 by: Mister Jack
217170 by: Bob Winter
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 ---
bruce <mailto:[EMAIL PROTECTED]>
on Friday, June 17, 2005 5:05 PM said:
> chris...
>
> i'll humour you.. although i'm pretty sure you have no idea as to
> what i'm trying to acomplish.. or how to get to my goal...
>
> the basic issue is to allow a user to click inside an image map, and
> to translate the coordinates to something else, prior to sending the
> information back to the server..
Ooohh...
> the solution to this appears to need to be a combination of
> jscript/php... thus the posting...
Actually it doesn't appear to be a mixture at all... It is solely the...
responsibility of javascript (or another client... side technology) to
do the transmalating... you speak of. PHP is completely... out... of
the... loop. ...
[snip/]
> so i waste another 30 secs dealing with some clueless person...
Come back when... you have a PHP question... and we can chat...
Chris.
--- End Message ---
--- Begin Message ---
Hi,
Saturday, June 18, 2005, 8:47:58 AM, you wrote:
b> hi...
b> i've got a problem where i'm trying to play with imagemaps. i created a test
b> image map, but when i select inside the image map, i 'see' the "?x,y" from
b> the imagemap, appended to the url in the browser address bar... i get
b> http://foo.com?3,5 etc...
b> is there a way to prevent this from occuring??
b> i'd like to be able to select the imagemap, get the coordinate, and not have
b> the x,y mouse coordinate show up in the address bar...
b> i thought i could use an onClick, and go to a javascript function, but i
b> couldn't figure out how to get the mouse coordinates within the jscript
b> function.
b> if i slammed all this inside a frame, would that prevent the url-"x,y"
b> information from being displayed??
b> my sample code is below...
b> thanks
b> -bruce
b> [EMAIL PROTECTED]
b> ----------------------------------------------------------------------------
b> ---
b> [EMAIL PROTECTED] site]# cat map.php
b> <?
b> /*
b> test for image maps...
b> */
?>>
b> <?
b> $_self = $_SERVER['PHP_SELF'];
?>>
b> <html>
b> <body>
b> <script language="javascript" type="text/javascript">
b> <!--
b> function foo1(q)
b> {
b> // str = window.location.search
b> // document.write("fff "+q+"<br>");
b> // location.href="map.php";
b> // return true;
b> }
b> function foo(e)
b> {
b> //q = q+1;
b> mX = event.clientX;
b> mY = event.clientY;
b> // str = window.location.search
b> document.write("fff "+mX+" y= "+mY+"<br>");
b> location.href="map.php";
b> return true;
b> }
// -->>
b> </script>
b> <!--
b> <center><a href="<?=$_self;?>"><img
-->>
b> <center>
b> <!--
b> <a href="<?=$_self;?>" onclick ="alert(self.location.search); return false">
-->>
b> <a href="ff.php" onclick="">
b> <img src="imagemap.gif" ISMAP></a></center>
b> <p>
b> <script language="javascript" type="text/javascript">
b> <!--
b> str = location.search
b> if(str)
b> {
b> document.write("fff "+str+"<br>");
b> //location.href="map.php";
b> }
// -->>
b> </script>
b> </body>
b> </html>
A PHP solution to your problem is to save the x y co-ordinates in a
session and do a refresh, then get the values fom session.
Do something like
<?php
session_start();
if(isset($_SESSION['x']) && isset($_SESSION['y'])){
//do your thing here
unset($_SESSION['x'];
unset($_SESSION['y'];
}else{
//get x and y from request variables here
if($x && $y){
$_SESSION['x'] = $x;
$_SESSION['y'] = $y;
header('location: '.$_SERVER['PHP_SELF']);
exit;
}else{
//show start page
}
}
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Hi,
Saturday, June 18, 2005, 7:55:10 AM, you wrote:
MM> I have to send a PDF file after a submit on a form. The PDF is well created,
MM> and I'm sending it to the client with this:
MM> $fpdfName = "/tmp/" . session_id() . ".pdf";
MM> // Vamos a mandar el PDF
MM> header('Content-type: application/pdf');
MM> // El archivo se va a llamar libreDeuda.pdf
MM> header('Content-Disposition: attachment; filename="libreDeuda' .
MM> '.pdf"');
MM> // El PDF fuente va a ser $ftexName.
MM> readfile($fpdfName);
MM> The problem is that the PDF file that is sent is corrupted for acroread
(xpdf
MM> reads it like a charme), because, after the end of file (%%EOF) of PDF there
MM> is an HTML page add to the file.
MM> Is there anyway I can solve this? Is the sintaxis I used for sending a file
MM> correct?
Here is a script I use to send pdfs which also handles caching
information. It may just be you are missing the content-length header?
<?php
$cache_time = false;
$requested_time = false;
$filename = "/tmp/" . session_id() . ".pdf";
$len = filesize($filename);
$mtime = filemtime($filename);
$cache_time = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
header('Last-Modified: '.$cache_time);
$rt = (empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))? false :
$_SERVER['HTTP_IF_MODIFIED_SINCE'];
if($rt) $requested_time = strtotime($rt);
if($requested_time && $cache_time){
if($requested_time == $cache_time){
Header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
exit;
}
}
header("Accept-Ranges: bytes");
header('Cache-Control: no-cache, must-revalidate');
header("Content-type: application/pdf");
header("Content-Length: $len");
readfile($filename);
--
regards,
Tom
--- End Message ---
--- Begin Message ---
El Sáb 18 Jun 2005 01:38, Tom Rogers escribió:
>
> Here is a script I use to send pdfs which also handles caching
> information. It may just be you are missing the content-length header?
[snip]
> header("Accept-Ranges: bytes");
> header('Cache-Control: no-cache, must-revalidate');
> header("Content-type: application/pdf");
> header("Content-Length: $len");
> readfile($filename);
Excelent! The Content-length did it. The only thing I don't understand is that
whenever I put the header("Accept-Ranges: bytes") it stops sending the PDF
file. I comment out that line and everything works like a charme.
Thank you!
--
10:06:43 up 11 days, 21:53, 1 user, load average: 2.32, 1.81, 1.35
-----------------------------------------------------------------
Martín Marqués | select 'mmarques' || '@' || 'unl.edu.ar'
Centro de Telematica | DBA, Programador, Administrador
Universidad Nacional
del Litoral
-----------------------------------------------------------------
--- End Message ---
--- Begin Message ---
Merlin wrote:
Hi Burhan,
you posted a while ago to the php user group:
This is an example of what my script outputs :
http://meidomus.com/code/captcha/
Source available if you are interested.
I would be interested to try that code and alter it to fit my needs.
Would that be possible?
Merlin :
Sure. A lot of people have requested this, so I'm going to post it
online for all to see. I think I found this script (or a version of it)
online somewhere and modified it. I can't remember where exactly.
Anyway, I have posted the script's source at
http://meidomus.com/code/captcha/captcha.phps
The font used in the script is available at
http://meidomus.com/code/captcha/bboron.ttf
You can use any other font, provided you change the $font variable in
the script. The script sets a session variable turing_string with the
text of the image (this is what you compare the user's input with).
The script is not very complex, and has a few comments. Let me know
if you have any other questions.
Warmly,
Burhan
--- End Message ---
--- Begin Message ---
hello group,
is it possible to compare two different text messages and highlight
the difference in php.
i mean to say that
$text1="message 1"
$text2="message 2"
i want to compare both $text1 and $text2 for differences and highlight
the differece in php.is it possible.
waiting for your reply.
thanks.
Yours,
Jenny
--- End Message ---
--- Begin Message ---
Hi,
I would like to know precisely what rename do in case of error. any
link for that ?
I do a : @rename($old, $new), what happens if I run out of space ? is
the rename just an alias for C function library ?
thanks
--- End Message ---
--- Begin Message ---
Look at http://us2.php.net/manual/en/function.rename.php
Mister Jack wrote:
Hi,
I would like to know precisely what rename do in case of error. any
link for that ?
I do a : @rename($old, $new), what happens if I run out of space ? is
the rename just an alias for C function library ?
thanks
--- End Message ---