Why are you writing a logging class? Why not use error_log and enable error
logging?
On Fri, Mar 21, 2008 at 1:11 PM, Al <[EMAIL PROTECTED]> wrote:
> int file_put_contents ( string $filename, mixed $data [, int $flags [,
> resource $context]] )
>
> This function is identical to calling fopen(), f
in php you have a number of constructs that can be used to execute code (or
not) based on certain conditions ie is_defined(). Not sure if
the comparison with C holds true as C is compiled and PHP is interpreted.
On Fri, Mar 14, 2008 at 6:34 PM, Eric Gorr <[EMAIL PROTECTED]> wrote:
> If you are ta
Will you two pricks cut it out. How fucking tedious.
On Wed, Mar 12, 2008 at 9:34 PM, Robert Cummings <[EMAIL PROTECTED]>
wrote:
>
> On Wed, 2008-03-12 at 22:26 +0100, Aschwin Wesselius wrote:
> > Robert Cummings wrote:
> > > On Wed, 2008-03-12 at 16:11 -0500, Greg Donald wrote:
> > >
> > >> On 3
session_register is old school. RTFM.
On Mon, Mar 10, 2008 at 4:26 PM, Al <[EMAIL PROTECTED]> wrote:
> Read the current php manual.
>
> Lamonte H wrote:
> > Is it necessary to use session_register()? What exactly was the point
> of
> > this function if you can set sessions using $_SESSION it sel
Said it was a crude example and I was pushed for time
On Jan 24, 2008 8:13 PM, Eric Butera <[EMAIL PROTECTED]> wrote:
> On Jan 24, 2008 3:08 PM, Dave Goodchild <[EMAIL PROTECTED]> wrote:
> > header("Location: index.php");
>
> Redirect uri's should be absolute.
>
Methink you're a little confused. A function is a piece of code that
performs a specific job that can be called. You may send it
data, you may not. It may return data, it may not. If your link goes to
logout.php, that script may use functions to do it's job.
You can't call a function in a link as p
Don't be scared of functions, no magic or mystery there, all you are doing
is putting your code in a function like so:
function add($a, $b) {
return $a + $b;
}
..for example and calling it like so:
$a = 12;
$b = 100;
$sum = add(12, 13);
...etc etc, not too much more to learn than that and now I
It's advisable as the page you will be redirected to will be relative to the
one the browser actually requested, so it's a good habit to get into.
On Jan 5, 2008 4:05 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Jan 5, 2008 10:59 AM, Dave Goodchild <[EMAIL PROTECTED]>
Also, supply an absolute URL when using header redirects.
On Jan 5, 2008 3:44 PM, Daniel Brown <[EMAIL PROTECTED]> wrote:
> On Jan 5, 2008 9:06 AM, peeyush gulati <[EMAIL PROTECTED]> wrote:
> > Greetings on New Year :)
>
>To you, as well!
>
> > We have a script, say layer.php, which uses HTTP
don't use nonbreaking spaces use CSS to style the input button then
you wont have to deal with redundant presentational gunk in your data
On 1/2/08, David Giragosian <[EMAIL PROTECTED]> wrote:
> On 1/2/08, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> >
> > On Jan 2, 2008 1:34 PM, tedd <[EMAIL PROTECT
If MVC is too heavy for you it may also be worth exploring templating
engines such as Smarty:
http://www.smarty.net/
On Jan 2, 2008 4:10 PM, Nathan Nobbe <[EMAIL PROTECTED]> wrote:
> On Jan 2, 2008 2:17 AM, Alain Roger <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> >
> > i would like to improve my codi
Why not try a css list? css-discuss for example?
On Dec 18, 2007 8:06 PM, Børge Holen <[EMAIL PROTECTED]> wrote:
> On Tuesday 18 December 2007 20:03:53 Stut wrote:
> > VamVan wrote:
> > > Please apologize for sending this question to PHP forums.
> >
> > If you know this already why ask the questi
Hi guys. I have the following XML file which I want to convert into a
multidimensional array. I am using PHP5 so don't want to use
SimpleXML as apparently there are issues with sessions and after
conversion I want to pass this array into the session. Any ideas on
the best and cleanest way to do thi
Start with Programming PHP and then get Upgrading To PHP5 (both by O'Reilly)
On Nov 17, 2007 2:31 PM, David Giragosian <[EMAIL PROTECTED]> wrote:
> On 11/17/07, joychen <[EMAIL PROTECTED]> wrote:
> >
> > tell me :which book is good for newman??
>
>
> You mean paul?
>
--
PHP General Mailing List
Start by coding proper semantic xhtml and you will have less headaches
too - that code looks very ugly.
On Nov 12, 2007 8:38 AM, Ronald Wiplinger <[EMAIL PROTECTED]> wrote:
> Chris wrote:
> > Ronald Wiplinger wrote:
> >> My php program is working with Firefox, but not with Internet Explorer.
> >
>
Support for php4 will be dropped at the end of the year so hosts will be
forced to make the upgrade at some point.
On 10/29/07, Hulf <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
>
> It is about time I made the jump to 5, however the only thing that is
> holding me back is the problem with hosts. How many
You mean a javscript library? If so, check out jquery and moo.fx.
On 10/23/07, Merlin <[EMAIL PROTECTED]> wrote:
>
> Hi there,
>
> I am looking for a framework to integrate some AJAX Functionality into
> my PHP4 MySQL Apache webapp. First thing I would like to do, is an edit
> function that opens
No, because extra processing is done on the other side - now
fuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuck
I use something like this:
$_SESSION['profane'] = false;
foreach ($_POST as $value) {
foreach ($swearbox as $profanity) {
if (preg_match("/$profanity/i", $value)) {
$errors = true;
$_SESSION['profane'] = true;
mail(TECHEMAIL, 'profane content
Sure, I usually put these files outside the docroot - unless I am in some
f**ked-up hosting environment that doesn't let me change the include path...
Unless some server config error causes that stuff to be output on the page?
I tend to put such functions in a .inc file and amend the .htaccess to
prevent download.
Why not use umask?
umask
Your problem is this:
$result_row[] = mysql_query($query) or die(mysql_error());
...you are assigning a query to a variable. What you need to do is
something like this:
$result = mysql_query($query) or die(mysql_error());
while ($result_row = mysql_fetch_array($result)) {
.
}
If there is no need to return a value then I don't do so. However, the
function is going to process something, and surely you should check that the
processing has succeeded or failed?
You could also try Drupal. Drupal 5 comes bundled with jQuery. Drupal is
powerful and flexible and the community is large and supportive.
What function(s) are you using to read the file contents? How are you
inserting them into the array? Code examples please...
It's a personal thing. I use Code Igniter (codeigniter.com), which is fast,
lightweight, has a great community and excellent documentation, as well as
some very good video tutorials.
It pales in comparison with Ruby On Rails, of course, but that's another
thread on another list...
Another small and unrelated point - you don't need to use double quotes
inside the array brackets - you're not processing them at all.
The characters are encoded in octal and the php interpreter converts them
into the corresponding ASCII characters and then the sequence is represented
as a string which is included?
Hi all. I have built an online events directory in php (
http://dontjustsitthere.co.uk) where people can find local events and also
post their events. The app is composed of a single page, index.php, that
generates different content depending on the parameters passed to it and
uses sessions for pe
View the source, you have this:
which is not closed, therefore everything after it will be blue.
You can also use that in interpolations where the variable name may be
ambiguous ie
"My name is Stephen and I am a {$type}drone"
..or to interpolate array lookups:
"This is {$desc['mood']} don't you know!"
Can we kill this now please? It's not a php issue, is an old and endless
argument and is better addressed on a css / design list.
Tables used for presentational layout are a hack, implemented in an albiet
ingenious way to overcome the shortcomings of the Web quite a while ago now.
Tables should be used for the display of tabular data, ie spreadsheets,
calendars etc.
Table layout increases download times, the deeper nested
That is, unless you use output buffering. It may not be the most elegant
solution (using header() to redirect users increases server calls), but I
built a template-driven php site that calls:
...depending on certain conditions which means I can then use header() even
after I have started output
Can you re-iterate what is happening - I have a site with 1and1 and use
header() with no issues.
Provide some code...?
I have just upgraded to Drupal 5 and so far am very impressed - D5 comes
bundled with the jquery library and I have found drupal to be very powerful
with a wide and supportive community.
Not true. You can submit the form back to itself as many times as required
by making the form action $_SERVER['PHP_SELF'] and checking for various
sequences and outputting different html in each case.
Amazing, just what I needed - many thanks. Have been coding non-stop for 10
days and things are getting foggy. Grats for your informed and quick
response and have a fantastic day!
Hi all, I have an array containing a sequence of dates in the following
format, for example:
Mon 26 Nov 2007
Mon 24 Dec 2007
Mon 31 Dec 2007
Mon 28 Jan 2007
...and I want to remove any the first element in cases where the Mondays
fall in the same month, so in this case I want to be
left with:
M
Because of this:
$sql = mysql_query("INSERT INTO tbl (WHEN, WHAT, WHO) VALUES
('$WHEN','$WHAT','$WHO')");
$result = mysql_query($sql) or die("Fatal Error :".mysql_error());
...you are running the query and assigning the results into $sql and then
running mysql_query again in the line below. S
Because isset will return true if the variable is set, even if it is blank.
Empty will return true is the variable holds an empty string.
use: $_POST['max_id'] ==
or even better:
if (empty($_POST['max_id']))
Om
On 3/20/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
Tijnema ! wrote:
> On 3/20/07, Dave Goodchild <[EMAIL PROTECTED]> wrote:
>> Have a look at this:
>
> Have a look at nothing :)
I believe this Dave's way of pointing people to the Great Void :-)
>>
Have a look at this:
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Turn off register_globals - if you pollute your scripts with global
variables like that you are asking for trouble. If you can't make sure you
clean the variable.
Using include("$page.php") is asking for trouble.
If you can get register_globals switched off (it's off by default in PHP5
for this
ucwords(strtolower($string))
or
ucfirst(strtolower($string))
On 3/13/07, Todd Cary <[EMAIL PROTECTED]> wrote:
I would like to write a filter that takes the text "smith" or
"SMith" and returns "Smith"; same for "ralph smith". Is the a
good source on using filters this way?
Thank you...
--
P
If you do want to use the header function after html has been output, you
can always look at using output buffering (ob_start()).
Hi guys, I have just read 'Programming PHP' (O'Reilly) and although I think
it's a great book, I am confused about variable variables and references -
not the mechanics, just where you would use them.
The subject of variable variables is explained but no examples are given as
to why and where you
Why not learn in a web environment if your goal is to build a website? Just
create the following file:
save it, upload it and view it. If you see the php details you have the
system set up as you need it and can just start writing php-driven web pages
(the file you are using now is one!).
If y
If you are running that from the command line, why do you need html? Not
sure why you're doing that.
Of course it's possible to output raw html in a php file, that's one of it's
fundamental uses! In fact, it's more efficient to switch the php parser off
and send raw html as the php parser doesn't need to get involved.
On 2/28/07, tedd <[EMAIL PROTECTED]> wrote:
At 11:22 PM -0500 2/27/07, John Taylor-Johnston wrote:
>I need an anti-spam-spider measure for my site. Too many addresses
>are getting raked. In once instance, I created a flash page:
>http://erasethis.glquebec.org/English/contact.htm
>But I just don'
OK. Blank entries means that as date is passed in and validated via forms,
it is then entered into $_SESSION so data can be persistent as the user goes
back and forth. These values are eventually entered into the database and
are blank, whereas the few values that are entered from $_POST (ie credi
You have a typo in your code...
On 2/25/07, zerof <[EMAIL PROTECTED]> wrote:
Alain Roger escreveu:
> Hi,
>
> i stored all my pictures in my PostgreSQL DB as bytea type.
> Now i would like to know how can i display them in my PHP pages ?
>
> where can i find some example ?
>
> thanks a lot,
>
--
It is not a good
On 2/24/07, Dotan Cohen <[EMAIL PROTECTED]> wrote:
Also, if you're using the variable in a print string, then you'll need
to exit the string, like so:
$print "Hello, $kind!";
would become:
$print "Hello, ".$_GET["kind"]."!";
Dotan Cohen
http://easyanswers.info
http://nirot.com
--
PHP General
On 2/24/07, Otto Wyss <[EMAIL PROTECTED]> wrote:
With method="post" just $kind works fine (register_global) yet I've also
tried any combination of $_GET['kind'] and $_POST['kind']. With
method="get" it doesn't work.
O. Wyss
Peter Lauri wrote:
> How are you fetching the GET and POST? With $_GET
$web = fopen('http://google.com/index.php', 'r');
$contents = file_get_contents($web);
if (preg_match('/$link/', $contents))... you got it
simplified and no error checking but you get the idea.
Hi all. I am running an online charity lottery and am having issues with IE6
and sessions.
To fix them, I added the following at the top of each file:
ini_set('session.name', 'tlc');
header("Cache-control: private");
session_start();
...ran a local test in IE6 worked fine, then noticed more bla
Also, if you want to get into the habit of writing valid xhtml, use
lowercase and selected="selected"
I assume you mean you want to hold that html in a variable? Use a heredoc.
Thanks all for your input - you're all correct, I don't really need to use
timestamps as I am only interested in dates so will be reworking the app to
use dates only. I still need to generate sequences of dates and really don't
want to deal with DST, so my question is: can I add days to dates with
I AM using the logic you and Jochem suggest in the query, I am not
performing any joins. I query for certain criteria re the start and end
dates held in the database, and once I have my set I then work with it
dynamically as I need to know, based on the event frequency, how many events
from that r
Hi all. I have an odd problem.
I am building an events directory and when users search, they provide a date
range ie Feb 16 2007 to March 12 2007 as one of the options for searching.
The system then creates an array of timestamps from this and then polls the
database for all events whose lifetime
Thanks for that - can't do that as all I know in the database is the start
and end date for each event (so I don't have to create mapping tables and
perform massive joins), the rest is handle dynamically.
I think I can do it using usort, this seems to work, any comments?
function compare($x, $y)
Hi all. I am building an online events directory and as part of the system
users can search for events by date, category etc.
The logic involved in finding events that match the user-entered dates works
like so:
1. we create a range of dates from the start and end dates specified by the
user
2.
This is what I use:
$site = (!preg_match('#^http://#', $_POST['c_site'])) ?
raw_param(trim(strip_tags("http:\/\/" . $_POST['c_site']))) :
raw_param(trim(strip_tags($_POST['c_site'])));
don't worry about raw_param, that's a function of my own, but you get the
idea.
Hi all, I posted a question a couple of days ago regarding a web app I have
wherein users are able to indicated prices and concessions via a text field,
and the resulting encoding issues I have experienced, the main one being
seeing the pound sign as £ if viewing the results in a browser with the
Thanks guys. The issue is that users can specify text as well as currency in
the input field ie '£2 students / £5 general admission'.
This may be more of a mysql issue, but I am using php for my app so here
goes...
I have a fee field in the database, and when users post events they can
specify entrance fee in £. In some, not all, of the fields I am getting, for
example, £7 rather than £. Is this an encoding issue?
Many thanks
mysql_select_db
Why not check php.ini to see whether display_errors is set to off and switch
it on until you are back in business? Check the httpd.conf file to make sure
Apache is parsing .php files correctly.
Read the reponses.
Wow, there are some really bitchy, unattractive people here. No wonder some
people bail out of IT. Don't confuse knowledge for wisdom.
On 1/9/07, tedd <[EMAIL PROTECTED]> wrote:
At 9:17 PM -0500 1/5/07, <[EMAIL PROTECTED]> wrote:
>You'll probably get 50 answers to this, but here's probably what
Can you show us what you're calling it with?
Al Padley
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
http://www.web-buddha.co.uk
is_numeric will return true for a positive or negative number.
Use ini_set or an .htaccess file - try the first, and if that doesn't work
use an .htaccess file if you have them enabled in the server (and it's
Apache of course!).
On 12/6/06, Ashley Hales <[EMAIL PROTECTED]> wrote:
I am trying to use includes on a free php server but I cannot set the
include
In that case you could use the /e trailing option to use strtolower on the
subpattern.
Why not use strtolower on the string after the replacements have been made?
--
http://www.web-buddha.co.uk
Indeed. A good habit to get into to avoid that is the write it like this:
if ('yes' == $Permission)
that way, if you write = rather than == you catch the error
On 11/29/06, Brad Fuller <[EMAIL PROTECTED]> wrote:
if ($Permission = "Yes")
should be
if ($Permission == "Yes")
It's one of those
Hi all. I am building a web app and as part of it advertisers can upload
their ad image and website URL to go with their ad. Is there a good way to
detect whether that site is a porn site via php?
--
http://www.web-buddha.co.uk
Also, turn off display_errors before going into production, at which stage
enable error logging.
On 11/23/06, Jochem Maas <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:
>> [EMAIL PROTECTED] wrote:
>>> hi!
>>>
>>> the company I work for moves our web server to other hosting company
>>> (ded
There are a few ways of working you should adpot early as they protect
against a range of security problems. Some examples:
1. Always initialised your variables.
2. If you can, turn off register_globals, or code defensively if you can't.
3. Always mistrust incoming data, validate, check contents
I charge £20(approx $40) per hour or by the job, code in php, use mysql, and
produce front end in xhtml/css. Recent example:
dontjustsitthere.co.uk/stage/.
On 11/18/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Does anyone know of a good website, which rates PHP programmers? or Does
anyone
I ran this expression through Regex Coach:
\[([A-Za-z0-9\'.-:underscore:\s]+)\|([A-Za-z0-9\'.
-:underscore:]+)\]
...and it matched the patterns your describe.
If you know the array elements, you may not need to loop. Why not just echo
the particular array elements i.e. for
example?
Result. Cheers!
On 11/16/06, Robert Cummings <[EMAIL PROTECTED]> wrote:
On Thu, 2006-11-16 at 15:28 +, Dave Goodchild wrote:
> Hi all. I have a multidimensional array here:
>
> Bums" ["name"]=> string(13) "Tits And Bums" [3]=> string(19) "
Hi all. I have a multidimensional array here:
array(6) { [0]=> array(25) { [0]=> string(1) "7" ["eventid"]=> string(1) "7"
[1]=> string(2) "17" ["cat_id"]=> string(2) "17" [2]=> string(13) "Tits And
Bums" ["name"]=> string(13) "Tits And Bums" [3]=> string(19) "The Pleasure
Centre" ["venue"]=> str
You would use cURL to achieve the things cURL is built to achieve?
Is there a way to make a regular expression to match on a particular way
the letters are arranged? For instance, if you had a word:
THAT
It could match on any word in the dictionary that had the form:
1231
preg_,match('/^(\w){1}\w\w\1$/');
would match the above on a single line for example,
Good responses here - I tend to use MS conditional comments as I only resort
to hacks when there (seems) to be no other way, and although conditional
comments are proprietary they are ignored as comments by other browsers and
are hence pretty harmless.
Yes, for example Opera identifies itself as
Are you writing the blog from scratch? I think you will have to get to grips
with mod_rewrite (Apache).
Better still, keep them outside the docroot. If you do insist on having them
inside and insist on calling them *.inc, create an .htaccess file that stops
download of *.inc files.
You could try creating a stylesheet for media type="handheld", not sure how
stable support is.
I am using Code Igniter on two projects at the moment and I am loving it.
All the tedious, repetitive elements are reduced, security is increased and
code organised in a clean fashion (you can of course mis-use frameworks but
with effort they can promote and facilitate a cleaner, more modular appr
Example HTTP redirect:
header('Location: http://www.google.com";);
Take out the comment before the DOCTYPE. There should be nothing before it.
1 - 100 of 246 matches
Mail list logo