php-general Digest 27 Feb 2004 09:00:23 -0000 Issue 2614
Topics (messages 178959 through 178990):
Re: [PHP-DEV] PHP5: Class behavior: method overloading
178959 by: Walter A. Boring IV
Re: Send Attachments via mail using form
178960 by: Manuel Lemos
178966 by: Justin Patrin
Re: PHP5 simpleXML bug or am i just being silly :)
178961 by: Luke
178989 by: André Cerqueira
Paginate Queries
178962 by: Shaun
178964 by: Tom Rogers
bug in PHP
178963 by: Kyle Goetz
178975 by: Chris W. Parker
php script that sends the user a link to complete validation process
178965 by: bruce
renamed images are now corrupt...
178967 by: Bryan Henry
178969 by: Bryan Henry
178970 by: Michael Nolan
178971 by: Bryan Henry
178972 by: Michal Migurski
178973 by: Bryan Henry
178974 by: Bryan Henry
178976 by: Bryan Henry
178982 by: Adam Bregenzer
Re: fscanf and memory
178968 by: Tom Rogers
Weird result from query...?
178977 by: Ryan A
178978 by: Erwin Kerk
178979 by: Daniel Clark
178980 by: Erwin Kerk
178981 by: Ryan A
178987 by: André Cerqueira
Re: Image resize on upload
178983 by: Will
Re: PHP Apache Log Stats and viewer?
178984 by: Jim Serio
Uploading a file to server behind a firewall
178985 by: Rick Laird
178988 by: André Cerqueira
Re: Question about CGI binary
178986 by: André Cerqueira
Passing the value of a variable from PHP to JavaScript.
178990 by: Prabu Subroto
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 ---
Quoting Vivian Steller <[EMAIL PROTECTED]>:
> Walter A. Boring IV wrote:
>
> > I say keep compatibility. If you want to enforce this, then declare an
> > interface. That is after all why they exist.
> >
> > Walt
> ...
>
> Would be nice if you could give a simple example - i really have problems
> working with interfaces :(
interface Entry
function __construct($name, $path);
}
class Folder implements Entry {
var $name = '';
var $path = '';
function __construct( $name, $path ) {
$this->name = $name;
$this->path = $path;
}
}
>
>
> how could i implement my interfaces? I think interfaces wouldn't solve php4
> compatibility problems...
----well, if you are implementing something completely new in php5, there there
are no compatibility issues. I have many classes in my projects in php4. I'm
not sure of how many child constructors have different parameters (my guess is
not many), but enforcing strict parameter count for childs classes would break
compatibility. Which is why I think that one should just use an interface to
enforce this rule. It seems like the right place for it.
my $0.02
Walt
--- End Message ---
--- Begin Message ---
Hello,
On 02/26/2004 06:54 AM, Dave Carrera wrote:
I would like to allow my visitors to send attachments via my contact form.
I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.
Also would this be limited to one file or can multiple files be allowed ?
You may want to try this class. You can add as many attachments as you want:
http://www.phpclasses.org/mimemessage
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--- End Message ---
--- Begin Message ---
Dave Carrera wrote:
Hi List,
I would like to allow my visitors to send attachments via my contact form.
I already have email validation, field verifications and other nice bits but
I am stuck on the add attachment bit.
Also would this be limited to one file or can multiple files be allowed ?
Thank you in advance for any help or advise with this.
Yours Truly
Dave C
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.595 / Virus Database: 378 - Release Date: 25/02/2004
And for a third possibility, you could try:
PEAR::Mail_Mime
http://pear.php.net/package/Mail_Mime
--
paperCrane <Justin Patrin>
--- End Message ---
--- Begin Message ---
Dont you need to use " instead of ' as ' is a string literal, while " parses
variables etc in that string
try this instead:
print("<p>$this->user->site[0]::</p>");
Maybe that will help?
--
Luke
"William Bailey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi All,
I am currently working with PHP5 beta and have found something strange
with the simplexml objects. It seems to be forgetting its values. Below
is an example..
[[the PHP5 code]]
<snip>
print('<pre>');
print('<p>$this->user::</p>');
print_r($this->user);
print('<p>$this->user->site::</p>');
print_r($this->user->site);
print('<p>$this->user->site[0]::</p>');
print_r($this->user->site[0]);
die('</pre>');
<snip>
[[END]]
[[the PHP5 Browser Output]]
$this->user::
simplexml_element Object
(
[login] => wb
[password] => 3c1175c6cdf614fb006cee10fdc325e3aa0f1894
[site] => Array
(
[0] => www.pro-net.co.uk
[1] => www.example.com
)
)
$this->user->site::
Array
(
[0] => simplexml_element Object
(
)
[1] => simplexml_element Object
(
)
)
$this->user->site[0]::
simplexml_element Object
(
)
[[END]]
Shouldn't $this->user->site return the Array displayed in the output
for $this->user or even shouldn't the simplexml_element Objects for
$this->user->site have a value or something. Basically they shouldn't be
blank otherwise how to you get the data?
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
or this:
print('<p>$this->user->site[0]::</p>');
print_r($this->user->site[0]);
wait... thats what he done hehe
nvm?
what is your php5 build?
have you tried the examples?
(http://www.php.net/manual/en/ref.simplexml.php)
did they work?
anyway, it looks pretty odd...
Luke wrote:
Dont you need to use " instead of ' as ' is a string literal, while " parses
variables etc in that string
try this instead:
print("<p>$this->user->site[0]::</p>");
Maybe that will help?
- --
André Cerqueira
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAPuGxaxdA/5C8vH8RAmdMAKDUQ49EszUioLy4VXZ8UEnaJmpq4wCggKNB
ROhlu0/fR4E43KDaFdsrzmI=
=NW8F
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Hi,
Using the following function I can present any query in a table. However
some of the results are very large and I would like to limit all results to
1000 rows. So I am trying to paginate the results. However the page that
calls these queries uses form elements to create the query. So I need to be
able to add links to the top of the query result i.e. previous and next, and
I need to resubmit the $_POST variables to create the query again.
Thanks for any advice offered.
function doQuery($query){
if(!($result = mysql_query(stripslashes($query)))){
echo '<br><br><div align="center">'.mysql_error().'</div>';
exit;
} else {
$num_fields = mysql_num_fields($result);
$num_rows = mysql_num_rows($result);
if ($num_fields > 0 && $num_rows > 0){
echo '
<table border="1" cellspacing="0" cellpadding="2"
bordercolor="#FFFFFF">
<tr>';
for($i = 0; $i < mysql_num_fields($result); $i++){
echo '<td bgcolor="#ffffff"
align="center"><strong>'.mysql_field_name($result, $i).'</strong></td>';
}
for($i = 0; $i < mysql_num_rows($result); $i++){
echo '<tr>';
$row_array = mysql_fetch_row($result);
for($j = 0; $j < mysql_num_fields($result); $j++){
echo '<td bgcolor="#eeeeee" align="center">'.$row_array[$j].'</td>';
}
echo '</tr>';
}
echo '</table>';
} else {
echo '<br><br><div align="center">No data in table</div>';
}
}
}
--- End Message ---
--- Begin Message ---
Hi,
Friday, February 27, 2004, 8:31:32 AM, you wrote:
S> Hi,
S> Using the following function I can present any query in a table. However
S> some of the results are very large and I would like to limit all results to
S> 1000 rows. So I am trying to paginate the results. However the page that
S> calls these queries uses form elements to create the query. So I need to be
S> able to add links to the top of the query result i.e. previous and next, and
S> I need to resubmit the $_POST variables to create the query again.
S> Thanks for any advice offered.
Here is a class that will create a google like pagination of results if that is
what you are after :)
<?
class page_class {
var $count = 0; //total pages
var $start = 0; //starting record
var $pages = 0; //number of pages available
var $page = 1; //current page
var $maxpages; //shows up to 2 * this number and makes a sliding scale
var $show; //number of results per page
function page_class($count=0,$show=5,$max=9){
$this->count = $count;
$this->show = $show;
$this->maxpages = $max;
($this->count % $this->show == 0)? $this->pages =
intval($this->count/$this->show):$this->pages intval($this->count/$this->show) +1;
if(!empty($_GET['search_page'])){
$this->page = $_GET['search_page'];
$this->start = $this->show * $this->page - $this->show;
}
}
function get_limit(){
$limit = '';
if($this->count > $this->show) $limit =
'LIMIT'.$this->start.','.$this->show;
return $limit;
}
function make_head_string($pre){
$r = $pre.' ';
$end = $this->start + $this->show;
if($end > $this->count) $end = $this->count;
$r .= ($this->start +1).' - '.$end.' of '.$this->count;
return $r;
}
function make_page_string($words,$pre='Result Page:'){
$r = $pre.' ';
if($this->page > 1){
$y = $this->page - 1;
$r .= '<a
href="'.$_SERVER['PHP_SELF'].'?search_page='.$y.$words.'">Previous</a> ';
}
$end = $this->page + $this->maxpages-1;
if($end > $this->pages) $end = $this->pages;
$x = $this->page - $this->maxpages;
$anchor = $this->pages - (2*$this->maxpages) +1;
if($anchor < 1) $anchor = 1;
if($x < 1) $x = 1;
if($x > $anchor) $x = $anchor;
while($x <= $end){
if($x == $this->page){
$r .= '<span class="s">'.$x.'</span> ';
}
else{
$r.= '<a
href="'.$_SERVER['PHP_SELF'].'?search_page='.$x.$words.'">'.$x.'</a> ';
}
$x++;
}
if($this->page < $this->pages){
$y = $this->page + 1;
$r .= '<a
href="'.$_SERVER['PHP_SELF'].'?search_page='.$y.$words.'">Next</a> ';
}
return $r;
}
}
//Usage
mysql_connect("**.**.**.**", "******", "********") or die (mysql_error());
$Query = "SELECT COUNT(*) AS cnt FROM tabletosearch WHERE fieldtosearch LIKE '%"
.$searchword."%'";
$query = mysql_query($Query) or die(mysql_error());
$row = mysql_fetch_array($result);
$count = $row['cnt'];
if($count > 0){
//start class total number of results,number of results to show,max number
of pages on a sliding scale (ends up as 2x this number..ie 20)
$page = new page_class($count,5,10);
$limit = $page->get_limit();
$Query2= "SELECT * FROM tabletosearch WHERE fieldtosearch LIKE '%"
.$searchword. "%' ORDER BY whatever ASC ".$limit;
$result = mysql_query($Query2) or die(mysql_error());
$hstring = $page->make_head_string('Results');
$pstring =
$page->make_page_string("&searchword=".$searchword."&whatever=".$whatever);//add
the other variables to pass to next page in a
similar fashion
echo "<table><tr><td>".$hstring."</td></tr>";
while($row = mysql_fetch_array($result)){
echo "<tr><td>".$show_data_here."</td></tr>";
}
echo "<tr><td>".$pstring."</td></tr></table>";
}
?>
Note: the search variables on subsequent pages will be passed by GET method
--
regards,
Tom
--- End Message ---
--- Begin Message ---
hey so i've been struggling with an apparent bug in and older version of
(BPHP but i wouldn't know where to look about this bug, as it concerns the
(Binclude function and there is no mention of a bug that i can find...
(B
(Bversion of php: 4.1.0
(Bi have a line of code
(Binclude 'new_album.php';
(Bi keep getting a file not found error
(Bi KNOW the file is there
(Bi copy the code to a new file, and save it as 123.php and then change the
(Bline of code to
(Binclude '123.php';
(Band voile! it works!
(Bit seems there is something wrong with using the name 'new_album.php' with
(Binclude but i dunno why...
(B
(Banyone got any input on this? i don't wanna have to worry about filenames
(Bmaking errors...
(B
(B--
(B\Kyle Goetz
(BBS Pure Mathemetics, BA Japanese 2006
(BThe University of Texas
(B
(BUsing M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
Kyle Goetz <mailto:[EMAIL PROTECTED]>
on Thursday, February 26, 2004 3:06 PM said:
> hey so i've been struggling with an apparent bug in and older version
> of PHP but i wouldn't know where to look about this bug, as it
> concerns the include function and there is no mention of a bug that i
> can find...
i'm not familiar with any bug like that (seems unlikely that there would
be a bug like that) so i'm just going to start at square one.
1. what exactly does your code look like?
2. what exactly is the error you're getting?
chris.
--- End Message ---
--- Begin Message ---
hey...
(B
(Btrying to find a quick php script/sample code/etc... that does validation
(Bfor a user.
(B
(Bbasically, i want the admin to authorize a user via a form. i want the form
(Bto kick off an email to the user that will require the user to goto the link
(Bto complete the validation process.
(B
(Bi've seen these before, but i can't seem to find an example now....!!
(B
(Bany help would be appreciated.
(B
(Bthanks
(B
(Bbruce
(B
(B[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
Hello all,
I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry
--- End Message ---
--- Begin Message ---
Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
Bryan
On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry <[EMAIL PROTECTED]>
wrote:
Hello all,
I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
Check the permissions and ownership of the files, especially if you ran
the script as some privileged user like root. chmod or chown can be
used to changed these.
Mike
Bryan Henry wrote:
Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
Bryan
On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry
<[EMAIL PROTECTED]> wrote:
Hello all,
I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry
--- End Message ---
--- Begin Message ---
Looking throught my FTP client it seems that the
permission are the same? Could this be incorrect?
Should I chmod or chown through a shell? or using PHP?
~ bryan
On Fri, 27 Feb 2004 00:01:47 +0000, Michael Nolan
<[EMAIL PROTECTED]> wrote:
Check the permissions and ownership of the files, especially if you ran
the script as some privileged user like root. chmod or chown can be
used to changed these.
Mike
Bryan Henry wrote:
Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
Bryan
On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry
<[EMAIL PROTECTED]> wrote:
Hello all,
I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
>I wrote a small script to rename a few thousand images, both gif and
>jpeg... After running the script, none of the renamed images can be
>viewed or downloaded.
>
>I now have over 3000 images I cannot download or view on our website.
>What about rename caused this?
Well, on line 5 of your script... oh wait. /Where's your script?/
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---
Here is the script I used to rename images.
<?php
clearstatcache();
$filename = "product_tn.txt";
$imgs = (array) null;
$tmp = (array) null;
$config = file($filename);
reset ($config);
$handle = fopen("import_product_tn.txt", "w");
$write = "";
foreach ($config as $line) {
if ( $line == "" ) next($config);
elseif ( $line == "\n" ) next($config);
elseif ( strstr($line,"#")) next($config);
else {
$value = split(Chr(9),$line);
$imgs[$value[0]] = $value[1];
}
}
foreach ($imgs as $k => $v) {
if ((strpos($v,'/s.gif') === FALSE) AND (strpos($v,'noimage') === FALSE)
AND (strlen(trim($v)) >= 0)) {
$tmp = split("/",$v);
$cnt = count($tmp);
$cnt = $cnt - 1;
$re = explode(".", $tmp[$cnt]);
$ext = $re[1];
$renamed = strtolower($k).".".strtolower($ext);
if (file_exists("Merchant2/".trim($v)) AND $cnt) {
rename("Merchant2/".trim($v), "pi/".$renamed);
$write .= $k.Chr(9)."graphics/00000001/".$renamed.Chr(10);
} else {
$write .= $k.Chr(9).Chr(10);
echo $k."<br>";
}
} else {
$write .= $k.Chr(9).Chr(10);
}
}
fwrite($handle, $write);
fclose($handle);
clearstatcache();
?>
On Thu, 26 Feb 2004 16:21:55 -0800 (PST), Michal Migurski
<[EMAIL PROTECTED]> wrote:
I wrote a small script to rename a few thousand images, both gif and
jpeg... After running the script, none of the renamed images can be
viewed or downloaded.
I now have over 3000 images I cannot download or view on our website.
What about rename caused this?
Well, on line 5 of your script... oh wait. /Where's your script?/
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
Chmod and file_exists report that the file does not exist,
even though I can view the files via the FTP client.
bryan
--- End Message ---
--- Begin Message ---
I realized that I did not trim the end line characters off of the file
extensions
after I grabbed all the file names from a text file. Now all the images
have
end of line chracters as part of the extension. I cannot access/edit the
files
through SHH, PHP or FTP...
Oh well...
bryan
On Fri, 27 Feb 2004 00:01:47 +0000, Michael Nolan
<[EMAIL PROTECTED]> wrote:
Check the permissions and ownership of the files, especially if you ran
the script as some privileged user like root. chmod or chown can be
used to changed these.
Mike
Bryan Henry wrote:
Browser and FTP client act as if the image
files do not exist, even though the directory
contents can be views via FTP...
What did I do?
Bryan
On Thu, 26 Feb 2004 17:56:25 -0600, Bryan Henry
<[EMAIL PROTECTED]> wrote:
Hello all,
I wrote a small script to rename a few thousand images,
both gif and jpeg... After running the script, none of
the renamed images can be viewed or downloaded.
Trying to download these images from an FTP client fails.
FTP client attempts to download the images PASSIVE-ly
Unaltered images can be downloaded as binary files with
no problem..
I now have over 3000 images I cannot download or view
on our website. What about rename caused this?
Thank you,
Bryan Henry
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
On Thu, 2004-02-26 at 20:18, Bryan Henry wrote:
> I realized that I did not trim the end line characters off of the file
> extensions
> after I grabbed all the file names from a text file. Now all the images
> have
> end of line chracters as part of the extension. I cannot access/edit the
> files
> through SHH, PHP or FTP...
You should be able to through a shell. Try using a shell script to
rename the files, here's something in bash script to get you started:
for x in `ls`; do
good_name=`echo -n ${x}|sed "s/\(.*\.[a-zA-Z]*\)/\1/"`;
mv ${x} ${good_name};
done
This will find any characters followed by a '.' and any upper or
lowercase letter. This should grab everything except for the newline at
the end and rename the file accordingly. Since I don't have any files
with newlines in their names I didn't test it so it may need a bit of
tweaking.
Regards,
Adam
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--- End Message ---
--- Begin Message ---
Hi,
Friday, February 27, 2004, 4:48:20 AM, you wrote:
SG> Hi,
SG> I don't know if it's a bug in php but if I do
SG> $fp=fopen("some_file","r");
SG> while (!feof($fp))
SG> {
SG> fscanf($fp, "%d %d",&$var1,&$var2);
SG> // some treatment
SG> }
SG> fclose($fp);
SG> and the file is big enough, php eat up memory like hot cakes.
SG> But if I do
SG> $fp=fopen("some_file","r");
SG> while (!feof($fp))
SG> {
SG> $line = fscanf($fp, "%d %d");
SG> list ($var1, $var2) = $line;
SG> // some treatment
SG> }
SG> fclose($fp);
SG> It work just fine. Seems a problem with fscanf.
SG> Has someone ever experienced this? Any advises?
SG> Oh btw I'm using php 4.3.4 with Apache 1.3.29
SG> Thanks in advance
SG> Sébastien Guay
SG> _________________________________________________________________
SG> MSN Search, le moteur de recherche qui pense comme vous !
SG> http://fr.ca.search.msn.com/
Thats not the way to use scanf, I think you are doing a scanf for each
line in the file. It should be something like:
while(fscanf($fp, "%d %d",&$var1,&$var2)){
//... do something with the values
}
--
regards,
Tom
--- End Message ---
--- Begin Message ---
Hi,
Just been getting some weird results from a query...can anybody tell me
why..?
Basically am sending 3 variables via a link on the page...
http://localhost/show_accounts.php?o=8927437717300145&n=shane&p=4.78
which runs the sql in show_accounts.php:
SELECT *,now()-0 from ".$tcname." where oorder='".$o."' and nname='".$n."'
and total='$p'
(globals is off and i am assigning the variables on top of the page. eg:
$o=$_GET['o'],)
my tables structure is:
oorder varchar(20) // varchar because I will have dashes and underscores in
it.
nname varchar 60
total float(6,2)
I have checked the database and I DO have a record that matches the SQL
above but it does not
return a result _unless_ the decimal spaces have two zeros in it,
eg:
4.00 works fine
1.00 works fine
77.00 works fine
4.77 does not work
1.42 does not work
etc
I have taken out the purchase amount and everythings running fine...but am
just curious as to what was
actually causing the problem...any ideas?
Cheers,
-Ryan
--- End Message ---
--- Begin Message ---
Ryan A wrote:
which runs the sql in show_accounts.php:
SELECT *,now()-0 from ".$tcname." where oorder='".$o."' and nname='".$n."'
and total='$p'
Try this:
which runs the sql in show_accounts.php:
SELECT *,now()-0 from ".$tcname." where oorder='".$o."' and
nname='".$n."' and total=$p
without the single quotes around $p
Erwin Kerk
Web Developer
--- End Message ---
--- Begin Message ---
&p=4.78
I wonder if a dot is a valid character for a URL adderss?
> Hi,
> Just been getting some weird results from a query...can anybody tell me
> why..?
>
> Basically am sending 3 variables via a link on the page...
> http://localhost/show_accounts.php?o=8927437717300145&n=shane&p=4.78
>
> which runs the sql in show_accounts.php:
> SELECT *,now()-0 from ".$tcname." where oorder='".$o."' and
> nname='".$n."' and total='$p'
>
> (globals is off and i am assigning the variables on top of the page. eg:
> $o=$_GET['o'],)
>
> my tables structure is:
> oorder varchar(20) // varchar because I will have dashes and underscores
> in it.
> nname varchar 60
> total float(6,2)
>
> I have checked the database and I DO have a record that matches the SQL
> above but it does not
> return a result _unless_ the decimal spaces have two zeros in it, eg:
> 4.00 works fine
> 1.00 works fine
> 77.00 works fine
> 4.77 does not work
> 1.42 does not work
> etc
>
> I have taken out the purchase amount and everythings running fine...but
> am just curious as to what was
> actually causing the problem...any ideas?
--- End Message ---
--- Begin Message ---
Daniel Clark wrote:
&p=4.78
I wonder if a dot is a valid character for a URL adderss?
Yup. Just tried it, it works.
Erwin Kerk
Web Developer
--- End Message ---
--- Begin Message ---
Hey everyone,
Thanks for your response,
I did try the query without the single quote, with double quotes but didnt
work.
I do think that a dot is valid in the URL coz it seems to be working if
there are 2 zeros in the
decimal part. I even tried running the SQL in PHPMyAdmin with same
results...
and I did try this:
total='".$p."'";
I wonder if "total" is a mysql reserved word or something....
Like I said before, i took that out and everythings running fine 'n
dandy...but am just curious as
to what was wrong...never know if it may come up again in future.
Cheers,
-Ryan
> Try this:
> which runs the sql in show_accounts.php:
> SELECT *,now()-0 from ".$tcname." where oorder='".$o."' and
> nname='".$n."' and total=$p
>
> without the single quotes around $p
>
>
> Erwin Kerk
> Web Developer
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[snip]
> I do think that a dot is valid in the URL coz it seems to be working if
> there are 2 zeros in the
> decimal part.
[/snip]
i think that means the dot DOESNT work hehe
because with 0's or not, a 4.00 is a 4, while 4.11 wouldnt be the same
thing without the dot and the things that follow...
try an url like this:
http://localhost/show_accounts.php?o=8927437717300145&n=shane&p=4%2E78
Ryan A wrote:
Hey everyone,
Thanks for your response,
I did try the query without the single quote, with double quotes but didnt
work.
I do think that a dot is valid in the URL coz it seems to be working if
there are 2 zeros in the
decimal part. I even tried running the SQL in PHPMyAdmin with same
results...
and I did try this:
total='".$p."'";
I wonder if "total" is a mysql reserved word or something....
Like I said before, i took that out and everythings running fine 'n
dandy...but am just curious as
to what was wrong...never know if it may come up again in future.
Cheers,
-Ryan
Try this:
which runs the sql in show_accounts.php:
SELECT *,now()-0 from ".$tcname." where oorder='".$o."' and
nname='".$n."' and total=$p
without the single quotes around $p
Erwin Kerk
Web Developer
- --
André Cerqueira
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAPtCAaxdA/5C8vH8RAvPpAJ9Ay6WK9BsYaUh/TJsaNt+d6YaLtACg1gGE
8Z39+7oB32MAg1fKw/3sla8=
=3/la
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Thanks everyone. I got GD2 to work quite well! The thumb look pretty good.
~WILL~
Ed Curtis wrote:
Make sure you use imagecreatetruecolor() with GD when resizing images or
you'll get some undesirable results. Imagemagick's convert and mogrify
worked well for me although I was resizing an uploaded image.
Ed Curtis
On Thu, 26 Feb 2004, Will wrote:
Thanks!! I found some documentation on the GD library.
I most likely be posting again!! :)
~WILL~
[EMAIL PROTECTED] wrote:
gd seems to work fine ? even nconvert via command line does a good job and
it resizes gif too
I'll second that one, I wrote a shell script in PHP to resize images,
using ImageMagicks mogrify
command, and it took ages. It's really much too slow for a web site.
If you need a faster solution, I think you have to buy something.
On 26 Feb 2004, at 09:15, Adam Bregenzer wrote:
On Thu, 2004-02-26 at 02:25, Will wrote:
I forgot to mention what I was trying to do.
There is a web page that pulls the image file name from the database
then reads the URL to the directory where the image is. Is it
possible
to just resize it when the web page is brought up in the browser?
I use ImageMagick's[1] convert[2] to do this. It is not a PHP module
and must be run through exec[3]. Also, in my experience image
manipulation is rather time consuming, it is a good idea to cache
altered images so they do not have to be recreated on every page load.
[1] http://www.imagemagick.org/
[2] http://www.imagemagick.org/www/convert.html
[3] http://www.php.net/exec
--
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
At 08:17 PM 2/26/2004, you wrote:
>Warning. I would NOT use Webalizer. This guy went commercial around 1999
>and it's well known that the free version (demo) contains code to
>call-home on every use. Beware.
Talk to me - what do you mean? I can't find any references on that, and
the fact that the project is distributed as source and licensed under the
GPL makes me think it wouldn't be in wide use if it were malware.
My mistake. AccessWatch (http://accesswatch.com/) is the log analyzer I was
speaking of. I always get the two mixed up. It used to be free but the guy
went commercial in the late 90s.
Jim
--
Jim Serio - [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
I am trying to upload a file to a server behind a firewall.
Notes
It works fine from inside the firewall.
I access the server and run the following
<?php
phpinfo();
?>
Bug when I run the following code. It works in from within the firewall.
But not from outside.
I have port forwarding turned on obviously. But is there anything else that
I need to do.
Any help would be much appreciated.
Thanks
Rick Laird
<?php if ($HTTP_POST_VARS['action']) { ?>
<!-- Code to process Uploaded File and Display -->
<!-- The HTML to display the results -->
?>
<BR><A HREF="<?php echo $PHP_SELF ?>">Back</A>
</FONT></P>
</BODY>
</HTML>
<?php } else { ?>
<HTML>
<HEAD>
<TITLE>File Upload</TITLE>
</HEAD>
<BODY BGCOLOR="WHITE" TEXT="BLACK">
<P><FONT FACE="Arial, Helvetica, sans-serif"><FONT SIZE="+1">File
Upload</FONT><BR><BR>
<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="<?php echo $PHP_SELF;?>">
<INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" VALUE="800000">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="1">
File 1: <INPUT TYPE="FILE" NAME="file1" SIZE="30"><BR><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM>
</FONT></P>
</BODY>
</HTML>
<?php } ?>
<?php if ($HTTP_POST_VARS['action']) { ?>
<HTML>
<HEAD>
<TITLE>File Upload Results</TITLE>
</HEAD>
<BODY BGCOLOR="WHITE" TEXT="BLACK">
<P><FONT FACE="Arial, Helvetica, sans-serif"><FONT SIZE="+1">File Upload
Results</FONT><BR><BR>
<?php
$uploadpath = '/files/';
$source = $HTTP_POST_FILES['file1']['tmp_name'];
$dest = $uploadpath.$HTTP_POST_FILES['file1']['name'];
if ( move_uploaded_file( $source, $dest ) ) {
echo 'File successfully stored.<BR>';
} else {
echo 'File could not be stored.<BR>';
}
?>
<BR><A HREF="<?php echo $PHP_SELF ?>">Back</A>
</FONT></P>
</BODY>
</HTML>
<?php } else { ?>
<!-- File Upload Form HTML Code Here -->
<?php } ?>
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
i dont know if that can be fixed using php, it looks like a firewall
setup problem?
which port is apache running?
i got confused with your ponctuation and explanations, maybe some
rephrasing and more details, like error message, could help
Rick Laird wrote:
I am trying to upload a file to a server behind a firewall.
Notes
It works fine from inside the firewall.
I access the server and run the following
<?php
phpinfo();
?>
Bug when I run the following code. It works in from within the firewall.
But not from outside.
I have port forwarding turned on obviously. But is there anything else that
I need to do.
Any help would be much appreciated.
Thanks
Rick Laird
<?php if ($HTTP_POST_VARS['action']) { ?>
<!-- Code to process Uploaded File and Display -->
<!-- The HTML to display the results -->
?>
<BR><A HREF="<?php echo $PHP_SELF ?>">Back</A>
</FONT></P>
</BODY>
</HTML>
<?php } else { ?>
<HTML>
<HEAD>
<TITLE>File Upload</TITLE>
</HEAD>
<BODY BGCOLOR="WHITE" TEXT="BLACK">
<P><FONT FACE="Arial, Helvetica, sans-serif"><FONT SIZE="+1">File
Upload</FONT><BR><BR>
<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="<?php echo $PHP_SELF;?>">
<INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" VALUE="800000">
<INPUT TYPE="HIDDEN" NAME="action" VALUE="1">
File 1: <INPUT TYPE="FILE" NAME="file1" SIZE="30"><BR><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM>
</FONT></P>
</BODY>
</HTML>
<?php } ?>
<?php if ($HTTP_POST_VARS['action']) { ?>
<HTML>
<HEAD>
<TITLE>File Upload Results</TITLE>
</HEAD>
<BODY BGCOLOR="WHITE" TEXT="BLACK">
<P><FONT FACE="Arial, Helvetica, sans-serif"><FONT SIZE="+1">File Upload
Results</FONT><BR><BR>
<?php
$uploadpath = '/files/';
$source = $HTTP_POST_FILES['file1']['tmp_name'];
$dest = $uploadpath.$HTTP_POST_FILES['file1']['name'];
if ( move_uploaded_file( $source, $dest ) ) {
echo 'File successfully stored.<BR>';
} else {
echo 'File could not be stored.<BR>';
}
?>
<BR><A HREF="<?php echo $PHP_SELF ?>">Back</A>
</FONT></P>
</BODY>
</HTML>
<?php } else { ?>
<!-- File Upload Form HTML Code Here -->
<?php } ?>
- --
André Cerqueira
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAPtRhaxdA/5C8vH8RAiIjAJ9wtAfZ9UV0FcabcfXv7z6qZxQIiwCg1DGR
H3D5zq0s/2XSFIJSDiBKLKA=
=4OMG
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
actually i thought you said your scripts were running in a remote host
which you cant change php.ini
and assuming that, i said that most servers setup php in safe mode
i believe php.ini is the same for php as module and cgi-bin
dont know if that helps, but if safe-mode was default for cgi-bin, it
would be for module too
safe mode being default or could depend on the distribution... all i got
had php.ini-dist and php.ini-recommened, none had safe mode on
hope it helps
Chris wrote:
> I am aware of safe mode but, are you saying that when PHP is
installed as a
> CGI binary safe mode is on by default?
> Chris
>
> "André cerqueira" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>
http://www.php.net/set_time_limit
[snip]
> Warning
> set_time_limit() has NO EFFECT when PHP is running in safe mode. There
> is NO workaround other than turning off safe mode or changing the time
> limit in the php.ini.
[/snip]
most servers do that
Chris wrote:
I've run into situation where my PHP script, (which loads records into a
database) gets timed out after 30 seconds, terminating the script
execution.
I understand that PHP, on my hosting system, is installed as a CGI
binary.
I've even included set_time_limit which seems to have no effect. Is is
possible that the timeout is being caused by a cgi script execution
limit?
Or may something else be afoot?
Chris
- --
André Cerqueira
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAPs0+axdA/5C8vH8RAqpeAJ4phC8gykyhYIvjwlazAPvvvq/zmwCfRHG2
8Y2dB0pnyUCn3EmUvzKCs/4=
=1H3c
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Dear my friends...
I have my code like this :
======
<?php
echo "
<html>
<script language='JavaScript'>
function tes(){
document.write('<p>JavaScript</p>');
window.location.replace('http://192.168.23.1/coba/coba.php?vtes=$vtes');
}
</script>
<body>
";
echo "diforward ke javascript";
echo "
<select onchange='tes()' name='vtes'>
<option value=''></option>
<option value='1'>1</option>
<option value='2'>2</option>
</select>
";
?>
</body>
</html>
======
I expect this result on url column of my internet browser:
"
http://192.168.23.1/coba/coba.php?vtes='1'
"
or
"
http://192.168.23.1/coba/coba.php?vtes='1'
"
But I only get this unexpected result:
"
http://192.168.23.1/coba/coba.php?vtes=
"
Lookslike the value of "$vtes" was not passed to JavaScript
interpreter.
Anybody of you have a solution for me?
Please teach me.
Thank you very much.
--
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
>From your mailbox to local or overseas cell phones.
Powered by Outblaze
--- End Message ---