Re: [PHP] How about a saveXHTML for the DOM?

2009-04-09 Thread Michael A. Peters

Michael Shadle wrote:

On Wed, Apr 8, 2009 at 8:58 PM, Michael A. Peters  wrote:


Yes it should - I believe php 6 is suppose to be much better at native UTF8.
At least according to some blog I read somewhere (IE don't believe me
without reservation, it's third hand knowledge at best)


afaik you're right, it's supposed to be fully unicode. or at least -was-

however, how long until it is production stable... when i am sure
someone can hack together a patch to make saveHTML unicode capable :p



I did a little reading on the issue and I don't think php 6 will fix it.
The issue is with libxml2 - it mutilates utf8 when exporting to html and 
php function wraps the libxml2 function.


The solution?
I don't know - but perhaps using saveXML() and then using a translation 
tool (maybe xslt?) to convert to HTML.


I actually had a function I wrote using preg_replace (started out as a 
wordpress plugin someone else wrote) but it could not properly handle 
cdata blocks - I'll see if I can find it.


I don't use it anymore as I use saveHTML() now for html output.

Maybe running iconv on the output would fix it?

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



Re: [PHP] How about a saveXHTML for the DOM?

2009-04-09 Thread Michael Shadle
On Thu, Apr 9, 2009 at 12:25 AM, Michael A. Peters  wrote:

> I did a little reading on the issue and I don't think php 6 will fix it.
> The issue is with libxml2 - it mutilates utf8 when exporting to html and php
> function wraps the libxml2 function.
>
> The solution?
> I don't know - but perhaps using saveXML() and then using a translation tool
> (maybe xslt?) to convert to HTML.
>
> I actually had a function I wrote using preg_replace (started out as a
> wordpress plugin someone else wrote) but it could not properly handle cdata
> blocks - I'll see if I can find it.
>
> I don't use it anymore as I use saveHTML() now for html output.
>
> Maybe running iconv on the output would fix it?
>

I tried to the best of my abilities. it looks like it was reported as
a bug years ago, but classified as not a bug or something.

I tried iconv, I am not the best hacker when it comes to encoding manipulation.

At the moment this was the best workaround someone had posted, and I
have not sanity checked that this gets into MySQL then back out on the
webpage properly as UTF-8, but it -appears- to work

html_entity_decode($dom->saveHTML(),ENT_QUOTES,"UTF-8");

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



Re: [PHP] How about a saveXHTML for the DOM?

2009-04-09 Thread Michael Shadle
On Thu, Apr 9, 2009 at 12:25 AM, Michael A. Peters  wrote:

> I did a little reading on the issue and I don't think php 6 will fix it.
> The issue is with libxml2 - it mutilates utf8 when exporting to html and php
> function wraps the libxml2 function.

not to mention i swore i tried saveXML and it didn't work either. but
maybe it was because the output was unusable...

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



Re: [PHP] How about a saveXHTML for the DOM?

2009-04-09 Thread Benjamin Hawkes-Lewis

On 9/4/09 04:55, Michael A. Peters wrote:

IE (still) does not properly support XHTML.
It will render an XHTML page sent with the text/html mime type - but
that's actually a standards violation.


Is it? What standard is it violating?

"XHTML Documents which follow the guidelines set forth in Appendix C, 
"HTML Compatibility Guidelines" may be labeled with the Internet Media 
Type "text/html" [RFC2854], as they are compatible with most HTML browsers."


http://www.w3.org/TR/xhtml1/#media

"Due to the long and distributed development of HTML, current practice 
on the Internet includes a wide variety of HTML variants. Implementors 
of text/html interpreters must be prepared to be "bug-compatible" with 
popular browsers in order to work with many HTML documents available the 
Internet. … [XHTML1] defines a profile of use of XHTML which is 
compatible with HTML 4.01 and which may also be labeled as text/html."


http://www.ietf.org/rfc/rfc2854.txt

(I'm not saying it's a good idea, mark you! http://hixie.ch/advocacy/xhtml )

--
Benjamin Hawkes-Lewis

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Richard Heyes
> Get paid for your opinion!

Y'know, I really think I should...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



RE: [PHP] PHP and Send Mail

2009-04-09 Thread Jay Blanchard
[snip]
And not one RTFM?
[/snip]

It is because I wasn't online at the time of the crime. 

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



RE: [PHP] Increase your monthly income!

2009-04-09 Thread abdulazeez alugo


 

> Date: Thu, 9 Apr 2009 12:02:29 +0100
> From: rich...@php.net
> To: tyrellmaccoll1...@gmail.com
> CC: php-general@lists.php.net
> Subject: Re: [PHP] Increase your monthly income!
> 
> > Get paid for your opinion!
> 
> Y'know, I really think I should...
> 
> -- 
> Richard Heyes
>

Richard

I actually thought you were going to point out to our guest that this is a 
mailing list for PHP-related issues only. And we're not here to get paid for 
our opinions are we??? I won't blame anybody going for the offer though but the 
point remains, this is a PHP-Mailing list.

Cheers.

 

Alugo Abdulazeez

www.frangeovic.com

 

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/

Re: [PHP] How can I echo a javascript var in an email subject line? Possible?

2009-04-09 Thread tedd

At 1:00 PM -0500 4/8/09, Terion Miller wrote:

Thought I would go ahead and post a bit more on this, so here is my
wordcount little function on the textarea of the form:


-snip-


or do I need to define the variable? think I'm starting to confuse myself
lol


The reason why you are starting to confuse yourself is that you are 
still considering doing some part of this by including javascript in 
the solution -- there is NO need.


Just receive what the user submits and process it server-side before 
mailing -- pure and simple.


That way not only can you clean the submission, but you can count the 
words and put that count in the subject line like you wanted. This 
really a simple problem. You are complicating it by including 
javascript.


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



Re: [PHP] codeigniter 'secure, non-secure content' pop up message in IE7

2009-04-09 Thread Yannick Mortier
2009/4/9 9el :
> -- Forwarded message --
> From: Sabrina Akter 
> Date: Thu, Apr 9, 2009 at 1:12 AM
> Subject: codeigniter 'secure, non-secure content' pop up message in IE7
> To: phpexpe...@yahoogroups.com
>
>
> Hello Experts,
>
> I badly need your help. My developed site's some pages are HTTPS, and
> other parts are HTTP. When I try to access the HTTPS page in IE it
> comes up with "secure & non-secure content " warning. I search on
> google to find out the solution. but almost every site suggest to
> change the IE setting. But, its not wish way to tell every visitor's
> to change  the IE setting. So, I want to stop this message with some
> coding. while searching, I found some advice to make all image to
> HTTPS, for https pages, I followed that, but still i am getting this
> same pop up warning. Is there any other way to solve my problem? Any
> one can help me on it? Please do reply.
>
> With Regards
> 
> Sabrina Akter
> Web App. Developer
> 'IBACS' - www.ibacs.co.uk
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Look at the generated source code and try to find any files that are
included by absolute URL (search for http://) those have to be
eliminated. Make sure everything uses relative paths or comes over
SSL.


-- 
Currently developing a browsergame...
http://www.p-game.de
Trade - Expand - Fight

Follow me on twitter!
http://twitter.com/moortier

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



Re: [PHP] codeigniter 'secure, non-secure content' pop up message in IE7

2009-04-09 Thread Jan G.B.
2009/4/9 Yannick Mortier :
> 2009/4/9 9el :
>> -- Forwarded message --
>> From: Sabrina Akter 
>> Date: Thu, Apr 9, 2009 at 1:12 AM
>> Subject: codeigniter 'secure, non-secure content' pop up message in IE7
>> To: phpexpe...@yahoogroups.com
>>
>>
>> Hello Experts,
>>
>> I badly need your help. My developed site's some pages are HTTPS, and
>> other parts are HTTP. When I try to access the HTTPS page in IE it
>> comes up with "secure & non-secure content " warning. I search on
>> google to find out the solution. but almost every site suggest to
>> change the IE setting. But, its not wish way to tell every visitor's
>> to change  the IE setting. So, I want to stop this message with some
>> coding. while searching, I found some advice to make all image to
>> HTTPS, for https pages, I followed that, but still i am getting this
>> same pop up warning. Is there any other way to solve my problem? Any
>> one can help me on it? Please do reply.
>>
>> With Regards
>> 
>> Sabrina Akter
>> Web App. Developer
>> 'IBACS' - www.ibacs.co.uk
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> Look at the generated source code and try to find any files that are
> included by absolute URL (search for http://) those have to be
> eliminated. Make sure everything uses relative paths or comes over
> SSL.
>

Yes. or absolute paths without protocoll and host. ;)
works:
src="/foo.bar"
src="./foo.bar"
src="https://otherserver/foo.bar";


And also be on the lookout for blank src= attributes like in a iframe

A bug in IE will show the mentioned popup when you have such code.
Solution: src="javascript:void(0)"

Bye

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



RE: [PHP] Re: PHP and Send Mail

2009-04-09 Thread Bob McConnell
From: Michael A. Peters
> 9el wrote:
>> On Thu, Apr 9, 2009 at 7:19 AM, Shawn McKenzie 
wrote:
>>> Alejandro Esteban Galvez wrote:
 Hi!, I am making a web system and i need known how send a mail
using PHP
>> Hi,
>> Use PHPmailer or PEAR:mail()
> 
> I second PHPmailer.
> It rocks!

Just be aware that it does have a few bugs you may need to work around
or patch. The SourceForge tracker is at
. I
submitted two reports last year against 1.73 which the tracker says were
summarily closed with no comment and apparently no action. The first one
is listed as fixed in the change logs for 2.0.3 and 2.3, but that was
not recorded in the tracker.

1. Incorrect line ending character. RFC 2821 and 2822 require CR/LF line
endings. PHPMailer only puts in the LF. Just because most current
clients can handle the single character is no excuse for doing it wrong.

2. Invalid use of Return-path for Sender. When you request a Sender
header, the email is written with Return-path instead. According to
those RFCs, the latter is reserved for use by transport agents and may
be rewritten or replaced anywhere in the chain. It should insert a
Sender line instead.

Bob McConnell

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Richard Heyes
> I actually thought you were going to point out to our guest that this is a
> mailing list for PHP-related issues only. And we're not here to get paid for
> our opinions are we??? I won't blame anybody going for the offer though but
> the point remains, this is a PHP-Mailing list.

Wow, someone is playing Mr. Misery Guts in the school play aren't they?

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread VamVan
I believe there is some kind of filter for SPAM emails and emails not
related to PHP. Question is: How come some emails still make it to this
list? Anyone to shed some light on this topic?

Thanks,
V


RE: [PHP] Increase your monthly income!

2009-04-09 Thread abdulazeez alugo


 

> Date: Thu, 9 Apr 2009 14:29:25 +0100
> Subject: Re: [PHP] Increase your monthly income!
> From: rich...@php.net
> To: defati...@hotmail.com
> CC: tyrellmaccoll1...@gmail.com; php-general@lists.php.net
> 
> > I actually thought you were going to point out to our guest that this is a
> > mailing list for PHP-related issues only. And we're not here to get paid for
> > our opinions are we??? I won't blame anybody going for the offer though but
> > the point remains, this is a PHP-Mailing list.
> 
> Wow, someone is playing Mr. Misery Guts in the school play aren't they?
> 
> -- 
> Richard Heyes
> 
Hi Richard,

You don't wanna be rude to me now do you? I'd pretend I didn't see that.

Cheers

Alugo Abdulazeez.

_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx

RE: [PHP] Increase your monthly income!

2009-04-09 Thread abdulazeez alugo


 

> Date: Thu, 9 Apr 2009 19:04:13 +0530
> From: vamsee...@gmail.com
> To: rich...@php.net
> CC: defati...@hotmail.com; tyrellmaccoll1...@gmail.com; 
> php-general@lists.php.net
> Subject: Re: [PHP] Increase your monthly income!
> 
> I believe there is some kind of filter for SPAM emails and emails not
> related to PHP. Question is: How come some emails still make it to this
> list? Anyone to shed some light on this topic?
> 
> Thanks,
> V


Quite frankly, I asked myself that same question earlier but I thought Dan was 
in charge of such stuffs. He's been very quiet on a lot of things lately. Hey 
guys, does anyone know where Dan's been? i'm guessing he's gone on a short 
course or maybe AWOL.

Cheers.

Alugo Abdulazeez.

_
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx

[PHP] preg_match and multibyte

2009-04-09 Thread Merlin Morgenstern

Hello,

I am trying to extract a number out of a string that is in utf-8 and 
contains chines characters.


This unfortunatelly does not work:

preg_match('{(\d+)}', $details, $m);
$number = $m[1];

I also tried to utf8decode it, but still, no luck.

Does anybody know how to overcome this problem?

Regards, Merlin

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



[PHP] Escape Data In/Out of db

2009-04-09 Thread tedd

Hi gang:

I'm gathering information from a user, storing that data in a db, and 
then showing it back to the user. It's a simple process and can bee 
seen here in this address book demo (not real people):


http://php1.net/a/edit-db-demo

I gather information from the user via a $_POST[]; like this:

   $last_name = trim($_POST['last_name']);

Then I pass it through mysql_real_escape_string() like so --

   $last_name = mysql_real_escape_string($last_name);

-- and then I put that data into my table via an UPDATE.

Then when I pull data from the table, I do this --

   $last_name = htmlentities($row['last_name']);

-- and show that data to the user. That's what I'm supposed to do right?

So, why is it that when I enter the name "O'Brian", the entry comes 
back "O/'Brian"?


So what's wrong and how do I fix it?

Cheers,

tedd

PS: I know that I'm supposed to know this, but that part of my brain 
is on vacation -- I can't afford for all of me to go on vacation at 
one time.


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



Re: [PHP] preg_match and multibyte

2009-04-09 Thread tedd

At 4:18 PM +0200 4/9/09, Merlin Morgenstern wrote:

Hello,

I am trying to extract a number out of a string that is in utf-8 and 
contains chines characters.


This unfortunatelly does not work:

preg_match('{(\d+)}', $details, $m);
$number = $m[1];

I also tried to utf8decode it, but still, no luck.

Does anybody know how to overcome this problem?

Regards, Merlin


That's simple, there's no "chines" characters in Unicode.

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



Re: [PHP] preg_match and multibyte

2009-04-09 Thread Merlin Morgenstern



tedd wrote:

At 4:18 PM +0200 4/9/09, Merlin Morgenstern wrote:

Hello,

I am trying to extract a number out of a string that is in utf-8 and 
contains chines characters.


This unfortunatelly does not work:

preg_match('{(\d+)}', $details, $m);
$number = $m[1];

I also tried to utf8decode it, but still, no luck.

Does anybody know how to overcome this problem?

Regards, Merlin


That's simple, there's no "chines" characters in Unicode.

Cheers,  :-)

tedd



:-) sorry about my spelling. Chinese.
e.g.:
月租: 350元其

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



[PHP] Connecting to dBase using ODBC on Mac OS X

2009-04-09 Thread Rahul S. Johari

Ave,

Does anyone have any knowledge on connecting a FoxPro table (.dbf,  
dbase) using ODBC on a Mac OS X? I've been googling but not much is  
turning up. Some information is available on ODBC Connections using  
PHP ... very little on Mac OS X ... and absolutely none to do with a  
FoxPro dBase table.


Thanks.

---
Rahul Sitaram Johari
Founder, Internet Architects Group, Inc.

[Email] sleepwal...@rahulsjohari.com
[Web]   http://www.rahulsjohari.com





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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Govinda



Quite frankly, I asked myself that same question earlier but I  
thought Dan was in charge of such stuffs. He's been very quiet on a  
lot of things lately. Hey guys, does anyone know where Dan's been?  
i'm guessing he's gone on a short course or maybe AWOL.


pretty sure he has answered this question a few times before.
The gist was, (IIRC) - some can get through..  nothing to do about it.
-G

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



Re: [PHP] Escape Data In/Out of db

2009-04-09 Thread Jan G.B.
2009/4/9 tedd :
> Hi gang:

-.-

>
> I'm gathering information from a user, storing that data in a db, and then
> showing it back to the user. It's a simple process and can bee seen here in
> this address book demo (not real people):
>
> http://php1.net/a/edit-db-demo
>
> I gather information from the user via a $_POST[]; like this:
>
>   $last_name = trim($_POST['last_name']);
>
> Then I pass it through mysql_real_escape_string() like so --
>
>   $last_name = mysql_real_escape_string($last_name);
>
Good.

> -- and then I put that data into my table via an UPDATE.
>
> Then when I pull data from the table, I do this --
>
>   $last_name = htmlentities($row['last_name']);
>
> -- and show that data to the user. That's what I'm supposed to do right?

Yes, but add ENT_QUOTES as second parameter to htmlentities, so that
php will convert single 'quotings', too.
You might want to use htmlspecialchars($str, ENT_QUOTES) to preserve
special characters liek äöü and alike.
If you're using UTF-8, you want to add 'UTF-8' as the third parameter
for the given html*() function.

bye




>
> So, why is it that when I enter the name "O'Brian", the entry comes back
> "O/'Brian"?

this happens, because you have php configured to automatically apply
addslashes() to every predefined user-input scope like _GET, _POST,
... just turn it of or call stripslashes *before* issuing
mysql_real_escape_string()..

like that :

"UPDATE `foo` SET `bar` = ".
mysql_real_escape_string(stripslashes($_POST['yourself']));

Beware of typing stripcslashes('see the C?"), as it will not strip
anything without further options. ;)



byebye


>
> So what's wrong and how do I fix it?
>
> Cheers,
>
> tedd
>
> PS: I know that I'm supposed to know this, but that part of my brain is on
> vacation -- I can't afford for all of me to go on vacation at one time.
>
> --
> ---
> 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
>
>

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Daniel Brown
On Thu, Apr 9, 2009 at 11:01, Govinda  wrote:
>>
>>
>> Quite frankly, I asked myself that same question earlier but I thought Dan
>> was in charge of such stuffs. He's been very quiet on a lot of things
>> lately. Hey guys, does anyone know where Dan's been? i'm guessing he's gone
>> on a short course or maybe AWOL.
>
> pretty sure he has answered this question a few times before.
> The gist was, (IIRC) - some can get through..  nothing to do about it.

I'm still here.  This had been marked as SPAM over here, so I
never even saw it until now.

And yes, whether we like it or not, SPAM will get through.
Because of the nature of the list, it would be difficult to develop a
pattern with today's AI technology to "learn" enough about the message
content to block SPAM on this (technical) list without blocking a good
portion of legitimate mail as well.  Even the obvious stuff is mostly
unfiltered --- we rely on each subscriber using a decent SPAM filter
on their side.

I'd personally recommend setting up a dedicated Gmail account for
the lists, and then if you want it all in the same place, use their
IMAP/POP3/forwarding/etc. features.  In the history of email, the only
better SPAM blocking stuff has been a pair of scissors applied to the
power cord.

(Zap.)

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



Re: [PHP] Increase your monthly income!

2009-04-09 Thread Richard Heyes
> In the history of email, the only
> better SPAM blocking stuff has been a pair of scissors applied to the
> power cord.

Wearing insulating gloves I would add...

-- 
Richard Heyes

HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
http://www.rgraph.net (Updated March 28th)

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



[PHP] Caching

2009-04-09 Thread דניאל דנון
I started caching some of the static files on my application,
I was wondering - Lets say I have an article on my website and I *want* to
cache it. How will I cache it AND will be able to make my visitors
"re-cache" it if it has been changed?

I read how to do that on static pages, but couldn't find any reference that
does not use mod_expires (since I don't have it)...


And, if I am already sending a message,

How do I use *Header set Expires* (on htaccess) and specifying "in a week"?
Couldn't find any answer to this question as well..


Re: [PHP] Increase your monthly income!

2009-04-09 Thread Daniel Brown
On Thu, Apr 9, 2009 at 11:33, Richard Heyes  wrote:
>> In the history of email, the only
>> better SPAM blocking stuff has been a pair of scissors applied to the
>> power cord.
>
> Wearing insulating gloves I would add...

You always were the one to see the Big Picture[tm].  ;-P

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1

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



[PHP] Newbie: handling instance values on a attribute of the same class.

2009-04-09 Thread MEM
Hi all,

Ok. Here is a code that I'm studying:

class Connection extends PDO {
private $dsn = 'mysql:dbname=testes;host=127.0.0.1';
private $user = 'root';
private $password = '';
public $handle = null;

   function __construct( ) {
try {
  if ( $this->handle == null ) {
$dbh = parent::__construct( $this->dsn , $this->user ,
$this->password );
$this->handle = $dbh;
return $this->handle;
   }
}
…

Can I replace this part:
$dbh = parent::__construct( $this->dsn , $this->user , $this->password );
$this->handle = $dbh;
  return $this->handle;

By this: (?)
$this->handle = parent::__construct( $this->dsn , $this->user ,
$this->password );

And put a return on my getHandler method? 

If so, is there any special reason that we should know about using a
structure like this?
$dbh = parent::__construct( $this->dsn , $this->user , $this->password );
$this->handle = $dbh;
return $this->handle;




Thanks a lot,
Márcio


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



Re: [PHP] difficult select problem

2009-04-09 Thread PJ
Jim Lucas wrote:
> PJ wrote:
>> Hi Jim,
>> Sorry I could not gat back to you on your suggestion. I've been under
>> the weather for a couple of days but am almost over it.
>> Your suggestion does not work... yet.
>> I'll insert comments & questions below...
>>
>> Jim Lucas wrote:
>>> PJ wrote:
 I've searched the web, the tutorials, etc. with no luck and have asked
 on MySql list with no luck and have even posted here with no replies.
 So, let's try again:

 I am trying to limit the search for books to only those that start
 with
 "A" (does not have to be case sensitive); but within that selection
 there may be a second author whose name may start with any letter
 of the
 alphabet.

 So, the real problem is to find if there is a second author in the
 selection of books and to display that name.
 My query shows all the books that begin with A:

 $SQL = "SELECT b.*, c.publisher, a.first_name, a.last_name
 FROM book AS b
 LEFT JOIN book_publisher as bp ON b.id = bp.bookID
 LEFT JOIN publishers AS c ON bp.publishers_id = c.id
 LEFT JOIN book_author AS ba ON b.id = ba.bookID
 LEFT JOIN author AS a ON ba.authID = a.id WHERE
 LEFT(last_name, 1 ) = '$Auth' ";

 Within the results there are some books that have 2 authors and now I
 have to find if
 there is a second author in the results and then be able to echo the
 second author.
 So far, I have not been able to figure out how to go about that.
 Do I need to do another query to find the second author or can it
 somehow be incorporated into the original query? Or can it be done
 with a UNION ?
 Please help.

  

>>> ... and we begin ...
>>>
>>> $SQL = "SELECT b.*, c.id AS publisher_id, c.publisher, a.id AS
>>> author_id, a.first_name, a.last_name
>>> FROM book AS b
>>> INNER JOIN book_publisher as bp ON b.id = bp.bookID
>>> INNER JOIN publishers AS c ON bp.publishers_id = c.id
>>> INNER JOIN book_author AS ba ON b.id = ba.bookID
>>> INNER JOIN author AS a ON ba.authID = a.id
>>> WHERE b.id IN (
>>> SELECT  b.id
>>> FROMbook AS b
>>> INNER JOIN book_author AS ba ON b.id = ba.bookID
>>> INNER JOIN author AS a ON ba.authID = a.id
>>> WHERE   a.last_name LIKE '{$Auth}%'
>>> )";
>> A written, the code does not produce a result.
>> Questions:
>> 1. why c.id AS publisher_id and a.id AS author_id? I do not see a
>> reference to these in the code
>> 2. why "a.last_name LIKE '{$Auth}%'? What does that change from
>> LEFT(last_name, 1) = '$Auth'? the LEFT clause will give me all authors
>> whose names begin with A; I don't care what the rest of the string may
>> be - the authors' last names always starts with a capital letter.
>> 3. What were you expecting to get as a result from the code? It looks to
>> me like the results will only give all authors whose names begin with A.
>> And that I am already getting with the code as I have written. Sorry for
>> my ignorance, but that is why I am asking for help.
>> 4. So far, no one has used the book_author.ordinal to select the author
>> ;  perhaps I have not been clear on that as that is what I use to
>> determine if there are more than 1 author. Ordinal 1 is for all authors
>> who are unique for a book; ordinal 2 is for authors who are the second
>> author for a book.
>>
>
> Thanks for explaining the ordinal significance.  Does it really make a
> difference if the ordinal is 1 or 2?  Does 1 indicate the primary
> author and the 2 indicate supporting authors???
I decided on the outset that there would only be a max or 2 authors in
the author fields as there are few books authored by more than 2
writers. So I assign ordinal 1 for the primary author and 2 for the
second(ary). I thought that would be necessary for differentiating
between the two.
If there are 3 authors, then that is entered under sub_title. And often
these "authors" are not authors but editors for the books then are
really anthologies.
I had not thought of searching for these under Authors. I suppose that
could be done by another type of search.
>
>
> If a book has three authors and all three had an ordinal of 2, would
> it make any difference then if one was 1 and the remaining two were
> marked 2?
>
> If it makes no difference, the the column is pointless.
>
> If it does make a difference (identifying one as 1 and the remaining
> as 2), then keep it and we will deal with that later.
>
> But, all this can be done without that column.
>
> Read my other email that I about to send, responding to a different
> part of this thread.
Will do.
>
>> Now, if my code is not too messy or cumbersome (I refer to your e-mail
>> of March 15) then what I really need is a way to save the book.id from
>> my query to a $tring and then use that to select the book in another

Re: [PHP] Re: PHP and Send Mail

2009-04-09 Thread Michael A. Peters

Bob McConnell wrote:
*snip*


Just be aware that it does have a few bugs you may need to work around
or patch. The SourceForge tracker is at
. I
submitted two reports last year against 1.73 which the tracker says were
summarily closed with no comment and apparently no action. The first one
is listed as fixed in the change logs for 2.0.3 and 2.3, but that was
not recorded in the tracker.

1. Incorrect line ending character. RFC 2821 and 2822 require CR/LF line
endings. PHPMailer only puts in the LF. Just because most current
clients can handle the single character is no excuse for doing it wrong.

2. Invalid use of Return-path for Sender. When you request a Sender
header, the email is written with Return-path instead. According to
those RFCs, the latter is reserved for use by transport agents and may
be rewritten or replaced anywhere in the chain. It should insert a
Sender line instead.

Bob McConnell



I wonder if that could be fixed by extending the class.
I'll have to look at it, I like standards compliance, the web would be a 
better place if standards were always strictly enforced.



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



Re: [PHP] Escape Data In/Out of db [solved]

2009-04-09 Thread tedd

At 5:03 PM +0200 4/9/09, Jan G.B. wrote:


You might want to use htmlspecialchars($str, ENT_QUOTES)


OUT from db to html

and


mysql_real_escape_string(stripslashes($_POST['yourself']));



IN to db from html

Thanks, that worked.

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



[PHP] Hello, I have a question about php array max number

2009-04-09 Thread PeterDu

Hello,

I have an array including 2000 records in database,

but when fetch all of them, why just get 1500 records? 



Does that depend on my computer?

Peter

__ Information from ESET NOD32 Antivirus, version of virus signature 
database 3997 (20090409) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



Re: [PHP] codeigniter 'secure, non-secure content' pop up message in IE7

2009-04-09 Thread 9el
On Thu, Apr 9, 2009 at 6:56 PM, Jan G.B.  wrote:

> 2009/4/9 Yannick Mortier :
> > 2009/4/9 9el :
> >> -- Forwarded message --
> >> From: Sabrina Akter 
> >> Date: Thu, Apr 9, 2009 at 1:12 AM
> >> Subject: codeigniter 'secure, non-secure content' pop up message in IE7
> >> To: phpexpe...@yahoogroups.com
> >>
> >>
> >> Hello Experts,
> >>
> >> I badly need your help. My developed site's some pages are HTTPS, and
> >> other parts are HTTP. When I try to access the HTTPS page in IE it
> >> comes up with "secure & non-secure content " warning. I search on
> >> google to find out the solution. but almost every site suggest to
> >> change the IE setting. But, its not wish way to tell every visitor's
> >> to change  the IE setting. So, I want to stop this message with some
> >> coding. while searching, I found some advice to make all image to
> >> HTTPS, for https pages, I followed that, but still i am getting this
> >> same pop up warning. Is there any other way to solve my problem? Any
> >> one can help me on it? Please do reply.
> >>
> >> With Regards
> >> 
> >> Sabrina Akter
> >> Web App. Developer
> >> 'IBACS' - www.ibacs.co.uk
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> > Look at the generated source code and try to find any files that are
> > included by absolute URL (search for http://) those have to be
> > eliminated. Make sure everything uses relative paths or comes over
> > SSL.
> >
>
> Yes. or absolute paths without protocoll and host. ;)
> works:
> src="/foo.bar"
> src="./foo.bar"
> src="https://otherserver/foo.bar";
>
>
> And also be on the lookout for blank src= attributes like in a iframe
> 
> A bug in IE will show the mentioned popup when you have such code.
> Solution: src="javascript:void(0)"
>
> Bye


Great !  making all img, CSS, js to https solved it :)


Re: [PHP] difficult select problem

2009-04-09 Thread PJ
OK, so I owe you a big one  :-*

Your code works... now, I'm faced with a horrendous problem and that is
to make sense of it all :-)   

What I seem to get from this exercise is that I don't need the ordinals
at all.
Uuuuh... that's interesting. I get it. So now, I can update my
bookInsert script to eliminate the ordinals and just use the bookID and
authID  which means I can list as may authors as I like and not
worry about limiting the number.
Looks like I will have to rewrite a bit of code. And I think this may
simplify my other code for publisher and categories.
Thank you, (kow-tow)- thank you, (kow-tow)- thank you, (kow-tow).

Now the silly questions = often I am curious what effect the differences
in code will have on performance.
For instance, why are you using author.last_name LIKE '{$Auth}%' rather
than LEFT('$Auth') ? As I have mentioned, it is not important what
follows the A

I think I understand the AS book_id and AS auth_id - is it to avoid
confusion with the book.id and author.id?

Anyway, I am beginning to see more light - could it be called
enLIGHTenment? :-D


Jim Lucas wrote:
> PJ wrote:
>> Gentlemen,
>>
>> First, let me thank you all for responding and offering suggestions. I
>> appreciate it and I am learning things.
>
> How about telling us/me what it did or did not do for you?
>
>> However, it looks like my message is not getting across:
>> The problem is not to retrieve only the authors whose last names begin
>> with A:
>>
>> 1) which books have a second author?
>> 2) who is the second author ?
>> This is determined by table book_author column ordinal (which can be 1
>> or 2) - if there is only 1 author for a book then there is no ordinal 2
>> linked to book_author bookID and authID.
>
> This is the first that I have heard about this 'ordinal'.  From your
> description above, I don't get what it does for you.  The book_author
> table should, basically, connect the books table to the authors table
> by a simple two column combination of ids.  So, I don't understand the
> significance of that field.  Could you explain it further please?
>
>>
>> The structure of the db:
>>
>> book
>>id
>>title
>>sub_title
>>descr
>>comment
>>bk_cover
>>copyright
>>ISBN
>>language
>>sellers
>>
>> author
>>id
>>first_name
>>last_name
>>   book_author
>>authID
>>bookID
>>ordinal
>>
>
> Thanks for the structure.  From this I can show you exactly what I
> would do to create the code. Minus the publishers information of
> course since you didn't supply the layout for those tables.
>
> $SQL = "
> SELECTbook.*
> FROMbook
> INNER JOINbook_authorON (book.id = book_author.bookID)
> INNER JOINauthorON (book_author.authID = author.id)
> WHEREauthor.last_name LIKE '{$Auth}%'
> ";
>
> $books = array();
> $bookIDs = array();
> if ( ( $results = mysql_query($SQL, $db) ) !== false ) {
> while ( $row = mysql_fetch_assoc($results) ) {
> $books[$row['id']] = $row;
> $bookIDs[] = $row['id'];
> }
> }
>
> if ( count($bookIDs) > 0 ) {
>
> print_r($bookIDs);
> # above should result in a structure that shows an indexed array
> of book ids for their values.
>
> $SQL = "
> SELECT book.id AS book_id, author.id AS author_id,
> author.first_name, author.last_name
> FROMbook
> INNER JOINbook_authorON (book.id = book_author.bookID)
> INNER JOINauthorON (book_author.authID = author.id)
> WHEREbook.id IN ( " . join(',', $bookIDs) . " )
> ";
>
> $authors = array();
> if ( ( $results = mysql_query($SQL, $db) ) !== false ) {
> while ( $row = mysql_fetch_assoc($results) ) {
> $authors[$row['book_id']][$row['author_id']] = $row;
> }
> }
>
> print_r($authors);
> # above should result in a multidimensional array of
> books/authors/(author data)
> # Now, you should be able to have two nexted foreach loops.
> # I will briefly give you an example.
> foreach ( $books AS $bookID => $bookData ) {
>
> # Display book information
> echo '', $bookID, '';
> print_r($bookData);
>
> # Test to see if the book has any authors
> if ( isset($authors[$bookID]) ) {
>
> # Tell us how many authors we found
> echo 'Found: ', count($author[$bookID]), ' authors';
>
($authors[$bookID]) in line above :-)
> # Loop through the authors
> foreach ( $authors[$bookID] AS $authorID => $authorData ) {
> # Display the
> echo "{$authorData['last_name']},
> {$authorData['first_name']}\n";
> }
> echo '';
> } else {
> echo 'No authors found';
> }
> echo '';
> }
> } else {
> echo 'No books match your search pattern...';
> }
>
> ?>
>
> Ok, this is the second time I have written a script for you...  You

Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-09 Thread Shawn McKenzie
Per Jessen wrote:
> Andrew Ballard wrote:
> 
>> A bit off topic, but Ctrl+I no longer brings up the Page Info in
>> Firefox like it used to -- at least on my Windows computers. (It opens
>> the bookmark list in the sidebar.) Does it do differently under Linux?
> 
> On FF 2.0.0.6 Ctrl-I brings up the info page - perhaps 3.0 changed that?
> 
> 
> /Per
> 

Same on 3.0 Linux.  Brings up the info page.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] difficult select problem

2009-04-09 Thread Andrew Ballard
On Thu, Apr 9, 2009 at 1:39 PM, PJ  wrote:
[snip]
> Now the silly questions = often I am curious what effect the differences
> in code will have on performance.
> For instance, why are you using author.last_name LIKE '{$Auth}%' rather
> than LEFT('$Auth') ? As I have mentioned, it is not important what
> follows the A

The query optimizer can use an index on author.last_name to evaluate
"WHERE author.last_name LIKE '{$Auth}%' ". It simply seeks/scans the
index since the last_name values are ordered, and starts returning
values when it reaches the first row that begins with $Auth and stops
returning rows when it finds a value is greater than the pattern.

To evaluate "WHERE LEFT('$Auth', LENGTH('$Auth')) = '$Auth' ", the
server has to calculate a substring of last_name for every row in the
table and then compare those substrings to the value $Auth.

Andrew

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



Re: [PHP] opening utf-8 files - chinese mb characters

2009-04-09 Thread Andrew Ballard
On Thu, Apr 9, 2009 at 1:53 PM, Shawn McKenzie  wrote:
> Per Jessen wrote:
>> Andrew Ballard wrote:
>>
>>> A bit off topic, but Ctrl+I no longer brings up the Page Info in
>>> Firefox like it used to -- at least on my Windows computers. (It opens
>>> the bookmark list in the sidebar.) Does it do differently under Linux?
>>
>> On FF 2.0.0.6 Ctrl-I brings up the info page - perhaps 3.0 changed that?
>>
>>
>> /Per
>>
>
> Same on 3.0 Linux.  Brings up the info page.
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>

I'm, not positive, but as I recall this stopped working even under
version 2 on Windows. I just figured it was another annoyance of a
feature that was removed for some obscure reason, kind of like no
longer being able to see the Forms tab on the Page Info screen. (You
can get an extension to add this back in, but it seems nuts to me that
they took that out.)

Sorry to hijack the thread, but I see people suggest Ctrl+I a lot for
stuff like this and it just got me wondering if there other current
versions where it still worked.

Andrew

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



[PHP] Hello, I have a question about php array max number

2009-04-09 Thread PeterDu

Hello,

I have an array including 2000 records in database,

but when fetch all of them, why just get 1500 records? 



Does that depend on my computer?

Peter

__ Information from ESET NOD32 Antivirus, version of virus signature 
database 3997 (20090409) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



Re: [PHP] Hello, I have a question about php array max number

2009-04-09 Thread Bastien Koert
On Thu, Apr 9, 2009 at 2:36 PM, PeterDu  wrote:

> Hello,
>
> I have an array including 2000 records in database,
>
> but when fetch all of them, why just get 1500 records?
>
> Does that depend on my computer?
>
> Peter
>
> __ Information from ESET NOD32 Antivirus, version of virus
> signature database 3997 (20090409) __
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Could be the memory limit on the server, could be the query only returning
1500 rows.

-- 

Bastien

Cat, the other other white meat


Re: [PHP] difficult select problem

2009-04-09 Thread PJ
Andrew Ballard wrote:
> On Thu, Apr 9, 2009 at 1:39 PM, PJ  wrote:
> [snip]
>   
>> Now the silly questions = often I am curious what effect the differences
>> in code will have on performance.
>> For instance, why are you using author.last_name LIKE '{$Auth}%' rather
>> than LEFT('$Auth') ? As I have mentioned, it is not important what
>> follows the A
>> 
>
> The query optimizer can use an index on author.last_name to evaluate
> "WHERE author.last_name LIKE '{$Auth}%' ". It simply seeks/scans the
> index since the last_name values are ordered, and starts returning
> values when it reaches the first row that begins with $Auth and stops
> returning rows when it finds a value is greater than the pattern.
>
> To evaluate "WHERE LEFT('$Auth', LENGTH('$Auth')) = '$Auth' ", the
> server has to calculate a substring of last_name for every row in the
> table and then compare those substrings to the value $Auth.
>
> Andrew
>
>   
Thanks Andrew. Just what I wanted to know. ;-)

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] unknown number of inputs

2009-04-09 Thread PJ
I have a script with $_POST and  to load data with text input.
Situation: enter name of author(s) for book. I have the script set up to
enter first_name, last_name for Author1 and the same for Author 2.
Check if entry 1 exists then proceed accordingly
Check if entry 2 exists then proceed accordingly.
Now, If I have three or more authors to enter, is there a way to add a
radio button to add more rows for input or to skip further inputs, if I
have to enter the inputs for each additional author?
I'm looking for a simple way to do this. Could or should Ajax be
involved in this somehow?

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-
Phil Jourdan --- p...@ptahhotep.com
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


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



[PHP] Re: unknown number of inputs

2009-04-09 Thread Shawn McKenzie
PJ wrote:
> I have a script with $_POST and  to load data with text input.
> Situation: enter name of author(s) for book. I have the script set up to
> enter first_name, last_name for Author1 and the same for Author 2.
> Check if entry 1 exists then proceed accordingly
> Check if entry 2 exists then proceed accordingly.
> Now, If I have three or more authors to enter, is there a way to add a
> radio button to add more rows for input or to skip further inputs, if I
> have to enter the inputs for each additional author?
> I'm looking for a simple way to do this. Could or should Ajax be
> involved in this somehow?
> 

Ajax would be a good way to go if it could be an undetermined number of
authors.  But if you have a limit (like 3 or 4 or 5) then just include
the text fields for that number.

For Ajax you might have a button or link that says "add more authors"
and when clicked the javascript adds an additional input to the form.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] Re: Hello, I have a question about php array max number

2009-04-09 Thread Jonesy
On Thu, 9 Apr 2009 10:08:12 -0700, PeterDu wrote:
> Hello,
>
> I have an array including 2000 records in database,
>
> but when fetch all of them, why just get 1500 records? 
>
> Does that depend on my computer?

Well, at least you hi-jacked a thread that did not pertain to PHP and 
put it back On Topic!



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



[PHP] Please Help Me ASAP

2009-04-09 Thread kunal sharma
 Hello,
I'm building my own website without any knowledge of PHP, & i'm almost done
with that..as my website works fine on my local server
i:e WAMPSERVER 2.0,
but the same code is not working on server...n i'm rilli 'd of coz of
that...

The error is :"PHP Parse error: syntax error, unexpected $end in
/home/usang2me/public_html/sign_up.php on line 145"

"145" happens to be last line i:e "?>" , but here becoz of pattern..itz not
into its proper way...

&
After filling the sign up form correctly . it says ALL FIELD ARE
MANDATORYi dont understand ...y soi'm pasting my code here...please
help me asap ...
each and every suggestion will be appreciat'd



Here Is The Code:

";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " Minimum length values for Username or Password or
Pincode or Mobile is missing. Please try again with correct
values.   ";
include 'signup.php';
exit;
//die("User/password was not long enough!");
}elseif (!is_numeric($code) || !is_numeric($phone)){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " Non Numeric Character Where only Numeric Value is
Allowed.   ";
include 'signup.php';
exit;
//}elseif (empty($username)|| empty($password1) || empty($password2) ||
empty($name) || empty($address) || empty($city) || empty($state) ||
empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
//echo "";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo "";
//echo " All fields are Mandatory
  //";
//include 'signup.php';
}else{
// checks if the username is in use
$checkuser = mysql_query("SELECT username FROM id_users WHERE
username='$username'");
$username_exist = mysql_num_rows($checkuser);
$referid = mysql_query("SELECT username FROM id_users WHERE
username='$refer_id'");
$referid_exist = mysql_num_rows($referid);
if($username_exist != 0){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the username you specified has
already been taken. Please pick another one.
  ";
unset($username);
include 'signup.php';
}elseif($referid_exist > 0){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the referral id doesn't exist. Please
check the referral id or enter the valid one.
  ";
unset($username);
include 'signup.php';
}else{
// this makes sure both passwords entered match
if ($password1 != $password2) {
die('Your passwords did not match.');
}else{
//}
// now we insert it into the database
//$password3 = md5($_POST['password1']);//
$insert = "INSERT INTO id_users (username, password, name, address, city,
state, code, phone, email, payment_status, member_status, total_member,
refer_id)
VALUES ('$username', '$password1', '$name', '$address', '$city', '$state',
'$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users
SET refer_id = '1' where username = 'refer_id';";
$queries =
preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/",
$insert);
foreach ($queries as $query){
if (strlen(trim($query)) != 0) mysql_query($query) or die(mysql_error());
}
//mysql_query($insert) or die(mysql_error());
//mysql_close();

//$update = "update id_users set refer_id='1' where username='refer_id'";
//mysql_query($update) or die(mysql_error());
//mysql_close();
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " You have successfully Registered, Please
Login   ";
include 'login.php';
}
}
}
?>

Thanks Kunal


Re: [PHP] Please Help Me ASAP

2009-04-09 Thread Jason Pruim



Jason Pruim

On Apr 9, 2009, at 11:03 PM, kunal sharma  wrote:


Hello,
I'm building my own website without any knowledge of PHP, & i'm  
almost done

with that..as my website works fine on my local server
i:e WAMPSERVER 2.0,
but the same code is not working on server...n i'm rilli 'd of  
coz of

that...

The error is :"PHP Parse error: syntax error, unexpected $end in
/home/usang2me/public_html/sign_up.php on line 145"

"145" happens to be last line i:e "?>" , but here becoz of  
pattern..itz not

into its proper way...

&
After filling the sign up form correctly . it says ALL FIELD ARE
MANDATORYi dont understand ...y soi'm pasting my code  
here...please

help me asap ...
each and every suggestion will be appreciat'd



Here Is The Code:

if (strlen($username) < $minuser_len || strlen($password1) <  
$minpass_len ||

strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
{
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " style=font-size:11pt;>Minimum length values for Username or  
Password or

Pincode or Mobile is missing. Please try again with correct
values.   ";
include 'signup.php';
exit;
//die("User/password was not long enough!");
}elseif (!is_numeric($code) || !is_numeric($phone)){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " style=font-size:11pt;>Non Numeric Character Where only Numeric  
Value is

Allowed.   ";
include 'signup.php';
exit;
//}elseif (empty($username)|| empty($password1) || empty($password2)  
||

empty($name) || empty($address) || empty($city) || empty($state) ||
empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
//echo "";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo " ";
//echo "";
//echo " style=font-size:11pt;>All fields are Mandatoryp>

  //";
//include 'signup.php';
}else{
// checks if the username is in use
$checkuser = mysql_query("SELECT username FROM id_users WHERE
username='$username'");
$username_exist = mysql_num_rows($checkuser);
$referid = mysql_query("SELECT username FROM id_users WHERE
username='$refer_id'");
$referid_exist = mysql_num_rows($referid);
if($username_exist != 0){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " I'm sorry but the username you specified has
already been taken. Please pick another one.td>

  ";
unset($username);
include 'signup.php';
}elseif($referid_exist > 0){
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " style=font-size:11pt;>I'm sorry but the referral id doesn't  
exist. Please
check the referral id or enter the valid one.td>

  ";
unset($username);
include 'signup.php';
}else{
// this makes sure both passwords entered match
if ($password1 != $password2) {
die('Your passwords did not match.');
}else{
//}
// now we insert it into the database
//$password3 = md5($_POST['password1']);//
$insert = "INSERT INTO id_users (username, password, name, address,  
city,
state, code, phone, email, payment_status, member_status,  
total_member,

refer_id)
VALUES ('$username', '$password1', '$name', '$address', '$city',  
'$state',
'$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE  
id_users

SET refer_id = '1' where username = 'refer_id';";
$queries =
preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\ 
\']*[^'|^\\\']$)/",

$insert);
foreach ($queries as $query){
if (strlen(trim($query)) != 0) mysql_query($query) or  
die(mysql_error());

}
//mysql_query($insert) or die(mysql_error());
//mysql_close();

//$update = "update id_users set refer_id='1' where  
username='refer_id'";

//mysql_query($update) or die(mysql_error());
//mysql_close();
echo "";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo " ";
echo "";
echo " You have successfully Registered, Please
Login   ";
include 'login.php';
}
}
}
?>

Thanks Kunal


Just based on a quick look i'd guess you don't have the right number  
of curly braces at the end of the file. 


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



Re: [PHP] Re: unknown number of inputs

2009-04-09 Thread Jim Lucas

Shawn McKenzie wrote:

PJ wrote:

I have a script with $_POST and  to load data with text input.
Situation: enter name of author(s) for book. I have the script set up to
enter first_name, last_name for Author1 and the same for Author 2.
Check if entry 1 exists then proceed accordingly
Check if entry 2 exists then proceed accordingly.
Now, If I have three or more authors to enter, is there a way to add a
radio button to add more rows for input or to skip further inputs, if I
have to enter the inputs for each additional author?
I'm looking for a simple way to do this. Could or should Ajax be
involved in this somehow?



Ajax would be a good way to go if it could be an undetermined number of
authors.  But if you have a limit (like 3 or 4 or 5) then just include
the text fields for that number.

For Ajax you might have a button or link that says "add more authors"
and when clicked the javascript adds an additional input to the form.



This isn't a job for AJAX, it is a job for JavaScript.

REF:

AJAX - http://en.wikipedia.org/wiki/Ajax_(programming)

Dynamic Form Generation - 
http://www.faqts.com/knowledge_base/view.phtml/aid/1785/fid/129

I did a quick Google and came up with the two above examples.  Others might have better suggestions. 
 But I just wanted to point out the difference.  AJAX, IMO, is bases on JavaScript talking to a 
server with the intent to send/receive data.  DHTML/JavaScript/etc... are was to do what you are 
asking without ever needing to talk with the server.  So it doesn't involve anything that AJAX was 
designed to solve.


I simply wanted to point out the different uses.  Hope I didn't step on 
anybodies toes.

--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] Escape Data In/Out of db [solved]

2009-04-09 Thread Jim Lucas

tedd wrote:

At 5:03 PM +0200 4/9/09, Jan G.B. wrote:


You might want to use htmlspecialchars($str, ENT_QUOTES)


OUT from db to html

and


mysql_real_escape_string(stripslashes($_POST['yourself']));




The above tells me that you probably need to look at your magic quotes setting.

Typically, you will want to disable magic quotes in your php.ini file / VirtualHost Block / or 
somewhere else.  This setting tells PHP to automagically escape your GET/POST data when PHP receives 
it from the web server (Apache/IIS/etc...).  I recommend turning it off, but making darn sure you 
sanitize all input to script from and outside source.




IN to db from html

Thanks, that worked.

Cheers,

tedd





--
Jim Lucas

   "Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare

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



[PHP] A Tool For Building PHP Web Apps

2009-04-09 Thread Paul M Foster
Here's a hairbrained idea I was kicking around. I object to the idea of
including 15 or 30 files in a PHP application just to display one page
on the internet. It makes the coding faster, but it makes the display
slower and seems silly to me.

So what if you had a tool or a set of tools where you could write code
snippets and such, and then hit a button or issue a command, and
everything you specified got written into a single file? You'd specify
that this page needs to read the config, set up a database connection,
validate these fields, etc. When you were done, it would write all this
code to a *single* file, which the user would invoke by surfing to that
page. The resulting code would be *static*, not like what results from
most templating systems. So rather than specify a specific variable
value in the resulting file, it would embed the PHP code to display the
variable, etc.

What might be the liabilities of something like that? Would there be
security issues? Would there be increased difficulty in debugging? What
can you think of?

Paul

-- 
Paul M. Foster

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



RE: [PHP] A Tool For Building PHP Web Apps

2009-04-09 Thread Asher Snyder
This might be what you're looking for:
http://www.roadsend.com/home/index.php

-Original Message-
From: Paul M Foster [mailto:pa...@quillandmouse.com] 
Sent: Friday, April 10, 2009 1:28 AM
To: php-general@lists.php.net
Subject: [PHP] A Tool For Building PHP Web Apps

Here's a hairbrained idea I was kicking around. I object to the idea of
including 15 or 30 files in a PHP application just to display one page
on the internet. It makes the coding faster, but it makes the display
slower and seems silly to me.

So what if you had a tool or a set of tools where you could write code
snippets and such, and then hit a button or issue a command, and
everything you specified got written into a single file? You'd specify
that this page needs to read the config, set up a database connection,
validate these fields, etc. When you were done, it would write all this
code to a *single* file, which the user would invoke by surfing to that
page. The resulting code would be *static*, not like what results from
most templating systems. So rather than specify a specific variable
value in the resulting file, it would embed the PHP code to display the
variable, etc.

What might be the liabilities of something like that? Would there be
security issues? Would there be increased difficulty in debugging? What
can you think of?

Paul

-- 
Paul M. Foster

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



RE: [PHP] Please Help Me ASAP

2009-04-09 Thread abdulazeez alugo


 

> Date: Fri, 10 Apr 2009 08:33:10 +0530
> From: usang...@gmail.com
> To: php-general@lists.php.net
> Subject: [PHP] Please Help Me ASAP
> 
> Hello,
> I'm building my own website without any knowledge of PHP, & i'm almost done
> with that..as my website works fine on my local server
> i:e WAMPSERVER 2.0,
> but the same code is not working on server...n i'm rilli 'd of coz of
> that...
> 
> The error is :"PHP Parse error: syntax error, unexpected $end in
> /home/usang2me/public_html/sign_up.php on line 145"
> 
> "145" happens to be last line i:e "?>" , but here becoz of pattern..itz not
> into its proper way...
> 
> &
> After filling the sign up form correctly . it says ALL FIELD ARE
> MANDATORYi dont understand ...y soi'm pasting my code here...please
> help me asap ...
> each and every suggestion will be appreciat'd
> 
> 
> 
> Here Is The Code:
> 
>  $username = $_POST['username'];
> $password1 = $_POST['password1'];
> $password2 = $_POST['password2'];
> $name = $_POST['name'];
> $address = $_POST['address'];
> $city = $_POST['city'];
> $state = $_POST['state'];
> $code = $_POST['code'];
> $phone = $_POST['phone'];
> $email = $_POST['email'];
> //$bankname = $_POST['bankname'];
> //$bankbranch = $_POST['bankbranch'];
> //$accountnumber = $_POST['bankac'];
> $refer_id = $_POST['refer_id'];
> //$country = $_POST['country'];
> // Connects to your Database
> include('database_connect_local.php');
> //This makes sure they did not leave any fields blank
> $minuser_len = 6; //username minimum length
> $minpass_len = 6; //password minimum length
> $mincode_len = 6; //code minimum length
> $minphone_len = 10; //phone minimum length
> //$refer_id_len = 6; //refer_id minimum length
> 
> if (strlen($username) < $minuser_len || strlen($password1) < $minpass_len ||
> strlen($code) < $mincode_len || strlen($phone) < $minphone_len)
> {
> echo "";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> echo "  style=font-size:11pt;>Minimum length values for Username or Password or
> Pincode or Mobile is missing. Please try again with correct
> values.   ";
> include 'signup.php';
> exit;
> //die("User/password was not long enough!");
> }elseif (!is_numeric($code) || !is_numeric($phone)){
> echo "";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> echo "  style=font-size:11pt;>Non Numeric Character Where only Numeric Value is
> Allowed.   ";
> include 'signup.php';
> exit;
> //}elseif (empty($username)|| empty($password1) || empty($password2) ||
> empty($name) || empty($address) || empty($city) || empty($state) ||
> empty($code) || //empty($phone) || empty($email) || empty($refer_id)){
> //echo "";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " ";
> //echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> //echo "  style=font-size:11pt;>All fields are Mandatory
>   //";
> //include 'signup.php';
> }else{
> // checks if the username is in use
> $checkuser = mysql_query("SELECT username FROM id_users WHERE
> username='$username'");
> $username_exist = mysql_num_rows($checkuser);
> $referid = mysql_query("SELECT username FROM id_users WHERE
> username='$refer_id'");
> $referid_exist = mysql_num_rows($referid);
> if($username_exist != 0){
> echo "";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> echo "  style=font-size:11pt;>I'm sorry but the username you specified has
> already been taken. Please pick another one.
>   ";
> unset($username);
> include 'signup.php';
> }elseif($referid_exist > 0){
> echo "";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " ";
> echo " bordercolor=#FF6600 bgcolor=#C0C0C0 width=50% height=10>";
> echo "  style=font-size:11pt;>I'm sorry but the referral id doesn't exist. Please
> check the referral id or enter the valid one.
>   ";
> unset($username);
> include 'signup.php';
> }else{
> // this makes sure both passwords entered match
> if ($password1 != $password2) {
> die('Your passwords did not match.');
> }else{
> //}
> // now we insert it into the database
> //$password3 = md5($_POST['password1']);//
> $insert = "INSERT INTO id_users (username, password, name, address, city,
> state, code, phone, email, payment_status, member_status, total_member,
> refer_id)
> VALUES ('$username', '$password1', '$name', '$address', '$city', '$state',
> '$code', '$phone', '$email', '0', '0', '0', '$refer_id'); UPDATE id_users
> SET refer_id = '1' where username = 'refer_id';";
> $queries =
> preg_split("/;+(?=([^'|^\\\']*['|\\\'][^'|^\\\']*['|\\\'])*[^'|^\\\']*[^'|^\\\']$)/",
> $