 |
 |
Index ‹ php-general
|
- Previous
- 2
- [PHP] mysql_real_escape_string() questionOn Thu, September 28, 2006 10:06 am, tedd wrote:
> In one of my snip-its, namely:
>
> http://xn--ovg.com/pdf
>
> I was generating a pdf document after the user filled in a form. I
> had been cleaning the user input by using --
>
> $name = mysql_real_escape_string($name);
>
> -- even though I wasn't using MySQL (the code was a cut-paste from
> some other code I had).
But you *WERE* using MySQL!
> However, everything worked!
>
> But, a couple of days ago it suddenly stopped working. Now, I get the
> following error:
>
> Warning: mysql_real_escape_string(): Access denied for user
> 'nobody'@'localhost' (using password: NO) in ...
One of two things happened.
Some auto-connect script is no longer running, or the 'nobody' user in
MySQL got nuked.
Cuz you used to be connected to MySQL, and it was using MySQL database
information to do the escaping.
> When I comment-out the offending statement, it runs. I replaced the
> statement, but wonder what happened -- when did using
> mysql_real_escape_string() require a password?
mysql_real_escape_string talks back to MySQL to ask it what character
encoding you are using, so it knows how to correctly escape
multi-byte/unicode/funky characters for MySQL usage.
Take out the "_real" bit, and it's doing a "fake" version that ignores
multibyte/unicode/funky characters.
So, short term, just delete '_real' from your function call, and it
will act exactly like before, except with the caveat that any
unicode/multibyte/funky characters may not be escaped the same way as
they were.
> What's up with that? Any ideas as to what happened?
One also has to ask WHY you would use MySQL's escaping for data that's
not going into MySQL.
That's almost certainly "wrong"
Though I confess, I'm sometimes at a loss how to properly escape
certain data for certain situations...
Here's an example:
Take the Subject of an email.
Sure, I've sanitized it to be sure there are no newlines for header
injection.
But now how do I properly escape it to be sure it's a kosher email
subject?
Where's the PHP function smtp_escape()?
I'm just passing it on from one user to another. I don't want to
munge it, nor make any assumptions about its format. It's just "data"
to me.
But to SMTP, there are bound to be all kinds of "rules" about it that
I have no desire, much less time, to research, code, and test in as
thorough a fashion as I should to be Professional.
And every developer who sends an email with PHP needs this, right?
So of the myriad PHP functions available, which one is the right one
to escape an email Subject.
I'm *NOT* asking for an answer to this specific question about email
Subjects!
I'm looking for a guide, a chart, a grid, an organized systemic
documentation of what data should be escaped how as it travels through
the "glue" that is PHP...
--
Like Music?
http://l-i-e.com/artists.htm
- 3
- mysql_insert () ???
now i have another problem. when i do it like you describe with add new
item i have to know the id (which is an auto_increment) of the main data
when adding the new item, in order to connect the two datas. but the id
i will know after inserted the main data.
I can try with mysql_insert ()+1 but if there are two people working
with the database at the same time?
Do I have to save the additional data and save it after the main data???
Thankx in advance
Flos
- 4
- LDAP exop how?Hi,
I'm trying to write a script to change LDAP passwords using exop
transactions but I can't see any reference to it in the PHP library. Can
anyone please help me out? How do I change LDAP passwords using exop? Do
I have to write my own module? If so, how do we do that? *Any* help will
be most appreciated.
Thanks,
Steve
- 5
- mysql_insert_idhow could i reduce the following piece of code:
for ($num=0;$num<50;$num++) {
mysql_query($db,"INSERT INTO whatever (stuff) VALUES (somevalue);";
mysql_query($db,"INSERT INTO sometable VALUES
(".mysql_insert_id().");";
}
to something where only two sql queries are made (as opposed to 100?).
ie. where the first line could be converted to something like this:
mysql_query($db,"INSERT INTO whatever (stuff) VALUES
(".implode(",",somearray).")";
where somearray contains every somevalue.
- 6
- Sequential file numbering...Hey all:
Slightly off topic...
If I have a series of images that I want to convert to an animated gif
using the command line tool 'convert' from imagemagick, they cannot be
named:
1
2
3
4
5
6
7
8
9
10
11
Because this is seen as:
1
10
11
2
3
4
5
6
7
8
9
So I am trying to write a PHP script that will sequentially convert and
number a series of images, and I won't know ahead of time how many will
be in a given sequence. This files are originally randomly numbered,
but the sequence information can be extracted, and their order
determined. I then want to rename them, and I'm thinking I should use:
01
02
03
04
05
06
07
08
09
10
11
This works, and I guess I'll just need to tally the number of images,
and figure out if the 'lefthand' zeroes should be taken to the hundreds
and thousands place.
Anyone else know a simpler way around this problem?
-cjl
- 7
- Sending HTML E-MailsHi all,
I want to send e-mails that have HTML formated content.
But no matter what I do, the script either errors or sends the email with
all the HTML visible.
I bet someone can help.
John.
- 10
- Print different URLUsing Javascript I can use the Window.print() function to open a print
dialog box.
I want to print a different page however, without loading it up first.
Is there any way of using output buffering or similar to pipe the page
result to the browser for printing?
- 11
- [PHP] htmlentities -- can it skip tagsJustin French wrote:
> Hi all,
>
> I need to convert some text from a database for presentation on
> screen... as per usual, characters like quotes and ampersands (&) are
> giving me grief. the obvious answer is to apply htmlspecialchars(), BUT
> this also converts all < and > into < and > signs, which destroys
> the html mark-up within the text.
>
> Is there a non-tag equivalent of htmlspecialchars(), or do I need to
> build one?
You'll have to build one.
If you know what characters are causing trouble, you could just use
str_replace on them. Or you could use htmlspecialchars() and then run
str_replace to convert < and > back into brackets.
You could also use get_html_translation_table() to get the conversions,
remove the < and > conversion elements of the array and then use strtr()
to do the conversion.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals ?www.phparch.com
- 12
- preg_matchMB wrote:
> I want to be able to extract key/value pairs from a string but I am not
> succeeding. Experimenting and googling for a few hours didn't get me
> anywhere so I'm hoping for help here. My input string could look
> something like this:
>
> some_var=yellow another_var = "blue and red" third_var= 'pink'
>
> The values could be enclosed in single quotes, double quotes or no
> quotes at all as you can see. Is it possible to make a regular
> expression to extract these and if so, how?
>
<?php
$a='some_var=yellow another_var = "blue and red" third_var= \'pink\'';
// simple regexp without quoting
preg_match_all('/(\w+) *=
*(\w+|(?:(["\'])([^"\']*)\\3))/',$a,$res,PREG_SET_ORDER);
foreach($res as $r)
{
echo $r[1].' = '.(isset($r[4])?$r[4]:$r[2])."\n";
}
?>
- 12
- Proper way to define? single, double or no quote marks?Hi all
Can someone tell me the proper way to define a variable using for example
_POST or _GET.
More specifically my question is whether to use single quotes, double quotes
or no quotes.
For example, which of these is the proper method and what would the
difference be?
$email = $_POST["email"];
$email = $_POST['email'];
$email = $_POST[email];
Thanks!
Brandon
- 13
- #38905 [NEW]: RAW values returned inconsistentlyFrom: david at acz dot org
Operating system: SuSE Linux
PHP version: 5.1.6
PHP Bug Type: OCI8 related
Bug description: RAW values returned inconsistently
Description:
------------
RAW columns are sometimes returned as binary and sometimes as hex. When
this happens seems to be dependent on the driver version, but I don't know
of a reliably way to detect this in application code.
The 9.2 client returns hex. The 10.2 instant client returns binary.
Reproduce code:
---------------
echo "PHP " . PHP_VERSION . "\n";
$db = oci_connect($user, $pass, $tns);
echo oci_server_version($db) . "\n";
$st = oci_parse($db, "SELECT x FROM raw_test ORDER BY x");
oci_execute($st);
echo "type: " . oci_field_type($st, 1) . "\n";
echo "type_raw: " . oci_field_type_raw($st, 1) . "\n";
echo "size: " . oci_field_size($st, 1) . "\n";
oci_fetch_all($st, $x, 0, -1, OCI_FETCHSTATEMENT_BY_ROW | OCI_NUM);
foreach ($x as $i)
var_dump($i[0]);
ob_start(); phpinfo(); $x = strip_tags(ob_get_contents());
ob_end_clean(); $x = explode("\n", $x);
foreach ($x as $i)
if (substr($i, 0, 7) == "Oracle ")
echo "$i\n";
Expected result:
----------------
Create a test table:
CREATE TABLE raw_test (x RAW(4) NOT NULL);
INSERT INTO raw_test VALUES('54455354');
INSERT INTO raw_test VALUES('424C4148');
INSERT INTO raw_test VALUES('61626364');
Actual result:
--------------
First machine:
PHP 5.1.2
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit
Production
With the Partitioning, OLAP and Data Mining options
type: RAW
type_raw: 23
size: 4
string(8) "424C4148"
string(8) "54455354"
string(8) "61626364"
Oracle Version 9.2
Second machine:
PHP 5.1.6
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit
Production
With the Partitioning, OLAP and Data Mining options
type: RAW
type_raw: 23
size: 4
string(4) "BLAH"
string(4) "TEST"
string(4) "abcd"
Oracle Instant Client Version 10.2
--
Edit bug report at http://bugs.php.net/?id=38905&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38905&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38905&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38905&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38905&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38905&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38905&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38905&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38905&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38905&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38905&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38905&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38905&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38905&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38905&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38905&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38905&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38905&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38905&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38905&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38905&r=mysqlcfg
- 13
- #45392 [Opn->Ctl]: ob_start()/ob_end_clean() and memory_limit ID: 45392
Updated by: email***@***.com
Reported By: flebron at bumeran dot com
-Status: Open
+Status: Critical
Bug Type: Output Control
Operating System: Fedora Linux 2
PHP Version: 5.3CVS-2008-06-29 (snap)
New Comment:
This slightly modified script shows the bug without massive output:
<?php
ini_set('memory_limit', 100);
ob_start();
$i = 0;
while($i++ < 5000) {
echo str_repeat("lol", 42);
}
ob_end_clean();
?>
Previous Comments:
------------------------------------------------------------------------
[2008-06-29 22:30:08] flebron at bumeran dot com
Description:
------------
When memory_limit is reached, and one is using the output buffering
functions, instead of just dying with an "out of memory" error, the
contents of the buffer are spilled onto stdout.
The output_buffering ini setting wasn't set to any particular limit.
Reproduce code:
---------------
<?php
ob_start();
$i = 0;
while($i++ < 10000000) {
echo str_repeat("lol", 42);
}
ob_end_clean();
/*Note that the 10,000,000 number varies according to your
memory_limit*/
Expected result:
----------------
STDERR: Fatal error: Allowed memory size of 134217728 bytes exhausted
at /home/flebron/cvs/php/php5.3-200806291230/main/output.c:395 (tried to
allocate 133693441 bytes) in /home/flebron/cvs/php/ob.php on line 5
STDOUT: Nothing
Actual result:
--------------
STDERR: Fatal error: Allowed memory size of 134217728 bytes exhausted
at /home/flebron/cvs/php/php5.3-200806291230/main/output.c:395 (tried to
allocate 133693441 bytes) in /home/flebron/cvs/php/ob.php on line 5
STDOUT: The text in the buffer is printed to stdout (millions of
"lolol"s).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45392&edit=1
- 13
- [PHP] Help me specify/develop a feature! (cluster web sessions management)On Tue, March 13, 2007 7:27 pm, Mark wrote:
> I have a web session management server that makes PHP clustering easy
> and
> fast. I have been getting a number of requests for some level of
> redundancy.
>
> As it is, I can save to an NFS or GFS file system, and be redundant
> that
> way.
Talk to Jason at http://hostedlabs.com if you haven't already.
He's rolling out a distributed redundant PHP architecture using your
MCache as an almost turn-key webhosting service.
Not quite sure exactly how he's makeing the MCache bit redundant, but
he's already doing it.
> Here is an explanation of how it works:
> http://www.mohawksoft.org/?q=node/36
NB:
There is a typo in "False Scalability" section:
"... but regardless of what you do you, every design has a limit."
> What would you be looking for? How would you expect redundancy to
> work?
In the ideal world, the developers are also working as an N-tier
architecture in their Personnel Org Chart. :-)
One Lead has to understand the whole system and the intricacies of
your system, as well as its implications and "gotchas" really well.
In an ideal world the Lead can then arrange things so that other
Developers (non lead) can just program "normally" and have little or
no impact on their process to roll-out to the scalable architecture.
This is not to say that they can squander resources, but rather that
if their algorithm "works" correctly and quickly (enough) on their dev
box with beefy datasets, it should seemlessly work on the scaled
boxes, assuming the datasets are not dis-proportionately larger
comparing hardware to hardware pro-rated to dataset size.
Yes, if the algorithm is anything bigger than O(n) this is not really
"safe" but it's a close rule of thumb, and you can generally figure
out pretty fast if your algorithm is un-workable.
At least in my experience, if I can get it to "work" on a relatively
large dataset on my crappy dev box, the real server can deal with it.
So the less intrusive the redundant architecture can be, the better.
Documentation of exactly how it all works is crucial -- If it's all
hand-waving, the Lead will never be able to figure out where the
"gotchas" are going to be.
I'd also expect true redundancy all across the board, down to spare
screws for the rack-mounts. Hey, a screw *could* sheer off at any
moment... :-)
Multiple data centers on a few different continents.
US, Europe, Asia, India (which seems to have caught the American
consumerism big-time lately...) Australia...
Probably need 2 or 3 just in the US.
Some folks need WAY more bigger farms than others. Offer a wide
variety of choices, from a simple failsafe roll-over up to
sky's-the-limit on every continent.
[Well, okay, you can probably safely skip Antartica. :-)]
I'd like a "status board" web panel of every significant piece of gear
and a health status in one screen of blinking lights. :-)
If I have to be the one to SysAdmin the things, make that a control
panel as well.
Okay, in reality, "I" would *not* be the one to SysAdmin that stuff,
as I would still need to hire a guy actually qualified to do that.
Which is why we're working with Jason (above) who's essentially our
out-source SysAdmin guy taking care of all this hardware and
redundancy stuff so we can focus on our WEb App from a business
perspective (mostly) instead of constantly fighting with hardware.
[I am so *not* a hardware guy...]
And, of course, *when* an MCache box falls over, the user should
seemlessly be sent to the next-closest box, with their session data
already waiting for them.
I.e., it's not enough that there will always be a working MCache box
for new users -- Logged-in users have to have their session data
replicated to at least one other box.
There also have to be enough "spare" cycles in the sum of all boxes
that a single failure won't just take them all down in a dominoe
effect. [shudder]
So it's gotta be more like Raid 5 or whatever it is, with the session
data striped across different boxes.
Something like this dominoe effect bit Dreamhost in the [bleep] awhile
back on their switch setup. Actually, go read all their woes on their
blog/newsletter and don't do that. :-)
[Though at Dreamhost pricing, it's really hard to complain...]
[And at least they tell you they screwed up instead of making it a
State Secret.]
Speaking of pricing:
Session replication is just a tiny piece of the puzzle, really. A
crucial piece, relatively easy to factor out for most web apps, and a
great target for optimization and modularization for that very reason.
But one also needs to make the web-farm, the app-farm, and the db-farm
all scalable...
So if you can do ALL of those in one nice package, or even some of
those, that's a Good Thing, imho, as many of the same issues you'll
have for session data are the same issues for web/app/db interaction.
Or you could specialize in the session replication, and be a vendor to
the folks replication whole systems -- Probably better, really, to
stay focussed.
But either way, the price has to be pretty low, or your target market
is mostly companies who already have folks on staff who already have
solved this problem...
Disclaimer:
I'm hardly an expert in this stuff!
You may want to ask on Internals, or try to button-hole some gurus at
a PHP conference.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
- 13
- URL variables parsing error?Hi all,
I use RedHat9.0 with Apache 2.0.40 & PHP 4.2.2
and I have problem with parsing URL variables...
I use this URL: http://my.domain.mine/index.php?var1=value1&var2=value2
and this is my index.php
<?php
echo "var1: $var1" ;
echo "var2: $var2" ;
phpinfo();
?>
Output of this page is without expansion of my variables var1, var2 at section "echo"
but phpinfo expand this:
_GET["var1"] value1
_GET["var2"] value2
Any idea?
THANKS.
- 13
|
| Author |
Message |
jodleren

|
Posted: 2007-11-15 0:32:01 |
Top |
php-general, new to sessions
escuse me the keyboard in Tallin airport
i work on http://panbaltica.com/docman/action_popup.php
i have one session_start which causes 2 errors
i send headers not to cache the page then the session_start - it
should be elsewhere it is a test - anyway, i want to create the
sesseion and stop caching of the page
i had somethiing which worked but i cannot recreate it
since i am new to session vars any ideas anyone?
wbr
sonnich
|
| |
|
| |
 |
jodleren

|
Posted: 2007-11-15 0:32:00 |
Top |
php-general >> new to sessions
escuse me the keyboard in Tallin airport
i work on http://panbaltica.com/docman/action_popup.php
i have one session_start which causes 2 errors
i send headers not to cache the page then the session_start - it
should be elsewhere it is a test - anyway, i want to create the
sesseion and stop caching of the page
i had somethiing which worked but i cannot recreate it
since i am new to session vars any ideas anyone?
wbr
sonnich
|
| |
|
| |
 |
igrosny@gmail.com

|
Posted: 2007-11-15 1:09:00 |
Top |
php-general >> new to sessions
On Nov 14, 1:32 pm, jodleren <email***@***.com> wrote:
> escuse me the keyboard in Tallin airport
>
> i work onhttp://panbaltica.com/docman/action_popup.php
>
> i have one session_start which causes 2 errors
> i send headers not to cache the page then the session_start - it
> should be elsewhere it is a test - anyway, i want to create the
> sesseion and stop caching of the page
>
> i had somethiing which worked but i cannot recreate it
>
> since i am new to session vars any ideas anyone?
>
> wbr
> sonnich
Aparently, you have a blank space/return in onew of the include files
try starting the session before the include files
hope it helps
|
| |
|
| |
 |
John Murtari

|
Posted: 2007-11-15 1:57:00 |
Top |
php-general >> new to sessions
jodleren <email***@***.com> writes:
> i work on http://panbaltica.com/docman/action_popup.php
> i have one session_start which causes 2 errors
> i send headers not to cache the page then the session_start - it
> should be elsewhere it is a test - anyway, i want to create the
> sesseion and stop caching of the page
> i had somethiing which worked but i can not recreate it
Okay, it looks like you have a blank line printing -- the
header info has to be the very first thing in the file. Be careful
that your <? to start php is at the very top of the file, not a few
lines down -- that often causes the 'output already started' error.
Best regards!
--
John
___________________________________________________________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/
|
| |
|
| |
 |
jodleren

|
Posted: 2007-11-15 6:09:00 |
Top |
php-general >> new to sessions
On 14 Nov., 18:09, "email***@***.com" <email***@***.com> wrote:
> On Nov 14, 1:32 pm, jodleren <email***@***.com> wrote:
>
> > i have one session_start which causes 2 errors
> > i send headers not to cache the page then the session_start - it
> > should be elsewhere it is a test - anyway, i want to create the
> > sesseion and stop caching of the page
> > i had somethiing which worked but i cannot recreate it
> > since i am new to session vars any ideas anyone?
>
> try starting the session before the include files
That was it
> hope it helps
Yep, thanks a lot.
This causes some problems for me, as my login is in an included file
(better overview), so I need a way to work that one around... heve
sleep on that one.
WBR
Sonnich
|
| |
|
| |
 |
jodleren

|
Posted: 2007-11-23 15:08:00 |
Top |
php-general >> new to sessions
On Nov 15, 12:09 am, jodleren <email***@***.com> wrote:
> On 14 Nov., 18:09, "email***@***.com" <email***@***.com> wrote:
>
> > On Nov 14, 1:32 pm, jodleren <email***@***.com> wrote:
>
> > > i have one session_start which causes 2 errors
> > > i send headers not to cache the page then the session_start - it
> > > should be elsewhere it is a test - anyway, i want to create the
> > > sesseion and stop caching of the page
> > > i had somethiing which worked but i cannot recreate it
> > > since i am new to session vars any ideas anyone?
>
> > try starting the session before the include files
>
> That was it
>
> > hope it helps
>
> Yep, thanks a lot.
> This causes some problems for me, as my login is in an included file
> (better overview), so I need a way to work that one around... heve
> sleep on that one.
Well I seems to have other problems - or just being new to sessions
when I have some pages, can I transfer the sesstion to another page?
say page1.php goes to page2.php ( <a href="page2.php"> ) ?
WBR
Sonnich
|
| |
|
| |
 |
Jerry Stuckle

|
Posted: 2007-11-23 20:48:00 |
Top |
php-general >> new to sessions
jodleren wrote:
> On Nov 15, 12:09 am, jodleren <email***@***.com> wrote:
>> On 14 Nov., 18:09, "email***@***.com" <email***@***.com> wrote:
>>
>>> On Nov 14, 1:32 pm, jodleren <email***@***.com> wrote:
>>>> i have one session_start which causes 2 errors
>>>> i send headers not to cache the page then the session_start - it
>>>> should be elsewhere it is a test - anyway, i want to create the
>>>> sesseion and stop caching of the page
>>>> i had somethiing which worked but i cannot recreate it
>>>> since i am new to session vars any ideas anyone?
>>> try starting the session before the include files
>> That was it
>>
>>> hope it helps
>> Yep, thanks a lot.
>> This causes some problems for me, as my login is in an included file
>> (better overview), so I need a way to work that one around... heve
>> sleep on that one.
>
> Well I seems to have other problems - or just being new to sessions
>
> when I have some pages, can I transfer the sesstion to another page?
>
> say page1.php goes to page2.php ( <a href="page2.php"> ) ?
>
> WBR
> Sonnich
>
That's the whole purpose of sessions - to be able to carry information
across pages.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
email***@***.com
==================
|
| |
|
| |
 |
| |
 |
Index ‹ php-general |
- Next
- 1
- php queryingwhere is the error in a query performed with php in this script?
<?php
@ $db=mysql_pconnect('localhost', 'database_name', 'password');
if (!$db)
{
echo 'conneciton eror';
exit;
}
else
{
echo 'connection on!';
}
mysql_select_db('books'); //books: table created previously.
$query="select * from orders"; //orders: a table that i have
previosly created.
$result=mysql_query($query);
$num_results=mysql_num_rows($result);
if ($num_results = 0)
{
echo'<br><br>nothing to dispaly';
}
else
{
echo'<br><br>here are the results: $num_results';
}
?>
- 2
- 3
- Rename does not workHi everyone,
I am using the rename function on my local development
system fine. But as soon as I upload the script, the
rename function does not work anymore.
Is there a specific compiler flag needed, to make rename
work on both plattforms?
Thank you very much.
Sascha
- 4
- pb compiling php (4&5) on debian sarge w/ ldap module
hi, as the subject said I've pb compiling php-4.4.4 and php-5.1.6 with
ldap module activated on linux debian sarge (2.6.8-3-686-smp) :
- for 4.4.4 I've
% /bin/sh /www/src/php-4.4.4/libtool --silent --preserve-dup-deps --mode=compile /www/src/php-4.4.4/meta_ccld -Isapi/cli/ [...]
ext/ldap/ldap.lo(.text+0x26a3): In function `zif_ldap_set_option':
: undefined reference to `ber_pvt_opt_on'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
* I've those ldap libs installed :
ii libldap2 2.1.30-8
ii libldap2-dev 2.1.30-8
ii libldap-2.2-7 2.2.23-8
/usr/lib/libldap-2.2.so.7
/usr/lib/libldap-2.2.so.7.0.16
/usr/lib/libldap.a
/usr/lib/libldap.so -> libldap.so.2.0.130
/usr/lib/libldap.so.2
/usr/lib/libldap.so.2.0.130
/usr/lib/libldap50.so
/usr/lib/liblber-2.2.so.7
/usr/lib/liblber-2.2.so.7.0.16
/usr/lib/liblber.a
/usr/lib/liblber.so -> liblber.so.2.0.130
/usr/lib/liblber.so.2
/usr/lib/liblber.so.2.0.130
- For 5.1.6 the pb is
% /bin/sh /www/src/php-5.1.6/libtool --silent --preserve-dup-deps --mode=link /www/src/php-5.1.6/meta_ccld -export-dynamic -I/usr/local/include -O3 -pthread -DZTS [...]
ext/gd/libgd/.libs/gdkanji.o(.text+0x1c4): In function `do_check_and_conv':
: undefined reference to `libiconv_open'
[...]
ext/iconv/.libs/iconv.o(.text+0x3f): In function `php_iconv_string':
: undefined reference to `libiconv_open'
[...]
ext/iconv/.libs/iconv.o(.text+0x2be7): In function `_php_iconv_mime_encode':
: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o(.text+0x2c18): more undefined references to `libiconv' follow
ext/iconv/.libs/iconv.o(.text+0x307c): In function `_php_iconv_mime_decode':
: undefined reference to `libiconv_open'
[...]
ext/iconv/.libs/iconv.o(.text+0x39d8): In function `php_iconv_stream_filter_cleanup':
: undefined reference to `libiconv_close'
ext/iconv/.libs/iconv.o(.text+0x3b89): In function `php_iconv_stream_filter_factory_create':
: undefined reference to `libiconv_open'
[...]
ext/iconv/.libs/iconv.o(.text+0x3da2): In function `_php_iconv_appendl':
: undefined reference to `libiconv'
[...]
ext/iconv/.libs/iconv.o(.text+0x3f6f): In function `php_iconv_stream_filter_append_bucket':
: undefined reference to `libiconv'
[...]
ext/ldap/.libs/ldap.o(.text+0x26e1): In function `zif_ldap_set_option':
: undefined reference to `ber_pvt_opt_on'
collect2: ld returned 1 exit status
(same libs)
Any clue highly appreciated thanks in advance
--
- heddy Boubaker -
- 5
- Newbie Question: WYSIWYG PHP Editor?What is the best, cleanest PHP wysiwyg editor around?
Free would be great too.
One reason I ask, is because I've been using a wysiwyg
HTML editor that was easy to use, but that spit out a
lot of unnecessary code.
I want to prevent the same mistake this time around.
Alex
- 6
- 7
- Please, test drive my algorithm [NOW FIXED]Test me: http://www.clickatus.com (my other post has my other domain
that got busted for missing a payment) ...sorry...
I was working on the algorithm for my future graph that would automatically
decide how to split available space into chunks of incrementing units that
would be easy for my eye to read.
Say, if my X-axis the largest number will be 11321 and I can fit at least 9
five digit numbers on the X-axis, how to cut 11321 into 9 or less chunks?
How to do it so the chunks would not be 1324 or something but more close to
say 1300 or so for easy recognition.
I think I got it. Could you test it with your ideas, I might have missed
something. Yeah, you can put in fractions too (though it doesn't work well
with really small fractions).
PS: I use my own "test" shell.
- 8
- Installing PHP5 on x64 OpenSuSE 10.2Hi.
I'm having to do a manual install of PHP5 on a OpenSuSE 10.2 box running
Cpanel as they do not seem to support this version properly and the auto
update for PHP does not appear to work properly.
I'm having real issues seemingly down to the fact it is a 64bit version
running.
the configure line:
./configure --prefix=/usr/local/php5 --datadir=/usr/local/share/php5
--with-libdir=lib64 --enable-libxml --enable-session --with-mm
--with-pcre-regex --enable-xml --enable-simplexml --enable-spl
--enable-filter --disable-debug --enable-inline-optimization
--disable-rpath --disable-static --enable-shared --with-pic
--with-apxs=/usr/local/apache/bin/apxs --disable-cli --with-mysql
--with-openssl --without-iconv
It fails just after checking for mysql_errno suggesting I add the line
to specify a path to the zlib dir, however the config.log suggests
something completely different:
configure:59418: checking for MySQL UNIX socket location
configure:59609: checking for mysql_close in -lmysqlclient
configure:59628: gcc -o conftest -g -O2 conftest.c -lmysqlclient
-lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm 1>&5
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
cannot find -lm
collect2: ld returned 1 exit status
configure: failed program was:
#line 59617 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char mysql_close();
int main() {
mysql_close()
; return 0; }
configure:60025: checking for mysql_errno in -lmysqlclient
configure:60044: gcc -o conftest -g -O2 conftest.c -lmysqlclient -lz
-lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm 1>&5
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible /usr/lib/libm.so when searching for -lm
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
skipping incompatible /usr/lib/libm.a when searching for -lm
/usr/lib64/gcc/x86_64-suse-linux/4.1.2/../../../../x86_64-suse-linux/bin/ld:
cannot find -lm
collect2: ld returned 1 exit status
configure: failed program was:
#line 60033 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char mysql_errno();
int main() {
mysql_errno()
; return 0; }
I tried other variations, such as adding the zlib support (which I do
need anyway) but it then fails claiming I need zlib>1.0.9, which I do
have (zlib 1.2.3) including all devel files. The thing is, it fails on
another test compile again with the "cannot find -lm". I presume this
is the "libm.so" library, which I have in both /lib64 and /usr/lib64.
I have googled and found others with similar problems trying to compile
PHP on an x64 system, but haven't found an answer for this specific issue.
Any ideas??
Thanks
Daren
- 9
- #39555 [NEW]: ftp_rawlist not work with open_basedirFrom: freidman at mail dot ru
Operating system: Gentoo Linux
PHP version: 5.2.0
PHP Bug Type: FTP related
Bug description: ftp_rawlist not work with open_basedir
Description:
------------
This is related to bug #32708
There must be a way to set tmp-file creation of this functions, but
setting TMPDIR environment variable doesn't work. I don't want to include
/tmp dir in open_basedir directories.
Reproduce code:
---------------
<?php
putenv('TMPDIR=/hosting/clients/xxx.com/httpd/tmp');
echo getenv('TMPDIR');
// set up basic connection
$conn_id = ftp_connect("xxx.com");
// login with username and password
$login_result = ftp_login($conn_id, "xxx", "xxx");
// get the file list for /
$buff = ftp_rawlist($conn_id, '/');
// close the connection
ftp_close($conn_id);
// output the buffer
var_dump($buff);
?>
Expected result:
----------------
listing of files
Actual result:
--------------
/hosting/clients/xxx.com/httpd/tmp
Warning: ftp_rawlist() [function.ftp-rawlist]: open_basedir restriction in
effect. File(/tmp) is not within the allowed path(s):
(/hosting/clients/xxx.com/httpd:/usr/lib/php:/usr/local/lib/php) in
/hosting/clients/xxx.com/httpd/htdocs/a.php on line 15
Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary
file. Check permissions in temporary files directory. in
/hosting/clients/xxx.com/httpd/htdocs/a.php on line 15
bool(false)
--
Edit bug report at http://bugs.php.net/?id=39555&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39555&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39555&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39555&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39555&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=39555&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39555&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39555&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39555&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39555&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39555&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=39555&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=39555&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39555&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39555&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39555&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39555&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39555&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39555&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39555&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39555&r=mysqlcfg
- 10
- DOM: how to create a document without XML declaration?Function DOMImplementation::createDocument() creates an XML document
beginning with declaration <?xml ... ?>. But this declaration is not
required in XML 1.0, and it some cases it is even better not to use it.
Is it possible to make createDocument() create an XML document without
this declaration?
Now I am to take a complete document and remove <?xml ... ?> from it
via string functions. But it is not fine; I wish that the document
would be initially created without XML declaration.
Thank you.
- 11
- Shopping carts in PHP and security
I have had two clients recently ask me about shopping carts.
I have also been using PHP on a more regular basis and thought I could
find an open source shopping cart such as oscommerce.
It seems as though oscommerce requires "register globals" turned on.
I know this is a bad idea. Also my hosting company won't turn them on
(not that I would want that). This got me thinking about a few things
and I was wondering what others experience on the subject is. I could
find very little information about this subject on Google.
I apologize if this is not the correct forum to present these topics.
As a note: I have built enrollment and authentication systems in PHP,
just not a store site.
What are peoples experience on these topics?
1. If using a cart with "register globals" on, has there been any
problems with injection of incorrect data? Are people being overly
paranoid of "register globals" being on?
2. Are there any solutions open source or paid that
have "register globals" turned off.
3. What kind of security are shopping cart ASPs providing?
I guess using a provider could provide security as long as
people didn't know the source code of the program.
4. Is any downloadable PHP shopping cart preferred over another?
Enough said!
Thank you,
Darryl
--
--
Derrald V
- 12
- mysql processess exceeded???My server is telling me that my scripts are opening up to 60 processes a
minute and not closing them.... the scripts have not had any ammendments
other than cosmetic changes. Could this be because i have submitted the site
for some 2 million hits???? would this cause the problem??? thanks
plato.
- 13
- ignore this Re: --- HELP!!: "insert statement" in PHP ---I just found out what the problem is so please ignore this post! It was
rather stupid (I didn't set the right permission on the user for the table).
Thanks for your help Ian!
Newbie
newbie_mw wrote:
> Seems my post was buried in more cries for help :-) I will try again.
> It's probably a very novice question so please take a look! Thanks!
> -----------------------------------------------------------------
>
> I created a sign-up sheet (reg.html) where people fill in their first
> name, last name, email, etc. The data are then sent to a PHP script
> (reg.php). The data are then inserted into a table (reg) in MS SQL
> server. I have declared the variables like this:
>
> The columns and variables are exactly matched so it shouldn't be the
> problem. The error message to the below script is:
> ~~~~~~~~~~~~~~~~~~~~~~
> call someoneDB Error:
> Warning: mssql_num_rows(): supplied argument is not a valid Sybase
> result
> resource ...
> ~~~~~~~~~~~~~~~~~~~~~~~~
>
> Even when I deleted the mssql_num_rows() stuff, it still doesn't work.
> The error message then said: "DB error".
>
> The (almost) full script is here:
>
> <?php
>
> // some MS SQL server connection thing that I can't show here :-) //
>
> if (!(isset($_POST['FirstName']))) {
> $FirstName = "" ;
> } else {
> $FirstName = $_POST['FirstName'] ;
> }
>
> if (!(isset($_POST['LastName']))) {
> $LastName = "" ;
> } else {
> $LastName = $_POST['LastName'] ;
> }
>
> if (!(isset($_POST['Email']))) {
> $Email = "" ;
> } else {
> $Email = $_POST['Email'] ;
> }
>
> if(empty($FirstName) OR empty($LastName) OR empty($Email))
>
> {
> echo "Oops, you must complete the form to register. Please use the
> browser
> back button to go back and complete the form.";
> echo "</body></html>";
> exit;
> }
>
> $qry = "insert into reg values (";
> $qry = $qry."'$FirstName'";
> $qry = $qry.",'$LastName'";
> qry = $qry.",'$Email'";
> $qry = $qry.")";
>
> $rs=$db->query ($qry);
> if (DB::iserror($rs)){print"call someone"; print $rs->getMessage();}
>
> $result = mssql_query("SELECT * FROM reg");
> $num_rows = mssql_num_rows($result) ;
>
> if ($num_rows > 10)
> {
> echo "Sorry, our registration is full. Please stay tuned till the next
>
> one.";
> }
>
> else
> {
> echo "Congratulations, $FirstName! Your have registered for --- ";
> echo "<p>";
> }
>
> ?>
>
> Hope it is clearer now. What's most frustrating is that it worked for a
> while,
> but now it is messed up.
>
> I also tried another "insert" statement that goes like this:
> $qry = "insert into reg values ('$FirstName','$LastName','$Email')";
>
> However, this doesn't work either. I looked into examples online, but
> none of those "insert into" statements handle varibles (they all insert
> actual values such as "Hanna, Smith, email***@***.com', etc.)
>
> Newbie
- 14
- Get Your Child to Sleep with SleepytimeWhile many babies fall into a routine of their own accord and will
sleep through the night automatically, the majority will need a little
coaching. Establishing the right sleep associations from an early age
is vital if you want to avoid long-term sleep problems. But no matter
what age your baby, there's always something you can do to improve
their sleeping habits.
http://parent.usu.ch/homebysl.htm
- 15
- know you Simple Machine Forum ?http://www.simplemachines.org/smf/features.php
which are the differences regarding phpbb ?
It seems good but little diffused and it is not supported by webhosting;
|
|
|