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
--
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
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
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
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
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
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
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
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
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
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?
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
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
Thanks everyone.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
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
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:
$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:
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
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()
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
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 pre HTML tag? (http://www.w3schools.com/TAGS/tag_pre.asp)
Putting inside a textarea might also work for you...
--
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
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
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
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
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 img tag like so:
img width='0' height='0' src=updater.php alt= /
Again, not sure if it will keep running
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
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
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
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 Â.
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
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
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
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
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
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 Â
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
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
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
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
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.
?php
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
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
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:
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
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
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/)
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
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,
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
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
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
$_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
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
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
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
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
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 =
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
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
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
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
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
I copied this thread to some co-workers with the subject line Be glad
that you're not programmers.
Is it Friday yet?
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
session_start(); // genesis
// do stuff
session_destroy(); // revelation
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I just googled up php tedd form validation and can't find a single
reference. What does this mean, that I respect tedd's skills or that
he needs better SEO?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
What are you are looking for?
I'm working on a new form and after reading a few threads on this list
since I've subscribed I realized that validating input is a weakness
of mine. I figured you would have an example online somewhere covered
some of the main security concerns.
Marc
--
PHP
Dinna know bats even _had_ eyelids
They increase the effectiveness of evil spells by 50%, especially when
coupled with Frogs Tears (tm).
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Does anyone have any ideas?
Sounds like it's getting caught in a loop. Post the whole script for
best results.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
$one = array(0 ='golf', 1 = 'field');
$two = array(0 = On the golf course or in the field of clover);
$array_exp = explode($one, $two);
What's the desired result?
array('golf' = On the golf course or in the field of clover,
'field' = On the golf course or in the field of clover)); ?
Marc
Hi folks,
I'm running some code locally which should produce this fun error we
all know and love: Warning: Cannot modify header information -
headers already sent by... but does not. Switching from 5.3 to 5.2
reveals the error and running it on another server with 5.2 also shows
the error. I
Thank you Balint but if you read my message I have a good
understanding of what causes this error. My confusion is why it is
not being thrown in this partciular instance.
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
See if output_buffering and output_handler are set the same in
your php.ini and/or phpinfo() output between working and non-working
versions.
Thanks Daniel. With output_buffering On the error was not displayed
and the re-location fired, while Off caused it to display the error
and continue
To everyone who did not read my original message but responded to it,
Thank you.
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I imagine this one's been done before, but maybe not in the same way
?php
$result = succeed();
while (!$result){
try{
$result = succeed();
}
catch (Exception $e){
Unsubscribe! Unsubscribe! Unsubscribe!
Can I detonate() the future of this thread before it goes where it's
about to go?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
What's PHP? I thought this was the
top-posting-etiquette-discussion-and-simmering-race-war group.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I bought a 1GB external hard drive for $1000. Did I just choke on my lunch?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
If that was about 20 years ago, then it would be fine!
Would have been around 1992, good guesswork!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi folks,
I'm working on a project that will only be run locally on a WAMP
server. A mobile browser/app will call a certain page which should
silently trigger a print job to a printer connected to the printer.
Does anyone have advice on how to accomplish this? I've seen
implementations
Bonus feature: The server is running Windows 7. I suspect the
crickets are going to win this one.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Take a look at http://www.php.net/printer -- this might be what you're
looking for.
Hi Ken,
Thanks for trying but I've been down that road and from my
understanding that PECL extension is really out of date and
unsupported (the page that hosts it doesn't even have a downloadable
DLL). Also
What type of file are you trying to print?
HTML.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
What type of file are you trying to print? I'm not very familiar with
Microsoft Windows but I know a little about it. Have you considered Windows
Powershell? Unfortunately you would essentially have to write a powershell
script and use the PHP exec functions. Windows 7 shipped with
What type of file are you trying to print? I'm not very familiar with
Microsoft Windows but I know a little about it. Have you considered Windows
Powershell? Unfortunately you would essentially have to write a powershell
script and use the PHP exec functions. Windows 7 shipped with
4 - And just found it. WordPad comes with Windows, so, maybe
PHP+COM+WordPad
(http://msdn.microsoft.com/en-us/library/51y8h3tk(v=vs.80).aspx) could
be another option here. I think WordPad is just a visual wrapper for
the RichEdit20 ActiveX component which is controllable via COM.
By using
That low-hanging fruit is too hard for some to resist...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Another theoretical approach, given the grey areas, would be to add a
field to your table to indicate these special users. I would call
the field is_awesome and have it default to zero, because that's
just the way it is. Then you can make your query SELECT * FROM users
WHERE is_awesome=1. This
You could store the accented characters in your DB if you set
everything to UTF-8, including calling the SET NAMES utf8 MySQL
command after connecting. I find this much easier than
encoding/decoding.
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Anyone know a smart way to order file names?
Nope, but I know a natural way:
http://ca.php.net/manual/en/function.natsort.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
use natsort.
For the repetitive answers specialists: Is it possible that 15
hours later someone is still only seeing the original question?
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Howdy,
I'm looking for a FOSS equivalent to PHPMaker, or at least something
which comes close to it. For those who don't know the program, it
syncs with your database and allows you to generate an entire CMS
system based on it. To be clear, I am not looking for a CRUD code
generator, I'm
Hi Ashley,
That's an interesting looking project, but wouldn't it require me to
switch to CodeIgniter? I'm not interested in changing my entire
working method for this.
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I assumed that as you'd mentioned trying Drupal that you would be OK with
trying out various PHP-based solutions?
True enough. Maybe I'll sharpen the focus then and ask if anyone
knows of a solution that does not require a reworking of method; a
stand-alone CMS generator similar to PHPMaker
Hi folks,
Let's say that I have 2 constants
DEFINE('DESKTOP_URL_en', http://www.website.com/index.php?page=home;);
DEFINE('DESKTOP_URL_fr', http://www.website.com/index.php?page=accueil;);
and I would like to populate the value of an href with them depending
on the
$var = constant('DESKTOP_URL_' . $_SESSION['lang']);
Very nice, thank you.
Marc
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Is it just me or does it not work unless you agree to the extra
information sharing stuff?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I want to write a script that requests a URL and then reads that website
.. I'm interested to map web structures. My web host is saying I'll need
URL file access enabled but that it's a) a security risk and b)
deprecated.
simplehtmldom is pretty great for this, if I understand your needs
Hi folks,
I'm trying to convert the contents of an array from utf8 to utf16
(thanks for the headache MS Excel!). I originally created a user
function that just ran the text through
mb_convert_encoding($text,'utf-16','utf-8') but now I'm wondering if I
can't just use the internal function
You need to pass a second and third array to array_map() with the same number
of elements as the first array. The arguments to the callback function are
the elements from each array at the same offset.
Wow, thanks for the clarification. I've decided to create my own
function and use that
1 - 100 of 169 matches
Mail list logo