php-general Digest 29 Jun 2006 14:28:04 -0000 Issue 4212

Topics (messages 238885 through 238918):

Re: Programming question - New to PHP
        238885 by: Chris
        238901 by: Dave Goodchild
        238910 by: Jeremy Schreckhise

Re: running system()
        238886 by: Chris

Re: cool your jets [WAS: Re: [PHP] working on a template system...]
        238887 by: Micky Hulse

Re: Calculations and exponents in languages
        238888 by: John Gunther

Re: modify xml before parse
        238889 by: Yeo Wee Tat
        238890 by: Chris
        238891 by: Yeo Wee Tat

How should we use PHPunit2
        238892 by: suma parakala
        238893 by: Chris

pdf
        238894 by: Yeo Wee Tat
        238895 by: Jyry Kuukkanen
        238896 by: Paul Novitski
        238900 by: João Cândido de Souza Neto
        238908 by: Kim Steinhaug

FTP - moving/copying files
        238897 by: James Nunnerley
        238903 by: Jochem Maas

Re: Multiple "if()" statements
        238898 by: Ford, Mike
        238906 by: tedd

running number in paging
        238899 by: Yeo Wee Tat

image upload problem
        238902 by: suresh kumar
        238904 by: Jay Blanchard
        238905 by: João Cândido de Souza Neto

[NEWBIE] PHP General List Guide & Other Good Stuff
        238907 by: Jay Blanchard

Documentation software
        238909 by: Mathieu Dumoulin

Update site through email
        238911 by: Rodrigo de Oliveira Costa
        238912 by: Jim Moseby
        238914 by: KermodeBear
        238915 by: John Nichel
        238916 by: John Nichel
        238917 by: Mathieu Dumoulin
        238918 by: Dan McCullough

creating a threaded message system--sorting messages
        238913 by: Ben Liu

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Russbucket wrote:
I took an example of a script from the PHP documentation and try to connect to my database. If I leave in the or die part of line 3, I get nothing, if I comment out that part I get the echo message on line 4.
<?php
// Connecting and selecting the database
$conn = mysql_connect ('localhost', 'finemanruss', 'XXXXXXXl') or die ('Could not connect : ' . mysql_error());
echo 'Connected successfully';
mysql_select_db ("Lions", $conn);

// Preform SQL query
$query = 'SELECT * FROM Moses_Lake_Lions';
$result = mysql_query ($query) or die ( 'Query failed;   '  . mysql_error());
?>

I know line three works without the or die part since I have a 2nd script that is almost the same (no or die) and it retrieves info from my DB.

Try it the same as the php manual page:

$conn = mysql_connect('....');
if (!$conn) {
  die("Could not connect: " . mysql_error());
}

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
On 29/06/06, Chris <[EMAIL PROTECTED]> wrote:

Russbucket wrote:
> I took an example  of a script from the PHP documentation and try to
connect
> to my database.   If I leave in the or die part of line 3, I get
nothing, if
> I comment out that part I get the echo message on line 4.
>
> <?php
> // Connecting and selecting the database
> $conn = mysql_connect ('localhost', 'finemanruss', 'XXXXXXXl') or die
('Could
> not connect :  '  . mysql_error());
> echo 'Connected successfully';
> mysql_select_db ("Lions", $conn);
>
> // Preform SQL query
> $query = 'SELECT * FROM Moses_Lake_Lions';
> $result = mysql_query ($query) or die ( 'Query failed;   '  .
mysql_error());
> ?>
>
> I know line three works without the or die part since I have a 2nd
script that
> is almost the same (no or die) and it retrieves info from my DB.

Try it the same as the php manual page:

$conn = mysql_connect('....');
if (!$conn) {
   die("Could not connect: " . mysql_error());
}

You may be logging the errors. Tty echoing the value of the resource
($conn) - it should be an integer.




--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

--- End Message ---
--- Begin Message ---
Try
        $link = mysql_connect('localhost',$youruser,$yourpassword) or die();
        mysql_select_db('yourdb'); 

        $query = 'SELECT * FROM Moses_Lake_Lions';
        if(!$result = mysql_query ($query,$link))
        {
                // do error checking here
        }

Jeremy Schreckhise, M.B.A.      

-----Original Message-----
From: Russbucket [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 28, 2006 6:58 PM
To: PHP General
Subject: [PHP] Programming question - New to PHP

I took an example  of a script from the PHP documentation and try to connect

to my database.   If I leave in the or die part of line 3, I get nothing, if

I comment out that part I get the echo message on line 4. 

<?php
// Connecting and selecting the database $conn = mysql_connect ('localhost',
'finemanruss', 'XXXXXXXl') or die ('Could not connect :  '  .
mysql_error()); echo 'Connected successfully'; mysql_select_db ("Lions",
$conn);

// Preform SQL query
$query = 'SELECT * FROM Moses_Lake_Lions';
$result = mysql_query ($query) or die ( 'Query failed;   '  .
mysql_error());
?>

I know line three works without the or die part since I have a 2nd script
that is almost the same (no or die) and it retrieves info from my DB.

Can anyone point me to some tips or solutions to the or die problem? This
script is located in the mysql ref section of the php manual. I'm using php5
on SUSE Linux 10.0 with a mysql database.

Thanks in advance.
--
Russ

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

--- End Message ---
--- Begin Message ---
Mark Steudel wrote:
So I'm trying to run some system commands on the windows box I am working
on. And I am getting "Unable to fork" errors. So after some googling I see
that its because the internet guest user needs access to cmd.exe, my
question is how safe is it to enable this on a production/shared
environment? Anyways pointers to securely setting this up?

If it's enabled, it's enabled for everyone.

If you're calling system, make sure you use escapeshellarg and escapeshellcmd in the relevant places.

That's not going to protect you from other peoples bad code though..

What are you trying to use system() for? Maybe there's a built in function or another way to do what you need.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Lol! Omg, you guys make reading my email so much more fun!

Cheers!
Micky

--- End Message ---
--- Begin Message ---
Algol used ^

More common, historically, is the use of ** as the exponentiation operator: Fortran, PL/I, perl, python

Curiously, many modern languages -- inexplicably -- don't have an exponentiation operator: C, Java, Javascript, PHP

John Gunther


Robin Vickery wrote:
On 28/06/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:

Huh.. thanks for the illustration Robin. Can't say that I did much with exponents when I've played around with perl or python or C.. and never worked with Java. You've expanded my view.

Ok, now what languages DO use ^ for exponents?


The only one I can think of off the top of my head is BASIC.

Even Bash uses ^ as an xor operator:

  $ echo $(( 7 ^ 2 ))
  5
  $ echo $(( 7 ** 2 ))
  49

-robin

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

  I can modify the xml file without any error , however when I tried to
unserializer the xml file using PEAR:XML , it gave the error message below.
I have attached my code for your perusal. 

Any ideas ? thanks 

<?php
ini_set('display_errors', E_ALL);
require_once '../library/config.php';
require_once '../library/class.XMLUtil.php';

$xmlfile = "/home/gvintranet/datacraft/htdocs/uploads/cisco.xml";

$xml = preg_replace("/<!\\[CDATA\\[.+?\\]\\]>/", "<![CDATA[ignore_this]]>",
$xml);
$filehandle = fopen($xmlfile, 'wb');
$ok = fwrite($filehandle,$xml);
echo "ok".$ok;

$options = array("complexType" => "object");
$xml_util = new XMLUtil($xmlfile, $options);
$xml_util->unserializer_XML(true);
$data = $xml_util->getUnserializedData();
echo print_r($data);

?>

error message:

pear_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024
[code] => 151 [message] => No unserialized data available. Use
XML_Unserializer::unserialize() first. [userinfo] => [backtrace] => Array (
[0] => Array ( [file] => /usr/share/pear/PEAR.php [line] => 566 [function]
=> pear_error [class] => pear_error [type] => -> [args] => Array ( [0] => No
unserialized data available. Use XML_Unserializer::unserialize() first. [1]
=> 151 [2] => 1 [3] => 1024 [4] => ) ) [1] => Array ( [file] =>
/usr/share/pear/XML/Unserializer.php [line] => 489 [function] => raiseerror
[class] => xml_unserializer [type] => -> [args] => Array ( [0] => No
unserialized data available. Use XML_Unserializer::unserialize() first. [1]
=> 151 ) ) [2] => Array ( [file] =>
/home/gvintranet/datacraft/htdocs/library/class.XMLUtil.php [line] => 54
[function] => getunserializeddata [class] => xml_unserializer [type] => ->
[args] => Array ( ) ) [3] => Array ( [file] =>
/home/gvintranet/datacraft/htdocs/admin/test_regex.php [line] => 43
[function] => getunserializeddata [class] => xmlutil [type] => -> [args] =>
Array ( ) ) ) [callback] => ) 1

Yeo Wee Tat 
Tel: +65-62730049   Fax: +65-62734934
Cxrus Solutions Pte Ltd (Singapore . Thailand)
1003 Bukit Merah Central #05-20 Singapore 159836
System Integration . Business Solutions . Linux Simplified
-----Original Message-----
From: Adam Zey [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 28, 2006 11:11 PM
To: weetat
Cc: php-general@lists.php.net
Subject: Re: modify xml before parse

weetat wrote:
> Hi Adam,
>
>  Thank for your input.
>  However search and replace the value such as 
> <![CDATA[ù?¸€ü÷Œú"<ù?àù?؀Z4À„Ï]]> to empty string ? Try the 
> code below , no  successful.
>
> $xmlfile = "/home/gvintranet/datacraft/htdocs/properties/test_cdata.xml";
>
> $xml = file_get_contents($xmlfile);
>
> $xml =
>
preg_replace('/<HardwareVersion>[^(\\/HardwareVersion)]<\\/HardwareVersion>/
', 
>
> '<HardwareVersion><\/HardwareVersion>', $xml);
>
> fwrite(fopen($xmlfile, 'wb'), $xml);
>
> Thanks
> - weetat
>
> Adam Zey wrote:
>> weetat wrote:
>>> Hi all,
>>>
>>>   I need to read xml file before it was parsed by PHP DOM functions.
>>>   The xml file have some encrypted value as shown below :
>>>
>>>     
>>> <InstanceName><![CDATA[ù?¸€ü÷Œú"<ù?àù?؀Z4À„Ï]]></InstanceName>
>>>
>>>   Anybody have any suggestion how to do it ?
>>>
>>> Thanks.
>>>
>>> - weetat
>>
>> $xmlfile = file_get_contents("http://urloffile.com/filename.xml";);
>>
>> I mean, that is what you asked, how to read the xml file...
>>
>> Regards, Adam Zey.
>
>
Why not:

$xml = preg_replace("/<!\\[CDATA\\[.+?\\]\\]>/", "", $xml);

(Keep in mind I wrote that regex for RegexCoach and then tried to 
translate it to PHP, might be some mistakes)

Regards, Adam.




-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.5/377 - Release Date: 6/27/2006

--- End Message ---
--- Begin Message ---
Yeo Wee Tat wrote:
Hi Adam,

  I can modify the xml file without any error , however when I tried to
unserializer the xml file using PEAR:XML , it gave the error message below.

Ask the pear list.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Thanks found the problem.



Yeo Wee Tat 
Tel: +65-62730049   Fax: +65-62734934
Cxrus Solutions Pte Ltd (Singapore . Thailand)
1003 Bukit Merah Central #05-20 Singapore 159836
System Integration . Business Solutions . Linux Simplified

-----Original Message-----
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 29, 2006 12:12 PM
To: Yeo Wee Tat
Cc: php-general@lists.php.net
Subject: Re: [PHP] RE: modify xml before parse

Yeo Wee Tat wrote:
> Hi Adam,
> 
>   I can modify the xml file without any error , however when I tried to
> unserializer the xml file using PEAR:XML , it gave the error message
below.

Ask the pear list.

-- 
Postgresql & php tutorials
http://www.designmagick.com/




-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.9.6/378 - Release Date: 6/28/2006

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

Can anyone please tell me one simple tutorial to learn phpunit2.

I have down loaded phpunit2 . There are many things in that. I am new to testing and oo.

Kindly tell me one simple tutorial

Thanks
Suma

_________________________________________________________________
Sexy, sultry, sensuous. - see why Bipasha Basu is all that and more. Try MSN Search http://server1.msn.co.in/Profile/bipashabasu.asp
--- End Message ---
--- Begin Message ---
suma parakala wrote:
Hi

Can anyone please tell me one simple tutorial to learn phpunit2.

I have down loaded phpunit2 . There are many things in that. I am new to testing and oo.

Do you know how to use a search engine?

http://www.phpunit.de/wiki/Presentations

--
Postgresql & php tutorials
http://www.designmagick.com/

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

 I am using PHP 4.3.2 and MYSQL database.

 I need to convert the sql query to Adobe PDF format.
 Any one have any suggestion how to do this?

I have search phpclasses , found SQL2PdfReport classes , however it gave error message as shown below :

  "Error in opening pdf ...."

Lookup the code in the SQL2Report class , it did not support pdf 7.0 and above.

Thanks

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


On Thu, 29 Jun 2006, weetat wrote:

> Hi all ,
> 
>   I am using PHP 4.3.2 and MYSQL database.
> 
>   I need to convert the sql query to Adobe PDF format.
>   Any one have any suggestion how to do this?


I have used fpdf (http://www.fpdf.org/) in order to create PDF documents 
with PHP and it has worked fine for me.


Cheers,
--jq




>   I have search phpclasses , found SQL2PdfReport classes , however it 
> gave error message as shown below :
> 
>    "Error in opening pdf ...."
> 
> Lookup the code in the SQL2Report class , it did not support pdf 7.0 and 
> above.
> 
> Thanks
> 
> 

-- 
Hienoja terveisiä
--Jyry
C|:-(    C|:-/    C|========8-O    C|8-/    C|:-(

--- End Message ---
--- Begin Message ---
At 11:50 PM 6/28/2006, weetat wrote:
 I am using PHP 4.3.2 and MYSQL database.

 I need to convert the sql query to Adobe PDF format.
 Any one have any suggestion how to do this?


I'm enjoying using the PHP class FPDF http://www.fpdf.org/

It's not a one-step conversion utility, it's a PHP class you invoke from your code to build the PDF document incrementally. If you've got a clear idea of how you want the query results rendered, FPDF can make it nearly as easy to output to PDF as to HTML.

Paul
--- End Message ---
--- Begin Message ---
How can i see, everyon here use that class.

I use it too. It always worked fine to me.

"weetat" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> Hi all ,
>
>  I am using PHP 4.3.2 and MYSQL database.
>
>  I need to convert the sql query to Adobe PDF format.
>  Any one have any suggestion how to do this?
>
>  I have search phpclasses , found SQL2PdfReport classes , however it gave 
> error message as shown below :
>
>   "Error in opening pdf ...."
>
> Lookup the code in the SQL2Report class , it did not support pdf 7.0 and 
> above.
>
> Thanks 

--- End Message ---
--- Begin Message ---
> Hi all ,
> 
>   I am using PHP 4.3.2 and MYSQL database.
> 
>   I need to convert the sql query to Adobe PDF format.
>   Any one have any suggestion how to do this?
> 
>   I have search phpclasses , found SQL2PdfReport classes , however it 
> gave error message as shown below :
> 
>    "Error in opening pdf ...."
> 
> Lookup the code in the SQL2Report class , it did not support pdf 7.0 and 
> above.
> 
> Thanks
> 

I would recommend you looking into pdflib, this is a professional package
which supports all versions of PDF, and really whatever you need. The other
class people mentions are free, but far from as advanced as pdflib.

Grab it here : http://www.pdflib.com/

regards,
Kim Steinhaug
http://www.steinhaug.no/

--- End Message ---
--- Begin Message ---
I'm setting up an ftp manager which allows a user to connect to their space
on an external server.

 

All the php-ftp functions work fine - after I'd realized how to use the
passive functionality - see previous email to list!

 

I've also got working the download and upload functionality, which is quite
nice, but annoying - it doesn't allow you to download the file without
creating a temporary version (whereas if it were a local copy you'd be able
to copy it to a variable, then echo it out...

 

Finally, what I now need to do it be able to move/copy files within the FTP
space.  The standard FTP commands (mv & cp or copy) are not featured in
php-ftp functions.  Does anyone have any suggestions bar copying the whole
lot to a local drive then upload in the new space?

 

Cheers

Nunners


--- End Message ---
--- Begin Message ---
James Nunnerley wrote:
> I'm setting up an ftp manager which allows a user to connect to their space
> on an external server.
> 
>  
> 
> All the php-ftp functions work fine - after I'd realized how to use the
> passive functionality - see previous email to list!
> 
>  
> 
> I've also got working the download and upload functionality, which is quite
> nice, but annoying - it doesn't allow you to download the file without
> creating a temporary version (whereas if it were a local copy you'd be able
> to copy it to a variable, then echo it out...
> 
>  
> 
> Finally, what I now need to do it be able to move/copy files within the FTP
> space.  The standard FTP commands (mv & cp or copy) are not featured in
> php-ftp functions.  Does anyone have any suggestions bar copying the whole
> lot to a local drive then upload in the new space?

what about: http://php.net/manual/en/function.ftp-rename.php ?

> 
>  
> 
> Cheers
> 
> Nunners
> 
> 

--- End Message ---
--- Begin Message ---
On 29 June 2006 01:03, David Tulloh wrote:


> I'm also going to throw in an elseif for fun, to get this (hopefully)
> improved version: 
> 
> if($row[1] == "none") {
>    print("<tr>");
>    print("<td>$row[0] $row[2]</td>");
>    print("</tr>");
> } elseif($row[1] == $row[2]) {
>    print("<tr>");
>    print("<td>$row[0] $row[2]</td>");
>    print("</tr>");
> } else {
>    print("<tr>");
>    print("<td>$row[0] ($row[1]) $row[2]</td>");
>    print("</tr>");
> }

This still seems overly complex to me -- there are 3 identical occurrences of 
some items.

When constructing an if() sequence, I think it's always important to isolate 
the parts that genuinely differ, so my effort would go like this:

    echo "<tr>";
    echo "<td>$row[0] ";
    if ($row[1] != "none" && $row[1] != $row[2]) {
       echo "($row[1]) ";
    }
    echo "$row[2]</td>";
    echo "</tr>";


Cheers!

Mike

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


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---
--- Begin Message ---
At 8:15 PM -0400 6/28/06, Robert Cummings wrote:
>On Wed, 2006-06-28 at 20:02, David Tulloh wrote:
>> Grae Wolfe - PHP wrote:
>> > ...
> > > want.  Any help would be great!


-snip- if/elseif -snip-


<holy war id="opinion">

Whenever you need a elseif, then it's time to consider a switch -- like thus:

print( "<tr>" );

switch $row[1]
        {
        case: "none";
        print( "<td>$row[0] $row[2]</td>" );
        break;

        case: $row[2];
        print( "<td>$row[0] $row[2]</td>" );
        break;

        default:
        print( "<td>$row[0] ($row[1]) $row[2]</td>" );
        break;
        }

print( "</tr>" );

<humor id="mine">

 /* Please note the humor tags, smiley and apology beforehand.
No offense meant to anyone -- insert  apology where needed -- and appropriate.
Your mileage may vary, Take only as prescribed by doctor's advice. No hablo 
inglés */

To me, the switch statement is so much simpler -- what's with you guys and 
these long-ass and confusing if/elseif structures?  :-)

</humor id="mine">

</holy war id="opinion">

tedd <limping off to his bear cave awaiting fallout/>.

--
------------------------------------------------------------------------------------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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

 I have using PEAR:Pager , to do paging .
 Everthing are ok . Except the running no will always start from 1 to 10 .
Anyway to increase the running number when user click next page for example Page 1 : 1 to 10,
        Page 2 : 11 to 20, and so on

Thanks

below is the code , the running number is the variable k.

<?php

while (list($name, $value) = each($chassisresult)) {
    $model = $value['chasis_model'];
    $serialno = $value['serial_no'];
    $hostname = $value['host_name'];
    $country = $value['country'];
    $city = $value['city'];
    $building = $value['building'];
    $other = $value['other'];
    $chasis_user_field_1 = $value['chasis_user_field_1'];
    $chasis_user_field_2 = $value['chasis_user_field_2'];
    $chasis_user_field_3 = $value['chasis_user_field_3'];
    $status = $value['status'];
    $chasiseos = $value['chasis_eos'];
    $chasiseol = $value['chasis_eol'];

    $countrynamestr = $serialno . "country[]";
    $citynamestr = $serialno . "city[]";
    $buildingnamestr = $serialno . "building[]";
    $othernamestr = $serialno . "other[]";
    $hostnamestr = $serialno . "hostname[]";
    $modelnamestr = $serialno . "model[]";
    $userfield1name = $serialno . "userfield1[]";
    $userfield2name = $serialno . "userfield2[]";
    $userfield3name = $serialno . "userfield3[]";
    $statusname = $serialno . "status[]";
    $eosname = $serialno . "eos[]";
    $eolname = $serialno . "eol[]";
    $checkboxname = "selected[]";

    ?>
                            <tr>
<td align="center" class="std1"><input name="<?php echo $checkboxname?>" type="checkbox" value="<?php echo $i ?>"></td> <td align="center" class="std1"><?php echo $k += 1 ?><input name="<?php echo $countrynamestr?>" type="hidden" value="<?php echo $country ?>"></td> <td class="std2"><?php echo $country == '' ? '&nbsp;' : $country ?><input name="<?php echo $citynamestr?>" type="hidden" value="<?php echo $city ?>"></td> <td class="std2" ><?php echo $city == '' ? '&nbsp;' : $city ?><input name="<?php echo $buildingnamestr?>" type="hidden" value="<?php echo $building ?>"></td> <td class="std2"><?php echo $building == '' ? '&nbsp;' : $building ?><input name="<?php echo $othernamestr?>" type="hidden" value="<?php echo $other ?>"></td>
                                <td class="std2"><?php echo $other == '' ? '&nbsp;' : 
$other ?></td>
<td class="std2"><?php echo $hostname == '' ? '&nbsp;' : $hostname ?><input name="<?php echo $hostnamestr?>" type="hidden" value="<?php echo $hostname ?>"></td> <td class="std2" ><?php echo $model == '' ? '&nbsp;' : $model ?><input name="<?php echo $modelnamestr?>" type="hidden" value="<?php echo $model ?>"></td> <td class="std2"><?php echo $serialno ?><input name="Serialno[]" type="hidden" value="<?php echo $serialno ?>"></td>
                                <td class="std2">&nbsp;</td>
                                <td class="std2">&nbsp;</td>
                                <td class="std2">&nbsp;</td>
<td class="std2"><?php echo $chasiseos == '' ? '&nbsp;' : dateconvert($chasiseos,2) ?><input name="<?php echo $eosname?>" type="hidden" value="<?php echo $chasiseos ?>"></td> <td class="std2"><?php echo $chasiseol == '' ? '&nbsp;' : dateconvert($chasiseol,2) ?><input name="<?php echo $eolname?>" type="hidden" value="<?php echo $chasiseol ?>"></td> <td class="std2"><?php echo $chasis_user_field_1 == '' ? '&nbsp;' : $chasis_user_field_1 ?><input name="<?php echo $userfield1name?>" type="hidden" value="<?php echo $chasis_user_field_1 ?>"></td> <td class="std2" ><?php echo $chasis_user_field_2 == '' ? '&nbsp;' : $chasis_user_field_2 ?><input name="<?php echo $userfield2name?>" type="hidden" value="<?php echo $chasis_user_field_2 ?>"></td> <td class="std2" ><?php echo $chasis_user_field_3 == '' ? '&nbsp;' : $chasis_user_field_3 ?><input name="<?php echo $userfield3name?>" type="hidden" value="<?php echo $chasis_user_field_3 ?>"></td> <input name="<?php echo $statusname?>" type="hidden" value="<?php echo $status ?>">
                                </tr>
               <?php
    $i += 1;
}

?>

--- End Message ---
--- Begin Message ---
Hi,
     This is the code i am using for image upload.
  if ($_FILES['ufile']['name'] != NULL)
 {
        
  $FlName= $_FILES['ufile']['name'];
  if(!is_uploaded_file($_FILES['ufile']['tmp_name'])){
    
             print "<Script type=\"text/javascript\">
    alert(\"Error! The expected file wasn't loaded\");
       
    </script>";
            
            exit();
  }
  
  $uploadfile = $_FILES['ufile']['tmp_name'];
  $uploadname = $_FILES['ufile']['name'];
  $uploadtype = $_FILES['ufile']['type'];
  $tempfile = fopen($uploadfile, 'rb');
  
  $filedata = addslashes(fread($tempfile,filesize($uploadfile)));
 $UpdateAdQuery = "update ". $thisAdTableName." set
   LocalImageName='" . $PostLocalCopy . "',
            ImageData='" . $filedata . "',
            ImageName='" . time() . "_".$uploadname ."',
            mimetype ='" . $uploadtype . "'
        where ID=" . $mID ;
  $ok = @mysql_query($UpdateAdQuery);
  }
   
  The Code is running properly.But I dont Know Where The uploaded image is 
Stored in the server.I checked "/tmp" directory,but image is  not there,is 
there any function where i can specify the location of the server where my 
image is to be stored i also tired move_uploaded_image() function .but its not 
working .I am waiting reply from any one

                                
---------------------------------
 Yahoo! India Answers: Share what you know. Learn something new Click here
Catch all the FIFA World Cup 2006 action on Yahoo! India Click here

--- End Message ---
--- Begin Message ---
[snip]
  The Code is running properly.But I dont Know Where The uploaded image
is Stored in the server.I checked "/tmp" directory,but image is  not
there,is there any function where i can specify the location of the
server where my image is to be stored i also tired move_uploaded_image()
function .but its not working .I am waiting reply from any one
[/snip]

http://www.php.net/move_uploaded_file

--- End Message ---
--- Begin Message ---
Please, check that: 
http://br.php.net/manual/pt_BR/function.move-uploaded-file.php

"suresh kumar" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> Hi,
>     This is the code i am using for image upload.
>  if ($_FILES['ufile']['name'] != NULL)
> {
>
>  $FlName= $_FILES['ufile']['name'];
>  if(!is_uploaded_file($_FILES['ufile']['tmp_name'])){
>
>             print "<Script type=\"text/javascript\">
>    alert(\"Error! The expected file wasn't loaded\");
>
>    </script>";
>
>            exit();
>  }
>
>  $uploadfile = $_FILES['ufile']['tmp_name'];
>  $uploadname = $_FILES['ufile']['name'];
>  $uploadtype = $_FILES['ufile']['type'];
>  $tempfile = fopen($uploadfile, 'rb');
>
>  $filedata = addslashes(fread($tempfile,filesize($uploadfile)));
> $UpdateAdQuery = "update ". $thisAdTableName." set
>   LocalImageName='" . $PostLocalCopy . "',
>            ImageData='" . $filedata . "',
>            ImageName='" . time() . "_".$uploadname ."',
>            mimetype ='" . $uploadtype . "'
>        where ID=" . $mID ;
>  $ok = @mysql_query($UpdateAdQuery);
>  }
>
>  The Code is running properly.But I dont Know Where The uploaded image is 
> Stored in the server.I checked "/tmp" directory,but image is  not there,is 
> there any function where i can specify the location of the server where my 
> image is to be stored i also tired move_uploaded_image() function .but its 
> not working .I am waiting reply from any one
>
>
> ---------------------------------
> Yahoo! India Answers: Share what you know. Learn something new Click here
> Catch all the FIFA World Cup 2006 action on Yahoo! India Click here 

--- End Message ---
--- Begin Message ---
Recommended reading....

http://zirzow.dyndns.org/php-general/NEWBIE
http://phpsec.org/
http://www.php.net/manual/en/security.php

--- End Message ---
--- Begin Message --- This is not a php specific question but more a programming question. I'd like to know names of software that help in creating documentation like the microsoft style of documentation when you visit the MSDN library. I can also see that often one some sites like the VBCORLIB web site.

I'm sure there is something out there, i'd like mostly a web based one and open source or free obviously...

Waiting for your input, thanks

--- End Message ---
--- Begin Message ---
Hy guys I'd like to know if there is a way to update a site through
sending an email. Something like this, you send an email and the body
of the email substitutes a text you use in your site. Igreat apreciate
any help since I couldn't find anything on this topic.

Thanks,
doRodrigo

--- End Message ---
--- Begin Message ---
> 
> Hy guys I'd like to know if there is a way to update a site through
> sending an email. Something like this, you send an email and the body
> of the email substitutes a text you use in your site. Igreat apreciate
> any help since I couldn't find anything on this topic.

How much time did you spend looking?  A good place to start might be:
http://us2.php.net/manual/en/ref.imap.php

Where there's a will, theres a way.  I imagine it would be fairly easy to
do.

JM

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

At my last job there were several companies that would send us text invoices
by email. These email accounts were on a Linux box, and when the mail would
come in the message was sent to scripts via STDIN. I'm not sure HOW it was
done but I know that it CAN be done.

I would be concerned about security in this case. The From: header can be
spoofed, as can any other header, so before you do this make sure you have
some kind of authentication scheme. Wouldn't want some lamer finding the
email address and spamming it with v14gr4 email.

-K.Bear

> Hy guys I'd like to know if there is a way to update a site through
> sending an email. Something like this, you send an email and the body
> of the email substitutes a text you use in your site. Igreat apreciate
> any help since I couldn't find anything on this topic.

> Thanks,
> doRodrigo

--- End Message ---
--- Begin Message ---
Jim Moseby wrote:
Hy guys I'd like to know if there is a way to update a site through
sending an email. Something like this, you send an email and the body
of the email substitutes a text you use in your site. Igreat apreciate
any help since I couldn't find anything on this topic.

How much time did you spend looking?  A good place to start might be:
http://us2.php.net/manual/en/ref.imap.php

Where there's a will, theres a way.  I imagine it would be fairly easy to
do.


And or knowing how your mail system works (even if you don't have imap set up). Take like qmail for instance; it's trivial to trigger a script when an email arrives:

.qmail-email_address (file)
---------------------------
|/your/path/here/script.php

And when you send an email to '[EMAIL PROTECTED]' it will inject the contents of that email into your script.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Nathanael Merrill wrote:
I will be on vacation from June 26th through July 17th. I will have limited access to email and will get back to you as soon as I
can. Thank you.

- nathanael merrill


You just made the list Nathanael.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message --- How i'd do it is not simple, i'm sure there is an easier method but here goes for mine.

First you have to setup an inbox that you can read, it can be POP3 or IMAP, as long as your PHP script can read it it's fine.

Second, create a script that can actually connect to that inbox and read for a new message periodically. You can use a CRONJOB or a Scheduled Task if it's available, else, you'll have to check the mailbox from time to time when your page launches from a web browser (Try not to do it all the time or your page will suffer from this process if it is launched all the time).

That script will have to read the emails in the inbox, finds the appropriate email and stores the content the way you want, database or file, your choice.

Then, your web page will have to read from that stored source of your choice and "echo" the content at it's right place.

As you can see, it CAN be done, it's just a strange way of doing it.

Furthermore i see problems to that. You can probably get very easily hacked using this method. Its easy to read the incoming data in the server, find the email address used to update the content and then send a mail yourself. There is nothing you can do to stop that except encrypt your email using SSL... But thats a bit hardcore and there are much simpler ways than using SSL encrypted email to update a page ;)

Math

Rodrigo de Oliveira Costa wrote:
Hy guys I'd like to know if there is a way to update a site through
sending an email. Something like this, you send an email and the body
of the email substitutes a text you use in your site. Igreat apreciate
any help since I couldn't find anything on this topic.

Thanks,
doRodrigo

--- End Message ---
--- Begin Message ---
There are several blog software packages and cms packages that do
something like this you might want to download and take a peek.

Wordpress one that comes to mind.

On 6/29/06, Mathieu Dumoulin <[EMAIL PROTECTED]> wrote:
How i'd do it is not simple, i'm sure there is an easier method but here
goes for mine.

First you have to setup an inbox that you can read, it can be POP3 or
IMAP, as long as your PHP script can read it it's fine.

Second, create a script that can actually connect to that inbox and read
for a new message periodically. You can use a CRONJOB or a Scheduled
Task if it's available, else, you'll have to check the mailbox from time
to time when your page launches from a web browser (Try not to do it all
the time or your page will suffer from this process if it is launched
all the time).

That script will have to read the emails in the inbox, finds the
appropriate email and stores the content the way you want, database or
file, your choice.

Then, your web page will have to read from that stored source of your
choice and "echo" the content at it's right place.

As you can see, it CAN be done, it's just a strange way of doing it.

Furthermore i see problems to that. You can probably get very easily
hacked using this method. Its easy to read the incoming data in the
server, find the email address used to update the content and then send
a mail yourself. There is nothing you can do to stop that except encrypt
your email using SSL... But thats a bit hardcore and there are much
simpler ways than using SSL encrypted email to update a page ;)

Math

Rodrigo de Oliveira Costa wrote:
> Hy guys I'd like to know if there is a way to update a site through
> sending an email. Something like this, you send an email and the body
> of the email substitutes a text you use in your site. Igreat apreciate
> any help since I couldn't find anything on this topic.
>
> Thanks,
> doRodrigo

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



--- End Message ---
--- Begin Message ---
This question might deviate from PHP into the domain of MySQL but I
thought best to post here first. I'm building a message board system
with PHP/MySQL. I'm trying to present the messages to the users in
threaded order rather than flat. I'm having a lot of trouble figuring
out how to sort the posts so they appear in the correct threaded
order. I don't think I can do this purely with a SQL query. If it can
be done this way, please suggest how and I'll take this question to
the MySQL list.

I think I have figured out the basic logic, I just have no idea how to
translate it into code. Also, I may have the logic wrong. Anyhow this
is what I have so far:

relevant data structure loosely:

post_id (unique, autoincrement, primary index)
parent_id (if the post is a child, this field contains the post_id of
its parent)
...
1) Query the database for all messages under a certain topic, sort by
parent_id then post_id

2) Somehow resort the data so that each group of children is directly
after their parent. Do this in order of ascending parent_id.

Can this be done with usort() and some programatic logic/algorithm?
How do you sort groups of items together rather than comparing each
array element to the next array element (ie: sorting one item at a
time)? Should this be done with a recursive algorithm?

Anyone with experience writing code for this type of message board, or
implementing existing code? Thanks for any help in advance.

- Ben

--- End Message ---

Reply via email to