php-general Digest 16 Apr 2009 08:50:47 -0000 Issue 6070
Topics (messages 291527 through 291548):
Re: header() and passing sessions
291527 by: abdulazeez alugo
291529 by: Adam Williams
291532 by: Shawn McKenzie
291533 by: Shawn McKenzie
Re: redirect to a page the fist time a site is accessed
291528 by: Andrew Ballard
291540 by: Don
291548 by: Jencisson Tsu
Re: PDO fetch_obj - question
291530 by: talofo talofo
Re: https and Credit Cards
291531 by: ×× ××× ×× ××
Re: bug or expected, mbstring.func_overload not changeable by .htaccess
5.2.8/5.2.9
291534 by: Thodoris
Re: cURL - Error 400
291535 by: haliphax
291546 by: David
GIS with PHP tutorial
291536 by: Diptanjan
291538 by: Adam Williams
help with statement
291537 by: Terion Miller
Re: alt() - unknown function?
291539 by: Paul M Foster
Re: try - catch is not so clear to me...
291541 by: Al
Re: Generate XHTML (HTML compatible) Code using DOMDocument
291542 by: Raymond Irving
291543 by: Raymond Irving
291547 by: Michael Shadle
ftp_put issues
291544 by: James
291545 by: Chris
Administrivia:
To subscribe to the digest, e-mail:
[email protected]
To unsubscribe from the digest, e-mail:
[email protected]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
> Date: Wed, 15 Apr 2009 11:09:19 -0500
> From: [email protected]
> To: [email protected]
> Subject: [PHP] header() and passing sessions
>
> I need some help passing a session variable with a header() function.
> According to www.php.net/header, the documentation states:
>
> *Note*: Session ID is not passed with Location header even if
> session.use_trans_sid
> <session.configuration.php#ini.session.use-trans-sid> is enabled. It
> must by passed manually using *SID* constant.
>
> so, I'm trying to manually pass the SID, but not having any luck. Here
> is a snippet of my code:
>
> There is a file login.php which has session_start(); and sets
> $_SESSION["username"] with the username you logged in with from
> index.php and has a form to click View Pending Requests which has the
> action of option.php.
>
> -- option.php --
> <?php
> session_start();
> if ($_POST["option"] == "View Pending Requests")
> {
> header('Location:
> http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
> }
> ?>
>
> --viewpending.php --
> <?php
> session_start();
> if (!$_SESSION["username"])
> {
> echo "You have not logged in";
> exit;
> }
> ?>
>
> so you click on View Pending Requests, and the URL in your browser is:
>
> http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=du75p41hel9k1vpuah799l2ce7
>
> but viewpending.php says "You have not logged in". Why is that?
Hi,
Well I'ld say the reason is quite obvious. You have simply not set
$_session["username"] . I'ld have done something like:
-- option.php --
<?php
session_start();
if ($_POST["option"] == "View Pending Requests")
{
$_session["username"]= true; //sets the session
header('Location:
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.SID); //
I'ld use SID
}
?>
--viewpending.php -
<?php
session_start();
if ($_SESSION["username"] !=true)
{
echo "You have not logged in";
exit;
}
?>
I hope this helps. try it.
Cheers
Alugo Abdulazeez
_________________________________________________________________
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.
http://www.microsoft.com/windows/windowslive/products/photos.aspx
--- End Message ---
--- Begin Message ---
abdulazeez alugo wrote:
Hi,
Well I'ld say the reason is quite obvious. You have simply not set
$_session["username"] . I'ld have done something like:
-- option.php --
<?php
session_start();
if ($_POST["option"] == "View Pending Requests")
{
$_session["username"]= true; //sets the session
header('Location:
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.SID);
//
<http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=%27.SID%29;%A0%A0%A0+//>
I'ld use SID
}
?>
--viewpending.php -
<?php
session_start();
if ($_SESSION["username"] !=true)
{
echo "You have not logged in";
exit;
}
?>
I hope this helps. try it.
Cheers
Alugo Abdulazeez
Well the thing is, $_SESSION["username"] is set. If I change option.php to:
<?php
session_start();
echo "session username is ".$_SESSION["username"];
/*if ($_POST["option"] == "View Pending Requests")
{
header('Location:
http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
}
*/
?>
and click on View Pending Requests, it prints:
session username is awilliam
--- End Message ---
--- Begin Message ---
Adam Williams wrote:
> I need some help passing a session variable with a header() function.
> According to www.php.net/header, the documentation states:
>
> *Note*: Session ID is not passed with Location header even if
> session.use_trans_sid
> <session.configuration.php#ini.session.use-trans-sid> is enabled. It
> must by passed manually using *SID* constant.
>
> so, I'm trying to manually pass the SID, but not having any luck. Here
> is a snippet of my code:
>
> There is a file login.php which has session_start(); and sets
> $_SESSION["username"] with the username you logged in with from
> index.php and has a form to click View Pending Requests which has the
> action of option.php.
>
> -- option.php --
> <?php
> session_start();
> if ($_POST["option"] == "View Pending Requests")
> {
> header('Location:
> http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
>
> }
> ?>
>
> --viewpending.php --
> <?php
> session_start();
> if (!$_SESSION["username"])
> {
> echo "You have not logged in";
> exit;
> }
> ?>
>
> so you click on View Pending Requests, and the URL in your browser is:
>
> http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=du75p41hel9k1vpuah799l2ce7
>
>
> but viewpending.php says "You have not logged in". Why is that?
>
>
What does this display: echo session_name();
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Adam Williams wrote:
> I need some help passing a session variable with a header() function.
> According to www.php.net/header, the documentation states:
>
> *Note*: Session ID is not passed with Location header even if
> session.use_trans_sid
> <session.configuration.php#ini.session.use-trans-sid> is enabled. It
> must by passed manually using *SID* constant.
>
> so, I'm trying to manually pass the SID, but not having any luck. Here
> is a snippet of my code:
>
> There is a file login.php which has session_start(); and sets
> $_SESSION["username"] with the username you logged in with from
> index.php and has a form to click View Pending Requests which has the
> action of option.php.
>
> -- option.php --
> <?php
> session_start();
> if ($_POST["option"] == "View Pending Requests")
> {
> header('Location:
> http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID='.session_id());
>
> }
> ?>
>
> --viewpending.php --
> <?php
> session_start();
> if (!$_SESSION["username"])
> {
> echo "You have not logged in";
> exit;
> }
> ?>
>
> so you click on View Pending Requests, and the URL in your browser is:
>
> http://intra.mdah.state.ms.us/helpdesk/viewpending.php?PHPSESSID=du75p41hel9k1vpuah799l2ce7
>
>
> but viewpending.php says "You have not logged in". Why is that?
>
>
What does this display: echo session_name();
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim <[email protected]> wrote:
>
>
> On Apr 14, 2009, at 10:11 PM, "Don" <[email protected]> wrote:
>
>> Hi,
>>
>> I have some code in my index.php file that check the user agent and
>> redirects to a warning page if IE 6 or less is encountered.
>>
>> 1. I'm using a framework and so calls to all pages go through index.php
>> 2. The code that checks for IE 6 or less and redirects is in index.php
>>
>> I know how to redirect the users but what I want to do is redirect a user
>> ONLY the first time the web site is accessed regardless of what page they
>> first access. I would like to minimize overhead (no database). Can this
>> be
>> done?
>>
>> Thanks,
>> Don
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> Probably the best way I could think of would be to set a cookie on their
> computer that you check for when they come and redirect based on that
> cookie.
>
> It's not completely fail proof because all they have to do is clear cookies
> and they will see it again but it should work for most people.
Well, there is that ... and if the browser does not accept your
cookie, it will be trapped in an infinte redirection cycle.
Andrew
--- End Message ---
--- Begin Message ---
"Andrew Ballard" <[email protected]> wrote in message
news:[email protected]...
On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim <[email protected]> wrote:
>
>
> On Apr 14, 2009, at 10:11 PM, "Don" <[email protected]> wrote:
>
>> Hi,
>>
>> I have some code in my index.php file that check the user agent and
>> redirects to a warning page if IE 6 or less is encountered.
>>
>> 1. I'm using a framework and so calls to all pages go through index.php
>> 2. The code that checks for IE 6 or less and redirects is in index.php
>>
>> I know how to redirect the users but what I want to do is redirect a user
>> ONLY the first time the web site is accessed regardless of what page they
>> first access. I would like to minimize overhead (no database). Can this
>> be
>> done?
>>
>> Thanks,
>> Don
>>
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> Probably the best way I could think of would be to set a cookie on their
> computer that you check for when they come and redirect based on that
> cookie.
>
> It's not completely fail proof because all they have to do is clear
> cookies
> and they will see it again but it should work for most people.
> Well, there is that ... and if the browser does not accept your
> cookie, it will be trapped in an infinte redirection cycle.
> Andrew
Yes and from php.net,
"Cookies will not become visible until the next loading of a page that the
cookie should be visible for."
So there's no PHP solution for my problem? I think I need to use unreliable
JavaScript.
--- End Message ---
--- Begin Message ---
hey,boy, i think you should use datebase to store user status,use user's
internet-ip and intranet-ip to idenification.
> To: [email protected]
> From: [email protected]
> Date: Wed, 15 Apr 2009 16:20:05 -0400
> Subject: Re: [PHP] redirect to a page the fist time a site is accessed
>
>
> "Andrew Ballard" <[email protected]> wrote in message
> news:[email protected]...
> On Tue, Apr 14, 2009 at 10:30 PM, Jason Pruim <[email protected]> wrote:
> >
> >
> > On Apr 14, 2009, at 10:11 PM, "Don" <[email protected]> wrote:
> >
> >> Hi,
> >>
> >> I have some code in my index.php file that check the user agent and
> >> redirects to a warning page if IE 6 or less is encountered.
> >>
> >> 1. I'm using a framework and so calls to all pages go through index.php
> >> 2. The code that checks for IE 6 or less and redirects is in index.php
> >>
> >> I know how to redirect the users but what I want to do is redirect a user
> >> ONLY the first time the web site is accessed regardless of what page they
> >> first access. I would like to minimize overhead (no database). Can this
> >> be
> >> done?
> >>
> >> Thanks,
> >> Don
> >>
> >>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> > Probably the best way I could think of would be to set a cookie on their
> > computer that you check for when they come and redirect based on that
> > cookie.
> >
> > It's not completely fail proof because all they have to do is clear
> > cookies
> > and they will see it again but it should work for most people.
>
> > Well, there is that ... and if the browser does not accept your
> > cookie, it will be trapped in an infinte redirection cycle.
>
> > Andrew
>
> Yes and from php.net,
>
> "Cookies will not become visible until the next loading of a page that the
> cookie should be visible for."
>
> So there's no PHP solution for my problem? I think I need to use unreliable
> JavaScript.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
Windows Live™: Life without walls.
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_allup_1b_explore_042009
--- End Message ---
--- Begin Message ---
Thanks. I will see. The script for my database was been generated so, I will
doublecheck this uppercase "issue"...
Regards,
Márcio
2009/4/15 Thodoris <[email protected]>
>
> Hi there, I’ve made a fetch_obj and, as stated on some sites, it returns
>> a anonymous
>> object where the properties will have the name of our columns database.
>> However, when I do this, I notice that instead of giving me the column
>> names
>> as they are typed on the DB I get them uppercase. So, when my database
>> field
>> is “id_dog” to retrieve the property properly I have to search for
>> “ID_DOG”
>> Why is this? Is this a normal behavior?
>> Thanks a lot,
>> Márcio
>>
>>
>>
> I have just dumped an object using var_dump retrieved with pdo fetch object
> method:
>
> object(stdClass)#3 (4) {
> ["id"]=>
> string(1) "1"
> ["cat"]=>
> string(1) "1"
> ["cod_sin"]=>
> string(6) "120014"
> ["cod_uis"]=>
> string(2) "26"
> }
>
>
> and it seems quite normal to me. Try to see your table info using:
>
> describe `tablename`;
>
> To see what are your table's fields .
>
> Try to include more info about your system, php version etc in case you
> reply. It will help us to help you.
>
> --
> Thodoris
>
>
--- End Message ---
--- Begin Message ---
You are right - Decline the job, you don't want any credit-card stealing on
your head
On Wed, Apr 15, 2009 at 1:10 PM, Richard Heyes <[email protected]> wrote:
> Hi,
>
> > To add to what others have said: CC processors with which I have worked
> will
> > audit your site *before* certifying your site to accept CC information.
> In
> > other words, if you don't do SSL, you won't be *allowed* to process
> cards.
>
> FWIW, companies exist that will host your "buy" page(s), so you don't
> end up with the hassle of buying and installing your own SSL
> certificate.
>
> --
> Richard Heyes
>
> HTML5 Canvas graphing for Firefox, Chrome, Opera and Safari:
> http://www.rgraph.net (Updated April 11th)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hello,
following in my .htaccess works with php 5.2.6 (mod_php)
php_value mbstring.func_overload 2
Seems that since (5.2.7?) 5.2.8/5.2.9 this value is not any more
accepted by php in .htaccess.
mbstring.func_overload should be changeable by PHP_INI_PERDIR which
includes .htaccess
Other values are changeable by .htaccess so it should not be a general
problem on my side.
Please someone could check this?
Thanks,
Andre
Besides the .htaccess which might be an apache configuration problem if
you use ini_set("mbstring.func_overload",2) in a script of this
directory does it work?
In addition to this heck your apache configuration to see if you allow
.htaccess to be parsed.
--
Thodoris
--- End Message ---
--- Begin Message ---
On Wed, Apr 15, 2009 at 10:36 AM, David <[email protected]> wrote:
> I was wondering if anyone could please help me with this cURL script since I
> keep getting error 400 from the web server:
>
> http://pastebin.ca/1392840
>
> It worked until around a month ago which is when they presumably made
> changes to the site. Except I can't figure out what configuration option in
> the cURL PHP script needs to be changed. I can visit the site perfectly in
> Lynx, Firefox and IE.
Are you just trying to get the contents of the page, or is there
something special you're doing? If it's just the contents you're
after, try file_get_contents() if allow_url_fopen is set to TRUE for
your PHP installation.
http://php.net/file_get_contents
http://php.net/allow_url_fopen
Hope this helps,
--
// Todd
--- End Message ---
--- Begin Message ---
Except I also need to POST data to the server to login. After I've logged
in, I then need to use cookies to maintain a session.
Doing that via file_get_contents() just isn't possible.
Thanks
On Thu, Apr 16, 2009 at 2:30 AM, haliphax <[email protected]> wrote:
> On Wed, Apr 15, 2009 at 10:36 AM, David <[email protected]>
>> wrote:
>> > I was wondering if anyone could please help me with this cURL script
>> since I
>> > keep getting error 400 from the web server:
>> >
>> > http://pastebin.ca/1392840
>> >
>> > It worked until around a month ago which is when they presumably made
>> > changes to the site. Except I can't figure out what configuration option
>> in
>> > the cURL PHP script needs to be changed. I can visit the site perfectly
>> in
>> > Lynx, Firefox and IE.
>>
>> Are you just trying to get the contents of the page, or is there
>> something special you're doing? If it's just the contents you're
>> after, try file_get_contents() if allow_url_fopen is set to TRUE for
>> your PHP installation.
>>
>> http://php.net/file_get_contents
>> http://php.net/allow_url_fopen
>>
>> Hope this helps,
>>
>>
>> --
>> // Todd
>>
>
>
--- End Message ---
--- Begin Message ---
Hi Gurus,
I was just wondering if there is any good tutorial on GIS with PHP ?
Tried googling but did'nt find anything real good.
Any help will be appreciated.
Regards
Diptanjan
--
View this message in context:
http://www.nabble.com/GIS-with-PHP-tutorial-tp23065797p23065797.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
have you looked into this? http://postgis.refractions.net/
--- End Message ---
--- Begin Message ---
I'm trying to take a paragraph then break it into linebreaks and grab each
line separately but it's not working, I can get the paragraph but my lines
are not I get the object id #6 or #7 everytime
Here's my code
// grab all the paragraphs on the page
$xpath = new DOMXPath($dom);
//$graphs = $xpath->evaluate("/html/body//p");
$graphs=$dom->getElementsByTagName("p");
$lines=$dom->getElementsByTagName("br");
// Set $i =5 because first 5 paragraphs are not inspections
for ($i = 5; $i+1 < $graphs->length; $i++) {
$paragraph = $graphs->item($i);
$text = $dom->saveXML($paragraph);
$text = trim($text);
/*
//my experiment for getting line br
for ($b = 1; $b+1 < $lines->length; $b++) {*/
$title = $lines->item($i);
$addie= $lines->item($i);
if($TESTING)
echo "<br />$i Graph: " . $text . "<br />";
echo "<br />$line: " . $title . "<br />";
echo "<br/>$line:" . $addie . "<br/>";
// }
}
?>
Thanks
Terion
Happy Freecycling
Free the List !!
www.freecycle.org
Over Moderation of Freecycle List Prevents Post Timeliness.
Report Moderator Abuse Here:
http://www.freecycle.org/faq/faq/contact-info
Or Email Your Complaint to:
[email protected] or [email protected]
------------------------------------------------
Twitter?
http://twitter.com/terionmiller
------------------------------------------------
Facebook:
<a href="http://www.facebook.com/people/Terion-Miller/1542024891"
title="Terion Miller's Facebook profile" target=_TOP><img src="
http://badge.facebook.com/badge/1542024891.237.919247960.png" border=0
alt="Terion Miller's Facebook profile"></a>
--- End Message ---
--- Begin Message ---
On Wed, Apr 15, 2009 at 03:23:19PM +0100, Tom Calpin wrote:
> Hi all,
>
> I've just started looking at the code of an e-commerce site we are taking
> over the development of, that another company has previously developed .
> Coupled with the difficulty of taking over development of someone else's
> code (also poorly commented), I've been stumped by a fatal error on a
> function call alt() which is dotted everywhere in the main templating script
> (sample below):
>
> // Get/Set a specific property of a page
> function getPageProp($prop,$id="") { return
> $this->PAGES[alt($id,$this->getPageID())][$prop]; }
> function setPageProp($prop,$val,$id="") {
> $this->PAGES[alt($id,$this->getPageID())][$prop]=$val; }
>
> It looks to be defining properties for a list of pages, with each page
> providing its own PageID.
>
> I've never seen this function before, nor can I find any definition of it in
> the site code, I was wondering if anyone recognises this, is it from a
> thirdparty templating tool at all?
It's been suggested you do a thorough search for this function, but the
fact that PHP isn't finding it in the first place leads me to believe it
isn't there. If that's the case, I'd suggest you make up your own alt()
function that does what you think this one is doing (maybe just return
the passed variable). You'll have to decide where to put it that's
visible in all the places where it's called.
Paul
--
Paul M. Foster
--- End Message ---
--- Begin Message ---
Lamp Lists wrote:
hi to all!
actually, the statement in the Subject line is not 100% correct. I understand
the purpose and how it works (at least I think I understand :-)) but to me it's
so complicated way?
let's take a look in example from php.net(http://us3.php.net/try)
<?php
function inverse($x) {
if (!$x) {
throw new Exception('Division by zero.');
}
else return 1/$x;
}
try {
echo inverse(5) . "\n";
echo inverse(0) . "\n";
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
// Continue execution
echo 'Hello World';
?>
I would do the same thing, I think, less complicated:
<?php
function inverse($x)
{
if (!$x) {
echo 'Division by zero';
}
else return 1/$x;
}
echo inverse(5);
echo inverse(0);
// Continue execution
echo 'Hello world';
?>
I know this is "too simple, maybe not the best example", but can somebody please explain
"the purpose" of try/catch?
Thanks.
-LL
Here is a practical example that may help you.
Each of the functions can throw an exception, which causes
the flow to jump to the catch block.
try
{
$checksOK = true;
checkEmailAddr($userSubmitedDataArray[EMAIL_ADDR_FIELD]);
checkPhoneDigits($userSubmitedDataArray[PHONE_NUM_FIELD],'phone');
checkNotes($userSubmitedDataArray, $sizesArray);
}
catch (Exception $e)
{
//Message text in check functions
$userErrorMsg = $e->getMessage();
}
Here is one of the functions:
function checkEmailAddr($emailAddr)
{
if(empty($emailAddr))
{
throw new Exception("No email address provided");
}
if(!preg_match("%...@%", $emailAddr))
{
throw new Exception("Email address missing mailbox
name.");
}
if(!filter_var($emailAddr, FILTER_VALIDATE_EMAIL))
{
throw new Exception("Email address error. Syntax is
wrong. ");
}
$domain = substr(strchr($emailAddr, '@'), 1);
if(!checkdnsrr($domain))
{
throw new Exception("Email address warning.
Specified domain \"$domain\" appears to be invalid. Check
carefully.");
}
return true;
}
--- End Message ---
--- Begin Message ---
Thanks for your feedback.
__
Raymond Irving
--- On Tue, 4/14/09, Michael A. Peters <[email protected]> wrote:
> From: Michael A. Peters <[email protected]>
> Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument
> To: "Raymond Irving" <[email protected]>
> Cc: [email protected]
> Date: Tuesday, April 14, 2009, 8:09 PM
> Raymond Irving wrote:
> > Hi,
> >
> > I'm thinking about using the html5 doctype for all
> html documents since it's supported by all the popular
> browsers available today.
> > Two Quick questions...
> > Why do we need to send XHTML code to a web browser
> when standard html code (with html 5 doctype) will do just
> fine?
>
> In most cases we don't.
> However if we want to include extensions (such as MathML
> etc.) then xhtml is the only way to do it.
>
> My own reason for sending xhtml is because I believe it to
> be a superior specification and would like to see html
> (where not all tags need to be closed) go away.
>
> Having valid x(ht)ml output also means that other software
> that uses your web page as a source for data can just parse
> it as xml to get the data it needs.
>
> Be careful with html 5 - use the fallbacks (IE embed or
> object for video as a fallback to the video tag), because
> not everyone uses the latest browsers.
>
> >
> > Is there any advantage of using xhtml in the web
> browser over html for normal web application development?
> >
>
> In most cases, not a display advantage.
>
> HTML 1.1 supports the ruby tags/attribute, html 4 does not,
> but with html 5 / xhtml 5 - they are supposedly identical in
> spec with the only difference being the markup semantics of
> xhtml 5 conform to xml standards. I suspect html 5
> elements/attributes are case insensitive (like they are for
> previous html) but I haven't checked - xhtml tags/attributes
> need to be lower case.
>
> But if your page can be properly displayed with valid html
> then the only technical advantage I can think of for using
> xhtml is for apps that use your page as a data source (so
> they don't have to convert it to xml).
>
> I personally will send xhtml most of the time when I can
> because I want HTML to go away, and as soon as 97% of
> browsers properly support xhtml, I may stop sending html all
> together. Since IE 8 still does not (not will correct mime
> type anyway) it will be years before that happens.
>
> Oh - another advantage to xhtml - it's easy to extend for
> your own use.
> For example, you can add a custom attribute for your own
> use (IE as hooks for other web apps on other sites to use
> when grabbing data from your site, or whatever) and it will
> validate as long as you properly declare it. With html, I
> believe adding an attribute is not allowed unless you create
> a whole new DTD.
>
--- End Message ---
--- Begin Message ---
Thanks for the feedback.
I too like xhtml but I think I like the option of serving both. My only concern
is that a proxy server might cache an xhtml page and then serve it to a
non-xhtml browser.
Do you think it's possible that a proxy might serve the xhtml source to the
wrong browser?
__
Raymond Irving
--- On Tue, 4/14/09, Michael Shadle <[email protected]> wrote:
From: Michael Shadle <[email protected]>
Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument
To: "Raymond Irving" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tuesday, April 14, 2009, 8:26 PM
As michael said my main reason is strictness. It's much easier to parse a
document when an XML parser can read it. I like the idea of closing tags etc.
On Apr 14, 2009, at 4:38 PM, Raymond Irving <[email protected]> wrote:
>
> Hi,
>
> I'm thinking about using the html5 doctype for all html documents since it's
> supported by all the popular browsers available today.
>
> Two Quick questions...
>
> Why do we need to send XHTML code to a web browser when standard html code
> (with html 5 doctype) will do just fine?
>
> Is there any advantage of using xhtml in the web browser over html for normal
> web application development?
>
>
> __
> Raymond Irving
>
> --- On Tue, 4/14/09, Peter Ford <[email protected]> wrote:
>
>> From: Peter Ford <[email protected]>
>> Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument
>> To: [email protected]
>> Date: Tuesday, April 14, 2009, 5:05 AM
>> Michael Shadle wrote:
>>> On Mon, Apr 13, 2009 at 2:19 AM, Michael A. Peters
>> <[email protected]>
>> wrote:
>>>
>>>> The problem is that validating xhtml does not
>> necessarily render properly in
>>>> some browsers *cough*IE*cough*
>>>
>>> I've never had problems and my work is primarily
>> around IE6 / our
>>> corporate standards. Hell, even without a script type
>> it still works
>>> :)
>>>
>>>> Would this function work for sending html and
>> solve the utf8 problem?
>>>>
>>>> function makeHTML($document) {
>>>> $buffer =
>> $document->saveHTML();
>>>> $output =
>> html_entity_decode($buffer,ENT_QUOTES,"UTF-8");
>>>> return $output;
>>>> }
>>>>
>>>> I'll try it and see what it does.
>>>
>>> this was the only workaround I received for the
>> moment, and I was a
>>> bit afraid it would not process the full range of
>> utf-8; it appeared
>>> on a quick check to work but I wanted to run it on our
>> entire database
>>> and then ask the native geo folks to examine it for
>> correctness.
>>
>> I find that IE7 (at least) is pretty reliable as long as I
>> use strict XHTML and
>> send a DOCTYPE header to that effect at the top - that
>> seems to trigger a
>> standard-compliant mode in IE7.
>> At least then I only have to worry about the JavaScript
>> incompatibilities, and
>> the table model, and the event model, and ....
>>
>> --Peter Ford
>>
>> phone: 01580 893333
>> Developer
>>
>> fax: 01580 893399
>> Justcroft International Ltd., Staplehurst, Kent
>>
>> --PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
I use XHTML 1.0 transitional and I've yet to have anyone tell me my
sites don't work. Mobile and desktop browsers too. So I'm not sure
that's an issue at all (?)
On Apr 15, 2009, at 6:31 PM, Raymond Irving <[email protected]> wrote:
Thanks for the feedback.
I too like xhtml but I think I like the option of serving both. My
only concern is that a proxy server might cache an xhtml page and
then serve it to a non-xhtml browser.
Do you think it's possible that a proxy might serve the xhtml source
to the wrong browser?
__
Raymond Irving
--- On Tue, 4/14/09, Michael Shadle <[email protected]> wrote:
From: Michael Shadle <[email protected]>
Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using
DOMDocument
To: "Raymond Irving" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Tuesday, April 14, 2009, 8:26 PM
As michael said my main reason is strictness. It's much easier to
parse a document when an XML parser can read it. I like the idea of
closing tags etc.
On Apr 14, 2009, at 4:38 PM, Raymond Irving <[email protected]> wrote:
Hi,
I'm thinking about using the html5 doctype for all html documents
since it's supported by all the popular browsers available today.
Two Quick questions...
Why do we need to send XHTML code to a web browser when standard
html code (with html 5 doctype) will do just fine?
Is there any advantage of using xhtml in the web browser over html
for normal web application development?
__
Raymond Irving
--- On Tue, 4/14/09, Peter Ford <[email protected]> wrote:
From: Peter Ford <[email protected]>
Subject: Re: [PHP] Generate XHTML (HTML compatible) Code using
DOMDocument
To: [email protected]
Date: Tuesday, April 14, 2009, 5:05 AM
Michael Shadle wrote:
On Mon, Apr 13, 2009 at 2:19 AM, Michael A. Peters
<[email protected]>
wrote:
The problem is that validating xhtml does not
necessarily render properly in
some browsers *cough*IE*cough*
I've never had problems and my work is primarily
around IE6 / our
corporate standards. Hell, even without a script type
it still works
:)
Would this function work for sending html and
solve the utf8 problem?
function makeHTML($document) {
$buffer =
$document->saveHTML();
$output =
html_entity_decode($buffer,ENT_QUOTES,"UTF-8");
return $output;
}
I'll try it and see what it does.
this was the only workaround I received for the
moment, and I was a
bit afraid it would not process the full range of
utf-8; it appeared
on a quick check to work but I wanted to run it on our
entire database
and then ask the native geo folks to examine it for
correctness.
I find that IE7 (at least) is pretty reliable as long as I
use strict XHTML and
send a DOCTYPE header to that effect at the top - that
seems to trigger a
standard-compliant mode in IE7.
At least then I only have to worry about the JavaScript
incompatibilities, and
the table model, and the event model, and ....
--Peter Ford
phone: 01580 893333
Developer
fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent
--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi, I'm trying to upload a pdf file from a local drive to the server using a
php routine. I've done it server to server before with no issues but this
just keeps failing on me.
This is the function I'm calling, it connects and logs in just fine, but it
will not upload the file. The file I'm sending is just a 100k pdf file. I
have php set up with:
max_execution_time = 30
max_input_time = 60
memory_limit = 20M
file_uploads = On
upload_max_filesize = 8M
ftpData($fileField, "/var/www/html/Docs/DU/DU1.pdf")
with $filefield just being a local path taken from a filebrowser in a html
form. I've also tried using ftp_chdir to change the destination path and
when calling ftp_pwd is shows the current directory has changed to the
correct one but it still won't write anything down.
any ideas?
James
function ftpData($Source, $Dest){
// set up basic connection
$success = 1;
$ftp_server = "blahblahbla.com";
$ftp_user_name = "dummy";
$ftp_user_pass = "dammy";
$destination_file = $Dest;
$source_file = $Source;
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
echo "FTP connection has failed!<br>";
echo "Attempted to connect to $ftp_server for user
$ftp_user_name<br>";
$success = 0;
exit;
} else {
echo "Connected to $ftp_server, for user $ftp_user_name<br>";
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
echo "FTP upload has failed!<br>";
$success = 0;
} else {
echo "Uploaded $source_file to $ftp_server as
$destination_file<br>";
}
// close the FTP stream
ftp_close($conn_id);
return($success);
}
--- End Message ---
--- Begin Message ---
James wrote:
Hi, I'm trying to upload a pdf file from a local drive to the server using a
php routine. I've done it server to server before with no issues but this
just keeps failing on me.
This is the function I'm calling, it connects and logs in just fine, but it
will not upload the file. The file I'm sending is just a 100k pdf file.
If you do it manually does it work? Maybe the account is over quota.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---