Re: [PHP] Select Values Didn't Get Passed in From Two Different Forms

2010-05-25 Thread Marc Guay
>> > I would like to take those values away into my third form, which is what
>> > you
>> > see with the hidden. If they are not populated, then how come I could
>> > see
>> > the drop down menus?
>>
>> So you're expecting the values selected in the first two forms to
>> populate the values of the hidden fields in the third form? Why not
>> wrap the whole thing in a single form? Do test_getrss.php and
>> test_getrss2.php perform anything useful or are they just hanging
>> around?
>
> No, the fields are populated in the first and second form, form1 and form2.
> What I want to do is to get the selections from both forms and pass them on
> to the third. Does this make sense? For some reason, the text input and the
> semester drop down menu result can be passed to process.php, but the results
> that I try to select from the first and second does not. So, the form is not
> passing the results of what I had from the radio button selections.

We forgot to reply to the group for the last few messages, they're copied above.

You should probably wrap the whole thing in a single form.  The reason
you're not getting the first 2 values in process.php is because
they're inputs inside of a different form.  Only the elements inside
that particular form will get passed to the action.

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



Re: [PHP] File Downloads

2010-05-28 Thread Marc Guay
> How can I go about restricting the number of downloads of a file on my
> server?

Something like this could be triggered every time and then you can do
whatever you want once it hits 150... maybe have it send you an email
notification or something...

http://www.stevedawson.com/article0007.php

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



Re: [PHP] Creating image on-the-fly

2010-07-07 Thread Marc Guay
> I was wondering if there was any way I can create an image from some text
> with php?

Something like this?

http://sgss.me/obsolete/experiments/phpfontimagegenerator2/usage.php

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



Re: [PHP] State and City Database

2010-07-07 Thread Marc Guay
> Does anyone have a source for a US State and City database?

This is a monster but seems to contain what you need:  http://www.geonames.org/.

Marc

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



Re: [PHP] Simple XML - problem with errors

2010-07-08 Thread Marc Guay
> libxml_use_internal_errors(true);
> $this->xml = new SimpleXMLElement($this->htmlString);

Hi Gary,

I have code that looks like this:

libxml_use_internal_errors(true);
$xml = simplexml_load_string($val);
$errors = libxml_get_errors();

if ($errors)
do this
else
do that

which works fine.  Not sure if that's helpful to you, but it seems
like it might.

Marc

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



Re: [PHP] Simple XML - problem with errors

2010-07-08 Thread Marc Guay
>  I wonder what the difference is between doing "new
> SimpleXMLElement" and calling simplexml_load_string which results in the
> libxml_use_internal_errors call being ineffective. Odd.

The documentation for "Dealing with XML errors" only mentions
simplexml_load_string() and this comment
http://ca3.php.net/manual/en/simplexml.examples-basic.php#93263 shows
that you're not the first person to run into this.

Marc

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



Re: [PHP] Simple XML - problem with errors

2010-07-08 Thread Marc Guay
> And yes, I'd rather use DOM, but I can't.

Could you use this: http://simplehtmldom.sourceforge.net/?

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



[PHP] Arrays passed to functions lose their indexing - how to maintain?

2010-07-09 Thread Marc Guay
Hi folks,

I have an array that looks a little something like this:

Array ( [6] => 43.712608, -79.360092 [7] => 43.674088, -79.388557 [8]
=> 43.674088, -79.388557 [9] => 43.704666, -79.397873 [10] =>
43.674393, -79.372147 )

but after I pass it to a function, it loses it's indexing and becomes:

Array ( [0] => 43.712608, -79.360092 [1] => 43.674088, -79.388557 [2]
=> 43.674088, -79.388557 [3] => 43.704666, -79.397873 [4] =>
43.674393, -79.372147 )

The indexing is important and I'd like to hang onto it.  Any ideas?  "pointers"?

Marc

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



Re: [PHP] Arrays passed to functions lose their indexing - how to maintain?

2010-07-09 Thread Marc Guay
My bad, I had some leftover code running array_values() on it before
it got passed.

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



[PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
Hi everyone,

I've built a fairly large normalized database schema for a project.
This is fun for me as I like thinking about how everything is
interconnected.  Foreign keys are all set up, many-to-many tables are
go, etc, and so on.   But now it's time to create an interface between
that database and the website using PHP.  I've searched the web and
this is obviously a very common problem with many solutions, but I
can't help but feel that all of the logic I've built into the database
is worth nothing once I start coding.  I found this
article/presentation that essentially sums up my frustration:
http://mag-sol.com/talks/lpm/2006/orm/.  Up until now I've been
working on smaller projects with only a few tables that don't really
relate to each other, and have found this tool
(http://www.ricocheting.com/code/php/mysql-database-class-wrapper)
very handy for the reasons he explains, but I'm looking for something
a little different.  I've looked at RedBean and it seems pretty handy,
but it also requires me to redefine all of the foreign keys I've
already defined, which is annoying.  Any hope of something like

// Get company where name='Widgets Inc.' or id=1 or
$company = $db->get_company("name='Widgets Inc.'");

// Get all clients joined to the company
$clients = $company->get_clients();

// Get all projects joined to the client
$projects = $clients->get_projects();

?

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



Re: [PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
> i recommend propel
> http://www.propelorm.org/

This looks hopeful.  I'd checked it out before but for some reason
lumped it in with all of the other half-baked tools that didn't do
what I wanted, but even that basic example seems to cover most of what
I want.

Thanks for the suggestions.

Marc

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



Re: [PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
> i recommend propel
> http://www.propelorm.org/

Holy Moses that thing is a monster.  It requires installing extra
libraries (Phing) in order to create an XML schema reverse-engineered
from my existing database.  The code looks simple enough but that
installation is brutal.  Any other suggestions?  I'm thinking of
sticking with good ol' hand coding and a few helper classes.

Marc

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



Re: [PHP] PHP database interface layer

2010-07-22 Thread Marc Guay
> Let me repeat myself: did you have a look at Doctrine2?

Hi Peter,

I didn't mean to ignore your suggestion, I just got extremely
overwealmed by the Doctrine website and didn't even have a response.
I get the impression that, like Zend and others, learning how to
install and use that would take longer than my 'little' website is
worth.  Maybe someday when I'm working for a more patient employer
who's willing to pay me to learn.  Insert laughter here.

Marc

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



[PHP] Protecting PHP scripts called via AJAX from evil

2010-08-06 Thread Marc Guay
Hi folks,

I'm looking for a straightforward way to protect PHP files which are
called via AJAX from being called from outside my application.
Currently, someone could forseeably open the console and watch the
javascript post variables to a public file (actions/delete_thing.php)
and then use this knowledge to trash the place.  I found this thread
at stackoverflow which seems to cover the issue I'm looking at, but
it's pretty intense and I figure there's an easier way but I'm not
sure how.

http://stackoverflow.com/questions/2486327/jquery-post-and-php-prevent-the-ability-to-use-script-outside-of-main-website

It seems unlikely that this is the method everyone uses, but maybe
not.  Advice is nice.
Marc

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



Re: [PHP] Protecting PHP scripts called via AJAX from evil

2010-08-06 Thread Marc Guay
Thanks everyone.

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



[PHP] Snoopy port using PHP cURL library

2010-08-09 Thread Marc Guay
Does anyone know if the Snoopy class has been ported to use the
built-in PHP cURL library and released publicly somewhere?

Marc

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



[PHP] Re: Snoopy port using PHP cURL library

2010-08-09 Thread Marc Guay
> Does anyone know if the Snoopy class has been ported to use the
> built-in PHP cURL library and released publicly somewhere?


I converted it myself.  If anyone's interested the class is attached.

Marc

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

Re: [PHP] Can't read $_POST array

2010-08-18 Thread Marc Guay
> $response = print_r($_REQUEST, true);
> echo $response;

I'm sorry I don't have any input on your actual question but tohuhgt
I'd mention that this can be shortened to:

print_r($_REQUEST);

... if I'm not mistaken.

Marc

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



Re: [PHP] possible issue with quotes (Magicquotes feature)?

2010-08-19 Thread Marc Guay
I would chalk this up to that fancy, extra-curly, apostrophe that you
get when copying and pasting text from Microsoft Word or similar.
Marc

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



Re: [PHP] two questions on serverside validation

2010-08-25 Thread Marc Guay
> function html($text)
> {
>        return htmlentities($text, ENT_QUOTES, 'UTF-8');
> }
>
> function htmlout($text)
> {
>        return html($text);
> }

Possibly irrelevant, and definitely not related to your questions, but
is it just me or is htmlout() a useless function?  Why not just call
html() directly?

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



Re: [PHP] a test (list is too quite)

2010-09-04 Thread Marc Guay
Can I make a facebook site using PHP?  If yes, how?

Please send me the infos privately.

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



Re: [PHP] Show text without converting to html

2010-09-09 Thread Marc Guay
> Which was created by the code, but I apparently can't seem to echo it and
> get it to display like above.. It converts it to html no matter what I do.

Have you tried the  HTML tag? (http://www.w3schools.com/TAGS/tag_pre.asp)

Putting inside a  might also work for you...


-- 
Marc Guay
MobilizeMe
mobilizeme.com

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



Re: [PHP] 1984 (Big Brother)

2010-09-13 Thread Marc Guay
> if steve's idea is something doable.. why don't you consider setting
> up the mysql data dir on some removable media (thumb/flash drive)?

It seems to me that almost no matter what method you choose, you're
going to have to ask the client to do something manually - whether
that's logging out of the website, shutting down his computer,
removing a thumb drive, or whatever - so you might as well be upfront
about that and see how he responds.  Provide the different options and
get them to choose one, at some point they'll need to take a bit of
personal responsibility for the management of this paranoid system.

Marc

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



Re: [PHP] 1984 (Big Brother)

2010-09-15 Thread Marc Guay
> if(file_exists('boss_man_say_okay') ){ // let monkeys work }

Is there an acronym for the sound of sad, knowing laughter?

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



Re: [PHP] Auto-generating HTML

2010-09-20 Thread Marc Guay
What sort of results do you get with

echo "



Page Title


This is the page body



";

or similar?

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



Re: [PHP] if/elseif being treated as if/if

2010-09-24 Thread Marc Guay
if(1 == 1){
echo 'here';
}
elseif(1 == 1){
echo 'here"';
}

Will only echo "here" once.

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



Re: [PHP] PHPExcel with large files (27,000+ rows)

2010-10-04 Thread Marc Guay
I use this: http://code.google.com/p/php-csv-parser/

No idea if it's any better than your current solution.  I presume
you've tried extending PHP's memory limit?

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



Re: [PHP] Execute a php page and don't wait for it to finish

2010-10-19 Thread Marc Guay
A simple AJAX script would do the trick, no?  Or does the script which
was triggered by JS get aborted if that page is unloaded?

If javascript is unavailable you could trigger it through the  tag like so:



Again, not sure if it will keep running if the caller is unloaded.

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



Re: [PHP] Reminder On Mailing List Rules

2010-10-21 Thread Marc Guay
Toilet seat.  Up or down.  Same thing?  Sort of.

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



[PHP] Character encoding hell

2010-10-26 Thread Marc Guay
Hi folks,

I've got a problem with character encoding that's threatening to kill
my little brain.  Here we go:

I have a directory with a bunch of PDFs in it that my webpage displays
links to.  All of the files have the french character  in them. The
operating system is Linux (I did not experience this problem on a
Windows machine). I don't want to type the display name of these files
twice and the website has no database capability so it takes the
filename, rips off the extension, and runs htmlentities() on it before
displaying to the user.  So far so good.  Now to the anchor's href.
The only encoding method I found which creates a proper link to the
file is rawurlencode(), but the catch is that the filename isn't user
friendly at all.  My question then is what is the best solution to
this problem?  Ideally I would like the link to function and for the
filename to be readable.

Any hope/help is appreciated.

Marc

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
> Are you using UTF-8?

Could you be more specific?  Do you mean in the browser/php header or
in the filesystem?  I created the file on a Windows machine,
transferred them to a Linux machine, and the encoding of the page is
UTF-8.

I just noticed a strange thing which might shed some light.  If I just
run htmlentities() on the href, it shows this in the browser URL:

LE CHÂT.pdf

But the browser returns a "not found" error:

LE%20CH%C3%82T.pdf

It seems like the  character is being misunderstood as "Â"

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
>  If I am understanding correctly, you are referring to a HTML specific issue 
> where the HTML and browser configuration is displaying your characters 
> improperly?

No, the browser is displaying the characters of the filename fine
(using htmlentities converts the ? unknown character into an Â.  The
problem is with the link/href to the file with the special character
in it's name.  I get a 404 not found unless I rawurlencode the href,
turning it into the rather unreadable "LE%20CH%C2T.pdf".

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
Again, if it helps, a link formatted in the same way to the same file
links correctly on a windows machine.

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
> A windows server, or windows client to the same Linux server? I believe that 
> this issue is starting to get a bit over my head, with the different 
> operating systems involved and such.

Windows server.  This is over my head, too.  I'm guessing that Windows
and Linux encode filenames differently and when I transferred the file
from one to the other, some kind of adjustment was made.

Marc

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
> Have you tried using the utf8 meta tag rather than using the htmlentities()
> function? That should solve the first issue, as I reckon the problem lies
> with the way your encoding the filename.

The page is being encoded in UTF-8.  Without htmlentities() the
special character is displayed as a black triangle with a question
mark in it.  Does that indicate that the filename isn't being stored
as UTF-8?

> Lastly, have you made sure your php scripts are saved as utf8, as that can
> sometimes solve some odd problems with character encoding.

This didn't seem to change anything.

Marc

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
> I think one way to do this is something like this (untested):

This is a good idea, but I'm stubborn and believe it can be solved
without adding more code.  Thanks, though, I'll probably end up using
it once I've ruined every other possibility.

Marc

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
> Where is the filename coming from? Is it hard-coded in the script or is your
> script reading it from a directory listing?

The filename is being read from the file via scandir().  File created
on Windows, transferred to *nix.

> Have you checked to see if that filename is what you think it is on the
> Linux server?

The character is shown as a question mark in putty.  I've tried
forcing a UTF-8 font to make sure it's not a rendering issue but it
didn't seem to make a difference.  I'm not convinced the encoding
changed, though.

> Was Apache the web server both times, or was iis used on windows? If it was,
> look for any errant .htaccess files causing problems.

Both are apache.

> Lastly, what happens if you directly request that file from with the browser
> itself, without php scripts in the equation.

If I request the file directly from the Windows server, it opens Adobe
Acrobat.  If I request the same file directly from the Linux server, I
get the 404 File Not Found.

Marc

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



Re: [PHP] Character encoding hell

2010-10-26 Thread Marc Guay
> You say that in putty it is converted to a '?'?  so, on linux, the file
> name is no longer what you intended it to be, so wouldn't you then need
> to call the file EXACTLY as it is on the linux server?

I thought this too at first, but if I run htmlentites() on the
filename it displays the  character so it must not have been lost
completely, just encoded in a different way?  I'm quite sure that the
propblem with putty displaying it as a question mark is related to its
display settings.

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



Re: [PHP] Character encoding hell

2010-10-27 Thread Marc Guay
> Have you tried using the utf8 meta tag rather than using the htmlentities()
> function? That should solve the first issue, as I reckon the problem lies
> with the way your encoding the filename.

It seems that the filenames are ISO encoded as if I set the meta tag
to ISO and remove the htmlentities() wrapper it displays the character
fine.  Not sure how that helps or if this is even PHP related anymore
but thought I'd follow up.

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



[PHP] Updating a GET variable

2010-11-09 Thread Marc Guay
Hi folks,

I'm sure this is an easy one that's standing right in front of me but
I'm too blind to see.  I have a page with an URL like this:
index.php?name=value&this=that. I have a link on the bottom of the
page which allows the user to switch languages.  I need to hang onto
the existing $name and $this get variables.

I tried

Flip

and it loses all previous GET data.  Then I tried

?&lang=en'>Flip

And it continually appends more &lang=en's to the URL if the user
keeps clicking on it (for whatever reason).

Now I've put it in a form and it works as expected, but the display
value and my under-the-hood value need to be different, so it's a
fail.  What's the best way to update the value of a GET var?

Marc

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



Re: [PHP] Updating a GET variable

2010-11-09 Thread Marc Guay
> What's wrong with just putting the url parameters in the link that you know
> you need, one by one?

I have a footer that I include on every page and would like it to
adapt to whatever situation it finds itself in.  Is your suggestion,
to do the following for the existing example:

echo "Flip";


>  Also, don't just output the values sent to the server, as that's an attack 
> waiting to happen.

Are you referring to echoing the SCRIPT_NAME and QUERY STRING values
into the href attribute?

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



Re: [PHP] Updating a GET variable

2010-11-09 Thread Marc Guay
My working solution was to put it in a form with a hidden input with
the correct name and value.






But I'm still wondering what your advice is regarding best practice.

Marc

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



Re: [PHP] Updating a GET variable

2010-11-10 Thread Marc Guay
>  Session_start();
> $_SESSION['language'] = "en";
> You can set the session variable to the current get or maintain the original
> passed.

I think you may have misunderstood.  The problem is holding onto the
existing GET variables in the URL while manipulating or adding one of
them... and doing it dynamically no matter what the existing
parameters are.

My partciular problem scenario is this:

directions.php?mode=DRIVING&lat=45.514516&long=-73.611056&zip=H4N+2W2&lang=en

I would like the user to be able to switch between two languages via
the $_GET['lang'] var.


As for

> Dear god, why would you butcher php like that?

Your example is just as ugly as mine and in my editor is actually
worse because the SERVER vars aren't highlighted.   Thanks anyways.


Marc

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



Re: [PHP] Updating a GET variable

2010-11-10 Thread Marc Guay
> foreach($_GET as $k => $v) $qs[$k] = URLDecode($v);
> $qs['lang'] = 'en';
> echo 'Flip';

Hi Tamara,

Thanks for the tips.  Do you see any advantage of this method over
using a small POST form besides the styling problems I'll run into
trying to make the submit button look like an achor?

Marc

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



Re: [PHP] Updating a GET variable

2010-11-11 Thread Marc Guay
> So all you need to do, is take a look at $_SERVER['HTTP_ACCEPT_LANGUAGE'] to
> get a users language preferences.

Hi Nathan,

Yep, I'm using this var to set the default but I think it's nice to
allow the user to override it.  Maybe someone using their computer is
more comfortable in a different language?

Marc

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



Re: [PHP] Updating a GET variable

2010-11-17 Thread Marc Guay
> A bit late in the thread.  However, IMO, I don't think session is necessary,
> unless you intend to save it for later use, during that same visit from the
> user.  If it's just a 1 time request, you can just use (example)
> $_GET['lang']=en,de,fr,...
> Then just split up individual languages, process the request of each
> supported language, and place each relevant localization in its own tab
> panel, div (non js), etc...

Hi Tommy,

I read this at least 5 times and still don't quite get your meaning,
but I'm curious enough to ask:  Could you repeat in other words or
give a short example?

Marc

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



Re: [PHP] Updating a GET variable

2010-11-17 Thread Marc Guay
> Nathan previously mention what if instead of a language specific request,
> you have request for multiple languages.

I get it now, multiple _simultaneous_ languages.

Cheers,
Marc

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



Re: [PHP] PHP shows nothing

2010-11-30 Thread Marc Guay
>        if(!$db = @pg_connect($connection_string)) {
>                return FALSE;
>        }
>        return $db;
>
> how can I find the problem and fix it?


The @ symbol is telling it to ignore errors.  Remove it and you'll see
them if that's where the problem is.

http://php.net/manual/en/language.operators.errorcontrol.php

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



Re: [PHP] $_POST issues

2010-12-01 Thread Marc Guay
>>> >>    var_dump($_POST);
>>> ?>

Where exactly are you putting this line?

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



Re: [PHP] $_POST issues

2010-12-01 Thread Marc Guay
The function http_build_query() is turning your $_POST array into a
query string ($_GET), so the answer to this really depends where
you're trying to dump the array.

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



Re: [PHP] $_POST issues

2010-12-01 Thread Marc Guay
This thread is a really good example of how difficult it can be to
both explain and understand a problem.  The original poster might want
to restate the question from scratch with a more explicit and complete
example.

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



Re: [PHP] sms class

2012-04-17 Thread Marc Guay
Woah.  Is that good luck or bad luck?

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



Re: [PHP] sms class

2012-04-17 Thread Marc Guay
Suspicion is my religion.  Let no thread end without a war.

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



Re: [PHP] Email Antispam

2012-04-17 Thread Marc Guay
Is there a reason for you not to build a contact form?

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



Re: [PHP] Searching IDE.

2012-06-13 Thread Marc Guay
I've used both Netbeans and Aptana w/ WinXP over the past few years
and of the two I would recommend Aptana.  Netbeans was crippling slow
and Aptana often gets it's workspace corrupted, which makes both of
them crappy (yet free!), but for day to day use when they're not
failing entirely, Aptana is a more efficient tool.

Marc

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



Re: [PHP] What's happened to our newsgroup?

2012-06-26 Thread Marc Guay
Everyone switched to PCP?

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



Re: [PHP] What's happened to our newsgroup?

2012-06-29 Thread Marc Guay
> You mean everyone finally RTFM?

There's a manual?  GoDaddy told me to just ask all of my questions here!


(No insult meant, in case it's not obvious.)

Happy Fridays
Marc

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



Re: [PHP] Unexpected Notice message

2012-07-04 Thread Marc Guay
> Notice: Use of undefined constant QUERY_STRING - assumed 'QUERY_STRING' in

I would guess that it's asking you to add quotes around QUERY_STRING...?

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



[PHP] Find match of string if only at end of string

2012-07-11 Thread Marc Guay
Hi folks,

I'm trying to compare two strings in order to determine whether or not
the site is just switching languages on the same page or whether the
link is pointing to an entirely different page.  Things were fine
until I realized I was getting false positives for subpages, where the
URLs matched.

Previous code example:

if (strpos('http://domain.com/fr/about/page/', '/about/page/') > -1){
$same_page = true;
}

As you can see this logic is not strong enough to deal with:

if (strpos(http://domain.com/about/page/subpage/', '/about/page/') > -1){
$same_page = true;
}

As it is not the same page.  I've looked into strrpos() and tried to
use the negative offset as the length of the needle, but unfortunately
it searches backwards from the offset and not forwards.  Any ideas?

Marc

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



[PHP] Re: Find match of string if only at end of string

2012-07-11 Thread Marc Guay
Answered it myself (funny how writing out a problem as descriptively
as possible makes the brain work better).

$end_of_url = substr("http://domain.com/about/page/subpage/";,
strlen("/about/page/") * -1);
$same_post = ($end_of_url == "/about/page/");

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



Re: [PHP] Programmers and developers needed

2012-09-13 Thread Marc Guay
I'll do it, but only if it's on "paid on delivery" and/or subsidized
by African royalty.

Are our comments still welcome?

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



Re: [PHP] Recommendation request: Use Magento or build my own eCommerce?

2012-10-22 Thread Marc Guay
Use Magento.  It will take you more than 6 months to build what you're
talking about all by yourself.  Magento is a pain to learn at first
but once you get into it things start to make sense and development
speeds up.

Marc

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



Re: [PHP] Boolean type forced on string assignment inside if statement

2013-01-03 Thread Marc Guay
> First, did the original poster realize that he was assigning a value to the
> variable $a in the 'if' statement?

Hello,

Yes, I did, and if you read my responses you can see that I came to
the realisations you describe.  I don't think that anyone suggested
there was a bug.


> $a is true (ie it is not set to a 'false' value,
> whatever PHP uses for false) and $b is "bar" because that is what it is set
> to.  Since the evaluation is within a bracket, the interior values ($a, $b)
> are set BEFORE the if condition is evaluated.

Regarding this I'm a bit confused.  In the case of an OR operator, $b
is not "bar" because it follows the "true" path as you said earlier.
Probably just a glitch in the English language.  I'll file a bug for
that.

Marc

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



Re: [PHP] Boolean type forced on string assignment inside if statement

2013-01-03 Thread Marc Guay
Hi Tedd,

A little searching enlightened me to the fact that in other languages,
a single | or & operator will cancel the short-circuiting so all of
the evaluations are done before proceeding.  However, they don't seem
to exist in PHP so in your example it behaves the same as ||...?

http://php.net/manual/en/language.operators.logical.php

Marc

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



Fwd: [PHP] Boolean type forced on string assignment inside if statement

2013-01-03 Thread Marc Guay
I received the message below addressed only to me, but I believe the
group could benefit.  It looks like the single pipe is a bitwise
operator so you will get an integer as a result (and probably other
weird things to discover when using it on non-numbers).

http://php.net/manual/en/language.operators.bitwise.php


-- Forwarded message --
From: Volmar Machado 
Date: 3 January 2013 12:42
Subject: Re: [PHP] Boolean type forced on string assignment inside if statement
To: Marc Guay 


My results in a simple test:

'); //1
 echo ('($a || $b))' . ($a || $b) . ''); //1
 echo ('($b | $a)' . ($b | $a) . ''); //1
 echo ('($b || $a)' . ($b || $a) . ''); //1
 echo ('($a | $a)'. ($a | $a) . ''); //1
 echo ('($a || $a)' . ($a || $a) . ''); //1
 echo ('($b | $b)' . ($b | $b) . ''); //0
 echo ('($b || $b)' . ($b || $b) . ''); //false(outputs nothing)
?>

2013/1/3 Marc Guay :
>> Now, I am not sure as to where that would mean anything. Can anyone provide 
>> an example where using a single pipe would produce different results than 
>> using a double pipe?
>
> If PHP had "Eager operators" (thanks Wikipedia), then your first
> example would have different output
>
> if (($a = 'foo') | ($b = 'bar'))
> {
> echo "$a  $b";
> }
> else
> {
> echo 'Neither are populated';
> }
>
> Would spit out:
> foo
> bar
>
> rather than just
> foo
>
> No?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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



[PHP] Re: Stripping accents from characters as they pass through a stream and then written to file

2013-01-14 Thread Marc Guay
And the answer is that it's a locale issue...

http://stackoverflow.com/questions/7931853/why-does-phps-iconv-need-setlocale

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



Re: [PHP] Testing

2013-03-08 Thread Marc Guay
> This is my first time using a list. Can anyone confirm I'm doing this 
> correctly?

N!  You broke it!

Happy Friday,
Marc

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



Re: FW: [PHP] Accessing Files Outside the Web Root

2013-03-13 Thread Marc Guay
> Have you tried keeping all of your documents in one directory and blocking
> that directory via a robots.txt file?

These don't sound like robots that would respect a txt file to me.

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



Re: [PHP] Re: Accessing Files Outside the Web Root

2013-03-14 Thread Marc Guay
> correlate various types of information, which is very hard. For a human,
> this is very simple. It's simple, and very friendly to your guests.

Assuming humans will continue to behave as I've seen them behave so
far, even this "simple" system will guarantee you angry emails from
people who'll want to argue that "five" is a colour in some
circumstances.  Please see discussions on this list about top-posting
as a reference.

TGIAF
Marc

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



Re: [PHP] REQUEST

2013-05-29 Thread Marc Guay
Does anyone else find it strange that the movie Troll only has 2 stars
on IMDB?  I think it's worth at least CAPSLOCK.


On 29 May 2013 11:45, Tommy Pham  wrote:
> On Wed, May 29, 2013 at 9:30 AM, Stuart Dallas  wrote:
>
>> On 29 May 2013, at 17:26, Last Hacker Always onpoint <
>> lasthack...@gmail.com> wrote:
>>
>> > HEY GUYZ I KNOW, I KNOW THIS IS NOT A PLACE FOR SOMETHING LIKE THIS SO
>> BUT
>> > HEY I HAVE A LITTLE TINY QUESTION FOR MY COOL GUYZ.
>> >
>> > DOES ANYONE HERE USE A SIMPLY MACHINE FUNCTION SCRIPT? BECAUSE THE
>> > SCRIPTINGS ARE A LITTLE HARD FOR ME TO UNDERSTAND PLEASE LET ME KNOW
>> GUYS I
>> > WANT SOMEONE TO TEACH ME.
>>
>> 1) Shouting at us will not encourage a helpful attitude.
>>
>> 2) Neither will calling us your "cool guyz."
>>
>> 3) What is "a simply machine function script?"
>>
>
> 4) http://www.catb.org/esr/faqs/smart-questions.html
>
>
>>
>> If you want someone to teach you PHP you'll probably need to pony up some
>> cash. If you want someone to help you while you're learning, show us that
>> you're working on it and we'll be happy to help.
>>
>> -Stuart
>>
>> --
>> Stuart Dallas
>> 3ft9 Ltd
>> http://3ft9.com/
>> --
>>
>>

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



Re: [PHP] include() Error

2013-05-29 Thread Marc Guay
Is the "echo $mySQL_user;" inside of a function?  I believe you'll
need to say "global $mySQL_user;" to gain access to it if so.


On 29 May 2013 12:39, Ron Piggott  wrote:
>
> Good morning all:
>
> I have recently purchased a computer and am using it as a dedicated server.  
> A friend helped me install PHP and configure.  I am saying this because I 
> wonder if using a newer version of PHP (compared to my commercial web host) 
> may be the reasoning behind the error I am receiving.
>
> I created a function to generate a form submission key.
> - This created hidden variable for forms
> - This is also session variable
>
> With this function I have an ‘ include ‘ for the file containing the mySQL 
> database, username and password.  I know this file is being accessed because 
> I added:
>
> ===
> echo $mySQL_user;
> ===
>
> following the login credentials.
>
> But when I remove this line from mySQL_user_login.inc.php and place within 
> the function on the line following the include the "echo” returns nothing.
>
> ===
> include("mySQL_user_login.inc.php");
>
> echo $mySQL_user;
> ===
>
> Can any of you tell me why this is happening?
>
> Ron Piggott
>
>
>
> www.TheVerseOfTheDay.info

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



Re: [PHP] Detect and Redirect Mobile Users

2013-06-14 Thread Marc Guay
http://www.answershat.com/questions/352/How-to-get-rid-of-spam-mail-in-my-mailbox

On 14 June 2013 09:28, Chirag Vekariya  wrote:
> Hi,
> Post your question to http://answershat.com
>
> On Thu, Jun 13, 2013 at 4:49 AM, dealTek  wrote:
>
>> Hi all,
>>
>> I'm curious of a simple, common, universal way to detect a mobile user so
>> I can redirect them to a mobile directory...
>>
>> What is best for this: Javascript - CSS - PHP?
>>
>> I think for my purposes if I can detect screen size or mobile browser
>> agent - that would be good enough for what I need right now.
>>
>> Thanks in advance - Dave
>>
>>
>> --
>> Thanks,
>> Dave - DealTek
>> deal...@gmail.com
>> [db-3]
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> --
> *Thanks & Regards,
> Chirag Vekariya.
> +91-87582 45922*

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



Re: [PHP] LightBox click detection

2013-06-14 Thread Marc Guay
$('.lightbox-image-class').click(function(){
$.post('ajax.php', {click: true});
});

and do your DB work in ajax.php

http://api.jquery.com/jQuery.post/

On 14 June 2013 09:52, Tedd Sperling  wrote:
> Hi gang:
>
> It's Friday so I am allowed to ask odd questions.
>
> Here's the problem --  I need to count the number of times a user activates a 
> LightBox -- how do you do that?
>
> Here's a LightBox Example:
>
>http://www.webbytedd.com/c2/lightbox/
>
> All the javascript is there (jQuery et al).
>
> Ideally, I would like to have a php/javascript combination that would:
>
> 1. Detect when a user clicked the LightBox;
> 2. Pass that value to PHP so I can keep count.
>
> Any ideas?
>
> Cheers,
>
> tedd
>
> _
> t...@sperling.com
> http://sperling.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] LightBox click detection

2013-06-14 Thread Marc Guay
Also, the docs and functionality for that particular plugin seem a bit
weak.  Maybe there's another one that has a "doneLoadingLightbox"
event that you could hook into and call your ajax script inside of...


On 14 June 2013 10:02, Marc Guay  wrote:
> $('.lightbox-image-class').click(function(){
> $.post('ajax.php', {click: true});
> });
>
> and do your DB work in ajax.php
>
> http://api.jquery.com/jQuery.post/
>
> On 14 June 2013 09:52, Tedd Sperling  wrote:
>> Hi gang:
>>
>> It's Friday so I am allowed to ask odd questions.
>>
>> Here's the problem --  I need to count the number of times a user activates 
>> a LightBox -- how do you do that?
>>
>> Here's a LightBox Example:
>>
>>http://www.webbytedd.com/c2/lightbox/
>>
>> All the javascript is there (jQuery et al).
>>
>> Ideally, I would like to have a php/javascript combination that would:
>>
>> 1. Detect when a user clicked the LightBox;
>> 2. Pass that value to PHP so I can keep count.
>>
>> Any ideas?
>>
>> Cheers,
>>
>> tedd
>>
>> _
>> t...@sperling.com
>> http://sperling.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] A Strange Problem

2013-06-20 Thread Marc Guay
Never used it but searching turned up
http://php.net/manual/en/function.chdir.php
Marc


On 20 June 2013 12:57, Tedd Sperling  wrote:
> On Jun 20, 2013, at 1:44 PM, Bastien  wrote:
>>
>> It sounds like a current working directory issue. Try running a getcwd() in 
>> both places to see how they are set
>>
>> Bastien
>
> I think you have something, here's the reports:
>
> Works:
>
> /home/content/64//html/sdi/tedd/php-mail
>
> Does NOT work:
>
> /home/content/64//html/sdi
>
> The one that does not work should be:
>
>/home/content/64//html/sdi/includes/
>
> How do I fix it?
>
> Cheers,
>
> tedd
>
> PS: All 's were identical.
>
>
> _
> t...@sperling.com
> http://sperling.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] Finally....

2013-08-16 Thread Marc Guay
Those Belgacom emails were the only thing keeping me from a crushing
loneliness - undo!


On 16 August 2013 11:51, Matijn Woudt  wrote:
> On Fri, Aug 16, 2013 at 5:23 PM, Daniel Brown  wrote:
>
>> # ezmlm-list ~ezmlm/php-general | grep skynet
>> supp...@skynet.be
>>
>> # ezmlm-unsub ~ezmlm/php-general supp...@skynet.be
>>
>> # ezmlm-list ~ezmlm/php-general | grep skynet
>> #
>>
>> No more of those "Your e-mail concerning our products and
>> services" autoreplies from the Belgacom Webteam.  Sorry it took me
>> this long to realize it and get around to it.
>>
>> Happy Friday.
>>
>> Daniel,
>
> Thank you, thank you, thank you ;)

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



Re: [PHP] PHP vs JAVA

2013-08-20 Thread Marc Guay
Here are two references from the Wikipedia article on Java in case you
haven't looked at them already.

http://www.langpop.com/
http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

On 20 August 2013 10:43, Tedd Sperling  wrote:
> On Aug 20, 2013, at 10:36 AM, "Liam"  wrote:
>> You do realise you are on a PHP based user subscription, so the vast
>> majority will go with PHP, so you will get a one sided argument.
>>
>> Regards,
>> Liam
>
>
> I realize that many, maybe the majority, will be bias. HOWEVER -- there are 
> professionals on this list that do know and it is to them I am asking. 
> Remember, I am also asking for supporting documentation of their view. The 
> people who respond with just their opinion are doing just that -- there is no 
> support.
>
> My nature is to seek the truth regardless of my bias.
>
> Cheers,
>
> tedd
>
>
> ___
> tedd sperling
> t...@sperling.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] PHP Dependency Injector

2013-09-05 Thread Marc Guay
> Thanks Sorin, I will do that and I will have more care the next time.

You have no reason to apologize.  You shared a project you made by
yourself, way to go.

Marc

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



Re: [PHP] Algorithm Help

2013-10-02 Thread Marc Guay
If you have the technology handy, it could also just be easier to wipe
the children's memories after each stay.

Marc

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



Re: [PHP] framework or not

2013-10-24 Thread Marc Guay
> I'm looking forward to the day that I'll know everything and can stop all 
> this learning nonsense.


Sounds like the attitude most people take when they sit down to a
keyboard.  (Ref: http://xkcd.com/386/)

Off-topic is the new on-topic
Marc

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



Re: [PHP] query strings and other delights

2011-01-13 Thread Marc Guay
Give parse_str() a go.

http://ca.php.net/manual/en/function.parse-str.php

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



Re: [PHP] which php file is sending emails?

2011-01-16 Thread Marc Guay
> There can be nothing more simpler than this!!!

I thought that this quote needed some revisiting.

Marc

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



Re: [PHP] switch case madness

2011-01-19 Thread Marc Guay
> Imagine when there'll be the day when you do not have to code at
> all...just copy 'n paste snippets together in the order that you wish
> them to work in and Voila'! - instant web app.

I have a Wordpress plugin that will do all of that for you.

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



Re: [PHP] Re: email address syntax checker

2011-01-21 Thread Marc Guay
> In fact I'm wondering why the OP doesn't just do what every other site
> seems to do - accept the registering user's input as valid, and ask them
> to validate it by sending them an email address to that address.

It still makes sense to validate the format of the address as soon as
possible.  The way you describe it the problem will have to be dealt
with further down the pipe when email is sent to "haha your form
doesn't have@validation!".  Why not grab it before it gets that far?

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



Re: [PHP] String Encodings - loose guidelines

2011-01-25 Thread Marc Guay
> 1.) Saving strings to a database

One thing I always forget to remember is to send tge "SET NAMES utf8"
command to MySQL after making a connection.  This will save you 1000
headaches if you're working with non-latin characters.  I can't count
the number of times I've thrown htmlentities, htmlspecialchars,
utf8_encode/decode/, stripslashes, etc, etc around trying to figure
out why those É's aren't being saved or read properly.  I imagine this
might fall into the category of "best practice".

Marc

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



Re: [PHP] Counting Online users, but not using a Session Table in MySQL

2011-01-28 Thread Marc Guay
> I'm looking for a faster way to count online users. COUNT(*) is time 
> consuming under MySQL.

If COUNTing is the heavy part, why not create a 'users_logged_in'
field somewhere and increment it when someone logs in and decrement it
when someone logs out?  Then your query is just a straight SELECT.
Just chucking a thought out there.

Marc

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



Re: [PHP] How to write code: how wrong am I?

2011-02-22 Thread Marc Guay
It's an interesting idea (a different take on coding best practices)
but I find the PHP example to be laborious and time consuming with
little benefit.  If I'm typing an IF statement, I hope to god I know
what the condition is before I start typing it.  Creating the if/else
structure first and then filling in the conditions after is a lot of
cursor-shuffling that could be lived without.

2 cents
Marc

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



[PHP] Does requesting $_SERVER variables need to query the server

2011-02-23 Thread Marc Guay
This question will probably reveal my lacking knowledge of the
fundamentals, but I'm a go for it anyway:

When you use a $_SERVER variable, is a query made to the server to get
the information or is it just sitting in a variable all ready to go?
Reworded, is there any efficiency gained by storing the data in a
"local" variable if it's going to be used many times in the script?
My experience with jQuery has taught me to store $(objects) in local
variables if they're going to be used repeatedly because the DOM is
queried every time a jQuery object is generated, so I'm wondering if a
similar logic applies.

Example:

if ($_SERVER['SCRIPT_NAME'] == 'how.php')
// do stuff
if ($_SERVER['SCRIPT_NAME'] == 'why.php')
// do other stuff

vs.

$script_name = $_SERVER['SCRIPT_NAME'];

if ($script_name == 'how.php')
// do stuff
if ($script_name  == 'why.php')
// do other stuff

Cheerios,
Marc

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



Re: [PHP] Does requesting $_SERVER variables need to query the server

2011-02-23 Thread Marc Guay
>    $_SERVER is just a prepopulated superglobal array that is created at 
> runtime.

Thanks for the clear answer.

Marc

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



Re: [PHP] Does requesting $_SERVER variables need to query the server

2011-02-23 Thread Marc Guay
>  so when
> you're using $_SERVER variables there's no call back to the server, as the
> code is still being run on the server at that point.

This is something I actually do understand.  I was wondering if the
code running on the server had to query the server for the information
every time a $_SERVER var was referenced, but like Daniel explained,
the contents of the $_SERVER array are populated at runtime and so no
further "hey server, what version of apache are you running?"
questions need to be asked of it.

Marc

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



Re: [PHP] Overriding session length in existing session?

2011-03-04 Thread Marc Guay
> This is called globally in *all* my scripts. In another script I'd
> really like to set the session to expire after the browser closes if a
> uses clicks "public terminal" or something.

Howdy.  Don't sessions expire when the browser closes as a rule?  Do
you mean the session cookie?  Why not store the cookie, if one exists,
 in a $_SESSION variable in your header file and then refer to that in
the rest of your code, rather than the cookie.  Then when you want to
destroy the session cookie, you can overwrite it and the existing
session will still flow using the $_SESSION vars until the browser
closes.

It's early here, I hope that sort of makes sense and that I've at
least sort of understood the problem.

Marc

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



Re: [PHP] Overriding session length in existing session?

2011-03-04 Thread Marc Guay
I think that my suggestion is still a valid solution, someone correct
me if I'm wrong.  Let's say your code went like this:

session_start();

 // Check to see if the session variable has already been set, if not
if (!isset($_SESSION['var'])){

// Check to see if it's been stored in a cookie
if (isset($_COOKIE['var'])){
$_SESSION['var'] = $_COOKIE['var'];
}

// If not, set the session variable and store it in a cookie for 7 days
else{
$_SESSION['var'] = "value";
setcookie ("var", $_SESSION['var'], time()+86400 * 7, "/", 
".domain.com");
}
}   
echo "Here I am using my session variable, it's value is ".$_SESSION['var'];


So if that's in the header of every page, but you want to make an
acception if the person is using a public computer, you just add
something like:

if ($_POST['public_terminal'] === TRUE){

// "Delete" the cookie
setcookie("var","",time() - 3600);  
}

echo "Here I am *still* using my session variable, it's value is
".$_SESSION['var']." and it will expire when the browser closes";


Marc

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



Re: [PHP] Overriding session length in existing session?

2011-03-05 Thread Marc Guay
> The statement should be at the start of every php file that has php code in 
> it.

Hi Tedd,

Normally I'd agree with this but having never used the function
session_set_cookie_params() before, I looked it up, and the manual
says to put it before session_start().

"Set cookie parameters defined in the php.ini file. The effect of this
function only lasts for the duration of the script. Thus, you need to
call session_set_cookie_params() for every request and before
session_start() is called. "

Marc

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



[PHP] Help translating PHP5 code to PHP4.

2011-03-07 Thread Marc Guay
Hi folks,

I've stumbled into a project involving a server running PHP4 without
cURL.  The script fetches data from an XML webservice and deals with
it.  Is http://ca2.php.net/xml_parser_create the place to start?  Any
tips (besides updating PHP)?

Here's an example of the PHP5 code:

$url = "http://www.domain.com/webservice.php?var=foo";;  
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$val = curl_exec($ch);
curl_close($ch);
libxml_use_internal_errors(true);
$xml = simplexml_load_string($val);
$errors = libxml_get_errors();

if (!($errors)){
$myvariable = $xml->attributes()->value;
}
else{
// deal with errors 
}

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



Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-07 Thread Marc Guay
Hi Richard,

It's not a SOAP service, and I've actually decided to have ask the
client to upgrade their server software before continuing.  But for
the sake of study:

> Depending upon your requirement, you could use simplexml_load_string()  to 
> convert an XML string into a native PHP object rather than manually parsing 
> the text of the XML string.

I looked up simplexml_load_string() and the manual seems to say that
it's only available in PHP5.  Can you clarify?

Marc

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



Re: [PHP] Overriding session length in existing session?

2011-03-08 Thread Marc Guay
Hi Scott,

I'm glad you resolved your problem.  I'm curious about your method
though, as it seems to be an entirely different approach to my own.
How do you refer to your session data throughout the rest of the site?
 Do you always reference the $_COOKIE variables or do you utilise
$_SESSION's at some point?

Marc

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



Re: [PHP] Help translating PHP5 code to PHP4.

2011-03-09 Thread Marc Guay
> The ease I had in running multiple versions of PHP on Windows would
> suggest it should be pretty easy to do for non-windows.

Funny and true.  Thanks for the tips Richard, I've suggested that they
upgrade their hosting package.

Marc

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



Re: [PHP] Deleting elements from the middle of an array

2011-03-14 Thread Marc Guay
> Here's what I need to do: I have an indexed array, from which I need to
> delete elements in the middle. Once completed, the indexes should be
> numerically in sequence, as they were when I first encountered the
> array.

I believe that array_values() will do the trick.

Marc

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



Re: [PHP] Deleting elements from the middle of an array

2011-03-14 Thread Marc Guay
> I've given a simplified example. The actual target array is
> multi-dimensional.

Your questioni sn't entirely clear but there's lot of chatter about
multidimensional arrays on the array_values() page that might provide
a solution.

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



Re: [PHP] Closing tab in Firefox

2011-03-15 Thread Marc Guay
Quick googling came up with this:

http://www.yournewdesigner.com/css-experiments/javascript-window-close-firefox.html

Maybe try the JS mailing list if that doesn't take you down the right
road.  PHP can't manipulate the browser.

Marc

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



  1   2   >