php-general Digest 27 Mar 2005 03:40:28 -0000 Issue 3361
Topics (messages 211619 through 211649):
Help!
211619 by: MIKEYTF.aol.com
211621 by: Matthew Fonda
Re: Storing data structires in DB
211620 by: GamblerZG
211630 by: listas.uakari.com
211645 by: GamblerZG
211646 by: Rasmus Lerdorf
mysql_fetch_row() --Still not working
211622 by: MIKEYTF.aol.com
211624 by: Matthew Fonda
Re: modules
211623 by: Matthew Fonda
fread is allocating memory on its own?
211625 by: Ficos
Re: header("Location: page.php target=_parent")?????
211626 by: Ospinto
deleting cookies on the touch of a button
211627 by: AndreaD
211631 by: Marek Kilimajer
Re: Referer checking is able to be referer spoofed
211628 by: Marek Kilimajer
PHP Netobjects Fusion problem
211629 by: Johan van Zyl
211637 by: Matthew Fonda
gd graphics on debian with apache 1.3
211632 by: theal
Re: So this isnt a bug?
211633 by: Marek Kilimajer
211636 by: A. S. Milnes
Re: setlocale and pt_BR problem on debian
211634 by: Christian Stadler
211635 by: Christian Stadler
Re: opt-in mail list best practice
211638 by: Matthew Weier O'Phinney
Avoiding SQL injections: htmlentities() ?
211639 by: Ryan A
211640 by: tg-php.gryffyndevelopment.com
211641 by: Chris Ramsay
211642 by: Guillermo Rauch
211649 by: Chris Shiflett
Re: [semi OT]: Planning projects
211643 by: Matthew Weier O'Phinney
Re: Pagination
211644 by: Matthew Weier O'Phinney
More about problems reading COM ports
211647 by: John McCaskey
211648 by: John McCaskey
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
I get this error: Warning: mysql_fetch_row(): supplied argument is not a
valid MySQL result resource in /home/helljump/public_html/php/index.php on line
39
and I am connecting to the database!
Here is line 39:
<?php
$query=mysql_query("SELECT
boardid,boardname,boardcaption,topics,messages,views FROM boards ORDER BY id
ASC");
while($row=mysql_fetch_row($query)) echo '<tr ',shading(),'><td><a
href="http://subzer0.net/php/topics.php?board='.$row[0].'">'.$row[1].'</a></td><td>
'.$row[2].'</td><td>'.$row[3].'</td><td>'.$row[4].'</td></tr>';
echo '<tr class="cell1"><td align="center" colspan="10"><b>User Options</b><
/td></tr><tr ',shading(),'><td>Use your <a href="/php/board_manager.php">board
manager</a> to add or remove boards from the index.</td></tr><tr ',shading(),'>
<td><a href="/php/meta_mod.php">Meta-Moderate</a> to give feedback to the
staff of '.$config['sitename'].'</td></tr>';
?>
--- End Message ---
--- Begin Message ---
Chances are you are not connected to the database, or you have a MySQL error
somewhere along the lines. Try using mysql_error() to help find whats going
on.
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> I get this error: Warning: mysql_fetch_row(): supplied argument is not a
> valid MySQL result resource in /home/helljump/public_html/php/index.php on
line 39
>
> and I am connecting to the database!
>
> Here is line 39:
>
> <?php
>
> $query=mysql_query("SELECT
> boardid,boardname,boardcaption,topics,messages,views FROM boards ORDER BY
id ASC");
> while($row=mysql_fetch_row($query)) echo '<tr ',shading(),'><td><a
>
href="http://subzer0.net/php/topics.php?board='.$row[0].'">'.$row[1].'</a></
td><td>
> '.$row[2].'</td><td>'.$row[3].'</td><td>'.$row[4].'</td></tr>';
>
> echo '<tr class="cell1"><td align="center" colspan="10"><b>User
Options</b><
> /td></tr><tr ',shading(),'><td>Use your <a
href="/php/board_manager.php">board
> manager</a> to add or remove boards from the index.</td></tr><tr
',shading(),'>
> <td><a href="/php/meta_mod.php">Meta-Moderate</a> to give feedback to the
> staff of '.$config['sitename'].'</td></tr>';
>
> ?>
>
>
>
--- End Message ---
--- Begin Message ---
Ok, let me ask in a different way. Is there any way to make eval to
parse only data structures, without executing any functions it may
encounter?
--- End Message ---
--- Begin Message ---
You can have the functions list in an array and check if any of that is
in the code you are going to pass to eval().
Devta.
GamblerZG escribi�:
Ok, let me ask in a different way. Is there any way to make eval to
parse only data structures, without executing any functions it may
encounter?
______________________________________________
Renovamos el Correo Yahoo!: �250 MB GRATIS!
Nuevos servicios, m�s seguridad
http://correo.yahoo.es
--- End Message ---
--- Begin Message ---
Why would you _manually_ edit a serialized array??? One would think you
would UNSERIALIZE (http://us4.php.net/unserialize) the serialized array
*before* working with the data.
Well, I guess my initial posting was a bit misleading. I'm writing a
content management system, and that system needs to give its users
ability to create arbitrary data structures. Suppose users should be
able to create hyperlinked menus. Each menu entry must have text, URL
and, possibly, title. There are several ways to achieve such functionality.
1) Write big and ugly interface that does only that – creates menus. Not
very smart, because tomorrow users might need to create nested
categories or some other things.
2) Invent your own syntax for menu programming and write small, but
still ugly procedure that parses that syntax.
3) Invent your own syntax for data structure programming, and write
function that parses it into PHP data structures. Almost a good
solution, but then I would need some way to store, retrieve and edit data.
4) Use something that already exists.
If I can, I would prefer to stick with 4. After all, PHP has
var_export() and eval(). The problem is, var_export() stuffs its output
with junk (extra commas, newlines, spaces), and eval() executes any code.
--- End Message ---
--- Begin Message ---
GamblerZG wrote:
Why would you _manually_ edit a serialized array??? One would think
you would UNSERIALIZE (http://us4.php.net/unserialize) the serialized
array *before* working with the data.
Well, I guess my initial posting was a bit misleading. I'm writing a
content management system, and that system needs to give its users
ability to create arbitrary data structures. Suppose users should be
able to create hyperlinked menus. Each menu entry must have text, URL
and, possibly, title. There are several ways to achieve such
functionality.
1) Write big and ugly interface that does only that – creates menus. Not
very smart, because tomorrow users might need to create nested
categories or some other things.
2) Invent your own syntax for menu programming and write small, but
still ugly procedure that parses that syntax.
3) Invent your own syntax for data structure programming, and write
function that parses it into PHP data structures. Almost a good
solution, but then I would need some way to store, retrieve and edit data.
4) Use something that already exists.
If I can, I would prefer to stick with 4. After all, PHP has
var_export() and eval(). The problem is, var_export() stuffs its output
with junk (extra commas, newlines, spaces), and eval() executes any code.
You are looking for serialize here. I bet you'd be better off with an
existing XML format for something like this though.
-Rasmus
--- End Message ---
--- Begin Message ---
Alright, I made a new index and I am 100% sure that I did it correctly.
http://subzer0.net/php
Notice those two mysql_fetch_row errors. I have successfull connected to the
database needed, the query seems to be correct, and I inserted some boards
into the board db.. But I still get that error.
Any idea how I could fix it?
~Mike
--- End Message ---
--- Begin Message ---
> Any idea how I could fix it?
Yes, use mysql_error() to see what the error is, once you know what MySQL
error you are getting, it will be easy to fix.
--- End Message ---
--- Begin Message ---
I would say the best way to go about doing this would be to look at examples
of the code in sites you find that do this. Observe how they do it, and base
your code off of it.
"Cima" <[EMAIL PROTECTED]> wrote:
hi,
im building a web site and i have seen some sites built using modules to
facilitate further maintainance. by modules im referring to having a module
for administrating the web site , another for searchs to be done, another
for reports to be generated ect. i hope im explaining my self.
what i would like are references to documentation on how to build such a web
site using php (im working php 4).
thanx.
--- End Message ---
--- Begin Message ---
I'm trying to use a PHP script to test the throughput from a few
different web servers on a test network at work. I'm doing an fopen
with the URL, and then a read loop like this:
while (!feof($handle)) {
fread($handle, 8192);
}
I'm ignoring the data returned by fread, since I'm just interested in
how long that loop takes, not the contents. It works fine on small
files, but once the test file is above PHP's memory limit I get "Allowed
memory size of 8388608 bytes exhausted (tried to allocate 8192 bytes)".
What I can't figure out is why memory is getting allocated in that loop.
I've also tried doing $string = fread (...) and immediately following
that with unset($string) or $string = NULL or $string = ''. None of
those worked, I still run out of memory.
Any suggestions?
--- End Message ---
--- Begin Message ---
use javascript
<body onLoad="javascript:parent.document.location.href='page.php'"></body>
not
the header function.
"Jacques" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How should I formulate the header function to replace the current frameset
> page with a new one? I have tried a combination of header("Location:
> page.php target=_parent"); but I get an error message saying the page does
> not exist.
>
> Also, can I save a frameset page with a .php extension? I have tried it
out
> and it seems to work. Maybe perhaps I should not do this as there may be
> some implications later on???
>
> Regards
>
> Jacques
--- End Message ---
--- Begin Message ---
I have a range of cookies that need to be deleted on the click of a button.
The cookies are set by using.
setcookie("cookie[$name]", "$age")
Is there a simple command to delete all cookies or I have to do a foreach
statement?
How can I execute the code/function on a click of a button?
Thanks,
AD.
--- End Message ---
--- Begin Message ---
AndreaD wrote:
I have a range of cookies that need to be deleted on the click of a button.
The cookies are set by using.
setcookie("cookie[$name]", "$age")
Is there a simple command to delete all cookies or I have to do a foreach
statement?
You have to use foreach
How can I execute the code/function on a click of a button?
I'm not sure what you mean. Perhaps a link, or a bookmark
--- End Message ---
--- Begin Message ---
Dan Rossi wrote:
On 20/03/2005, at 5:40 AM, Marek Kilimajer wrote:
If you need only hotlink protection then the current referer checking
is just enough. Most users will not install referer spoofing software.
But if you need to be 100% sure the videos are streamed through
affiliate server, you can use tokens - a script at the affiliate
server will request a token from the streaming server (with
username/password/clip id etc.). This token will be sent with the link
to the streaming server. Hope this is clear.
Hi there sorry to return back to this, but we are somehow needing to
create a token url that will be generated on the customer's webpage
before the link is redirected to an access script of our clients video
feeds site. What would be the most safest credentials to use to create a
token with and how could the access script decrypt this information to
validate access ? Let me know if this is too vague of a question thanks.
You can create tokens using uniqid() function. Save the token in the
database together with create time, so you can expire it. Then in the
access script check if the token is in the database and it has not expired.
--- End Message ---
--- Begin Message ---
Hi All
This code:
<?
print "Connected to: ";
print " ";
$host = "10.0.0.3:employee.fdb";
//$host = "10.0.0.6:testfb";
print_r($host);
$username = "SYSDBA";
$password = "masterkey";
$dbh = ibase_connect($host, $username, $password);
if (!$dbh)
{
exit ("Unable to establish a connection - please try later.");
}
else
{
$stmt = "SELECT FIRST_NAME, LAST_NAME FROM EMPLOYEE ORDER BY LAST_NAME
DESC, FIRST_NAME DESC";
$result = ibase_query($stmt);
//$row_array = ibase_fetch_row($result);
//$row_array = ibase_fetch_row($result);
//print_r($row_array);
?>
<TABLE BORDER=0 BGCOLOR='#55BFFF' CELLSPACING=6 CELLPADDING=0 WIDTH='100%'>
<TR>
<TD><P><B>First Name</B></P></TD>
<TD><P><B>Last Name</B></P></TD>
</TR>
<?
While ($row = ibase_fetch_assoc($result))
{
echo "<TR>";
echo "<TD><SPAN STYLE= 'font-size: 11px;'>";
echo $row["FIRST_NAME"];
echo "</TD>";
echo "<TD><SPAN STYLE= 'font-size: 11px;'>";
echo $row["LAST_NAME"];
echo "</TD>";
echo "</TR>";
}
echo "</table>";
ibase_free_result($result);
}
?>
gives me this error:
Connected to: 10.0.0.3:employee.fdb
First Name Last Name
Fatal error: Call to undefined function: ibase_fetch_assoc() in
/home/e-smith/files/ibays/Primary/html/html/untitled17.php on line 209
How do I slove this?
Thx
----------------------------
Johan van Zyl
JVZ Systems CC/realcorp.net
Customised Software
http://www.jvz.co.za
[EMAIL PROTECTED]
021 851 7205
082 875 4238
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.1 - Release Date: 2005/03/23
--- End Message ---
--- Begin Message ---
On Sat, 2005-03-26 at 11:43, Johan van Zyl wrote:
> Fatal error: Call to undefined function: ibase_fetch_assoc() in
> /home/e-smith/files/ibays/Primary/html/html/untitled17.php on line 209
>
> How do I slove this?
Perhaps you haven't updated for a while, so you don't have this function
in your PHP version. This is a note on the ibase_fetch_assoc() manual
page saying:
"
If your php is older than version 4.3.0, you can use the following:
$arr_record = get_object_vars(ibase_fetch_object($sql_result));
which is the same as: $arr_record = ibase_fetch_assoc($sql_result);
"
--
Regards,
Matthew Fonda
http://mfonda.info
--- End Message ---
--- Begin Message ---
I am trying to get Dashboard graphics working on a Debian woody system. I have
the following php packages installed:
ii php4 4.1.2-7.0.1 A server-side, HTML-embedded scripting langu
ii php4-cgi 4.1.2-7.0.1 A server-side, HTML-embedded scripting langu
ii php4-gd2 4.1.2-2 GD module (with GD2) for php4
ii php4-pgsql 4.1.2-4 PostgreSQL module for php4
the error I am getting is
Fatal error: Call to undefined function: gd_info() in
/var/www/html/dashboard/test_setup.php on line 29
php.ini has extensions set up as:
extension_dir=/usr/lib/php4/20010901/
extension=pgsql.so
extension=gd.so
ls -l /usr/lib/php4/20010901/
lrwxrwxrwx 1 root root 23 Mar 26 14:23 gd.so ->
/usr/lib/libgd.so.2.0.1
-rw-r--r-- 1 root root 95036 Mar 17 2002 gd.so.orig
lrwxrwxrwx 1 root root 23 Mar 25 20:27 libgd.so.2.0.1 ->
/usr/lib/libgd.so.2.0.1
-rw-r--r-- 1 root root 41412 Mar 31 2002 pgsql.so
the line in the script that is failing:
<?php
echo "Here is the dump [";
var_dump(gd_info());
echo "] end of dump.";
?>
--- End Message ---
--- Begin Message ---
Aaron wrote:
http://bugs.php.net/bug.php?id=32449
I dont see how its not a bug.
No, it's not. There are undefined variables
--- End Message ---
--- Begin Message ---
> Aaron wrote:
> http://bugs.php.net/bug.php?id=32449
> I dont see how its not a bug.
You might find the advice here helpful as well:-
http://www.catb.org/~esr/faqs/smart-questions.html
Alan
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jonis Maurin Cear� schrieb:
> Hi
Hi Jonis,
> I'm trying to use setlocale to setup my language to pt_BR for ue with
> strftime but don't work.
>
> I've tryied:
> pt_BR
> pt_BR.ISO_8859-1
> portuguese.br
> etc...
>
>
> but don't work, i just get in english.
Is pt_BR being listed, when you execute
locale -a
on the commandline?
system('locale -a'); should do the trick, if you don't have shell access.
Regards,
Christian Stadler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCRcyr9250Hcbf/3IRAnGtAJ4wK0vjx9pB5C8aw9ppYlZOCX6d3ACeN9MP
R+Uwqo6hfR0VD/KLk7Hzhrg=
=mYQD
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jonis Maurin Cear� schrieb:
> Hi
Hi Jonis,
> I'm trying to use setlocale to setup my language to pt_BR for ue with
> strftime but don't work.
>
> I've tryied:
> pt_BR
> pt_BR.ISO_8859-1
> portuguese.br
> etc...
>
>
> but don't work, i just get in english.
Is pt_BR being listed, when you execute
locale -a
on the commandline?
system('locale -a'); should do the trick, if you don't have shell access.
Regards,
Christian Stadler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCRcyr9250Hcbf/3IRAnGtAJ4wK0vjx9pB5C8aw9ppYlZOCX6d3ACeN9MP
R+Uwqo6hfR0VD/KLk7Hzhrg=
=mYQD
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
* Jason Barnett <[EMAIL PROTECTED]>:
> --------------enig95F502C374775F42772D3BEB
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit
>
> Scott Haneda wrote:
> ...
>> I use it to create HTML emails, send them to 1000's of people. I think I
>> did a test to 30K or so, it handled it fine using mail locally.
>
> HTML emails [shudder]
>
>> As for tracking, what we do is embed a image bug in the html and track when
>> that loads, it is getting less reliable in todays anti spam world, but in my
>> case these are paying subscribers so they generally want to get these
>> emails.
>
> [shudder]
> The above paragraph is why I abhor HTML emails, and why I am glad that
> Mozilla lets me block all remote images (and click to view if I *really*
> want to see them).
And this illustrates why the HTML image method of tracking mail open
rates is completely unreliable: some mail programs allow the user to
block all images from loading (indeed, some have this turned on by
default), and if the client is text-only, the image will never be
loaded.
>> To track your users, at least the bounces we set the bounce address
>> (return-path) to [EMAIL PROTECTED] and POP check domain.com every few
>> seconds. We then scan for the bounce address and mark that user as bouncing
>> x times, if they go over y we cancel the account.
>
> Now this is interesting... so you're telling me that all I have to do to
> get you to stop emailing me, is to bounce back all of your messages?
> Sure I'll have to forge a few headers to make it look like the mail
> server daemon didn't recognize my address... but THAT sounds like time
> well spent!!!
>
> OK, OK, I'm being a little harsh here. Because after all you're sending
> emails to customers that have at least opted-in (or so I hope). But
> there are so many shady ways of getting someone to opt-in, or making it
> hard to opt-out, or just plain harvesting emails and ignoring the wishes
> of the users.
There really *are* legitimate reasons to send large numbers of mail
items. Think of organizations like MoveOn, or companies like Amazon --
you opt-in, they send you mail, you opt-out, they stop. The idea is that
they send mail to those who want to receive it; they also happen to be
popular internet sites.
Legit organizations such as these need to do some due diligence to make
sure they aren't perceived as spammers, and also to ensure that those
receiving their emails don't get their rights trampled -- or their
inboxes stuffed. Additionally, sending email is *not* free, as many
believe; it costs in bandwidth, CPU time, etc. So the bounce-back
address is supposed to (1) automate pruning of the list (if somebody
switches services and forgets to unsubscribe, that email address is no
longer a viable addres for communication), as well as (2) follow
standard abuse policies (AOL and other large ISPs expect that if an
address bounces from your mailing list, that you will automatically
unsubscribe; failure to do so can result in the ISP blacklisting your
site's SMTP service).
*You* may not have heard of such practices before, but they *are*
standard in the industry.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org
--- End Message ---
--- Begin Message ---
Hi,
Just a quick question, I have been reading a lot about SQL injection doing a
s**tload of damage to many sites, I myself use a pagentation class which
sends the page number from page to page in a $_GET['page'] request which
gets used in a LIMIT parameter.
>From what i have been reading, wrapping all my GET and POST requests in a
htmlentities() function should keep me safe....right? or what else should
i/can i do?
eg:
$page= htmlentities($_GET[page]);
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 3/25/2005
--- End Message ---
--- Begin Message ---
Actually I was just about to look into this again myself since I'm working on a
project that I'd like to protect from SQL injections.
htmlentities() is a start, but that's not going to protect you from someone
using apostrophes (single quotes) and breaking your SQL in other ways.
While some of the things you need to guard against aren't really security
issues, there's still a handful of things you want to do to your data before
you put that data into a SQL string.
So if I could broaden the question and ask, in general, what people recommend
for pre-processing data before it goes into a SQL statement.. for security and
for things like making sure singlequotes and other special characters are
escaped properly?
htmlentities()
addslashes() (if magic quotes isn't turned on right?)
What else?
-TG
= = = Original message = = =
Hi,
Just a quick question, I have been reading a lot about SQL injection doing a
s**tload of damage to many sites, I myself use a pagentation class which
sends the page number from page to page in a $_GET['page'] request which
gets used in a LIMIT parameter.
>From what i have been reading, wrapping all my GET and POST requests in a
htmlentities() function should keep me safe....right? or what else should
i/can i do?
eg:
$page= htmlentities($_GET[page]);
Thanks,
Ryan
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 3/25/2005
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 3/25/2005
--- End Message ---
--- Begin Message ---
This is excellent:
http://www.shiflett.org/
Chris R
--- End Message ---
--- Begin Message ---
With htmlentities() you are safe also to potential XSS attacks.
--- End Message ---
--- Begin Message ---
Hi Ryan,
From what i have been reading, wrapping all my GET and POST requests in a
htmlentities() function should keep me safe....right? or what else should
i/can i do?
No, let me start by correcting a misunderstanding. Yes, htmlentities()
is an escaping function, but it is for escaping data for use in HTML
(e.g., data being sent to the client), not data for use in SQL (e.g.,
data being sent to a database).
To answer this question in reverse, to have an SQL vulnerability
generally requires that you fail to take the two most important steps:
1. Filter input.
2. Escape output.
Filtering input doesn't modify it at all. This is the step where you
inspect data to prove its validity. For example, this is one way to
filter a username that is required to be alphanumeric:
<?php
$clean = array();
if (ctype_alnum($_POST['username']))
{
$clean['username'] = $_POST['username'];
}
?>
Escaping output is the process by which you prepare data to be sent to
some external system. The client is the most common, since that's where
standard out goes, and databases are probably the second most common.
The process of escaping does modify data, but only in an attempt to
preserve it. The escaping process should preserve data in the sense that
any characters that might be interpreted by the external system are
represented with an escaped syntax. For example, this is one way to
escape a username (that has already been filtered as demonstrated above)
for use with a MySQL query:
<?php
$mysql = array();
$mysql['username'] = mysql_real_escape_string($clean['username']);
$query = "SELECT *
FROM profile
WHERE username = '{$mysql['username']}'";
$result = mysql_query($query);
?>
I left out basic error checking and such, but hopefully this makes the
escaping part clear.
I don't recommend skipping either of these two crucial steps, but
escaping can help protect you against weak or broken filtering. Because
there are built-in escaping functions for most external systems, you
should rely on these where possible.
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--- End Message ---
--- Begin Message ---
* Richard Lynch <[EMAIL PROTECTED]>:
> On Mon, March 21, 2005 2:55 pm, Chris W. Parker said:
>> a pad of paper with a pencil.
>
> +1
+1
> Seriously, any time I try to plan something out for any kind of
> programming, I find that a nice big desk surface, and a pencil and paper
> are the best tools.
>
> After I've got things worked out on paper, with all the scratch-outs,
> circles and arrows, and am happy with the basic design, I then type up
> something in plain text as my "final" draft.
>
> Not claiming I don't end up revising the hell out of it in development,
> mind you, but it seems to work, and I catch all the stuff I have enough
> smarts to anticipate.
>
> The stuff I can't anticipate, well, there you are, eh?
Exactly. I find that after programming a class, I'll be about 75% in and
realize that if I were to refactor this section of code, I could do the
next 5% in just a few lines, and refactoring that leads to another
refactor.... But in the end, I'm still following that hand-written,
hand-drawn plan I started with; the implementation just needs tweaking.
> I've tried Visio and all that stuff, and find myself wasting *WAY* more
> time lining up the damn boxes than actually thinking about what I want to
> *do*.
And when it comes down to it, you really don't need those boxes lined
up; it's just that because the computer's so good at drawing straight
lines, we often think everything needs to be aligned. Visio and Dia can
be great tools, as long as you don't let the diagram presentation
dictate the software you're designing.
(I typically find that the only reason I need to go to Dia is to create
a presentation of my hand-drawn diagram for public consumption.)
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org
--- End Message ---
--- Begin Message ---
* Pavel <[EMAIL PROTECTED]>:
>> I am wanting to paginate records from a MySQL Database.
>> I want there to be 5 records on a page, on multiple pages.
>
> example for selecting page of records from mysql table:
> $sql=sprintf("
> SELECT SQL_CALC_FOUND_ROWS * FROM table LIMIT %d, %d",
> $position*$records,
> $records
> );
>
> after get count of all records:
> $sql='SELECT FOUND_ROWS()';
>
>> (I would like there to be a "next" and "previous.")
>
> you can use http://pear.php.net/package/Pager
+1 PEAR::Pager
In the examples/ directory of the Pager class is a wrapper class for
doing pagination from DB results; this will answer the OP's question.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:[EMAIL PROTECTED] | http://vermontbotanical.org
--- End Message ---
--- Begin Message ---
Others have reported problems reading COM ports using fopen and fgets or
fread. They open the port and start reading but nothing ever arrives.
I have the same problem and discovered the following. There is an 8K
input buffer. Only after 8K bytes have arrived does fgets or fread see the
first.
How does one get around this feature (or bug)?
This is with php 5.0.2.2 on Windows XP.
--- End Message ---
--- Begin Message ---
Others have reported problems reading COM ports using fopen and fgets or
fread. They open the port and start reading but nothing ever arrives.
I have the same problem and discovered the following. There is an 8K
input buffer. Only after 8K bytes have arrived does fgets or fread see the
first.
How does one get around this feature (or bug)?
This is with php 5.0.2.2 on Windows XP.
--- End Message ---