|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: php-general-digest-help
lists.php.netDate: Tue Apr 30 2002 - 22:22:23 CDT
php-general Digest 1 May 2002 03:22:23 -0000 Issue 1318
Topics (messages 95384 through 95478):
Re: Problem with array
95384 by: Richard Emery
95387 by: Tim Ward
Announcement: Smarty template engine 2.1.0 released
95385 by: Monte Ohrt
Parsing XML
95386 by: Fredrik Arild Takle
PHP 4.2.0 + Apache 2.0.35 (W2KSP2)
95388 by: Kirk Babb
95399 by: Julio Nobrega Trabalhando
Specify php.ini location in windows
95389 by: Patrick Lynch
95450 by: Patrick Lynch
Files sorted by date?
95390 by: Randum Ian
95392 by: heinisch.creaction.de
95397 by: Jason Wong
php command line
95391 by: Ezra Nugroho
95440 by: J Smith
Re: _SERVER variable insd prnt sttmnt
95393 by: Andrew Chase
Checking to see if a DELETE was successful from MSSQL
95394 by: Joshua E Minnie
95395 by: Steve Bradwell
95404 by: Joshua E Minnie
95405 by: Miguel Cruz
95406 by: Joshua E Minnie
95413 by: Steve Bradwell
XML to HTML?!
95396 by: Fredrik Arild Takle
95408 by: Alexander Skwar
mail() errors and alternatives
95398 by: John Hughes
95467 by: John Holmes
Re: Database Duplication
95400 by: Miguel Cruz
95401 by: Jason Wong
Re: regular expressions help please
95402 by: Miguel Cruz
95420 by: Jason Wong
95445 by: John Fishworld
95446 by: Miguel Cruz
95448 by: John Fishworld
95456 by: Miguel Cruz
SQL Query (Group By)
95403 by: Andrew Brampton
parse error
95407 by: Jule
95412 by: Miguel Cruz
95416 by: Steve Cayford
95417 by: Jule
95422 by: Richard Emery
95423 by: Miguel Cruz
PHP Secure Connection: Alternative to Curl ?
95409 by: [-^-!-%-
Re: Best BBS
95410 by: Austin Marshall
95411 by: Austin Marshall
95414 by: Michael Kimsal
PHP Editors
95415 by: Liam Gibbs
95424 by: r
95461 by: Jason McCormack
Hex2Bin??
95418 by: Joshua E Minnie
95419 by: Miguel Cruz
95421 by: Joshua E Minnie
95438 by: Bogdan Stancescu
95441 by: Joshua E Minnie
95465 by: Evan Nemerson
95473 by: Evan Nemerson
95475 by: Bogdan Stancescu
95476 by: John Holmes
newbie problem under Solaris
95425 by: Emiliano Marmonti
95433 by: Billy S Halsey
Is it possible to verify that a form submision is not being "spoofed"?
95426 by: Warrick Wilson
95428 by: Miguel Cruz
95430 by: Cal Evans
95434 by: Miguel Cruz
95435 by: Jason Wong
95437 by: James E. Hicks III
95439 by: Kevin Stone
95458 by: Justin French
how do you parse this?
95427 by: Lazor, Ed
95432 by: Miguel Cruz
i cannot pass variables to php script...
95429 by: efa
95431 by: Lazor, Ed
95436 by: efa
Please help - Libxslt/PHP/Apache
95442 by: Venu Reddy
apps that need register globals 'on' and others require 'off' on same server
95443 by: Jeff Bearer
95444 by: SHEETS,JASON (Non-HP-Boise,ex1)
95447 by: CC Zona
95449 by: Philip Olson
odd behavior
95451 by: Craig Westerman
95464 by: Evan Nemerson
sending data to two tables.
95452 by: Jule
Include Files self aware?
95453 by: PHP List
95454 by: Billy S Halsey
95455 by: mArk.cOLListER
95457 by: Miguel Cruz
95459 by: Maxim Maletsky \(PHPBeginner.com\)
95463 by: Evan Nemerson
Help! Transparency using GD with PNGs!
95460 by: Cam
Help on master detail
95462 by: Denis L. Menezes
95466 by: John Holmes
Accessing/Passing Old Session Variables
95468 by: Andre Dubuc
function not returning value
95469 by: Mark Pelillo
95470 by: Martin Towell
95474 by: Evan Nemerson
Login with Text Files
95471 by: Rodrigo
95472 by: John Holmes
95477 by: Bogdan Stancescu
Re: apps that need register globals 'on' and others require
95478 by: php3.developersdesk.com
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
show the form.....
----- Original Message -----
From: Carlos Fernando Scheidecker Antunes <nando
antunes.eti.br>
To: PHP-GENERAL <PHP-GENERAL
lists.php.net>
Sent: Tuesday, April 30, 2002 10:11 AM
Subject: [PHP] Problem with array
Hello All,
I've got a form that creates checkboxes based on the number of rows on a
table. The user has to check some of the boxes and then click submit. The
boxes are named RG1, RG2, RG3, ....
If there are 4 checkboxes and the user selects them all or selects the
first, second and fourth, or the first third and fourth my code works. But
if the user selects the second, third and fourth (He does not checks the
first one) no information is recorded on my array.
Here's the code that I have to search the $HTTP_POST_VARS and then fill a
array variable called $RG.
function SearchRGs() {
global $HTTP_POST_VARS;
global $RGs;
// fills the array variable RGs with the values of checked checkboxes
that start with the name RG# (where # goes from 1,2,3,....).
// returns the qty of checked RGs and size of the $RGs array.
$index = count($HTTP_POST_VARS);
$count = 0;
for ($i=1; $i < $index; $i++) {
if (isset($HTTP_POST_VARS["RG$i"])) {
$RGs[] = $HTTP_POST_VARS["RG$i"];
$count++;
}
}
return $count;
}
Can anyone help me with this?
Why if I do not check the first checkbox on the form the array is not
filled.
Thank you,
Carlos Fernando.
attached mail follows:
Try some diagnostics to tell you what's going on
In the page you're submitting to try
Foreach($HTTP_POST_VARS as $key=>$value) echo("$key=>$value<br>");
Part of your problem may be that you're using the number of
form elements returned to control the for loop. It doesn't
really have any significance in this context.
Is there any reason why you're not naming the checkboxes RG[1], RG[2], etc.?
This would make everything much easier - you can then do ...
Foreach ($HTTP_POST_VARS["RG"] as $value) $RGs[] = $value
Tim Ward
Internet Chess www.chessish.com <http://www.chessish.com>
----------
From: Carlos Fernando Scheidecker Antunes
[SMTP:nando
antunes.eti.br]
Sent: 30 April 2002 16:11
To: PHP-GENERAL
Subject: Problem with array
Hello All,
I've got a form that creates checkboxes based on the number of rows
on a table. The user has to check some of the boxes and then click submit.
The boxes are named RG1, RG2, RG3, ....
If there are 4 checkboxes and the user selects them all or selects
the first, second and fourth, or the first third and fourth my code works.
But if the user selects the second, third and fourth (He does not checks the
first one) no information is recorded on my array.
Here's the code that I have to search the $HTTP_POST_VARS and then
fill a array variable called $RG.
function SearchRGs() {
global $HTTP_POST_VARS;
global $RGs;
// fills the array variable RGs with the values of checked
checkboxes that start with the name RG# (where # goes from 1,2,3,....).
// returns the qty of checked RGs and size of the $RGs array.
$index = count($HTTP_POST_VARS);
$count = 0;
for ($i=1; $i < $index; $i++) {
if (isset($HTTP_POST_VARS["RG$i"])) {
$RGs[] = $HTTP_POST_VARS["RG$i"];
$count++;
}
}
return $count;
}
Can anyone help me with this?
Why if I do not check the first checkbox on the form the array is
not filled.
Thank you,
Carlos Fernando.
attached mail follows:
Homepage:
http://www.phpinsider.com/php/code/Smarty/
Most notable new features are block functions which act on
blocks of text {func}{/func}, and output filters which
act on the output of the templates.
Version 2.1.0
-------------
- introduced output filters. (Andrei)
- changed the way filters are loaded, added load_filter()
API function and $autoload_filters variable. (Andrei)
- added caching logic for expire times per cache file
(Norbert Rocher, Monte)
- fixed html_select_date when field separator is "/"
(Roberto Berto, Monte)
- added YYYY-MM-DD format support to html_select_date
(Jan Rosier, Monte)
- fixed cache_lifetime logic bug, also made -1 = never
expire (Monte)
- fixed directory separator issue for Windows. (Andrei)
- added ability to use simple variables as array indices or
object properties. (Andrei)
- added ability to unregister pre/postfilters plugins at
runtime. (Andrei)
- added 'htmlall' attribute to escape modifier. (Monte)
- added template_exists() API function. (Andrei)
- fixed a problem with using dynamic values for 'file'
attribute of {include_php} tag. (Andrei)
- added $smarty.template variable. (Andrei)
- fixed several plugins that would not work if the plugin
directory was not the default one. (Andrei)
- implemented support for block functions. (Andrei)
- made it possible to assign variables in pre/postfilter
plugins. (Andrei)
-- Monte Ohrt <monteispi.net> Director of Technology, ispi Inc.
attached mail follows:
Hi,
this might be a silly question, but I really haven't used XML alot with PHP. I've parsed som XML, when I do xml_parse it outputs the html-codes.
I want to make a variable out of it.. I've tried $output = xml_parse();
attached mail follows:
I have copied these three lines from the php install.txt file into httpd.conf:
LoadModule php4_module c:/php/sapi/php4apache.dll AddModule mod_php4.c AddType application/x-httpd-php .php
and php4ts.dll is in winnt\system32. Apache freezes unless I comment out those lines. When I test php scripts from the command prompt inside the php dir. (C:\php) I see the correct output, so I know php is working (as is my install of php-gtk). Where have I "strayed from the path"?
this worked for my install of Apache 1.3.24 and PHP 4.1.2, so I'm not sure what's going on.
thanks for any and all help,
Kirk
attached mail follows:
Load the experimental apache2filter.dll instead.
--Julio Nobrega.
Um dia eu chego lá: http://sourceforge.net/projects/toca
Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
"Kirk Babb" <kbcd
worldnet.att.net> wrote in message news:20020430155437.70008.qmail
pb1.pair.com... > I have copied these three lines from the php install.txt file into > httpd.conf: > > LoadModule php4_module c:/php/sapi/php4apache.dll > AddModule mod_php4.c > AddType application/x-httpd-php .php > > and php4ts.dll is in winnt\system32. Apache freezes unless I comment out > those lines. When I test php scripts from the command prompt inside the php > dir. (C:\php) I see the correct output, so I know php is working (as is my > install of php-gtk). Where have I "strayed from the path"? > > this worked for my install of Apache 1.3.24 and PHP 4.1.2, so I'm not sure > what's going on. > > thanks for any and all help, > > Kirk > >
attached mail follows:
Hi, I am having a small problem with PHP/Windows. [config] Windows 2000 Server IIS 5 PHP 4.0.6 I have a server with a php.ini in the c:\winnt directory and a site running fine with that configuration. I need to set up a new site, using a different php.ini. The new site is set up in IIS but I cannot find a way to make PHP look to a different php.ini other than the one in c:\winnt. I have tried using the -c command line option in the app mappings section but to no avail. Here is what I have in the executable text box: C:\Inetpub\php\php.exe -c z:\Dir\With\Other\IniFile %s %s PHP pages execute fine but a page with phpinfo() shows that php is still reading the file from c:\winnt\php.ini Any ideas? Thanks in advance, Patrick.
attached mail follows:
Hi,
The -c option does not seem to work for me. I saw it in the manual and was the first thing I tried.
It just seems to get ignored - The php scripts that are supposed to be working under that directive work just fine... But they use the ini file from c:\winnt
Any other ideas?
Thanks,
/P
-----Original Message-----
From: Brian McGarvie [mailto:bmcgarvie
lennox-mckinlay.co.uk]
Sent: 30 April 2002 17:20
To: Patrick Lynch
Subject: RE: [PHP] Specify php.ini location in windows
sorry ;)
hit send by accident ;)
the command line for it is:
php.exe -c c:\anotherfolder\php.ini
or even:
php.exe -c c:\anotherfolder\pfp_for_iis.ini
etc etc...
hope this helps ;)
i use IIS5 also but at the moment only need one .ini...
i suggest looking at the above via Properties > Home Directory > Configuration
and edit the line for .php? I think that sould work.... lemme know ;)
-----Original Message-----
From: Patrick Lynch [mailto:Patrick.Lynch
optip.com]
Sent: 30 April 2002 17:09
To: 'PHP-GENERAL'
Subject: [PHP] Specify php.ini location in windows
Hi, I am having a small problem with PHP/Windows. [config] Windows 2000 Server IIS 5 PHP 4.0.6 I have a server with a php.ini in the c:\winnt directory and a site running fine with that configuration. I need to set up a new site, using a different php.ini. The new site is set up in IIS but I cannot find a way to make PHP look to a different php.ini other than the one in c:\winnt. I have tried using the -c command line option in the app mappings section but to no avail. Here is what I have in the executable text box: C:\Inetpub\php\php.exe -c z:\Dir\With\Other\IniFile %s %s PHP pages execute fine but a page with phpinfo() shows that php is still reading the file from c:\winnt\php.ini Any ideas? Thanks in advance, Patrick.
attached mail follows:
Hi there,
I got a number of files in the directory "/reviews/txt" which are reviews. They are submitted by people all over the world.
Can someone please tell me what I need to do so that I can display them in date order, newest at the top on a webpage?
Cheers, Ian.
--- Randum Ian DJ / Reviewer / Webmaster, DancePortal (UK) Limited iandanceportal.co.uk http://www.danceportal.co.uk DancePortal.co.uk - Global dance music media
attached mail follows:
At 30.04.2002 17:24, you wrote:
>
>Hi there,
>
>I got a number of files in the directory "/reviews/txt" which are reviews.
>They are submitted by people all over the world.
>
>Can someone please tell me what I need to do so that I can display them in
>date order, newest at the top on a webpage?
>
>Cheers, Ian.
>---
>Randum Ian
>DJ / Reviewer / Webmaster, DancePortal (UK) Limited
>ian
danceportal.co.uk
>http://www.danceportal.co.uk
>DancePortal.co.uk - Global dance music media
exec("ls -lc reviews/txt/*",$result);
for($i=0;$i < count($result);$i++)
{
if(($result[$i] ==".")||($result[$i] =="..")
{} // do notjing
else
{
do something with $result[$i];
}
}
HTH Oliver
attached mail follows:
On Wednesday 01 May 2002 00:24, Randum Ian wrote: > Hi there, > > I got a number of files in the directory "/reviews/txt" which are reviews. > They are submitted by people all over the world. > > Can someone please tell me what I need to do so that I can display them in > date order, newest at the top on a webpage?
First look at "Directory functions" Then "Filesystem functions" Then "Array Functions"
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Support your right to arm bears!! */
attached mail follows:
I was trying to compile php command line and got some problem. Maybe some of you can help.
version: 4.1.2 I did: ./configure --with-ldap --with-oracle --with-oci8 --with-mysql=/usr/src/mysql-3.23.43-pc-linux-gnu-i686 --enable-track-vars --disable-debug --prefix=/usr/local/apache/php --with-config-file-path=/usr/local/apache/lib --with-gd
when tested, it gave: Failed loading /usr/local/apache/libexec/ZendOptimizer.so: /usr/local/apache/libexec/ZendOptimizer.so: cannot open shared object file: No such file or directory
I couldn't find ZendOptimizer.so anywhere. Any clue?
Thanks,
Ezra Nugroho Web/Database Application Specialist Goshen College Information Technology Services Phone: (574) 535-7706
attached mail follows:
Check out your php.ini file and look for some lines that read something along the lines of
zend_extension=/path/to/ZendOptimizer.so zend_optimizer.optimization_level=15
Then either:
a. Get rid of those lines; or b. Get the Zend Optimizer and put it some place where PHP can see it can modify the zend_extension line in your php.ini file accordingly.
J
Ezra Nugroho wrote:
> I was trying to compile php command line and got some problem. > Maybe some of you can help. > > version: 4.1.2 > I did: > ./configure --with-ldap --with-oracle --with-oci8 > --with-mysql=/usr/src/mysql-3.23.43-pc-linux-gnu-i686 --enable-track-vars > --disable-debug --prefix=/usr/local/apache/php > --with-config-file-path=/usr/local/apache/lib --with-gd > > when tested, it gave: > Failed loading /usr/local/apache/libexec/ZendOptimizer.so: > /usr/local/apache/libexec/ZendOptimizer.so: cannot open shared object > file: No such file or directory > > I couldn't find ZendOptimizer.so anywhere. > Any clue? >
attached mail follows:
For the sake of legibility you could always assign the contents of $_SERVER['PHP_SELF'] to another variable before using it in the print statement:
$PHP_SELF = $_SERVER['PHP_SELF'];
print "<LI><A HREF='$PHP_SELF?letter=$chars[$cnt]'>";
Shouldn't be a problem security-wise as long as register_globals is off; Even if somebody tried to pass an arbitrary value to PHP_SELF in the query string, it would only show up in $_GET['PHP_SELF']. It also provides a quick way to bring pre- 4.1.2 scripts relying on the old global $PHP_SELF up to date.
-Andy
> -----Original Message-----
> From: 1LT John W. Holmes [mailto:holmes072000
charter.net]
> Sent: Monday, April 29, 2002 8:30 AM
> To: php-general
lists.php.net
> Subject: Re: [PHP] _SERVER variable insd prnt sttmnt
>
>
> > > // print "<LI><A HREF='$_SERVER['PHP_SELF']?letter=$chars[$cnt]'>" .
>
> This is the problem with not breaking out of a string to display
> a variable.
> Ideally, you would do it this way:
>
> print "<LI><A HREF='" . $_SERVER['PHP_SELF'] . "?letter=" . $chars[$cnt] .
> "'>";
>
> But some people just have a problem with doing it that way, so you can use
> braces.
>
> print "<LI><A HREF='{$_SERVER['PHP_SELF']}?letter={$chars[$cnt]}'>";
attached mail follows:
Can anyone tell me the best way to check that a DELETE query was successful. I have tried using mssql_num_rows() and mssql_rows_affected() but it is always telling me that the DELETE was successful, even when it shouldn't have been. Here is the code that I am trying to work with right now.
<? function delete_user($dbname, $user) { //connecting to db and getting table mssql_select_db($dbname) or die("Table unavailable");
//deleting user from user table $query = "DELETE FROM [users] WHERE [user] = '$user'"; $result = mssql_query($query) or die("Unable to delete user"); if(mssql_num_rows($result) > 0) echo "User successfully deleted.<br>\n"; else echo "User does not exist<br>\n"; } ?>
*Running PHP 4.1.2 on Windows NT 4.0 with MS SQL Server 2000
-- Joshua E Minnie/CIO joshacsurf.net Phone: 616.276.9690 Fax: 616.342.8750 Nextel: 616.862.2847
"Don't work for recognition, but always do work worthy of recognition."
attached mail follows:
Try this,
$query = "DELETE FROM [users] WHERE [user] = '$user'"; $result = mssql_query($query) or die("Unable to delete user"); if ($result) //delete worked. else //delete failed.
-----Original Message-----
From: Joshua E Minnie [mailto:josh
acsurf.net]
Sent: Tuesday, April 30, 2002 12:44 PM
To: php-general
lists.php.net
Subject: [PHP] Checking to see if a DELETE was successful from MSSQL
Can anyone tell me the best way to check that a DELETE query was successful. I have tried using mssql_num_rows() and mssql_rows_affected() but it is always telling me that the DELETE was successful, even when it shouldn't have been. Here is the code that I am trying to work with right now.
<? function delete_user($dbname, $user) { //connecting to db and getting table mssql_select_db($dbname) or die("Table unavailable");
//deleting user from user table $query = "DELETE FROM [users] WHERE [user] = '$user'"; $result = mssql_query($query) or die("Unable to delete user"); if(mssql_num_rows($result) > 0) echo "User successfully deleted.<br>\n"; else echo "User does not exist<br>\n"; } ?>
*Running PHP 4.1.2 on Windows NT 4.0 with MS SQL Server 2000
-- Joshua E Minnie/CIO joshacsurf.net Phone: 616.276.9690 Fax: 616.342.8750 Nextel: 616.862.2847
"Don't work for recognition, but always do work worthy of recognition."
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I tried that already, it always returns true. The reason is because it will always return true since it is only deleting if the user exists. This means that the query will run and successfully complete. But if the user does not exist it still runs and completes successfully, but the user was not there. So how do I detect that situation.
-- Joshua E Minnie/CIO joshacsurf.net Phone: 616.276.9690 Fax: 616.342.8750 Nextel: 616.862.2847
"Don't work for recognition, but always do work worthy of recognition."
"Steve Bradwell" <SteveB
compxnet.com> wrote: > Try this, > > $query = "DELETE FROM [users] WHERE [user] = '$user'"; > $result = mssql_query($query) or die("Unable to delete user"); > if ($result) > //delete worked. > else > //delete failed.
<<Original Message>> > Can anyone tell me the best way to check that a DELETE query was successful. > I have tried using mssql_num_rows() and mssql_rows_affected() but it is > always telling me that the DELETE was successful, even when it shouldn't > have been. Here is the code that I am trying to work with right now. > > <? > function delete_user($dbname, $user) { > //connecting to db and getting table > mssql_select_db($dbname) or die("Table unavailable"); > > //deleting user from user table > $query = "DELETE FROM [users] WHERE [user] = '$user'"; > $result = mssql_query($query) or die("Unable to delete user"); > if(mssql_num_rows($result) > 0) echo "User successfully deleted.<br>\n"; > else echo "User does not exist<br>\n"; > } > ?> > > *Running PHP 4.1.2 on Windows NT 4.0 with MS SQL Server 2000
attached mail follows:
On Tue, 30 Apr 2002, Joshua E Minnie wrote: > I tried that already, it always returns true. The reason is because it > will always return true since it is only deleting if the user exists. > This means that the query will run and successfully complete. But if > the user does not exist it still runs and completes successfully, but > the user was not there. So how do I detect that situation.
You could always try preceeding it with a SELECT...
miguel
attached mail follows:
That was exactly what I needed. Thanks, this group has been so helpful.
.:. Josh .:.
"Miguel Cruz" <mnc
stoic.net> wrote in message
news:Pine.LNX.4.44.0204301240510.23990-100000
stoic.net...
> On Tue, 30 Apr 2002, Joshua E Minnie wrote:
> > I tried that already, it always returns true. The reason is because it
> > will always return true since it is only deleting if the user exists.
> > This means that the query will run and successfully complete. But if
> > the user does not exist it still runs and completes successfully, but
> > the user was not there. So how do I detect that situation.
>
> You could always try preceeding it with a SELECT...
>
> miguel
>
attached mail follows:
I agree, try using a select after the delete.
-Steve.
-----Original Message-----
From: Joshua E Minnie [mailto:josh
acsurf.net]
Sent: Tuesday, April 30, 2002 1:40 PM
To: php-general
lists.php.net
Subject: Re: [PHP] Checking to see if a DELETE was successful from MSSQL
I tried that already, it always returns true. The reason is because it will always return true since it is only deleting if the user exists. This means that the query will run and successfully complete. But if the user does not exist it still runs and completes successfully, but the user was not there. So how do I detect that situation.
-- Joshua E Minnie/CIO joshacsurf.net Phone: 616.276.9690 Fax: 616.342.8750 Nextel: 616.862.2847
"Don't work for recognition, but always do work worthy of recognition."
"Steve Bradwell" <SteveB
compxnet.com> wrote: > Try this, > > $query = "DELETE FROM [users] WHERE [user] = '$user'"; > $result = mssql_query($query) or die("Unable to delete user"); > if ($result) > //delete worked. > else > //delete failed.
<<Original Message>> > Can anyone tell me the best way to check that a DELETE query was successful. > I have tried using mssql_num_rows() and mssql_rows_affected() but it is > always telling me that the DELETE was successful, even when it shouldn't > have been. Here is the code that I am trying to work with right now. > > <? > function delete_user($dbname, $user) { > //connecting to db and getting table > mssql_select_db($dbname) or die("Table unavailable"); > > //deleting user from user table > $query = "DELETE FROM [users] WHERE [user] = '$user'"; > $result = mssql_query($query) or die("Unable to delete user"); > if(mssql_num_rows($result) > 0) echo "User successfully deleted.<br>\n"; > else echo "User does not exist<br>\n"; > } > ?> > > *Running PHP 4.1.2 on Windows NT 4.0 with MS SQL Server 2000
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi,
this might be a silly question, but I really haven't used XML alot with PHP. I've parsed some XML, when I do xml_parse it outputs the html-codes.
I want to make a variable out of it, so I can write it to a file. I've tried $output = xml_parse();
attached mail follows:
»Fredrik Arild Takle« sagte am 2002-04-30 um 18:48:37 +0200 : > I've parsed some XML, when I do xml_parse it outputs the html-codes.
Wrap into a output buffer. ob_start, ob_get_contents
Alexander Skwar
-- How to quote: http://learn.to/quote (german) http://quote.6x.to (english) Homepage: http://www.iso-top.de | Jabber: askwara-message.de iso-top.de - Die günstige Art an Linux Distributionen zu kommen Uptime: 6 days 12 hours 49 minutes
attached mail follows:
For the second time in less than a week, the commercial Web service provider where I have four domains hosted has managed to break PHP. In particular, I get this message:
Warning: mail() is not supported in this PHP build
I'm not interested in what causes the PHP mail() function to become unavailable. My problem is that the mail() function -- or, more to the point, the ability to send e-mail -- is "mission critical." No mail; no work. No work; unhappy boss. You get the idea.
I'm looking for ideas on how I can defend against mail() failures. One idea I had would be to test
if(mail($to, $subj, $body, $headers) { /* report ok send */ } ELSE { /* do alternative send */ }
Any ideas of how that alternative send could work?
I do have an alternative service provider where I have access to PHP that works. Any ideas on the best way to redirect the $to, $subj, $body, $headers to a PHP script at the other domain and return some notification that the send did not report errors?
TIA,
John Hughes http://jomari.com
__________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com
attached mail follows:
There are some classes that use sockets to send mail by connecting directly to an SMTP server. Look on hotscripts.com or phpclasses.com (.org?)
---John Holmes...
> -----Original Message-----
> From: John Hughes [mailto:jlhughes
yahoo.com]
> Sent: Tuesday, April 30, 2002 10:01 AM
> To: php-general
lists.php.net
> Subject: [PHP] mail() errors and alternatives
>
> For the second time in less than a week, the commercial Web service
> provider where I have four domains hosted has managed to break PHP.
> In particular, I get this message:
>
> Warning: mail() is not supported in this PHP build
>
> I'm not interested in what causes the PHP mail() function to become
> unavailable. My problem is that the mail() function -- or, more to
> the point, the ability to send e-mail -- is "mission critical." No
> mail; no work. No work; unhappy boss. You get the idea.
>
> I'm looking for ideas on how I can defend against mail() failures.
> One idea I had would be to test
>
> if(mail($to, $subj, $body, $headers)
> {
> /* report ok send */
> } ELSE {
> /* do alternative send */
> }
>
> Any ideas of how that alternative send could work?
>
> I do have an alternative service provider where I have access to PHP
> that works. Any ideas on the best way to redirect the $to, $subj,
> $body, $headers to a PHP script at the other domain and return some
> notification that the send did not report errors?
>
> TIA,
>
> John Hughes
> http://jomari.com
>
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Tue, 30 Apr 2002, Liam Gibbs wrote: >> Before starting a test, dump your database with the >> mysqldump command. >> Edit this file to create/use your test database. >> Load your test database with this file. > > Hmm. No I didn't do this. Not too familiar with all > the intricacies of MySQL (or SQL). I'll take a look at > dumping the database.
Something like:
mysqladmin -u root create temp_db mysql -u root -e 'grant all access on temp_db to real_user' mysqldump -u real_user real_db | mysql -u real_user temp_db
and then when you're done:
mysqladmin -u root drop temp_db
obviously adding -p to those lines as appropriate.
But it's not going to be that fast with large databases, and you'll have to work out some scheme for dealing with multiple users each needing their own copy.
We don't know nearly enough about your project to really work out alternatives for you, but I bet there's a good one somewhere. Temp tables, shadow tables in the same database, something.
miguel
attached mail follows:
On Wednesday 01 May 2002 01:04, Miguel Cruz wrote: > On Tue, 30 Apr 2002, Liam Gibbs wrote: > >> Before starting a test, dump your database with the > >> mysqldump command. > >> Edit this file to create/use your test database. > >> Load your test database with this file. > > > > Hmm. No I didn't do this. Not too familiar with all > > the intricacies of MySQL (or SQL). I'll take a look at > > dumping the database. > > Something like: > > mysqladmin -u root create temp_db > mysql -u root -e 'grant all access on temp_db to real_user' > mysqldump -u real_user real_db | mysql -u real_user temp_db
I would recommend adding the "--opt" option to the mysqldump command. These will amongst other things, drop tables on the destination db if they already exist ...
> and then when you're done: > > mysqladmin -u root drop temp_db
... and thus you can omit this and leave the temp_db in place ready for use next time.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Witch! Witch! They'll burn ya! -- Hag, "Tomorrow is Yesterday", stardate unknown */
attached mail follows:
On Tue, 30 Apr 2002, Ed Lazor wrote: > Pull everything except a specific word from a sentence. For example, > pulling everything except the word run from "the water run was steep".
$str = 'the water run was steep'; print preg_replace('/(\s*water)/', '', $str);
> Pull all words from a string starting with a specific letter or > pattern. For example, pulling all of the words starting with the letter r > from "run beep burp ran rin ron runt zoot zip pow"
$str = 'run beep burp ran rin ron runt zoot zip pow'; if (preg_match_all('/(\br\w+\b)/', $str, $matches)) print join(' ', $matches[1]);
> Pulling all words from a string excluding ones starting with a specific > letter or pattern. For example, pulling all of the words except ones > starting with the letter r from "run beep burp ran rin ron runt zoot zip > pow"
$str = 'run beep burp ran rin ron runt zoot zip pow'; if (preg_match_all('/([\b\W][^r]\w+\b)/', $str, $matches)) print join(' ', $matches[1]);
> Pulling a word between two other words without having to know what the > word is. For example, pulling whatever word displays between "the" and > "sky". If the string was "the blue sky", the result would be the word > blue. If the string were "the green sky", the result would be the word > green.
$str = 'the green sky'; if (preg_match('/the\s+(\S+?)\s+sky/', $str, $matches)) print $matches[1];
> I apologize in advance if these are really simple. It's just that I'm > new to regular expressions and reading all of the web page tutorials, > manual pages, and mailing list archive messages has left me thinking I'm > complicating something somewhere, because it really shouldn't be this > hard.
Well, it's not trivial. Regular expressions is a whole complete language, entirely separate from PHP, with a lot to learn. Practice enough, though, and you'll start to see how you can do amazing things with it.
Also, I'd recommend using the Perl-style regex (preg_ rather than ereg_ functions) and reading 'man perlre' if it's installed on your system (someone can probably suggest a web location for that text).
miguel
attached mail follows:
On Tuesday 30 April 2002 21:09, John Fishworld wrote: > Duh ! lol sorry !
> <img src="/db/imodeklein/edgar-IMODE-1-.gif" vspace=2><br> <a > href="imode.fpl?op=imodecard&prefix=IMODE&nummer=1&suffx=&uid=55%2eFAGAE&pa
> > > > Unfortunately, no. Could you post say 20 lines of this file you're > > > > talking about. > > > > I mean the file that you're readingparsing, not your program.
Try this:
preg_match_all("/src=(\'[a-z0-9_\/-]+\.gif\')/i", $input, $MATCH); print_r($MATCH);
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Money is its own reward. */
attached mail follows:
Thanks after playing about with that I've got the following which does seem to work !
$imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")", "\\1\\2$path/\\3\\2", $imode_code[$i]);
Very very very slowly getting the hang of regexs !
What does your /i do at the end ???
Thanks
> Try this: > > preg_match_all("/src=(\'[a-z0-9_\/-]+\.gif\')/i", $input, $MATCH); > print_r($MATCH); > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > Money is its own reward. > */ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
On Wed, 1 May 2002, John Fishworld wrote: > Thanks after playing about with that I've got the following which does seem > to work ! > > $imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")", > "\\1\\2$path/\\3\\2", $imode_code[$i]); > > Very very very slowly getting the hang of regexs ! > > What does your /i do at the end ???
Makes it case-insensitive, so "gif" and "GIF" are treated identically.
miguel
attached mail follows:
aha ! thats very strange then because mine works at the moment but if I add the /i at the end then it doesn't !
> On Wed, 1 May 2002, John Fishworld wrote: > > Thanks after playing about with that I've got the following which does seem > > to work ! > > > > $imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")", > > "\\1\\2$path/\\3\\2", $imode_code[$i]); > > > > Very very very slowly getting the hang of regexs ! > > > > What does your /i do at the end ??? > > Makes it case-insensitive, so "gif" and "GIF" are treated identically. > > miguel > >
attached mail follows:
I wasn't paying that much attention. The /i is a preg thing. It's the same as changing from ereg to eregi.
miguel
On Wed, 1 May 2002, John Fishworld wrote: > aha ! > thats very strange then because mine works at the moment but if I add the /i > at the end then it doesn't ! > > > On Wed, 1 May 2002, John Fishworld wrote: > > > Thanks after playing about with that I've got the following which does > seem > > > to work ! > > > > > > $imode_code[$i] = eregi_replace("(src=)(\")([a-z0-9_\/-]+\.gif)(\")", > > > "\\1\\2$path/\\3\\2", $imode_code[$i]); > > > > > > Very very very slowly getting the hang of regexs ! > > > > > > What does your /i do at the end ??? > > > > Makes it case-insensitive, so "gif" and "GIF" are treated identically. > > > > miguel > > > > > > >
attached mail follows:
Hi, This is more a SQL question that a php one, but here goes:
I have a table with 3 fields, Date, IP, ISP. Basically I have written some php to store the following in the table each time someone hits a page on my site. Now I want to display some info about the users currently on my site, but I want to try and do it with 1 SQL query.
Basically I want to display a count of how many unique IPs there are on my site from each ISP... for example 3 NTL 1 BT 5 Freeserve
but in each group there will be more than 1 entry for each user due to them causing a row in the table on each hit. I can't seem to group it together how I want with 1 query. The best I can do is count how many rows are from each IP (but this figure is too high since it doesn't take into account that the IPs must be unique). Here is my current SQL:
$sql = "SELECT ISP, COUNT(*) as total FROM track GROUP BY ISP ORDER BY total DESC";
I could make this work by doing some sorting in PHP once I get the data, but I would prefer to do it with SQL... Anyone know how to do what I want?
Thanks Andrew
attached mail follows:
Hey guys, i'm writing this guestbook script for my site, and i'm getting a random parse error where i think everything is normal, it gives it on line 26 which is
echo "Your entry will be posted!";
my script follows
Jule
--SCRIPT--
<?php $Guestbook["dateadd"] = date("F j, Y H:i:s"); $Guestbook["name"] = trim($Guestbook["name"]); $Guestbook["town"] = trim($Guestbook["town"]); $Guestbook["email"] = trim($Guestbook["email"]); $Guestbook["website"] = trim($Guestbook["website"]); $Guestbook["favsong"] = trim($Guestbook["favsong"]); $Guestbook["comments"] = trim($Guestbook["comments"]); $Guestbook["mailinglist"] = trim($Guestbook["mailinglist"]);
$Host = "localhost";
$User = "****";
$Password = "*********";
$DBName = "blindtheory";
$TableName = "guestbook";
$TableName2 = "mailinglist";
$Pattern = ".+
.+..+";
$Pattern2 = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
$Link = mysql_connect ($Host, $User, $Password); $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]', '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]', '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')"; $Link2 = mysql_connect ($Host, $User, $Password); $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]', '$Guestbook[name]', '$Guestbook[email]');
if (mysql_db_query ($DBName, $Query, $Link)) {
echo "Your entry will be added";
} else {
echo "There was an error in during the posting, please contact <a
href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
problem.<br>";
}
if (isset($Guestbook[mailinglist])) {
if (mysql_db_query ($DBName, $Query2, $Link2)) {
echo "Your e-mail address was sucessfully added to our mailinglist";
} else {
echo "There was an error in during the posting, please contact <a
href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
problem.<br>";
}
}
mysql_close ($Link);
mysql_close ($Link2);
?>
-- Jule Slootbeek jslootbeekclarku.edu http://blindtheory.cjb.net
attached mail follows:
You're missing a closing quote on the assignment for $Query2.
Come on people, keep your eyes open. This is basic stuff. Doesn't take any special genius to count quotes and braces.
miguel
On Tue, 30 Apr 2002, Jule wrote:
> Hey guys, i'm writing this guestbook script for my site, and i'm getting a
> random parse error where i think everything is normal, it gives it on line 26
> which is
>
> echo "Your entry will be posted!";
>
> my script follows
>
> Jule
>
> --SCRIPT--
>
> <?php
> $Guestbook["dateadd"] = date("F j, Y H:i:s");
> $Guestbook["name"] = trim($Guestbook["name"]);
> $Guestbook["town"] = trim($Guestbook["town"]);
> $Guestbook["email"] = trim($Guestbook["email"]);
> $Guestbook["website"] = trim($Guestbook["website"]);
> $Guestbook["favsong"] = trim($Guestbook["favsong"]);
> $Guestbook["comments"] = trim($Guestbook["comments"]);
> $Guestbook["mailinglist"] = trim($Guestbook["mailinglist"]);
>
> $Host = "localhost";
> $User = "****";
> $Password = "*********";
> $DBName = "blindtheory";
> $TableName = "guestbook";
> $TableName2 = "mailinglist";
> $Pattern = ".+
.+..+";
> $Pattern2 = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
>
> $Link = mysql_connect ($Host, $User, $Password);
> $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]',
> '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]',
> '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')";
> $Link2 = mysql_connect ($Host, $User, $Password);
> $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]',
> '$Guestbook[name]', '$Guestbook[email]');
>
> if (mysql_db_query ($DBName, $Query, $Link)) {
> echo "Your entry will be added";
> } else {
> echo "There was an error in during the posting, please contact <a
> href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> problem.<br>";
> }
>
> if (isset($Guestbook[mailinglist])) {
>
> if (mysql_db_query ($DBName, $Query2, $Link2)) {
> echo "Your e-mail address was sucessfully added to our mailinglist";
> } else {
> echo "There was an error in during the posting, please contact <a
> href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> problem.<br>";
> }
> }
> mysql_close ($Link);
> mysql_close ($Link2);
> ?>
>
attached mail follows:
Looks like your problem is on line 24. See below.
-Steve
On Tuesday, April 30, 2002, at 12:48 PM, Jule wrote:
> Hey guys, i'm writing this guestbook script for my site, and i'm
> getting a
> random parse error where i think everything is normal, it gives it on
> line 26
> which is
>
> echo "Your entry will be posted!";
>
> my script follows
>
> Jule
>
> --SCRIPT--
>
> <?php
> $Guestbook["dateadd"] = date("F j, Y H:i:s");
> $Guestbook["name"] = trim($Guestbook["name"]);
> $Guestbook["town"] = trim($Guestbook["town"]);
> $Guestbook["email"] = trim($Guestbook["email"]);
> $Guestbook["website"] = trim($Guestbook["website"]);
> $Guestbook["favsong"] = trim($Guestbook["favsong"]);
> $Guestbook["comments"] = trim($Guestbook["comments"]);
> $Guestbook["mailinglist"] = trim($Guestbook["mailinglist"]);
>
> $Host = "localhost";
> $User = "****";
> $Password = "*********";
> $DBName = "blindtheory";
> $TableName = "guestbook";
> $TableName2 = "mailinglist";
> $Pattern = ".+
.+..+";
> $Pattern2 = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
>
> $Link = mysql_connect ($Host, $User, $Password);
> $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]',
> '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]',
> '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')";
> $Link2 = mysql_connect ($Host, $User, $Password);
> $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]',
> '$Guestbook[name]', '$Guestbook[email]');
You're missing a final double quote here ^.
>
> if (mysql_db_query ($DBName, $Query, $Link)) {
> echo "Your entry will be added";
> } else {
> echo "There was an error in during the posting, please contact <a
> href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> problem.<br>";
> }
>
> if (isset($Guestbook[mailinglist])) {
>
> if (mysql_db_query ($DBName, $Query2, $Link2)) {
> echo "Your e-mail address was sucessfully added to
> our mailinglist";
> } else {
> echo "There was an error in during the posting, please contact <a
> href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> problem.<br>";
> }
> }
> mysql_close ($Link);
> mysql_close ($Link2);
> ?>
> --
> Jule Slootbeek
> jslootbeek
clarku.edu
> http://blindtheory.cjb.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Thanks for that, yeah i should be more carefull before going to the list.. i'll watch out for it next time.
Jule
On Tuesday 30 April 2002 13:54, Miguel Cruz wrote:
> You're missing a closing quote on the assignment for $Query2.
>
> Come on people, keep your eyes open. This is basic stuff. Doesn't take
> any special genius to count quotes and braces.
>
> miguel
>
> On Tue, 30 Apr 2002, Jule wrote:
> > Hey guys, i'm writing this guestbook script for my site, and i'm getting
> > a random parse error where i think everything is normal, it gives it on
> > line 26 which is
> >
> > echo "Your entry will be posted!";
> >
> > my script follows
> >
> > Jule
> >
> > --SCRIPT--
> >
> > <?php
> > $Guestbook["dateadd"] = date("F j, Y H:i:s");
> > $Guestbook["name"] = trim($Guestbook["name"]);
> > $Guestbook["town"] = trim($Guestbook["town"]);
> > $Guestbook["email"] = trim($Guestbook["email"]);
> > $Guestbook["website"] = trim($Guestbook["website"]);
> > $Guestbook["favsong"] = trim($Guestbook["favsong"]);
> > $Guestbook["comments"] = trim($Guestbook["comments"]);
> > $Guestbook["mailinglist"] = trim($Guestbook["mailinglist"]);
> >
> > $Host = "localhost";
> > $User = "****";
> > $Password = "*********";
> > $DBName = "blindtheory";
> > $TableName = "guestbook";
> > $TableName2 = "mailinglist";
> > $Pattern = ".+
.+..+";
> > $Pattern2 = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
> >
> > $Link = mysql_connect ($Host, $User, $Password);
> > $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]',
> > '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]',
> > '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')";
> > $Link2 = mysql_connect ($Host, $User, $Password);
> > $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]',
> > '$Guestbook[name]', '$Guestbook[email]');
> >
> > if (mysql_db_query ($DBName, $Query, $Link)) {
> > echo "Your entry will be added";
> > } else {
> > echo "There was an error in during the posting, please contact <a
> > href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> > problem.<br>";
> > }
> >
> > if (isset($Guestbook[mailinglist])) {
> >
> > if (mysql_db_query ($DBName, $Query2, $Link2)) {
> > echo "Your e-mail address was sucessfully added to our mailinglist";
> > } else {
> > echo "There was an error in during the posting, please contact <a
> > href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> > problem.<br>";
> > }
> > }
> > mysql_close ($Link);
> > mysql_close ($Link2);
> > ?>
-- Jule Slootbeek jslootbeekclarku.edu http://blindtheory.cjb.net
attached mail follows:
When constructing $Query, end each line with a period (.) not a comma(,). Same applies to $Query2.
$Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]'. '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]'. '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')"; $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]'. '$Guestbook[name]', '$Guestbook[email]');
----- Original Message -----
From: Jule <jslootbeek
clarku.edu>
To: <php-general
lists.php.net>
Sent: Tuesday, April 30, 2002 12:48 PM
Subject: [PHP] parse error
Hey guys, i'm writing this guestbook script for my site, and i'm getting a random parse error where i think everything is normal, it gives it on line 26 which is
echo "Your entry will be posted!";
my script follows
Jule
--SCRIPT--
<?php $Guestbook["dateadd"] = date("F j, Y H:i:s"); $Guestbook["name"] = trim($Guestbook["name"]); $Guestbook["town"] = trim($Guestbook["town"]); $Guestbook["email"] = trim($Guestbook["email"]); $Guestbook["website"] = trim($Guestbook["website"]); $Guestbook["favsong"] = trim($Guestbook["favsong"]); $Guestbook["comments"] = trim($Guestbook["comments"]); $Guestbook["mailinglist"] = trim($Guestbook["mailinglist"]);
$Host = "localhost";
$User = "****";
$Password = "*********";
$DBName = "blindtheory";
$TableName = "guestbook";
$TableName2 = "mailinglist";
$Pattern = ".+
.+..+";
$Pattern2 = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
$Link = mysql_connect ($Host, $User, $Password); $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]', '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]', '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')"; $Link2 = mysql_connect ($Host, $User, $Password); $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]', '$Guestbook[name]', '$Guestbook[email]');
if (mysql_db_query ($DBName, $Query, $Link)) {
echo "Your entry will be added";
} else {
echo "There was an error in during the posting, please contact <a
href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
problem.<br>";
}
if (isset($Guestbook[mailinglist])) {
if (mysql_db_query ($DBName, $Query2, $Link2)) {
echo "Your e-mail address was sucessfully added to our mailinglist";
} else {
echo "There was an error in during the posting, please contact <a
href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
problem.<br>";
}
}
mysql_close ($Link);
mysql_close ($Link2);
?>
-- Jule Slootbeek jslootbeekclarku.edu http://blindtheory.cjb.net
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
The commas were inside the string enclosed by "". If changed to periods, that would create a SQL error.
miguel
On Tue, 30 Apr 2002, Richard Emery wrote:
> When constructing $Query, end each line with a period (.) not a comma(,).
> Same applies to $Query2.
>
> $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]'.
> '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]'.
> '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')";
> $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]'.
> '$Guestbook[name]', '$Guestbook[email]');
>
>
> ----- Original Message -----
> From: Jule <jslootbeek
clarku.edu>
> To: <php-general
lists.php.net>
> Sent: Tuesday, April 30, 2002 12:48 PM
> Subject: [PHP] parse error
>
>
> Hey guys, i'm writing this guestbook script for my site, and i'm getting a
> random parse error where i think everything is normal, it gives it on line
> 26
> which is
>
> echo "Your entry will be posted!";
>
> my script follows
>
> Jule
>
> --SCRIPT--
>
> <?php
> $Guestbook["dateadd"] = date("F j, Y H:i:s");
> $Guestbook["name"] = trim($Guestbook["name"]);
> $Guestbook["town"] = trim($Guestbook["town"]);
> $Guestbook["email"] = trim($Guestbook["email"]);
> $Guestbook["website"] = trim($Guestbook["website"]);
> $Guestbook["favsong"] = trim($Guestbook["favsong"]);
> $Guestbook["comments"] = trim($Guestbook["comments"]);
> $Guestbook["mailinglist"] = trim($Guestbook["mailinglist"]);
>
> $Host = "localhost";
> $User = "****";
> $Password = "*********";
> $DBName = "blindtheory";
> $TableName = "guestbook";
> $TableName2 = "mailinglist";
> $Pattern = ".+
.+..+";
> $Pattern2 = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
>
> $Link = mysql_connect ($Host, $User, $Password);
> $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]',
> '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]',
> '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')";
> $Link2 = mysql_connect ($Host, $User, $Password);
> $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]',
> '$Guestbook[name]', '$Guestbook[email]');
>
> if (mysql_db_query ($DBName, $Query, $Link)) {
> echo "Your entry will be added";
> } else {
> echo "There was an error in during the posting, please contact <a
> href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> problem.<br>";
> }
>
> if (isset($Guestbook[mailinglist])) {
>
> if (mysql_db_query ($DBName, $Query2, $Link2)) {
> echo "Your e-mail address was sucessfully added to our mailinglist";
> } else {
> echo "There was an error in during the posting, please contact <a
> href=\"mailto:webmaster
blindtheory.cjb.net\">me</a> and I will fix the
> problem.<br>";
> }
> }
> mysql_close ($Link);
> mysql_close ($Link2);
> ?>
> --
> Jule Slootbeek
> jslootbeek
clarku.edu
> http://blindtheory.cjb.net
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
attached mail follows:
Hello everyone,
I have host that does not support Curl. I was wondering, if there was another program I can use to make a secure connection (in PHP).
I need to make an ADC Connection to Authorize.net.
Pleae let me know.
FYI: Do those of you who use Dreamweaver Ultradev & Phakt, Dreamweaver MX now supports PHP. Macromedia ahs a pre-release on theri server. Check it out!
__________John Monfort_________________ _+-----------------------------------+_ P E P I E D E S I G N S www.pepiedesigns.com -+___________________________________+-
attached mail follows:
R wrote: > Hey all, > > This email is not for any questions/suggestions etc but a thank you note. > Some time back i posted an email asking if anyone had any recomendation for > a BBS system and I got a lot of replies. > I thank each and every one of you who wrote in, > after checking out the links or software names you gave me I have decided to > use PHPBB2 > Will post a link to my site where this is installed after a week or so, tell > me what you think. > If you have any comments on why PHPbb2 is BAAAAAAAAAAAAADDDDD for me lemme > know. > > Cheers all & god bless. > -Ryan. >
To bring balance in the force, there is www.phpbb2.org. It has a few arguments of why it is BAAAAAAADDDDDDD... I know i will never use phpbb2
attached mail follows:
R wrote: > Hey all, > > This email is not for any questions/suggestions etc but a thank you note. > Some time back i posted an email asking if anyone had any recomendation for > a BBS system and I got a lot of replies. > I thank each and every one of you who wrote in, > after checking out the links or software names you gave me I have decided to > use PHPBB2 > Will post a link to my site where this is installed after a week or so, tell > me what you think. > If you have any comments on why PHPbb2 is BAAAAAAAAAAAAADDDDD for me lemme > know. > > Cheers all & god bless. > -Ryan. >
To bring balance in the force, there is www.phpbb2.org. It has a few arguments of why it is BAAAAAAADDDDDDD... I know i will never use phpbb2
attached mail follows:
Austin Marshall wrote:
> > To bring balance in the force, there is www.phpbb2.org. It has a few > arguments of why it is BAAAAAAADDDDDDD... I know i will never use phpbb2 >
It's a pretty lame page/site that amounts to someone whining about the fact that
1. The phpbb website looks good, therefore they must have crap code and 2. They have a lot of includes/requires/constants and if/else
If it's truly poor code, and the guy wants to criticize, then post some code samples and point out WHY it's bad.
Personally, I agree - I had to do a bit of work with someone else's phpbb site a few weeks ago and thought it was a horrible mishmash of code/html. But I'm not going to post a whole website about how bad it is unless without giving specific examples. :)
Michael Kimsal http://www.logicreate.com 734-480-9961
attached mail follows:
Does anybody know of any PHP project editors, something that will group together all the PHP, INC, HTML, CSS files together into one logical project? Preferrably freeware/shareware, obviously.
__________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com
attached mail follows:
Hey, I use MacroMedia's ultra dev for my JSP/ASP pages but i know it supports PHP. The only problem i see is that it sure as hell aint free, you can use it for the first 30 days of course....... after than i've heard that SOME people crack it and use it illegally....but i dont know much about that......;-) Cheers, -Ryan
----- Original Message -----
From: "Liam Gibbs" <liamgibbs
yahoo.com>
To: <php-general
lists.php.net>
Sent: Tuesday, April 30, 2002 11:11 AM
Subject: [PHP] PHP Editors
> Does anybody know of any PHP project editors, > something that will group together all the PHP, INC, > HTML, CSS files together into one logical project? > Preferrably freeware/shareware, obviously. > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - your guide to health and wellness > http://health.yahoo.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Check Out Zend Studio. www.zend.com This was created by the folks who created php.
Jason
"Liam Gibbs" <liamgibbs
yahoo.com> wrote in message
news:20020430181109.9152.qmail
web10008.mail.yahoo.com...
> Does anybody know of any PHP project editors,
> something that will group together all the PHP, INC,
> HTML, CSS files together into one logical project?
> Preferrably freeware/shareware, obviously.
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - your guide to health and wellness
> http://health.yahoo.com
attached mail follows:
I know that there is a built-in function for bin2hex(), but does any body know have any code to do just the opposite, convert hex2bin?
-- Joshua E Minnie/CIO joshacsurf.net Phone: 616.276.9690 Fax: 616.342.8750 Nextel: 616.862.2847
"Don't work for recognition, but always do work worthy of recognition."
attached mail follows:
On Tue, 30 Apr 2002, Joshua E Minnie wrote: > I know that there is a built-in function for bin2hex(), but does any body > know have any code to do just the opposite, convert hex2bin?
Check the first comment in the manual under bin2hex.
miguel
attached mail follows:
Although the first comment was not what I needed, I did find another built-in function that converts between any base, base_convert($number, $frombase, $tobase) worked wonderful for what I needed.
Josh
"Miguel Cruz" <mnc
stoic.net> wrote in message
news:Pine.LNX.4.44.0204301331340.24584-100000
stoic.net...
> On Tue, 30 Apr 2002, Joshua E Minnie wrote:
> > I know that there is a built-in function for bin2hex(), but does any
body
> > know have any code to do just the opposite, convert hex2bin?
>
> Check the first comment in the manual under bin2hex.
>
> miguel
>
attached mail follows:
I'd recommend writing a wrapper around base_convert, naming it hex2bin and using that instead. base_convert() is way too expensive for this purpose (you know that any hex figure is translated to exactly four bits, so you don't need any actual conversion - just replacement). This is why I suggested the wrapper - you can change the code at any time if you see it's too time-consuming...
Bogdan
Joshua E Minnie wrote:
>Although the first comment was not what I needed, I did find another
>built-in function that converts between any base, base_convert($number,
>$frombase, $tobase) worked wonderful for what I needed.
>
>Josh
>
>"Miguel Cruz" <mnc
stoic.net> wrote in message
>news:Pine.LNX.4.44.0204301331340.24584-100000
stoic.net...
>
>>On Tue, 30 Apr 2002, Joshua E Minnie wrote:
>>
>>>I know that there is a built-in function for bin2hex(), but does any
>>>
>body
>
>>>know have any code to do just the opposite, convert hex2bin?
>>>
>>Check the first comment in the manual under bin2hex.
>>
>>miguel
>>
>
>
>
attached mail follows:
Expensive how?
-josh
"Bogdan Stancescu" <mgv
fx.ro> wrote:
> I'd recommend writing a wrapper around base_convert, naming it hex2bin
> and using that instead. base_convert() is way too expensive for this
> purpose (you know that any hex figure is translated to exactly four
> bits, so you don't need any actual conversion - just replacement). This
> is why I suggested the wrapper - you can change the code at any time if
> you see it's too time-consuming...
attached mail follows:
Perhaps you could use something a little more KISS- like
rawurldecode(chunk_split ( $hexstring, 2 , "%"))
not sure if it would be faster than base_convert or not, but it wouldn't be too hard to find out.
On Tuesday 30 April 2002 11:50 am, you wrote:
> Although the first comment was not what I needed, I did find another
> built-in function that converts between any base, base_convert($number,
> $frombase, $tobase) worked wonderful for what I needed.
>
> Josh
>
> "Miguel Cruz" <mnc
stoic.net> wrote in message
> news:Pine.LNX.4.44.0204301331340.24584-100000
stoic.net...
>
> > On Tue, 30 Apr 2002, Joshua E Minnie wrote:
> > > I know that there is a built-in function for bin2hex(), but does any
>
> body
>
> > > know have any code to do just the opposite, convert hex2bin?
> >
> > Check the first comment in the manual under bin2hex.
> >
> > miguel
-- Not life, but good life, is to be chiefly valued.Socrates
attached mail follows:
Computation time. CPU cycles.
On Tuesday 30 April 2002 13:56 pm, you wrote:
> Expensive how?
>
> -josh
>
> "Bogdan Stancescu" <mgv
fx.ro> wrote:
> > I'd recommend writing a wrapper around base_convert, naming it hex2bin
> > and using that instead. base_convert() is way too expensive for this
> > purpose (you know that any hex figure is translated to exactly four
> > bits, so you don't need any actual conversion - just replacement). This
> > is why I suggested the wrapper - you can change the code at any time if
> > you see it's too time-consuming...
-- Let us endeavor so to live that when we come to die even the undertaker will be sorry.Samuel Clemens
attached mail follows:
Computing-intensive, time-consuming and whatever else expensive functions do ;-)
Bogdan
Joshua E Minnie wrote:
>Expensive how?
>
>-josh
>
>"Bogdan Stancescu" <mgv
fx.ro> wrote:
>
>>I'd recommend writing a wrapper around base_convert, naming it hex2bin
>>and using that instead. base_convert() is way too expensive for this
>>purpose (you know that any hex figure is translated to exactly four
>>bits, so you don't need any actual conversion - just replacement). This
>>is why I suggested the wrapper - you can change the code at any time if
>>you see it's too time-consuming...
>>
>
>
>
attached mail follows:
This one will actually remove money from your bank account if you pass the constant PHP_TAKE_MY_MONEY as the 10th argument.
---John Holmes...
> -----Original Message-----
> From: Bogdan Stancescu [mailto:mgv
fx.ro]
> Sent: Tuesday, April 30, 2002 8:06 PM
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Hex2Bin??
>
> Computing-intensive, time-consuming and whatever else expensive
> functions do ;-)
>
> Bogdan
>
> Joshua E Minnie wrote:
>
> >Expensive how?
> >
> >-josh
> >
> >"Bogdan Stancescu" <mgv
fx.ro> wrote:
> >
> >>I'd recommend writing a wrapper around base_convert, naming it
hex2bin
> >>and using that instead. base_convert() is way too expensive for this
> >>purpose (you know that any hex figure is translated to exactly four
> >>bits, so you don't need any actual conversion - just replacement).
This
> >>is why I suggested the wrapper - you can change the code at any time
if
> >>you see it's too time-consuming...
> >>
> >
> >
> >
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi people,
I know there is a lot of material about it. I´m installing PHP under Solaris 8 and obtain the message that gcc cannot create executables. I know that gcc has libraries that are not installed by default under Solaris. If I download a version of gcc newer and complete will I pass this problem? Can you recommend me a site with some instructions about doing that (I never had to install gcc)? Is a hard work?
Thanks in advance
--------------------------------------------------------------------- Emiliano H.Marmonti Informático Módulo de Bibliotecas Programa SIU Ministerio de Educación de la Nación
attached mail follows:
Buon giorno, Emiliano,
Do you have root access to the system? If so, try downloading the gcc package from http://www.sunfreeware.com/. Installing it in package format should make everything work for you. Also make sure that your LD_LIBRARY_PATH contains the correct locations (such as /usr/local/bin, which it won't by default in Solaris).
Feel free to write back if you still run into problems.
Ciao, /bsh/
Emiliano Marmonti wrote: > Hi people, > > I know there is a lot of material about it. I´m installing PHP under Solaris 8 and obtain the message that gcc cannot create executables. I know that gcc has libraries that are not installed by default under Solaris. If I download a version of gcc newer and complete will I pass this problem? Can you recommend me a site with some instructions about doing that (I never had to install gcc)? Is a hard work? > > Thanks in advance > > --------------------------------------------------------------------- > Emiliano H.Marmonti > Informático Módulo de Bibliotecas > Programa SIU > Ministerio de Educación de la Nación >
--/---------------------------------------------=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | "All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer." | \--=[ bsh-php
sun.com ]=--------------------------------------------/
attached mail follows:
I'm having a hard time explaining what I'm trying to do, which is why I'm having a hard time finding anything online/in manuals...
My site serves a form for the user to fill in. User has been authenticated with a login and we're using PHP 4 sessions. When using Internet Explorer, the user can hit Ctrl-N and get a new window, but his session for that new window is still valid. He could then load up a local page and submit it to the target of my original form.
Is there some way of detecting that the submission came from a page that hadn't been served up by my application, but was instead sent in from some other "foreign" form?
Or maybe the question is - how can I kill off sessions if the user navigates away from the page that I sent him originally?
Warrick Wilson
mailto:wwilson
fredsystems.com
attached mail follows:
On Tue, 30 Apr 2002, Warrick Wilson wrote: > I'm having a hard time explaining what I'm trying to do, which is why I'm > having a hard time finding anything online/in manuals... > > My site serves a form for the user to fill in. User has been authenticated > with a login and we're using PHP 4 sessions. When using Internet Explorer, > the user can hit Ctrl-N and get a new window, but his session for that new > window is still valid. He could then load up a local page and submit it to > the target of my original form. > > Is there some way of detecting that the submission came from a page that > hadn't been served up by my application, but was instead sent in from some > other "foreign" form? > > Or maybe the question is - how can I kill off sessions if the user navigates > away from the page that I sent him originally?
You can't (assuming you're dealing with someone halfway knowledgeable who is halfway determined to do it). Redesign your application so it doesn't matter. Perhaps time logins out quickly and/or require periodic re-authentication.
miguel
attached mail follows:
Generate a random number when creating a form, store it in the session and in a hidden on the form. Then when the post comes back, make sure the hidden is there and that it matches the one in the session.
Cal * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com *
-----Original Message-----
From: Warrick Wilson [mailto:wwilson
fredsystems.com]
Sent: Tuesday, April 30, 2002 2:52 PM
To: php-general
lists.php.net
Subject: [PHP] Is it possible to verify that a form submision is not
being "spoofed"?
I'm having a hard time explaining what I'm trying to do, which is why I'm having a hard time finding anything online/in manuals...
My site serves a form for the user to fill in. User has been authenticated with a login and we're using PHP 4 sessions. When using Internet Explorer, the user can hit Ctrl-N and get a new window, but his session for that new window is still valid. He could then load up a local page and submit it to the target of my original form.
Is there some way of detecting that the submission came from a page that hadn't been served up by my application, but was instead sent in from some other "foreign" form?
Or maybe the question is - how can I kill off sessions if the user navigates away from the page that I sent him originally?
Warrick Wilson
mailto:wwilson
fredsystems.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Tue, 30 Apr 2002, Cal Evans wrote: > Generate a random number when creating a form, store it in the session and > in a hidden on the form. Then when the post comes back, make sure the hidden > is there and that it matches the one in the session.
That doesn't help, that I can tell - when the form is copied the hidden value will come with it.
You could use it to allow each form to be submitted only once (change the random number each time, thus invalidating previous ones) but that will kill the back button and will still allow someone to submit a manipulated form once.
miguel
attached mail follows:
On Wednesday 01 May 2002 04:05, Cal Evans wrote: > Generate a random number when creating a form, store it in the session and > in a hidden on the form. Then when the post comes back, make sure the > hidden is there and that it matches the one in the session.
But the flaw in that is if the nasty user was determined, there's nothing to stop them from:
1) looking at the source of the legitimate page 2) grabbing the 'hidden' value 3) creating their own form along with that hidden value 4) opening a new window 5) loading their own form and submit away.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* People say I live in my own little fantasy world... well, at least they *know* me there! -- D.L. Roth */
attached mail follows:
This random number, because it is being sent to the user is just as easy to forge as the rest of the fields on the form. The only thing you can do is check the refferer on the submitted page, but alas even this can be forged with enough technohow. Good luck!
James
-----Original Message-----
From: Cal Evans [mailto:cal
calevans.com]
Sent: Tuesday, April 30, 2002 4:05 PM
To: Warrick Wilson; php-general
lists.php.net
Subject: RE: [PHP] Is it possible to verify that a form submision is not
being "spoofed"?
Generate a random number when creating a form, store it in the session and in a hidden on the form. Then when the post comes back, make sure the hidden is there and that it matches the one in the session.
Cal * * Cal Evans * Journeyman Programmer * Techno-Mage * http://www.calevans.com *
-----Original Message-----
From: Warrick Wilson [mailto:wwilson
fredsystems.com]
Sent: Tuesday, April 30, 2002 2:52 PM
To: php-general
lists.php.net
Subject: [PHP] Is it possible to verify that a form submision is not
being "spoofed"?
I'm having a hard time explaining what I'm trying to do, which is why I'm having a hard time finding anything online/in manuals...
My site serves a form for the user to fill in. User has been authenticated with a login and we're using PHP 4 sessions. When using Internet Explorer, the user can hit Ctrl-N and get a new window, but his session for that new window is still valid. He could then load up a local page and submit it to the target of my original form.
Is there some way of detecting that the submission came from a page that hadn't been served up by my application, but was instead sent in from some other "foreign" form?
Or maybe the question is - how can I kill off sessions if the user navigates away from the page that I sent him originally?
Warrick Wilson
mailto:wwilson
fredsystems.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
The only fool proof method is is to have the application generate an image. The image will contain a random number or series of letters. The user must type these into a form field to continue. It's a password that only humans can read. It won't prevent an outside script from 'trying' to access the system.. but since the script can not read what is on the image then it has to try 50,000,000 keys until it finds the right one.
It works.
-Kevin
----- Original Message -----
From: "Warrick Wilson" <wwilson
fredsystems.com>
To: <php-general
lists.php.net>
Sent: Tuesday, April 30, 2002 1:52 PM
Subject: [PHP] Is it possible to verify that a form submision is not being
"spoofed"?
> I'm having a hard time explaining what I'm trying to do, which is why I'm
> having a hard time finding anything online/in manuals...
>
> My site serves a form for the user to fill in. User has been authenticated
> with a login and we're using PHP 4 sessions. When using Internet Explorer,
> the user can hit Ctrl-N and get a new window, but his session for that new
> window is still valid. He could then load up a local page and submit it to
> the target of my original form.
>
> Is there some way of detecting that the submission came from a page that
> hadn't been served up by my application, but was instead sent in from some
> other "foreign" form?
>
> Or maybe the question is - how can I kill off sessions if the user
navigates
> away from the page that I sent him originally?
>
>
> Warrick Wilson
> mailto:wwilson
fredsystems.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
In addition to everything else discussed:
1. make sure the referring page (ie, the form) was as expected (ie, an address you trust). This may block a small % or users who's browser doesn't set a referrer string.
2. ensure that all values were submitted via $_POST, which will prevent the user from entering them directly into the URL
Justin French
-------------------- Creative Director http://Indent.com.au --------------------
attached mail follows:
I have a file with this:
<ul><li><a href="http:\\www.someaddress.com">SomeSite</a> This is a description of the site.</ul>
I'm trying to parse out the address, site name, and description into separate variables. How can I do this?
Thanks,
-Ed
**************************************************************************** This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much.
attached mail follows:
On Tue, 30 Apr 2002, Lazor, Ed wrote: > <ul><li><a href="http:\\www.someaddress.com">SomeSite</a> This is a > description of the site.</ul> > > I'm trying to parse out the address, site name, and description into > separate variables. How can I do this?
I assume you mean http:// and not http:\\.
$str = '<ul><li><a href="http://www.someaddress.com">SomeSite</a> This is a description of the site.</ul>'; preg_match('/href="(\S+)">(.+?)<\/a>(.+?)<\/ul>/', $str, $matches);
print "Address: {$matches[1]}<br>Site: {$matches[2]}<br>Description:{$matches[3]}";
It's all laid out on the preg pages in the manual.
miguel
attached mail follows:
Hi! I have a problem with passing variables to php script with simple GET. example:
--- hello.html ----------------------------- <html><head><title="hello"></head> <body> <a href="hello.php?arg=world">hello</a> </body> </html>
--- hello.php ------------------------------ <? printf("arg=$arg<br>"); ?>
output from clicking on the link is:
arg=
I should mention that I use mod_userdir and the script/html are lying in home directory for the user ( /home/username/public_html/...), and URL=http://server/~username/hello.html
I am attaching output of phpinfo() and a copy of httpd.conf .htaccess file is empty btw.
Cheers
-- /admir efendic, stockholm, sweden
- TEXT/PLAIN attachment: httpd.conf
- APPLICATION/x-gzip attachment: info.php.tar.gz
attached mail follows:
Make sure enable track vars is enabled.
Try specifying global $arg before you access it.
Try using phpinfo(); in your script. That will display all available variables.
-----Original Message-----
From: efa [mailto:efa
softwell.se]
Sent: Tuesday, April 30, 2002 1:04 PM
To: php-general
lists.php.net
Subject: [PHP] i cannot pass variables to php script...
Hi! I have a problem with passing variables to php script with simple GET. example:
--- hello.html ----------------------------- <html><head><title="hello"></head> <body> <a href="hello.php?arg=world">hello</a> </body> </html>
--- hello.php ------------------------------ <? printf("arg=$arg<br>"); ?>
output from clicking on the link is:
arg=
I should mention that I use mod_userdir and the script/html are lying in home directory for the user ( /home/username/public_html/...), and URL=http://server/~username/hello.html
I am attaching output of phpinfo() and a copy of httpd.conf .htaccess file is empty btw.
Cheers
-- /admir efendic, stockholm, sweden**************************************************************************** This message is intended for the sole use of the individual and entity to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message. Thank you very much.
attached mail follows:
thx that worked, the problem is that I am installing XMB which is php/mysql based message board, and they are useing syntax similar to mine ( without $_GET). Is there a workaround for it, without having to edit their code? I'll try to recompile the PHP with trackvars enabled as suggested by other reply.
On Tue, 30 Apr 2002, Nathan wrote:
> Instead of printf, do an
>
> echo "arg = ".$_GET["arg"];
>
> # Nathan
>
> ----- Original Message -----
> From: "efa" <efa
softwell.se>
> To: <php-general
lists.php.net>
> Sent: Tuesday, April 30, 2002 2:04 PM
> Subject: [PHP] i cannot pass variables to php script...
>
>
> Hi!
> I have a problem with passing variables to php script with simple GET.
> example:
>
> --- hello.html -----------------------------
> <html><head><title="hello"></head>
> <body>
> <a href="hello.php?arg=world">hello</a>
> </body>
> </html>
>
>
>
> --- hello.php ------------------------------
> <?
> printf("arg=$arg<br>");
> ?>
>
>
> output from clicking on the link is:
>
> arg=
>
>
> I should mention that I use mod_userdir and the script/html are lying in
> home directory for the user ( /home/username/public_html/...), and
> URL=http://server/~username/hello.html
>
>
> I am attaching output of phpinfo() and a copy of httpd.conf
> .htaccess file is empty btw.
>
>
> Cheers
>
>
-- /admir
attached mail follows:
I have been successfully using Sablotron with PHP for the last year and half. Recently I have started investigating Libxslt(running on my windows machine I get much better performance with it as compared to sablotron.)
I am trying to find any information about installing Libxslt on Linux running Apache with PHP, but have not gotten anywhere. The new PHP interface to xslt is supposed to run with any xslt engine, but I cannot find any information about how to run xslt engines other than Sablotron.
Any help is greatly appreciated.
Thanks,
Venu Reddy
attached mail follows:
I have a server where I'm running some third party apps.
until now I've had register globals 'on', now I have a new app that requires register globals 'off' for it to work, if I change the php.ini to off then it breaks some of the other applications.
Is there a way to turn register globals on or off in the script at runtime?
-- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper
attached mail follows:
Chapter 3 in the PHP manual covers setting PHP configuration directives via the .htaccess file.
I use this to enable register globals where needed so that I can keep it off for the scripts that do not depend on them.
Jason
-----Original Message-----
From: Jeff Bearer [mailto:jbearer
pittsburghlive.com]
Sent: Tuesday, April 30, 2002 3:10 PM
To: php-general
lists.php.net
Subject: [PHP] apps that need register globals 'on' and others require
'off' on same server
I have a server where I'm running some third party apps.
until now I've had register globals 'on', now I have a new app that requires register globals 'off' for it to work, if I change the php.ini to off then it breaks some of the other applications.
Is there a way to turn register globals on or off in the script at runtime?
-- Jeff Bearer, RHCE Webmaster PittsburghLIVE.com 2002 EPpy Award, Best Online U.S. Newspaper-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
In article <CBD6266EA291D5118144009027AA633502FFC10F
xboi05.boi.hp.com>,
jason_sheets
non.hp.com (Jason Sheets) wrote:
> > From: Jeff Bearer [mailto:jbearer
pittsburghlive.com]
> >
> > Is there a way to turn register globals on or off in the script at
> > runtime?
> Chapter 3 in the PHP manual covers setting PHP configuration directives via > the .htaccess file. Yes, and these directives can also be used within containers such as <file>, <location>, and <directory> within the Apache configuration file.
Since the OP asked about runtime, there is also ini_set() <http://php.net/ini-set>.
-- CC
attached mail follows:
Use .htaccess, setting register_globals at runtime will not have the desired affect.
Btw, I can't think of a reason why a script designed with register_globals = off would not work with it on. Which is why assuming register_globals = off will make your scripts more portable.
See also: import_request_variables() and extract().
Regards, Philip Olson
On 30 Apr 2002, Jeff Bearer wrote:
> I have a server where I'm running some third party apps. > > until now I've had register globals 'on', now I have a new app that > requires register globals 'off' for it to work, if I change the php.ini > to off then it breaks some of the other applications. > > Is there a way to turn register globals on or off in the script at > runtime? > > > > > -- > Jeff Bearer, RHCE > Webmaster > PittsburghLIVE.com > 2002 EPpy Award, Best Online U.S. Newspaper > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
When I run this the first time, file.txt contains value of 30. Then I add 15 to it with following script and file now contains value of 45. I look at file.txt after write and it does indeed contain number 45. But when I run script 24 hours later via cron job, it still thinks file.txt is holding number 30. Is $file somehow retaining value of 30 and not getting new value of 45 when script runs second time? What is it called when this happens?
<?php
$file = file('/usr/home/xyz/file.txt'); //file.txt contains value of 30
$number = "15";
$newnumber = $file + $number; //$newnumber now is 45
$fp = fopen('/usr/home/xyz/file.txt','w'); fputs($fp,"$newnumber"); // write value 45 to file.txt fclose($fp);
?>
Thanks
Craig ><>
westerman
chanuteks.com
attached mail follows:
Sure you got your permissions set right?
On Tuesday 30 April 2002 16:29 pm, you wrote:
> When I run this the first time, file.txt contains value of 30. Then I add
> 15 to it with following script and file now contains value of 45. I look at
> file.txt after write and it does indeed contain number 45. But when I run
> script 24 hours later via cron job, it still thinks file.txt is holding
> number 30. Is $file somehow retaining value of 30 and not getting new value
> of 45 when script runs second time? What is it called when this happens?
>
> <?php
>
> $file = file('/usr/home/xyz/file.txt'); //file.txt contains value of 30
>
> $number = "15";
>
> $newnumber = $file + $number; //$newnumber now is 45
>
> $fp = fopen('/usr/home/xyz/file.txt','w');
> fputs($fp,"$newnumber"); // write value 45 to file.txt
> fclose($fp);
>
> ?>
>
> Thanks
>
> Craig ><>
> westerman
chanuteks.com
-- God is a comedian playing to an audience too afraid to laugh.Voltaire
attached mail follows:
Hey, This time it's not about missing quotes or parenthasies i hope. I'm trying to make a form which sends name, email, website, favsong and comments to table guestbook, but when the checkbox mailinglist is checked it should send the name and email to table mailinglist, but it doesn;t seem to work. any pointers?
Jule
--SCRIPT--
<?php $Guestbook["dateadd"] = date("F j, Y"); $Guestbook["name"] = trim($Guestbook["name"]); $Guestbook["town"] = trim($Guestbook["town"]); $Guestbook["email"] = trim($Guestbook["email"]); $Guestbook["website"] = trim($Guestbook["website"]); $Guestbook["favsong"] = trim($Guestbook["favsong"]); $Guestbook["comments"] = trim($Guestbook["comments"]); $Guestbook["mailinglist"] = trim($Guestbook["mailinglist"]);
$Host = "localhost";
$User = "****";
$Password = "*********";
$DBName = "blindtheory";
$TableName = "guestbook";
$TableName2 = "mailinglist";
$Pattern = ".+
.+..+";
$Pattern2 = "(http://)?([^[:space:]]+)([[:alnum:]\.,-_?/&=])";
$Link = mysql_connect ($Host, $User, $Password); $Query = "INSERT into $TableName values('0', '$Guestbook[dateadd]', '$Guestbook[name]', '$Guestbook[town]', '$Guestbook[email]', '$Guestbook[website]','$Guestbook[favsong]', '$Guestbook[comments]')"; $Query2 = "INSERT into $TableName2 values('0', '$Guestbook[dateadd]', '$Guestbook[name]', '$Guestbook[email]')";
if (mysql_db_query ($DBName, $Query, $Link)) {
echo "<p><p><p><p>Your entry will be added<br>Click <a
href=../index.php?left=guestbook&righttop=guestbook&rightbottom=guestbook&rttitle=mailinglist&rbtitle=gbadd>here</a>
to go back.<p><p><p><p>";
} else {
echo "There was an error in during the posting, please contact <a
href=\"mailto:webmaster
blindtheory.cjb.net\">the webmaster</a> and he will
fix the problem.<br>";
}
mysql_close ($Link);
if (isset($Guestbook[mailinglist])) {
if (mysql_db_query ($DBName, $Query2, $Link)) { echo "Your e-mail address was sucessfully added to our mailinglist"; } else { echo "Your e-mail address will not be added to the mailinglist"; } } mysql_close ($Link);
?>
-- Jule Slootbeek jslootbeekclarku.edu http://blindtheory.cjb.net
attached mail follows:
Hi, Is it possible to detect if a file is being called as an include or require?
ex: include("file.php") <-- file.php code can "detect" that is has been called as an include.
Thanks, Chris
attached mail follows:
Try this code (untested):
function selfAwareInclude($filename) { define($filename, true); include($filename); }
Inside your include file, make calls such as
if (defined($filename)) { // Do whatever }
Then use the selfAwareInclude() function instead of include(). You could do the same with require, etc.
/bsh/
PHP List wrote: > Hi, > Is it possible to detect if a file is being called as an include or require? > > ex: > include("file.php") <-- file.php code can "detect" that is has been > called as an include. > > Thanks, > Chris > >
--/---------------------------------------------=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | "All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer." | \--=[ bsh-php
sun.com ]=--------------------------------------------/
attached mail follows:
The problem with this is you will loose the scope of your variables.
So $filename will not have access to anything from where the function is called...
-mark
On Tue, 30 Apr 2002, Billy S Halsey wrote:
> Try this code (untested):
>
> function selfAwareInclude($filename)
> {
> define($filename, true);
> include($filename);
> }
>
> Inside your include file, make calls such as
>
> if (defined($filename)) {
> // Do whatever
> }
>
> Then use the selfAwareInclude() function instead of include(). You could
> do the same with require, etc.
>
> /bsh/
>
> PHP List wrote:
> > Hi,
> > Is it possible to detect if a file is being called as an include or require?
> >
> > ex:
> > include("file.php") <-- file.php code can "detect" that is has been
> > called as an include.
> >
> > Thanks,
> > Chris
> >
> >
>
>
> --
>
>
> /---------------------------------------------=[ BILLY S HALSEY ]=--\
> | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW |
> | "All opinions and technical advice offered in this message are my |
> | own and not necessarily endorsed by my employer." |
> \--=[ bsh-php
sun.com ]=--------------------------------------------/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Tue, 30 Apr 2002, PHP List wrote: > Is it possible to detect if a file is being called as an include or require? > > ex: > include("file.php") <-- file.php code can "detect" that is has been > called as an include.
Compare $PHP_SELF with __FILE__, maybe?
miguel
attached mail follows:
// In your config file:
function selfAwareInclude($filename) { define($filename, true); }
// in the file you are making an include
selfAwareInclude($filename) include($filename);
Sincerely,
Maxim Maletsky Founder, Chief Developer
www.PHPBeginner.com // where PHP Begins
> -----Original Message-----
> From: mArk.cOLListER [mailto:mark
netstep.co.nz]
> Sent: Wednesday, May 01, 2002 2:00 AM
> To: php
> Subject: Re: [PHP] Include Files self aware?
>
>
> The problem with this is you will loose the scope of your variables.
>
> So $filename will not have access to anything from where the function
is
> called...
>
> -mark
>
> On Tue, 30 Apr 2002, Billy S Halsey wrote:
>
> > Try this code (untested):
> >
> > function selfAwareInclude($filename)
> > {
> > define($filename, true);
> > include($filename);
> > }
> >
> > Inside your include file, make calls such as
> >
> > if (defined($filename)) {
> > // Do whatever
> > }
> >
> > Then use the selfAwareInclude() function instead of include(). You
could
> > do the same with require, etc.
> >
> > /bsh/
> >
> > PHP List wrote:
> > > Hi,
> > > Is it possible to detect if a file is being called as an include
or require?
> > >
> > > ex:
> > > include("file.php") <-- file.php code can "detect" that is has
been
> > > called as an include.
> > >
> > > Thanks,
> > > Chris
> > >
> > >
> >
> >
> > --
> >
> >
> > /---------------------------------------------=[ BILLY S HALSEY
]=--\
> > | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW
|
> > | "All opinions and technical advice offered in this message are my
|
> > | own and not necessarily endorsed by my employer."
|
> > \--=[ bsh-php
sun.com
]=--------------------------------------------/
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Or you could try something like this:
function isInclude ( $this_scripts_true_location ) { if ( $SCRIPT_FILENAME != $this_scripts_true_location ) { return TRUE; } else { return FALSE; } }
On Tuesday 30 April 2002 17:20 pm, you wrote:
> // In your config file:
>
> function selfAwareInclude($filename) {
> define($filename, true);
> }
>
>
>
> // in the file you are making an include
>
> selfAwareInclude($filename)
> include($filename);
>
>
>
>
> Sincerely,
>
> Maxim Maletsky
> Founder, Chief Developer
>
> www.PHPBeginner.com // where PHP Begins
>
> > -----Original Message-----
> > From: mArk.cOLListER [mailto:mark
netstep.co.nz]
> > Sent: Wednesday, May 01, 2002 2:00 AM
> > To: php
> > Subject: Re: [PHP] Include Files self aware?
> >
> >
> > The problem with this is you will loose the scope of your variables.
> >
> > So $filename will not have access to anything from where the function
>
> is
>
> > called...
> >
> > -mark
> >
> > On Tue, 30 Apr 2002, Billy S Halsey wrote:
> > > Try this code (untested):
> > >
> > > function selfAwareInclude($filename)
> > > {
> > > define($filename, true);
> > > include($filename);
> > > }
> > >
> > > Inside your include file, make calls such as
> > >
> > > if (defined($filename)) {
> > > // Do whatever
> > > }
> > >
> > > Then use the selfAwareInclude() function instead of include(). You
>
> could
>
> > > do the same with require, etc.
> > >
> > > /bsh/
> > >
> > > PHP List wrote:
> > > > Hi,
> > > > Is it possible to detect if a file is being called as an include
>
> or require?
>
> > > > ex:
> > > > include("file.php") <-- file.php code can "detect" that is has
>
> been
>
> > > > called as an include.
> > > >
> > > > Thanks,
> > > > Chris
> > >
> > > --
> > >
> > >
> > > /---------------------------------------------=[ BILLY S HALSEY
>
> ]=--\
>
> > > | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW
> > > |
> > > | "All opinions and technical advice offered in this message are my
> > > |
> > > | own and not necessarily endorsed by my employer."
> > >
> > > \--=[ bsh-php
sun.com
>
> ]=--------------------------------------------/
>
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
-- I know nothing except the fact of my ignorance.Socrates
attached mail follows:
I've got PHP 4.2 and