php-general Digest 10 Apr 2007 12:55:10 -0000 Issue 4726

Topics (messages 252391 through 252412):

Re: Curious Problem with $_POST
        252391 by: itoctopus
        252392 by: Buesching, Logan J

Question on Portfoilo's
        252393 by: Matt Carlson
        252394 by: Larry Garfield
        252395 by: Davi
        252396 by: Paul Scott
        252409 by: clive

Re: keeping credit card info in session
        252397 by: Jim King
        252405 by: Eric Butera
        252408 by: itoctopus

Re: Where to insert a phrase in the right place
        252398 by: Jan Brucek

Re: ribs (rsync) problem
        252399 by: Chris

Re: redirect http to https
        252400 by: Chris
        252411 by: Zoltán Németh

Re: 0x9f54
        252401 by: Man-wai Chang
        252402 by: Man-wai Chang
        252403 by: Man-wai Chang

Re: SimpleXML end of element/tag error
        252404 by: Don Don

Re: Session Authentication
        252406 by: tedd

Re: mysql if empty
        252407 by: tedd

Re: MD5 & bot Question
        252410 by: tedd
        252412 by: Ólafur Waage

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 ---
You should check $_FILES, and your form tag should be like this

<form action='yoursubmitfile' method='post' enctype='multipart/form-data'>

--
itoctopus - http://www.itoctopus.com
"Stephen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a form for uploading files. It is intended to upload photos. I
> have it listed at the end.
>
> When I upload a jpg everything is fine. The $_POST variable is populated
> as expected.
>
> If I upload a zip file, it is empty!
>
> print_r ($_POST); gives
>
> Array ( )
>
> If I upload a jpg Print_r gives:
>
> Array ( [form] => uploadimagesform [MAX_FILE_SIZE] => 100000 [category]
> => 1 [photo_caption] => Array ( [0] => [1] => [2] => [3] => ) [submit]
> => Add Photos )
>
> I am at a total loss to understand this, and don't know where to begin.
>
> Help!
>
> Thanks in advance
> Stephen
>
> <form enctype="multipart/form-data" action="up.php" method="post"
> name="upload_form"><br />
>     <input name="form" type="hidden" value="uploadimagesform" />
>     <label for="category">Select Category</label>
>     <select id="category" name="category">
>         <option value=1>Name</option>
>         <option value=2>Purple</option>
>     </select><br /><br />
>     <label for="Photo1">Photo 1:</label>
>     <input id="photo_filename[]" name="photo_filename[]" type="file"
> /><br />
>     <label for="Caption1">Caption: </label>
>     <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br
> /><br />
>     <label for="Photo2">Photo 2:</label>
>     <input id="photo_filename[]" name="photo_filename[]" type="file"
> /><br />
>     <label for="Caption2">Caption: </label>
>     <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br
> /><br />
>     <label for="Photo3">Photo 3:</label>
>     <input id="photo_filename[]" name="photo_filename[]" type="file"
> /><br />
>     <label for="Caption3">Caption: </label>
>     <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br
> /><br />
>     <label for="Photo4">Photo 4:</label>
>     <input id="photo_filename[]" name="photo_filename[]" type="file"
> /><br />
>     <label for="Caption4">Caption: </label>
>     <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br
> /><br />
>     <input type="submit" name="submit" value="Add Photos" />
> </form>

--- End Message ---
--- Begin Message ---
You may also want to take a look at
http://us.php.net/features.file-upload.  That is a good resource for
starting in file uploads.

-Logan

-----Original Message-----
From: Stephen [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 09, 2007 8:54 PM
To: PHP-General
Subject: [PHP] Curious Problem with $_POST

I have a form for uploading files. It is intended to upload photos. I 
have it listed at the end.

When I upload a jpg everything is fine. The $_POST variable is populated

as expected.

If I upload a zip file, it is empty!

print_r ($_POST); gives

Array ( )

If I upload a jpg Print_r gives:

Array ( [form] => uploadimagesform [MAX_FILE_SIZE] => 100000 [category] 
=> 1 [photo_caption] => Array ( [0] => [1] => [2] => [3] => ) [submit] 
=> Add Photos )

I am at a total loss to understand this, and don't know where to begin.

Help!

Thanks in advance
Stephen

<form enctype="multipart/form-data" action="up.php" method="post" 
name="upload_form"><br />
    <input name="form" type="hidden" value="uploadimagesform" />
    <label for="category">Select Category</label>
    <select id="category" name="category">
        <option value=1>Name</option>
        <option value=2>Purple</option>
    </select><br /><br />
    <label for="Photo1">Photo 1:</label>
    <input id="photo_filename[]" name="photo_filename[]" type="file" 
/><br />
    <label for="Caption1">Caption: </label>
    <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br

/><br />      
    <label for="Photo2">Photo 2:</label>
    <input id="photo_filename[]" name="photo_filename[]" type="file" 
/><br />
    <label for="Caption2">Caption: </label>
    <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br

/><br />       
    <label for="Photo3">Photo 3:</label>
    <input id="photo_filename[]" name="photo_filename[]" type="file" 
/><br />
    <label for="Caption3">Caption: </label>
    <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br

/><br />      
    <label for="Photo4">Photo 4:</label>
    <input id="photo_filename[]" name="photo_filename[]" type="file" 
/><br />
    <label for="Caption4">Caption: </label>
    <textarea id="photo_caption[]" name="photo_caption[]"></textarea><br

/><br />      
    <input type="submit" name="submit" value="Add Photos" />
</form>

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

--- End Message ---
--- Begin Message ---
So i've been meaning to start a portfolio of some code, so that when I apply 
for a job, and they want code samples, I have something to show them.  
Unfortunately, at this time, most of my work is inside of a much larger 
application, or in code that belongs to my current employer (not a php job, 
just misc. things i've made).

What kind of things do you guys have in your portfolio's/code samples that your 
provide to a potential employer?  What things do you feel I should avoid when 
putting this kinda of thing together?

--- End Message ---
--- Begin Message ---
This is why one should work on an open source project.  Much easier to show 
off legally. :-)  

On Monday 09 April 2007 8:23 pm, Matt Carlson wrote:
> So i've been meaning to start a portfolio of some code, so that when I
> apply for a job, and they want code samples, I have something to show them.
>  Unfortunately, at this time, most of my work is inside of a much larger
> application, or in code that belongs to my current employer (not a php job,
> just misc. things i've made).
>
> What kind of things do you guys have in your portfolio's/code samples that
> your provide to a potential employer?  What things do you feel I should
> avoid when putting this kinda of thing together?

-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Em Segunda 09 Abril 2007 22:36, Larry Garfield escreveu:
> This is why one should work on an open source project.  Much easier to show
> off legally. :-)
>

You can't live for and from only open source projects...

_I_ develop web sites and show them to my clients... Well... I'm an 
empoyler... =p

What about you develop your personal web log?
Later, you can develop your own personal calendar, to schelude that importante 
meeting...
And going to make your own portfoilo... =]



-- 
Davi Vidal
[EMAIL PROTECTED]
[EMAIL PROTECTED]
--

Agora com fortune:
"Al, there are plenty of good people in this newsgroup, and I would go
so far as to count myself among them.  Take a moment to really ponder
why they don't come to your defence ...  No, I meant REALLY ponder ...
From: Sylvain Robitaille"

--- End Message ---
--- Begin Message ---
On Mon, 2007-04-09 at 22:45 -0300, Davi wrote:
> Em Segunda 09 Abril 2007 22:36, Larry Garfield escreveu:

> You can't live for and from only open source projects...

Why not? I do...

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

--- End Message ---
--- Begin Message ---
Larry Garfield wrote:
This is why one should work on an open source project. Much easier to show off legally. :-)

unfortunately we aren't all fortunate enough to work for an open source project and earn a living, except Paul of course.



Regards,

Clive.

{No electrons were harmed in the creation, transmission or reading of this email. However, many were excited and some may well have enjoyed the experience.}
--- End Message ---
--- Begin Message ---


Does encrypting credit card information really do any good? You have to store the keys somewhere to decrypt the data to use it. As we have seen with blu-ray and HD DVD movies, the keys are the weak point that are easily compromised. Besides, even encrypted data can be decrypted by brute force. The strength of the encryption only dictates how long it will take. Once you have the decryption key, the strength of the encryption means nothing. Does anyone believe that all these botnets are just for sending spam? You could use them to create a huge supercomputer for code busting.

I think it is better to protect you network and passwords. Use the Visa/MC/Amex standards that the companies themselves publish. None of them require encryption, by the way.



On Apr 8, 2007, at 4:56 PM, itoctopus wrote:

Usually paying should be the last step, so you might probably want to review
your workflow.
Anyways, if you're storing the credit card in the database, then why are you also storing it in the session, you can just query the database for the credit card based on the session id (so you should also store the session id
in that table).
Since you're storing the credit card in the database, then you should
encrypt the credit card (there are plenty of encryption/decrypting
algorithms on the internet for PHP).
Other than that, I think everything is fine, and your system should work
smoothly.
--
itoctopus - http://www.itoctopus.com
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

Hi All,

I've got quite a bit or php experience, but I've never had to deal with
credit
card info before. Now for a property rental site, I'm adding a way for
users to
be able to fill out a form which also has some credit card info in it.

After they submit the form, there are a couple of more steps and to pass
credit
card info to the last page, I'm storing all the info in my session. Now, I
did
go and bought an SSL certificate, so the booking section of the site is on
SSL
(https). I'm just wondering if this is secure enough. as far as I know,
SSL
means connection to server is secured, so session variables should be
secured
too. no?

Also after I get credit card info, I'm storing them in a mysql table until
an
admin would log in to the site, see new reservations, charge them manually
and
contact the customer, and then that entry will be removed from my database
for
ever. Is this ok? or is it a really bad idea? originally the plan was to
send
an email to the admin with credit card info, but then I realized that
emails
are very unsecure. so I decided to keep the info on the SSL section of the
site.

just because I'm dealing with credit cards, I'm so afraid of doing
anything
now. Any suggestions? or perhaps any links to how to make it all more
secure?

Thanks a lot in advance,
Siavash

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

--- End Message ---
--- Begin Message ---
On 4/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Thanks a lot every one. These are great replies.

I guess I should have explained a bit more about what I'm doing.

first of all, this is not my site, it's for a client of mine.

second, I did suggest using a paypal API or a paid site to take care of this,
but my client said no. She has a credit card processing account and how she
works with it right now, is that interested users email her, she calls them,
gets their credit card info and charges their card manually without the card
present.

so, this is not really my problem, it's what she's been doing before and wants
to continue doing. All she asked me to do is that as part of the form that
people send their requests through, now she wants their credit card info as
well. So that she doesn't have to call them.

And the reason I'm keeping cc info in the session for a few steps, is to take
them to confirmation page, and then the reciept page. and after wards, I want
to keep it in there untill the client logs in to the admin page and sees new
requests, charges them and then deletes them for ever.

So now I've got two different responses, some people say do it, but use
encryption/decryption methods, and some people say don't do it. But if I don't
do it, that means I tell my client that I can't do it and I lose the job.



Thanks again,
Siavash




Quoting Travis Doherty <[EMAIL PROTECTED]>:

> Jochem Maas wrote:
>
> >unless you are a payment gateway or a bank don't touch credit card numbers.
> >there are plenty of threads in the archive of this list that give good
> reasons
> >not to e.g. being sued out of existence.
> >
> >
> 100% agreed.  Never touch credit card numbers.  You can't just take
> credit card numbers and manually process them in 'card not present'
> transactions (or MOTO in more archaic terms.)  You need a merchant
> account that allows for this -- usually at a higher discount rate.
> Check the merchant agreement.
>
> Your client should get an account like this, or better yet, provide you
> with the instructions on how to integrate his site with the payment
> providers so that you never have to worry about credit cards.
>
> As an additional note... Maybe your SSL cert secures the numbers from
> the client to the server, and just maybe your PHP scripts have no
> security flaws in them, but you must remember the server itself and
> everything else outside of PHP.  What if someone found a flaw in the FTP
> server for example, or the mail server even, and used that to get the CC
> info.   I would hate to be explaining to a list of 1000 clients that I
> was responsible for their card numbers being stolen.
>
> Travis Doherty
>

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


Did you know sessions are just plain text files sitting on the
webserver in most cases?  So by putting a credit card in the session
it is actually just cleartext for people to read.

Also if for some reason you think the benefits of this job outweigh
the chances that something could go wrong and the credit cards are
compromised, make sure all pages that deal with this are SSL.  So on
the end-user side where they send data in and on the side where your
client checks them.  Also make sure to have something that purges the
credit cards after X amount of days or after a transaction has been
processed.

The company I work for deals with lots of people like this who are
stuck in their ways on "I already have a working system."  The problem
is that the liability is too high to do something on this level
without serious thought into security.  I think you should try to do a
better job of convincing your client that a payment gateway that does
a capture is the only way to go because it would change having the
liability of credit cards laying around in temp files for sessions and
databases.  You could get it down to existing only once for $_POST and
curl it away and be done.  People generally do budge once they realize
that the heavy hand can come down hard on them.

--- End Message ---
--- Begin Message ---
Encryption is a mandatory part of PCI compliance...

--
itoctopus - http://www.itoctopus.com
"Jim King" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
>
> Does encrypting credit card information really do any good?  You have
> to store the keys somewhere to decrypt the data to use it.  As we
> have seen with blu-ray and HD DVD movies, the keys are the weak point
> that are easily compromised.  Besides, even encrypted data can be
> decrypted by brute force.  The strength of the encryption only
> dictates how long it will take.  Once you have the decryption key,
> the strength of the encryption means nothing.  Does anyone believe
> that all these botnets are just for sending spam?  You could use them
> to create a huge supercomputer for code busting.
>
> I think it is better to protect you network and passwords.  Use the
> Visa/MC/Amex standards that the companies themselves publish.  None
> of them require encryption, by the way.
>
>
>
> On Apr 8, 2007, at 4:56 PM, itoctopus wrote:
>
> > Usually paying should be the last step, so you might probably want
> > to review
> > your workflow.
> > Anyways, if you're storing the credit card in the database, then
> > why are you
> > also storing it in the session, you can just query the database for
> > the
> > credit card based on the session id (so you should also store the
> > session id
> > in that table).
> > Since you're storing the credit card in the database, then you should
> > encrypt the credit card (there are plenty of encryption/decrypting
> > algorithms on the internet for PHP).
> > Other than that, I think everything is fine, and your system should
> > work
> > smoothly.
> > --
> > itoctopus - http://www.itoctopus.com
> > <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> >>
> >> Hi All,
> >>
> >> I've got quite a bit or php experience, but I've never had to deal
> >> with
> > credit
> >> card info before. Now for a property rental site, I'm adding a way
> >> for
> > users to
> >> be able to fill out a form which also has some credit card info in
> >> it.
> >>
> >> After they submit the form, there are a couple of more steps and
> >> to pass
> > credit
> >> card info to the last page, I'm storing all the info in my
> >> session. Now, I
> > did
> >> go and bought an SSL certificate, so the booking section of the
> >> site is on
> > SSL
> >> (https). I'm just wondering if this is secure enough. as far as I
> >> know,
> > SSL
> >> means connection to server is secured, so session variables should be
> > secured
> >> too. no?
> >>
> >> Also after I get credit card info, I'm storing them in a mysql
> >> table until
> > an
> >> admin would log in to the site, see new reservations, charge them
> >> manually
> > and
> >> contact the customer, and then that entry will be removed from my
> >> database
> > for
> >> ever. Is this ok? or is it a really bad idea? originally the plan
> >> was to
> > send
> >> an email to the admin with credit card info, but then I realized that
> > emails
> >> are very unsecure. so I decided to keep the info on the SSL
> >> section of the
> > site.
> >>
> >> just because I'm dealing with credit cards, I'm so afraid of doing
> > anything
> >> now. Any suggestions? or perhaps any links to how to make it all more
> > secure?
> >>
> >> Thanks a lot in advance,
> >> Siavash
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Hi, it seems that you set the $_SESSION['greeted'] variable and
do not unset it anywhere.

If user wants to log-in, and his credentials are OK, you then create
session and set this varaible you want. If it isn't OK, you need to
unset the variable or/and destroy the session so that the variable
won't be set to 1 any more.

Then, you need also to have some logout form/page/whatever to destroy
the session in case user wants to. And unset the variable accordingly.

Hope that helps.

J.

Mário Gamito wrote:
Hi,

André Medeiros wrote:
<?php
session_start();
if(!isset($_SESSION['greeted'])) {
   echo "Welcome";
   $_SESSION['greeted'] = 1;
}
?>

It doesn't work :(

if ($_SESSION['greeted'] == 1)
 print('Welcome ' . $name);

$_SESSION['greeted'] is always equal to 1 as set in the beginning of the
file.

http://www.telbit.pt/2/login.php

Warm Regards

--- End Message ---
--- Begin Message ---
Sebe wrote:
anyone here using the ribs php rsync script?

There is a google group for it

http://www.rustyparts.com/ribs.php

So ask there.

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

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

<?php
if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !== "on")
{header("Location: https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']);exit;}
?>

Very bad solution.

Don't just tell us it's bad, explain why (even with an RTFM or URL to look at)... nobody learns from an answer like this.

The only thing I can think of is that $_SERVER variables can be compromised (ie you can't rely on them, they can be changed via curl or some other method).

But that's just a guess.

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

--- End Message ---
--- Begin Message ---
I have separate document roots for the http and the https stuff, say
"htdocs" and "htdocs-secure" - this can be done with apache
configuration
then I need only to put a single redirecting line into the
htdocs/index.php like

<?php
header("Location: https://my.server.com/";);
?>

and that's all

greets
Zoltán Németh

2007. 04. 9, hétfő keltezéssel 08.40-kor Ben Liu ezt írta:
> What's the prescribed method for redirecting a user forcibly to from  
> the non-SSL secured version of a page to the SSL-secured version? Is  
> this handled at the web server level or at the script level. I found  
> this by googling:
> 
> <?php
> if($_SERVER['SERVER_PORT'] !== $encport || $_SERVER['HTTPS'] !== "on")
> {header("Location: https://".$_SERVER['SERVER_NAME'].$_SERVER 
> ['SCRIPT_NAME']);exit;}
> ?>
> 
> What do people think about this solution?
> 
> Thanks,
> 
> - Ben
> 

--- End Message ---
--- Begin Message ---
>     On the other hand, I remember you talked about the type of that
> column to be char(2).  Have you specified what encoding it's using?
> Moreover, I hope you're not using legacy encoding like Big5 or GB.  Use
> Unicode (UTF-8) if your database is a brand new one.

Unfortunately, I am still using Big5. you need a longer field to store
utf-8 codes for the same big5 string right?

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.6
  ^ ^   19:11:01 up 3 days 2:02 0 users load average: 1.23 1.12 1.03
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

--- End Message ---
--- Begin Message ---
> Well, show us a part of your code. Do var_dump($value) before you
> enter it into the database, and see if it still says 0x9f54.

The error:

string(2) ""
Duplicate entry '' for key 1

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.6
  ^ ^   19:14:01 up 3 days 2:05 1 user load average: 2.24 1.42 1.14
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
<?
class MYSQL {
        private $fhandle;
        var $row;
        function MYSQL($host,$db,$usr,$pwd) {
                $this->fhandle=new mysqli($host,$usr,$pwd,$db)
                        or die(mysqli_error($this->fhandle));
                $this->query("set names 'big5'");
        }
        function query($sql_str) {
                $this->row=mysqli_query($this->fhandle, $sql_str) or 
die(mysqli_error($this->fhandle));
        }
        function affected_rows() {
                return mysqli_affected_rows($this->row);
        }
        function num_rows() {
                return mysqli_num_rows($this->row);
        }
        function fetch_assoc() {
                return mysqli_fetch_assoc($this->row);
        }
        function __destruct() {
                mysqli_close($this->fhandle);
        }
        function begin_tran() {
                mysqli_autocommit($this->fhandle, FALSE);
        }
        function commit() {
                mysqli_commit($this->fhandle);
                mysqli_autocommit($this->fhandle, TRUE);
        }
        function rollback() {
                mysqli_rollback($this->fhandle);
                mysqli_autocommit($this->fhandle, TRUE);
        }
}

function showcode($cChar) {
        return 
"[".dechex(ord(substr($cChar,0,1))).".".dechex(ord(substr($cChar,1,1)))."]";
}


$target=new MYSQL("localhost","testing","root","testing");

$fhandle=dbase_open("/home/bt/canton.DBF",0);
if ($fhandle) {
        $reccount=dbase_numrecords($fhandle);
        echo "input count: ".$reccount."\n";
        $target->query("show tables like 'canton';");
        if ($target->num_rows()>0)
                $target->query("drop table canton");
        $target->query(
                "create table canton ("
                . " big5 char(2) not null,"
                . " thekey char(6),"
                . " canton char(10),"
                . " changjei char(10),"
                . " touched integer,"
                . " primary key (big5)"
                . " ) character set big5;"
        );
        for ($ii=1; $ii<=$reccount; $ii++) {
                $row=dbase_get_record_with_names($fhandle,$ii);
                $ss=$row['BIG5'];
                echo var_dump($ss);
                $target->query("select * from canton where big5='".$ss."'");
                $yy = $target->num_rows();
                if ($yy>0) {
                        $query="update canton set touched="
                                . $row["TOUCHED"]
                                . " where big5='" . $ss . "';";
                }
                else {
                        $query="insert into canton ("
                                . " big5,"
                                . " thekey,"
                                . " changjei,"
                                . " canton,"
                                . " touched "
                                . ") values ("
                                . "'$ss',"
                                . "'".$row["THEKEY"]."',"
                                . "'".$row["CHANGJEI"]."',"
                                . "'".$row["CANTON"]."',"
                                . $row["TOUCHED"]
                                . ");";
                }
                $result=$target->query($query);
                if (! $target->row)
                        echo showcode($ss);
        }
        $result=$target->query("select count(*) as cnt from canton");
        $yy = $target->fetch_assoc();
        echo "output count: ".$yy['cnt']."\n";
        dbase_close($fhandle);
}
?>

--- End Message ---
--- Begin Message ---
screenshot of the error:

-- 
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.10)  Linux 2.6.20.6
  ^ ^   19:25:01 up 3 days 2:16 1 user load average: 1.03 1.08 1.08
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

--- End Message ---
--- Begin Message ---
the code section is displayed below
   
  $xml = simplexml_load_file($_POST['feedurl']);
   
  foreach($xml->TT as $TT) 
{
    foreach($TT->TOTS as $TOTS)
    {
      $cnt++;
               
        foreach($TT->TOTS[$cnt]->attributes() as $a => $b)   // problematic 
line.
        {
   
                          // DISPLAY THE TITLE AND THE VALUES
                        //echo " $a $b <br/>";   
 }
    }
}
   
  the error occours when the parser reaches the end of the last element and 
then fires the error
Fatal error: Call to a member function attributes() on a non-object in line 
(see problematic line)
   
  How can i solve that or determine when there are no more tags to parse.

JM Guillermin <[EMAIL PROTECTED]> wrote:
  And with :

foreach ($xml as $cs) {
.....
}
??

jm

----- Original Message ----- 
From: "Don Don" 

To: "PHP List" 

Sent: Thursday, April 05, 2007 10:32 AM
Subject: [PHP] SimpleXML end of element/tag error


>I am using simple xml to parse an xml file, the program parses the file and 
>produces an error at the end of the foreach loop when it reaches the end of 
>the tag, it tries to look for an element/tag when there is none and 
>produces an error "Call to a member function attributes() on a non-object" 
>the foreach loop looks like this
>
> foreach($xml->CS as $CS)
> {
> //processing takes place here
> }
>
> when there are no more CS it fires an error
>
> How can i detect when there are no more elements/tags to parse and handle 
> it?
>
>
> cheers
>
>
> ---------------------------------
> It's here! Your new message!
> Get new email alerts with the free Yahoo! Toolbar. 



 
---------------------------------
Now that's room service! Choose from over 150,000 hotels 
in 45,000 destinations on Yahoo! Travel to find your fit.

--- End Message ---
--- Begin Message ---
At 7:07 PM +0200 4/9/07, Tijnema ! wrote:
On 4/9/07, tedd <[EMAIL PROTECTED]> wrote:
At 5:55 PM +0200 4/9/07, Tijnema ! wrote:
 >Cookies are old, so in the time they were introduced, today it is
possible to create and modify cookies with some good tools. These
 >tools are illegal,

I don't believe that.

FireFox probably has most, if not all.

Cheers,

tedd

Who said firefox is legal? :P

Tijnema

Tijnema:

Read what was said -- no one said FireFox was illegal.

I simply added that FireFox probably has most of the tools you say are illegal.

Cheers,

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

--- End Message ---
--- Begin Message ---
At 10:18 PM +0100 4/9/07, <[EMAIL PROTECTED]> wrote:
If I search for something in mysql that returns an empty result I cant get it to return "No result found" always returns "Found" even though the recoed does not exist...


$sql = "SELECT Client FROM booked WHERE Name = 'larry'";

$result = mysql_query($sql);

if ($result == "")
{
echo "No result found";
}
echo "Found";

Try NULL

Cheers,

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

--- End Message ---
--- Begin Message ---
At 8:10 PM -0400 4/9/07, Robert Cummings wrote:
On Mon, 2007-04-09 at 17:14 -0400, tedd wrote:
 At 4:39 PM -0400 4/9/07, Robert Cummings wrote:
 >On Mon, 2007-04-09 at 22:27 +0200, Tijnema ! wrote:
 >
 >  > This is exactly what tedd did in his last arrow example. He edited the
 >>  header of the GIF image, and so that would result in different MD5.
 >>
 >>  Finding this part and skipping it in the MD5 check would do the job. :)
 >
 >Yep, that's an obvious solution since it's the same way virus signatures
 > >are matched. The entire image needs some kind of permutation. Passing a
 > >couple of curved ripples across the image as a transformation, and in
 >different directions should suffice to obfuscate the image signature
 > >without obfuscating the image itself :) Similarly watermarking the image
 > >using fractal patterns should also provide good noise.
 >
 >Cheers,
 >Rob.

 Rob:

 It doesn't need to be complicated, just random placed pixels on the
 image from a selection of colors would provide millions of
 permutations.

No, you're wrong. Read the part about I mentioned about virus
signatures. A small portion of the whole can be used as an identifier
where that portion is unique to the overall entity. For instance, I can
throw a tub of tar over you, then a tub of feathers ;) ;) and if one of
your fingers doesn't get covered, I can still identify your chicken
ass ;)

Cheers,
Rob.

Rob:

Your use of metaphor is quite colorful, but if you if change a single pixel in an image, then you change the MD5 signature -- that is what I was talking about -- and that is not wrong.

Plus, if you:

[A] Passing a couple of curved ripples across the image as a transformation, and in different directions should suffice to obfuscate the image signature without obfuscating the image itself

or

[B] Similarly watermarking the image using fractal patterns should also provide good noise.

You would still leave at least one pixel the same as it was before so your chicken ass would still be exposed, right? Or does your ripple/watermark application alter every pixel by changing its alpha channel or something?

And if so, then why is it that you are required to change every pixel? I am sure that there are images that have at least one pixel in common, so I don't see the point you're trying to make -- please explain.

Cheers,

tedd








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

--- End Message ---
--- Begin Message ---
You were talking about an OCR reader for the arrows to see what letters it
is pointing to. If the arrow would be at a random location in the actual
image, the arrow being not an arrow but ie. a man pointing and the arm being
flexible (so even if the man himself would move around randomly, the arm
would always face the right direction for the image.

I like the idea of a pointing arrow, it could be quick, pretty effective
(not 100% since nothing is) and easy for the user to identify.

If there was a miniature version of this available, i would use it on my
site. Since i hate the text versions.

- Olafur W

2007/4/10, tedd <[EMAIL PROTECTED]>:

At 8:10 PM -0400 4/9/07, Robert Cummings wrote:
>On Mon, 2007-04-09 at 17:14 -0400, tedd wrote:
>>  At 4:39 PM -0400 4/9/07, Robert Cummings wrote:
>>  >On Mon, 2007-04-09 at 22:27 +0200, Tijnema ! wrote:
>>  >
>>  >  > This is exactly what tedd did in his last arrow example. He
edited the
>>  >>  header of the GIF image, and so that would result in different
MD5.
>>  >>
>>  >>  Finding this part and skipping it in the MD5 check would do the
job. :)
>>  >
>>  >Yep, that's an obvious solution since it's the same way virus
signatures
>  > >are matched. The entire image needs some kind of permutation.
Passing a
>  > >couple of curved ripples across the image as a transformation, and
in
>>  >different directions should suffice to obfuscate the image signature
>  > >without obfuscating the image itself :) Similarly watermarking the
image
>  > >using fractal patterns should also provide good noise.
>>  >
>>  >Cheers,
>>  >Rob.
>>
>>  Rob:
>>
>>  It doesn't need to be complicated, just random placed pixels on the
>>  image from a selection of colors would provide millions of
>>  permutations.
>
>No, you're wrong. Read the part about I mentioned about virus
>signatures. A small portion of the whole can be used as an identifier
>where that portion is unique to the overall entity. For instance, I can
>throw a tub of tar over you, then a tub of feathers ;) ;) and if one of
>your fingers doesn't get covered, I can still identify your chicken
>ass ;)
>
>Cheers,
>Rob.

Rob:

Your use of metaphor is quite colorful, but if you if change a single
pixel in an image, then you change the MD5 signature -- that is what
I was talking about -- and that is not wrong.

Plus, if you:

[A] Passing a couple of curved ripples across the image as a
transformation, and in different directions should suffice to
obfuscate the image signature without obfuscating the image itself

or

[B] Similarly watermarking the image using fractal patterns should
also provide good noise.

You would still leave at least one pixel the same as it was before so
your chicken ass would still be exposed, right? Or does your
ripple/watermark application alter every pixel by changing its alpha
channel or something?

And if so, then why is it that you are required to change every
pixel? I am sure that there are images that have at least one pixel
in common, so I don't see the point you're trying to make -- please
explain.

Cheers,

tedd








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

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



--- End Message ---

Reply via email to