|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Wed Jan 22 2003 - 01:08:00 CST
php-general Digest 22 Jan 2003 07:08:00 -0000 Issue 1837
Topics (messages 132487 through 132552):
Re: mysql_connect problem..update
132487 by: Tom Ray
Re: security question regarding including files..
132488 by: Chris Shiflett
132529 by: Sean Burlington
Dynamic List Using Php
132489 by: Pushpinder Singh Garcha
132490 by: cal.calevans.com
132491 by: Edward Peloke
Re: build menu with mysql data
132492 by: Marc Bleuler
Re: Detecting posts from outside site
132493 by: Jim Lucas
132494 by: Chris Shiflett
Re: PHP Sessions
132495 by: Tim Thorburn
132496 by: Tim Thorburn
Wrapping SQL results in 2 tables
132497 by: Mike Smith
132500 by: Chris Shiflett
132503 by: Mike Smith
simple way to edit textfiles?
132498 by: Patrick
activate an external link thru crontab
132499 by: Patrick
132502 by: Chris Shiflett
Re: [PHP-DB] Re: [PHP] build menu with mysql data
132501 by: Edward Peloke
create new odbc connection..please help
132504 by: Edward Peloke
File upload problem
132505 by: John M
132506 by: Edward Peloke
132507 by: Matt Schroebel
132508 by: Bobby Patel
Re: Page Rendering
132509 by: Bill Arbuckle, Jr.
Re: dreading OOP
132510 by: Chris Worth
132548 by: olinux
HELP HELP on a file parser
132511 by: Didier McGillis
132513 by: 1LT John W. Holmes
Re: encrypt data with pgp
132512 by: Ermelir
fscanf
132514 by: Kris
132517 by: Philip Hallstrom
132521 by: Jason k Larson
132525 by: Kris
132533 by: Brian T. Allen
132536 by: Kris
132539 by: Kris
Re: $header = "Location:........" being ignored!
132515 by: Rick Emery
Re: ADV SQL Help Needed.
132516 by: Rick Emery
setcooke(...) before header("Location: XYZ") - Cookie doesn't set!
132518 by: Mike Potter
132520 by: Chris Shiflett
132522 by: Jason k Larson
132523 by: Rich Gray
132541 by: Mike Potter
132542 by: Michael Sims
132543 by: Jason k Larson
132545 by: Mike Potter
132547 by: Mike Potter
132549 by: Michael Sims
Re: I need my PHP script to call a TCL proc
132519 by: Phil Powell
Blueshoes App Framework
132524 by: Weston Houghton
132527 by: Timothy Hitchens \(HiTCHO\)
numbers
132526 by: cj
132528 by: cj
132531 by: Brian T. Allen
132532 by: cj
session_register() Killing MySQL Connection
132530 by: Brian T. Allen
Read Mysql & Access
132534 by: Karl James
132546 by: Rick Emery
working with pop up windows
132535 by: Peter Houchin
132537 by: Timothy Hitchens \(HiTCHO\)
132538 by: Peter Houchin
How do I find email patterns in a query string in a text and urlescape them?
132540 by: Phil Powell
file uploads received, but mangled
132544 by: af.ax-im.com
Comparing two objects
132550 by: Jeff Moore
Measuring Query Times
132551 by: Peter Janett
132552 by: Jason Wong
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:
Thanks, we're going to give that a try.
-----Original Message-----
From: Tracy Finifter Rotton <tracy
taupecat.com>
To: Tom Ray <tom
blazestudios.com>, <php-general
lists.php.net>
Date: Tue, 21 Jan 2003 10:25:55 -0800
Subject: Re: [PHP] mysql_connect problem..update
> Talk to the other admin. If you're using RPMs, you just need to
> install the
> php_mysql RPM, restart apache, and you should be up and running again.
>
> If you're compiling PHP from scratch, you'll have to do so again with
> --with-mysql in the configure command. But, as this is the default
> when
> compiling PHP from scratch, my hunch is the first option is what you
> really
> need.
>
> -- t
>
> On 1/21/03 10:01 AM, "Tom Ray" <tom
blazestudios.com> wrote:
>
> > It turns out after some checking, the other admin on the machine ran
> a
> > kernel update last week. I hadn't been testing any scripts over the
> last
> > week myself so I didn't notice the issue until the other day.
> >
> > When I run a function_exists() for mysql_connect it comes back false.
> When
> > I run phpinfo() there is no reference to mysql at all.
> >
> > I'm still kind of new to all this, and I'm just wondering what I need
> to
> > do to get php and mysql talking again. Is there a service or command
> I can
> > run to get things going again?
> >
>
> --
> Tracy F. Rotton
> tracy
taupecat.com
> http://www.taupecat.com/
>
> "... I like the 49ers because they're pure of heart,
> Seattle because they've got something to prove,
> and the Raiders because they always cheat."
> -- Lisa Simpson, "Lisa the Greek"
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
--- Sean Burlington <sean
uncertainty.org.uk> wrote:
> is there really any site which will accept a book
> order based an a sigle GET?
Well, yes, but that is not the point really. The example of
the <img> tag is just one way you can forge an HTTP request
from another user (the victim).
Also consider that many people create sites with PHP with
register_globals set to on. Even when these people go to
great lengths to validate all incoming data and to identify
the user, this does not defend against CSRF. The data being
sent is valid data, and the user sending it is the
authenticated user. That is the danger.
Chris
attached mail follows:
Chris Shiflett wrote:
> --- Sean Burlington <sean
uncertainty.org.uk> wrote:
>
>>I'm not sure what harm could be done by this though.
>>
>>if a broswer attempts to load an image reference by
>>an <img tag - but finds an unsuitable type of data -
>>I would expect it simply to ignore it...
>
>
> I sent a response about this earlier, but you should
> research CSRF and XSS.
>
> It does not matter that the browser shows a broken image if
> it has already sent the HTTP request. There is no special
> HTTP request for checking whether the Content-Type is
> really an image without the receiving Web server taking any
> action. A GET is a GET.
>
hmmm....
but what does this have to do with the site allowing users to include
links to images
this is a security problem for the site that allows you to place
purchase orders with a single click.
what difference does it make that img links are placed by users ?
I could just as easily trick users into making GET requests by puting
dodgy img links in a pgae that I control ...
I only initiate a small proportion of the requests my browser makes - in
fact I go to some trouble to stop some of the requests happening as I
don't like to see so many ads - I filter outgoing requests via squid.
There are problems in the way the internet is designed and in
misconcepotions as to how it works - but if we all code for absolute
security we end up disconnecting from the web entirely.
--Sean
attached mail follows:
Hello All
I am wanting a create a dynamic List using php. When a user enters a value on a form, I need the value that he entered on the form to added to a dynamic list box, which is displayed on the next page. So the List Box continues to grow whenever a user adds a value on the form (note: The values entered every time have to be stored)
Thanks in advance.
Pushpinder Singh Garcha _________________________________ Web Architect T. Falcon Napier and Associates, Inc. _________________________________
attached mail follows:
unless you want to submit the form to the server for each new entry (bad mojo) then I would recommend you look into using JavaScript to do this. (much easier and faster.)
Once the user has entered all their entries then submit the form and update your database or storage medium of choice.
IMHO, etc. =C= * * Cal Evans * Techno-Mage * http://www.calevans.com *
----- Original Message -----
From: "Pushpinder Singh Garcha" <pgarcha
adelphia.net>
To: <php-general
lists.php.net>
Sent: Tuesday, January 21, 2003 1:09 PM
Subject: [PHP] Dynamic List Using Php
> Hello All > > I am wanting a create a dynamic List using php. When a user enters a > value on a form, I need the value that he entered on the form to added > to a dynamic list box, which is displayed on the next page. So the List > Box continues to grow whenever a user adds a value on the form (note: > The values entered every time have to be stored) > > Thanks in advance. > > Pushpinder Singh Garcha > _________________________________ > Web Architect > T. Falcon Napier and Associates, Inc. > _________________________________
attached mail follows:
So the select will be generated from values in the db?
here is an example of something I did..
print" <br>City:<br>"; print" <select name='city'>"; $result2=mysql_query("SELECT distinct(city) from listings where approved=1 and state='$state' and country='$country'");
while ($myrow2 = mysql_fetch_array($result2)){ print "<OPTION>" . $myrow2["city"]; } print "</select><br><br>";
Eddie
-----Original Message-----
From: Pushpinder Singh Garcha [mailto:pgarcha
adelphia.net]
Sent: Tuesday, January 21, 2003 2:10 PM
To: php-general
lists.php.net
Subject: [PHP] Dynamic List Using Php
Hello All
I am wanting a create a dynamic List using php. When a user enters a value on a form, I need the value that he entered on the form to added to a dynamic list box, which is displayed on the next page. So the List Box continues to grow whenever a user adds a value on the form (note: The values entered every time have to be stored)
Thanks in advance.
Pushpinder Singh Garcha _________________________________ Web Architect T. Falcon Napier and Associates, Inc. _________________________________
attached mail follows:
Hi Eddie,
This is exactly what I'm looking for. I don't have some code today that's why I'm posting to the newsgroup. The only working thing I have today is the listing of the "main db" It looks a bit whired since I copy past it from the file. Could you post some of your code?
---------------------------------------------------------------------------- ------------------------------------------------- print "$html_body_in"; print "<b>Systems</b><br><br>"; print "<table border=\"0\" width=\"900\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-size: 10pt\">"; print "<tr>"; print "<td width=\"20\"><b></b></td>"; print "<td width=\"130\"><b>Name</b></a></td>"; print "<td width=\"130\"><b>Vendor</b></td>"; print "<td width=\"620\"><b>Description</b><b></td>"; print "\t</tr>\n"; print "</table>\n";
$query="SELECT system.*, vendor.* FROM system, vendor where system.VENDOR = vendor.ID order by system.NAME ASC"; $result=mysql_query($query); $num=mysql_numrows($result);
$i=0;
while ($i < $num) { $system_id=mysql_result($result,$i,"system.ID"); $system_name=mysql_result($result,$i,"system.NAME"); $vendor_name=mysql_result($result,$i,"vendor.NAME"); $vendor_id=mysql_result($result,$i,"vendor.ID"); $system_description=mysql_result($result,$i,"system.DESCRIPTION");
print "<table border=\"0\" width=\"900\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-size: 10pt\">"; print "<tr>"; print "<td width=\"20\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im g border=\"0\" src=\"$plus_gif\" alt=\"extract $system_name\"></a></td>"; print "<td width=\"130\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\">$sy stem_name</a></td>"; print "<td width=\"130\"><a href=\"index.php?$LINK&ACTION=system&SUB=vendordetail&vendorid=$vendor_id\"> $vendor_name</a></td>"; print "<td width=\"520\">$system_description</td>"; print "<td width=\"25\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im g border=\"0\" src=\"$edit_gif\" alt=\"edit $system_name\" width=\"12\" height=\"12\"></a></td>"; print "<td width=\"25\"><a href=\"index.php?$LINK&ACTION=admin&SUB=useradd\"><img border=\"0\" src=\"$new_gif\" alt=\"add Useraccount\" width=\"12\" height=\"12\"></a></td>"; print "<td width=\"50\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im g border=\"0\" src=\"$delete_gif\" alt=\"delete $system_name\" width=\"12\" height=\"12\"></a></td>";
print "</tr>"; print "</table>";
++$i; }
---------------------------------------------------------------------------- -------------------------------------------------
br Marc
print "$html_body_out";
"Edward Peloke" <epeloke
echoman.com> schrieb im Newsbeitrag
news:NFBBIIKNALMFFNANEKEFCEIJDEAA.epeloke
echoman.com...
> Marc,
>
> I did something sort of along these lines with an 'auction' site I worked
> on. I displayed rows from a db. If the row had bid information in the db
> (or your case submenu info) then a + sign icon was displayed next to it.
IF
> the plus sign was clicked, the page would reload and the bid or submenu
info
> would be displayed and the + sign would change to a - sign to give the
> appearence of a tree menu. Can you post some of your code?
>
> Eddie
>
> -----Original Message-----
> From: Marc Bleuler [mailto:marc
bleuler.net]
> Sent: Tuesday, January 21, 2003 12:31 PM
> To: php-db
lists.php.net; php-general
lists.php.net
> Subject: [PHP] build menu with mysql data
>
>
> Hi,
>
> I would like to bild a tree menu with mySQL data. where I have the
collapsed
> main menue and when I click the link the specific submenue expands (as
> follow).
>
> (collapsed Main Menu)
> + Home
> + Downloads
> + About me
> + Search
>
> ....and for example if I click the "Download" section it will look as
> follow....
>
> (expanded Main-Sub Menu)
> + Home
> + Downloads
> - Music
> - Programm
> + About me
> + Search
>
> ....and the SQL Tables...
>
> MAINMENUE_TABLE
> ID NAME
> -----------------------------
> | 1 | Home |
> | 2 | Downloads |
> | 3 | About me |
> | 4 | Search |
>
> ....and....
>
> SUBMENUE_TABLE
> ID MAIN_ID NAME URL
> -------------------------------------------------------------------
> | 1 | 2 | Music |
> ./somefile.php?action=music
> | 2 | 2 | Programm |
> ./somefile.php?action=programm
> | 3 | 3 | Pictures |
> ./somefile.php?action=pictures
> | 4 | 3 | Address |
> ./somefile.php?action=address
> | 5 | 4 | My Page |
> ./somefile.php?action=mypage
> | 6 | 4 | The Web |
> ./somefile.php?action=theweb
> | 7 | 4 | Google |
> ./somefile.php?action=google
>
>
> If I'm using a while loop it won't work, so I realy don't have and more
> ideas...
> Please consider in your explanations I'm a PHP beginner... :-)
>
> thanks
> Marc
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
what about checking the checking the remote ip address?
Jim
----- Original Message -----
From: "Chris Shiflett" <shiflett
php.net>
To: <Liam.Gibbs
dfait-maeci.gc.ca>; <php-general
lists.php.net>
Sent: Tuesday, January 21, 2003 10:45 AM
Subject: Re: [PHP] Detecting posts from outside site
> --- Liam.Gibbs
dfait-maeci.gc.ca wrote:
> > If it's bulletproof, then I figured this could help
> > some of you out. If not, I welcome comments (I'm a
> > little bit hesitant of calling things 'bulletproof').
>
> It's not bulletproof. :-)
>
> > if((count($_POST) > 0) &&
> > (!stristr($_SERVER["HTTP_REFERER"],
> > $http_referer))) {
> > unset($_POST);
> > $evil = "postedfromoutsidepage";
> > }
>
> If this page is located at http://www.example.org/foo.php,
> and you are trying to ensure that the data is being posted
> from http://www.example.org/bar.php consider the following:
>
> --------------------
> # telnet www.example.org 80
> Trying 192.0.34.166...
> Connected to www.example.org (192.0.34.166).
> Escape character is '^]'.
> POST /foobar.php HTTP/1.1
> Host: www.example.org
> Referer: http://www.example.org/bar.php
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 26
>
> varname=any_value_i_choose
> --------------------
>
> Someone can use this method to bypass your Referer header
> check and post any data they choose.
>
> Chris
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
--- Jim Lucas <phplist
zonedzero.net> wrote:
> what about checking the checking the remote ip
> address?
The common use of HTTP proxies on the Web makes this extremely unreliable.
A typical HTTP proxy servicing many users will cause them all to appear to be coming from the same IP address, while round-robin HTTP proxies (like AOL's) will make a single person appear to be coming from many different IP addresses.
Chris
attached mail follows:
Ok, here's the sample code I found in one of my PHP books - it doesn't work exactly like my original script for checking passwords, but it does a close enough job to let me know that the sessions aren't staying registered.
I could ask my host if anyone else has had problems, but that would mean being able to get them on the phone, find someone who speaks English, and then hope that person has any kind of experience with Linux/PHP - which I'm quickly finding does not exist.
As it is a shared hosting situation, and I have no shell access (through telnet or SSH), I cannot check the php.ini file to see.
authmain.php <? session_start();
if ($userid && $password) { // if the user has just tried to log in
$db_conn = mysql_connect("localhost", "login", "passWord"); mysql_select_db("databaseName", $db_conn); $query = "SELECT * FROM userlogin WHERE user='$userid' AND passwd=password('$password')"; $result = mysql_query($query, $db_conn); if (mysql_num_rows($result) > 0) { // if they are in the database register the user id $valid_user = $userid; session_register("valid_user"); } } ?> <html> <head> <title>Test Sessions</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?
if (session_is_registered("valid_user")) { echo "You are logged in as: $valid_user <br><a href=\"logout.php\">Log out</a><br>"; } else { if (isset($userid)) { // if they've tried and failed to log in echo "Could not log you in"; } else { // they have not tried to log in yet or have logged out echo "You are not logged in.<br>"; }
// provide form to log in echo "<form method=post action=\"authmain.php\">"; echo "<table>"; echo "<tr><td>Userid:</td>"; echo "<td><input type=text name=userid></td></tr>"; echo "<tr><td>Password:</td>"; echo "<td><input type=password name=password></td></tr>"; echo "<tr><td colspan=2 align=center>"; echo "<input type=submit value=\"log in\"></td></tr>"; echo "</table></form>"; } ?> <br> <a href="members_only.php">Members section</a> </body> </html>
members_only.php <? global $userid; session_start();
echo "<h1>Members only</h1>";
// check session variable
if (session_is_registered("valid_user")) { echo "<p>You are logged in as $valid_user.</p>"; echo "<p>Members only content goes here</p>"; } else { echo "<p>You are not logged in.</p>"; echo "<p>Only logged in members may see this page.</p>"; }
echo "<a href=\"authmain.php\">Back to main page</a>"; ?>
At 06:29 PM 1/21/2003 +0800, Jason Wong wrote: >On Tuesday 21 January 2003 17:59, Tim Thorburn wrote: > > Yes, the examples from the manual do work on the server using PHP 4.2.2 - > > however they do not work on the server using PHP 4.1.2. > > > > I've been using this same script for many sites with PHP versions 4.0.6 > > thru 4.2.2 with no problems until now which leads me to believe that I must > > attempt to change a PHP setting through .htaccess since it is hosted on a > > shared server. > > > > I've tried the example from the manual on several other sites - works > > everywhere but on this problem server. > >It's time to see some code :) > >Does sessions work at all for the other people on your shared server? Ask >your >host whether anybody else has complained. > > > PHP 4.1.2 (doesn't work) > > '--enable-mm=shared' > >Would this have anything to do with it? Apparently there could be problems >with storing sessions in mm: > > http://marc.theaimsgroup.com/?l=php-general&m=104311365417871&w=2 > >Check in php.ini whether sessions are file based or using mm. > >-- >Jason Wong -> Gremlins Associates -> www.gremlins.biz >Open Source Software Systems Integrators >* Web Design & Hosting * Internet & Intranet Applications Development * > >/* >Goals... Plans... they're fantasies, they're part of a dream world... > -- Wally Shawn >*/ > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Ok, here's what I've found:
register_globals is ON however register_argc_argv is OFF on the server with problems.
The server is a Sun Cobalt server running some form of Linux.
My local machine that I work on is WinXP Pro using PHP 4.3.0, on this machine I've got register_globals set to ON and register_argc_argv ON as well ... I'm not entirely sure what register_argc_argv does, but could this be the problem?
At 09:41 PM 1/21/2003 +1100, Justin French wrote:
>on 21/01/03 9:25 PM, Tim Thorburn (immortal
nwconx.net) wrote:
>
> > There is some discussion as to whether my globals are on or not ... I am
> > using session_register to name my sessions, and then the global command
> > later on on the individual pages to remember which session it is we're
> > looking for.
>
>No no no... check the output of phpinfo(), or check your php.ini file to see
>if the directive "register_globals" has a value of ON or OFF.
>
>This is more than likely the problem I think.
>
>Also check the same value on your local machine.
>
>Justin
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I'm trying to present a phone directory in a printable format that will make "most" people happy. What I need to do is take the results from our database and "break" it into two tables. ie.
<table> Extension FName LName Dept. ...25x </table> <table> Extension FName LName Dept. ...Records 26+ </table>
This is what I have done without success:
$result = mssql_query($sql);
echo "<table border=1>\n"; echo "<tr>\n"; echo "<td>Extension\n"; echo "</td>\n"; echo "<td>First Name\n"; echo "</td>\n"; echo "<td>Last Name\n"; echo "</td>\n"; echo "<td>Dept.\n"; echo "</td>\n"; echo "</tr>\n"; while($row = mssql_fetch_array($result)) { $n++; echo "<tr>\n"; echo "<td>$row[0]\n"; echo "</td>\n"; echo "<td>$row[1]\n"; echo "</td>\n"; echo "<td>$row[2]\n"; echo "</td>\n"; echo "<td>$row[3]\n"; echo "</td>\n"; echo "</tr>\n"; If ($n==40) { echo "</table>\n"; echo "<br>"; echo "<table border=1>\n"; echo "<tr>\n"; echo "<td>$row[0]\n"; echo "</td>\n"; echo "<td>$row[1]\n"; echo "</td>\n"; echo "<td>$row[2]\n"; echo "</td>\n"; echo "<td>$row[3]\n"; echo "</td>\n"; echo "</tr>\n"; } else { } } echo "</table>\n";
It successfully closes that table after 40 records, but the remaining records are at the bottom of the page. What I'd like to end up with is 2 columns with 40 records in each column Ext. FName LName Dept. | Ext. FName LName Dept. 1 41 ... ... 40
Any help is appreciated.
attached mail follows:
--- Mike Smith <msmith
larrymethvin.com> wrote:
> I'm trying to present a phone directory in a
> printable format that will make "most" people
> happy. What I need to do is take the results
> from our database and "break" it into two
> tables.
I can't really tell what you are trying to do, but it sounds like you just want to loop through a MySQL result set more than once, right? If so, check out this function:
http://www.php.net/manual/en/function.mysql-data-seek.php
Chris
attached mail follows:
Just goes to show there are such things as dumb questions. Thanks for pointing me in the right direction. I'm using MSSQL, but mssql-data-seek does the trick!
Thanks, Mike
-----Original Message-----
From: Chris Shiflett [mailto:shiflett
php.net]
Sent: Tuesday, January 21, 2003 11:35 AM
To: Mike Smith; php-general
lists.php.net
Subject: Re: [PHP] Wrapping SQL results in 2 tables
--- Mike Smith <msmith
larrymethvin.com> wrote:
> I'm trying to present a phone directory in a
> printable format that will make "most" people
> happy. What I need to do is take the results
> from our database and "break" it into two
> tables.
I can't really tell what you are trying to do, but it sounds like you just want to loop through a MySQL result set more than once, right? If so, check out this function:
http://www.php.net/manual/en/function.mysql-data-seek.php
Chris
attached mail follows:
Hi,
i want to edit just one post in the middle of 100 posts, i use this code to loop thru the posts
$fp = fopen($servername, "r") or die("error"); $wuser = file($servername); $num = -1; for ($i=0; $i < count($wuser); $i++) { $wtemp = explode(";;", $wuser[$i]); if ($ausername == $wtemp[0]) { $num = $i; $wserver = explode(";;", $wuser[$i]); } } fclose($fp);
if ($num == -1) { die ("error 2"); }
the post is $num (eg. 50) and when the uses has made his changes i want to loop thru all and update just this post? its probebly very simple, i just cant find it in the book :/
regards patrick
attached mail follows:
Hi,
i have a crontab that runs my script every 15min to check if anything has changed since the last control, if something has changed i want my page to send a report to a url, like a form. Is that possible thru php?
regards patrick
attached mail follows:
--- Patrick <pafo
pafo.net> wrote:
> i want my page to send a report to a url, like a
> form. Is that possible thru php?
Sure. For the GET method, you can just use something like fopen() to open the URL. For the POST method, you can try something like this:
<base href="http://www.php.net/">
<? $content = php_post("www.php.net", "/search.php", "lang=en_US&pattern=curl&show=manual"); echo $content;
function php_post($host, $path, $data) { $http_response="";
$fp=fsockopen($host, 80); fputs($fp, "POST $path HTTP/1.1\r\n"); fputs($fp, "Host: $host\r\n"); fputs($fp, "Content-Type: application/x-www-form-urlencoded\r\n"); fputs($fp, "Content-Length: " . strlen($data)."\r\n"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, "$data"); while(!feof($fp)) { $http_response.=fgets($fp, 128); } fclose($fp);
list($http_headers, (http_content) = explode("\r\n\r\n", $http_response);
return $http_content; } ?>
Chris
attached mail follows:
Marc,
Here is the entire script...
It is doing a lot of things you don't need so you will have to sift through it to see what you want. If you have any questions, just ask.
Eddie
<?
require("connection.php");
if ($addbid) { # setup SQL statement $SQL = " INSERT INTO bids"; $SQL = $SQL . " (clientreqid,amount,operatorid,accepted) Values"; $SQL = $SQL . " ('$clientreqid','$amount','$operatorid',0) ";
#execute SQL statement $result = mysql_db_query($db,"$SQL",$connection); }
# setup SQL statement $SQL = "select id,clientid,DATE_FORMAT(departdate, '%m/%d/%y') as departdate,DATE_FORMAT(returndate, '%m/%d/%y') as returndate,departloc,numpass,craftpref,returnloc from clientreq"; #execute SQL statement $result = mysql_db_query($db,"$SQL",$connection); $bgcolor="#fffafo"; ##get the lengths $sqllength="select max(length(departloc)) as departloclen, max(length(departdest)) as departdestlen from clientreq"
?> <br> <br> <table width="95%" border="0"> <tr bgcolor="#2c1d65" border="1"> <td> </td> <td><font face="arial" size="4" color="#fffaf0"><b>Depart</td> <td><font face="arial" size="4" color="#fffaf0"><b>Location</td> <td><font face="arial" size="4" color="#fffaf0"><b># Pass</td> <td><font face="arial" size="4" color="#fffaf0"><b>Return</td> <td><font face="arial" size="4" color="#fffaf0"><b>Return</td> <td><font face="arial" size="4" color="#fffaf0"><b>Location</td> <td><font face="arial" size="4" color="#fffaf0"><b>Craft Preference</td> <td><font face="arial" size="4" color="#fffaf0"><b>Lowest Bid</td> <td><font face="arial" size="3" color="#fffaf0"><b>Add Bid</td> </tr>
<? $trcolor="#F0F8FF"; while ($myrow = mysql_fetch_array($result)){ $return='No'; $colorset=0; if ($myrow["return"]==1){ $return='Yes';} $open='No'; if ($myrow["open"]==1){ $open='Yes';}
if ($trcolor=='#F0F8FF'){ $trcolor='#B0C4DE'; $colorset=1; } if ($colorset==0){ if ($trcolor=='#B0C4DE'){ $trcolor='#F0F8FF';} }
if ($bidhist<>1){ # setup SQL statement $SQL3 = "select min(amount), count(*) as count1 from bids where clientreqid=".$myrow["id"].""; #execute SQL statement $result3= mysql_db_query($db,"$SQL3",$connection); $myrow3=mysql_fetch_array($result3); $count1=$myrow3["count1"]; print "<tr bgcolor='$trcolor'>"; if ($count1>0){ print"<td><a href='auction3.php?clientreqid=".$myrow["id"]."&bidhist=1'><img name='bidhist' src='plus.gif' border='0'></a></td>"; $minbid=$myrow3["min(amount)"]; } if ($count1==0){ print"<td></td>"; $minbid="No Bids"; } print"<td>".$myrow["departdate"]."</td>"; print"<td>".$myrow["departloc"]."</td>"; print"<td>".$myrow["numpass"]."</td>"; print"<td>$return</td>"; print"<td>".$myrow["returndate"]."</td>"; print"<td></td>"; print"<td>".$myrow["craftpref"]."</td>"; print"<td>$minbid</td>"; print "<td><nobr><a href='addbid.php?reqid=".$myrow["id"]. "&operatorid=$operatorid'>Add Bid</a></nobr></td></tr>"; }
if ($bidhist==1){ # setup SQL statement $SQL3 = "select min(amount), count(*) as count1 from bids where clientreqid=".$myrow["id"].""; #execute SQL statement $result3= mysql_db_query($db,"$SQL3",$connection); # setup SQL statement $SQL4 = "select b.amount, DATE_FORMAT(b.timestamp, '%m/%d/%y') as timestamp, o.corpname from bids b ,operators o where b.operatorid=o.id and clientreqid='$clientreqid' order by b.amount,b.timestamp asc"; #execute SQL statement $result4= mysql_db_query($db,"$SQL4",$connection); $myrow3=mysql_fetch_array($result3); $count1=$myrow3["count1"];
if($clientreqid==$myrow["id"]){ print "<tr bgcolor='$trcolor'>"; if ($count1>0){ print"<td><a href='auction3.php?clientreqid=".$myrow["id"]."&bidhist=0'><img name='bidhist' src='minus.gif' border='0'></a></td>"; $minbid=$myrow3["min(amount)"]; } if ($count1==0){ print"<td></td>"; $minbid="No Bids"; } print"<td>".$myrow["departdate"]."</td>"; print"<td>".$myrow["departloc"]."</td>"; print"<td>".$myrow["numpass"]."</td>"; print"<td>$return</td>"; print"<td>".$myrow["returndate"]."</td>"; print"<td></td>"; print"<td>".$myrow["craftpref"]."</td>"; print"<td>$minbid</td>"; print "<td><nobr><a href='addbid.php?reqid=".$myrow["id"]. "&operatorid=$operatorid'>Add Bid</a></nobr></td></tr>"; print" <tr bgcolor='#2c1d65' border='1'>"; print"<td bgcolor=$bgcolor></td>"; print"<td bgcolor=$bgcolor></td>"; print"<td><font face='arial' size='2' color=$bgcolor><b>Bid History</td>"; print" <td><font face='arial' size='2' color=$bgcolor><b>Operator</td>"; print" <td><font face='arial' size='2' color=$bgcolor><b>Bid</td>"; print" <td><font face='arial' size='2' color=$bgcolor><b>Bid Date</td>"; print"<td bgcolor=$bgcolor></td>"; print"<td bgcolor=$bgcolor></td>"; print"<td bgcolor=$bgcolor></td>"; print "<td bgcolor=$bgcolor></td></tr>"; while ($myrow4 = mysql_fetch_array($result4)){ print "<tr bgcolor='$trcolor'>"; print"<td bgcolor=$bgcolor></td>"; print"<td bgcolor=$bgcolor></td>"; print"<td bgcolor=$bgcolor></td>"; print"<td>".$myrow4["corpname"]."</td>"; print"<td>".$myrow4["amount"]."</td>"; print"<td>".$myrow4["timestamp"]."</td>"; print"<td bgcolor=$bgcolor></td>"; print"<td bgcolor=$bgcolor></td>"; print"<td bgcolor=$bgcolor></td>";
print "<td bgcolor=$bgcolor></td></tr>"; } }
if($clientreqid<>$myrow["id"]){ print "<tr bgcolor='$trcolor'>"; if ($count1>0){ print"<td><a href='auction3.php?clientreqid=".$myrow["id"]."&bidhist=1'><img name='bidhist' src='plus.gif' border='0'></a></td>"; $minbid=$myrow3["min(amount)"]; } if ($count1==0){ print"<td></td>"; $minbid="No Bids"; } print"<td>".$myrow["departdate"]."</td>"; print"<td>".$myrow["departloc"]."</td>"; print"<td>".$myrow["numpass"]."</td>"; print"<td>$return</td>"; print"<td>".$myrow["returndate"]."</td>"; print"<td></td>"; print"<td>".$myrow["craftpref"]."</td>"; print"<td>$minbid</td>"; print "<td><nobr><a href='addbid.php?reqid=".$myrow["id"]. "&operatorid=$operatorid'>Add Bid</a></nobr></td></tr>";
} }
} print"</table>";
?>
-----Original Message-----
From: Marc Bleuler [mailto:marc
bleuler.net]
Sent: Tuesday, January 21, 2003 2:11 PM
To: php-general
lists.php.net; php-db
lists.php.net
Subject: [PHP-DB] Re: [PHP] build menu with mysql data
Hi Eddie,
This is exactly what I'm looking for. I don't have some code today that's why I'm posting to the newsgroup. The only working thing I have today is the listing of the "main db" It looks a bit whired since I copy past it from the file. Could you post some of your code?
---------------------------------------------------------------------------- ------------------------------------------------- print "$html_body_in"; print "<b>Systems</b><br><br>"; print "<table border=\"0\" width=\"900\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-size: 10pt\">"; print "<tr>"; print "<td width=\"20\"><b></b></td>"; print "<td width=\"130\"><b>Name</b></a></td>"; print "<td width=\"130\"><b>Vendor</b></td>"; print "<td width=\"620\"><b>Description</b><b></td>"; print "\t</tr>\n"; print "</table>\n";
$query="SELECT system.*, vendor.* FROM system, vendor where system.VENDOR = vendor.ID order by system.NAME ASC"; $result=mysql_query($query); $num=mysql_numrows($result);
$i=0;
while ($i < $num) { $system_id=mysql_result($result,$i,"system.ID"); $system_name=mysql_result($result,$i,"system.NAME"); $vendor_name=mysql_result($result,$i,"vendor.NAME"); $vendor_id=mysql_result($result,$i,"vendor.ID"); $system_description=mysql_result($result,$i,"system.DESCRIPTION");
print "<table border=\"0\" width=\"900\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-size: 10pt\">"; print "<tr>"; print "<td width=\"20\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im g border=\"0\" src=\"$plus_gif\" alt=\"extract $system_name\"></a></td>"; print "<td width=\"130\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\">$sy stem_name</a></td>"; print "<td width=\"130\"><a href=\"index.php?$LINK&ACTION=system&SUB=vendordetail&vendorid=$vendor_id\"> $vendor_name</a></td>"; print "<td width=\"520\">$system_description</td>"; print "<td width=\"25\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im g border=\"0\" src=\"$edit_gif\" alt=\"edit $system_name\" width=\"12\" height=\"12\"></a></td>"; print "<td width=\"25\"><a href=\"index.php?$LINK&ACTION=admin&SUB=useradd\"><img border=\"0\" src=\"$new_gif\" alt=\"add Useraccount\" width=\"12\" height=\"12\"></a></td>"; print "<td width=\"50\"><a href=\"index.php?$LINK&ACTION=system&SUB=systemdetail&sysid=$system_id\"><im g border=\"0\" src=\"$delete_gif\" alt=\"delete $system_name\" width=\"12\" height=\"12\"></a></td>";
print "</tr>"; print "</table>";
++$i; }
---------------------------------------------------------------------------- -------------------------------------------------
br Marc
print "$html_body_out";
"Edward Peloke" <epeloke
echoman.com> schrieb im Newsbeitrag
news:NFBBIIKNALMFFNANEKEFCEIJDEAA.epeloke
echoman.com...
> Marc,
>
> I did something sort of along these lines with an 'auction' site I worked
> on. I displayed rows from a db. If the row had bid information in the db
> (or your case submenu info) then a + sign icon was displayed next to it.
IF
> the plus sign was clicked, the page would reload and the bid or submenu
info
> would be displayed and the + sign would change to a - sign to give the
> appearence of a tree menu. Can you post some of your code?
>
> Eddie
>
> -----Original Message-----
> From: Marc Bleuler [mailto:marc
bleuler.net]
> Sent: Tuesday, January 21, 2003 12:31 PM
> To: php-db
lists.php.net; php-general
lists.php.net
> Subject: [PHP] build menu with mysql data
>
>
> Hi,
>
> I would like to bild a tree menu with mySQL data. where I have the
collapsed
> main menue and when I click the link the specific submenue expands (as
> follow).
>
> (collapsed Main Menu)
> + Home
> + Downloads
> + About me
> + Search
>
> ....and for example if I click the "Download" section it will look as
> follow....
>
> (expanded Main-Sub Menu)
> + Home
> + Downloads
> - Music
> - Programm
> + About me
> + Search
>
> ....and the SQL Tables...
>
> MAINMENUE_TABLE
> ID NAME
> -----------------------------
> | 1 | Home |
> | 2 | Downloads |
> | 3 | About me |
> | 4 | Search |
>
> ....and....
>
> SUBMENUE_TABLE
> ID MAIN_ID NAME URL
> -------------------------------------------------------------------
> | 1 | 2 | Music |
> ./somefile.php?action=music
> | 2 | 2 | Programm |
> ./somefile.php?action=programm
> | 3 | 3 | Pictures |
> ./somefile.php?action=pictures
> | 4 | 3 | Address |
> ./somefile.php?action=address
> | 5 | 4 | My Page |
> ./somefile.php?action=mypage
> | 6 | 4 | The Web |
> ./somefile.php?action=theweb
> | 7 | 4 | Google |
> ./somefile.php?action=google
>
>
> If I'm using a while loop it won't work, so I realy don't have and more
> ideas...
> Please consider in your explanations I'm a PHP beginner... :-)
>
> thanks
> Marc
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Can someone point me in the right direction on how to create a new odbc connection? I need to use php to actually set up the connection. I know how to use php to connect once the connection is created and know how to create on using control panel>etc, just don't know how to create one using php.
Thanks, Eddie
attached mail follows:
Hello,
I have the code below. It's a simple file upload. But it doesn't work. Before the line if(isset( $Submit )) is an echo which can I read. But after choosing a file and press a submit nothing happens. Why is if(isset( $Submit )) always false? Maybe my apache or php config is wrong?
I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on , upload_tmp_dir is "c:\tmp\" and upload_max_filesize is 2M in PHP config file.
Thanks!
<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body>
<form name="form1" method="post" action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <input type="submit" name="Submit" value="Submit">
<? echo "Before submit <br>\n"; if(isset( $Submit )) { echo "After submit <br>\n";
if ($_FILES['imagefile']['type'] == "image/gif"){ copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']) or die ("Could not copy"); echo "Name: ".$_FILES['imagefile']['name'].""; } else { echo ""; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")"; } } ?> </form>
</body> </html>
attached mail follows:
John,
I have Win 98 with Apache 2 and it worked fine for me, once I commented out the file type check, didn't seem to like any file I tried, even gifs. I also had to create a folder named 'files' under my htdocs folder in apache.
Eddie
-----Original Message-----
From: John M [mailto:bali1a
freemail.hu]
Sent: Monday, June 30, 2003 3:05 PM
To: php-general
lists.php.net
Subject: [PHP] File upload problem
Hello,
I have the code below. It's a simple file upload. But it doesn't work. Before the line if(isset( $Submit )) is an echo which can I read. But after choosing a file and press a submit nothing happens. Why is if(isset( $Submit )) always false? Maybe my apache or php config is wrong?
I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on , upload_tmp_dir is "c:\tmp\" and upload_max_filesize is 2M in PHP config file.
Thanks!
<html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body>
<form name="form1" method="post" action="" enctype="multipart/form-data"> <input type="file" name="imagefile"> <input type="submit" name="Submit" value="Submit">
<? echo "Before submit <br>\n"; if(isset( $Submit )) { echo "After submit <br>\n";
if ($_FILES['imagefile']['type'] == "image/gif"){ copy ($_FILES['imagefile']['tmp_name'], "files/".$_FILES['imagefile']['name']) or die ("Could not copy"); echo "Name: ".$_FILES['imagefile']['name'].""; } else { echo ""; echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")"; } } ?> </form>
</body> </html>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
> -----Original Message-----
> From: John M [mailto:bali1a
freemail.hu]
> Sent: Monday, June 30, 2003 3:05 PM
> To: php-general
lists.php.net
> Subject: [PHP] File upload problem
>
>
> Hello,
>
> I have the code below. It's a simple file upload. But it doesn't work.
> Before the line if(isset( $Submit )) is an echo which can I
> read. But after
> choosing a file and press a submit nothing happens. Why is if(isset(
> $Submit )) always false? Maybe my apache or php config is wrong?
Shouldn't you be looking at $_POST['Submit'] or do you have register_globals turned on?
attached mail follows:
Since you have 'safe-mode' on, Register globals will be turned off, so you
should test $HTTP_POST_VARS['Submit'], instead.
"John M" <bali1a
freemail.hu> wrote in message
news:20030121200444.36951.qmail
pb1.pair.com...
> Hello,
>
> I have the code below. It's a simple file upload. But it doesn't work.
> Before the line if(isset( $Submit )) is an echo which can I read. But
after
> choosing a file and press a submit nothing happens. Why is if(isset(
> $Submit )) always false? Maybe my apache or php config is wrong?
>
> I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on ,
upload_tmp_dir
> is "c:\tmp\" and upload_max_filesize is 2M in PHP config file.
>
> Thanks!
>
>
> <html>
> <head>
> <title>Untitled Document</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
> <body>
>
> <form name="form1" method="post" action="" enctype="multipart/form-data">
> <input type="file" name="imagefile">
> <input type="submit" name="Submit" value="Submit">
>
> <?
> echo "Before submit <br>\n";
> if(isset( $Submit ))
> {
> echo "After submit <br>\n";
>
> if ($_FILES['imagefile']['type'] == "image/gif"){
> copy ($_FILES['imagefile']['tmp_name'],
> "files/".$_FILES['imagefile']['name'])
> or die ("Could not copy");
> echo "Name: ".$_FILES['imagefile']['name']."";
> }
> else {
> echo "";
> echo "Could Not Copy, Wrong Filetype
> (".$_FILES['imagefile']['name'].")";
> }
> }
> ?>
> </form>
>
> </body>
> </html>
>
>
attached mail follows:
This worked ... thanks! But I am confused. It has worked with PHP_SELF in the past. Why would it not evaluate the variable on the server. Or more specifically, why would the page render fine in both Netscape and IE with the links (from PHP_SELF) being the only thing wrong with the page? Just trying to understand. :o)
Bill
-----Original Message-----
From: Jason Wong [mailto:php-general
gremlins.biz]
Sent: Tuesday, January 21, 2003 8:56 AM
To: php-general
lists.php.net
Subject: Re: [PHP] Page Rendering
On Tuesday 21 January 2003 22:26, Bill Arbuckle, Jr. wrote:
> This code is at the top of an include file which is included in pics.php. > It seems that $PHP_SELF is interpreted differently in *some* instances > between the two browsers. I can't figure it out because PHP_SELF is a > server side evaluation. The links are output correctly in IE ... > http://www.xyz.com/pics.php?page=2 ... but in Netscape I get ... > http://www.xyz.com/?page=2 I had this problem once before and > inadvertently fixed it with something else that I was doing. Any hints are > appreciated.
Most likely $PHP_SELF is in fact blank. If you're using a relatively new version of PHP use $_SERVER['PHP_SELF'] instead.
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* On the road, ZIPPY is a pinhead without a purpose, but never without a POINT. */
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Tue, 21 Jan 2003 09:47:28 -0600, Chris Boget wrote:
>> > equates an object to a function >> You'd be better off trying to equate an object to a data type. > >Why is that? Please explain?
my 2 cents are as follows.
Objects have functions that return data types as many objects contain data. and the functions just tell the object how to manipulate and "display" or give some of the data back.
I hope that helps. OOP kinda threw me for a loop when I first started wrapping my mind around it.
>I do not mean to sound trite. I do not know and am very curious >to hear more. > >Chris > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
The most helpful intro to OOP for me is the sidebar here: http://webreference.com/perl/xhoo/php1/5.html
--- Jay Paulson <jpaulson
lbjs.com> wrote:
> The easiest way for me to explain and understand OOP
> was to think of it this
> way.
>
__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
attached mail follows:
I need some help, I think this is probably really simple and I was wondering if anyone had some code I could use to help me write this.
I need a page to parse a text file with a list of numbers, and then take those numbers and parse another file with over 7MB of information and to look for those numbers and then to pull out the matches. Now the file that its looking through each record that has a number in it is in a specific format with a beginnning and an end.
Any help would be appreciated.
_________________________________________________________________ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
attached mail follows:
> I need some help, I think this is probably really simple and I was wondering > if anyone had some code I could use to help me write this. > > I need a page to parse a text file with a list of numbers, and then take > those numbers and parse another file with over 7MB of information and to > look for those numbers and then to pull out the matches. Now the file that > its looking through each record that has a number in it is in a specific > format with a beginnning and an end.
Can you give a short example of each file and what you want to match in each?
---John Holmes...
attached mail follows:
just for explain me another better: if I had post in this mailing list, it's just because I want to find another way to use this function under windows system
function pgp_encrypt($keyring_location, $public_key_id, $plain_text) { $key_id = EscapeShellArg($public_key_id); putenv("PGPPATH=$keyring_location"); // encrypt the message $pipe = popen("pgpe -r $key_id -af", "r"); fwrite($pipe, $plain_text); $encrypted_text = ''; while($s = fgets($pipe, 1024)) { // read from the pipe $encrypted_text .= $s; } pclose($pipe); return $encrypted_text; }
thanks for the tip on winPT, I will try it and will post the code of the function I will developp if some are interest in...
_____________________________________________________________________ GRAND JEU SMS : Pour gagner un NOKIA 7650, envoyez le mot IF au 61321 (prix d'un SMS + 0.35 euro). Un SMS vous dira si vous avez gagné. Règlement : http://www.ifrance.com/_reloc/sign.sms
attached mail follows:
Hi
I'm having dramers with fscanf I have a line: text, text, text
I can't work out how to scan removing the comma and whitespace. the text can be absolutle anything.
at the moment I have $array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]);
Thanks
Kris
attached mail follows:
Why not:
$array = split("[ ,]", $line);
?
On Wed, 22 Jan 2003, Kris wrote:
> Hi > > I'm having dramers with fscanf > I have a line: > text, text, text > > I can't work out how to scan removing the comma and whitespace. > the text can be absolutle anything. > > at the moment I have > $array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > > Thanks > > Kris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
I think he is looking more for: $array = fscanf ($fp, "%s, %s, %s\n");
But with split, wouldn't that need to be:
$array = split(', ', $line);
http://www.php.net/manual/en/function.split.php or
$array = preg_split ('/[\s,]+/', $line); using: http://www.php.net/manual/en/function.preg-split.php
HTH, Jason k Larson
Philip Hallstrom wrote: > Why not: > > $array = split("[ ,]", $line); > > ? > > On Wed, 22 Jan 2003, Kris wrote: > > >>Hi >> >>I'm having dramers with fscanf >>I have a line: >>text, text, text >> >>I can't work out how to scan removing the comma and whitespace. >>the text can be absolutle anything. >> >>at the moment I have >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); >> >>Thanks >> >>Kris
attached mail follows:
I've tried $array = fscanf ($fp, "%s, %s, %s\n"); earlier. It picks up array[0] == text,
I need array[0] == text array[1] == text array[2] == text
Thanx
K
----- Original Message -----
From: "Jason k Larson" <jlarson
candlefire.org>
To: "Kris" <kreid2
bigpond.net.au>
Cc: <php-general
lists.php.net>
Sent: Wednesday, January 22, 2003 9:52 AM
Subject: Re: [PHP] Re: fscanf
> I think he is looking more for: > $array = fscanf ($fp, "%s, %s, %s\n"); > > But with split, wouldn't that need to be: > > $array = split(', ', $line); > > http://www.php.net/manual/en/function.split.php > or > > $array = preg_split ('/[\s,]+/', $line); > using: http://www.php.net/manual/en/function.preg-split.php > > HTH, > Jason k Larson > > > Philip Hallstrom wrote: > > Why not: > > > > $array = split("[ ,]", $line); > > > > ? > > > > On Wed, 22 Jan 2003, Kris wrote: > > > > > >>Hi > >> > >>I'm having dramers with fscanf > >>I have a line: > >>text, text, text > >> > >>I can't work out how to scan removing the comma and whitespace. > >>the text can be absolutle anything. > >> > >>at the moment I have > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]); > >> > >>Thanks > >> > >>Kris > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >
attached mail follows:
Given the information below this works:
<?php
$string ="text1, text2, text3"; $array = preg_split("/[, ]/", $string, -1, PREG_SPLIT_NO_EMPTY); echo "|" . $array[0] . "|" . $array[1] . "|" . $array[2] . "|";
?>
I put it between pipes to confirm the absence of spaces...
It may or may not be the best way, but it is one way.
Brian
> -----Original Message-----
> From: Kris [mailto:kreid2
bigpond.net.au]
> Sent: Tuesday, January 21, 2003 5:02 PM
> To: Jason k Larson
> Cc: php-general
lists.php.net
> Subject: Re: [PHP] Re: fscanf
>
>
> I've tried
> $array = fscanf ($fp, "%s, %s, %s\n");
> earlier. It picks up
> array[0] == text,
>
> I need
> array[0] == text
> array[1] == text
> array[2] == text
>
> Thanx
>
> K
>
> ----- Original Message -----
> From: "Jason k Larson" <jlarson
candlefire.org>
> To: "Kris" <kreid2
bigpond.net.au>
> Cc: <php-general
lists.php.net>
> Sent: Wednesday, January 22, 2003 9:52 AM
> Subject: Re: [PHP] Re: fscanf
>
>
> > I think he is looking more for:
> > $array = fscanf ($fp, "%s, %s, %s\n");
> >
> > But with split, wouldn't that need to be:
> >
> > $array = split(', ', $line);
> >
> > http://www.php.net/manual/en/function.split.php
> > or
> >
> > $array = preg_split ('/[\s,]+/', $line);
> > using: http://www.php.net/manual/en/function.preg-split.php
> >
> > HTH,
> > Jason k Larson
> >
> >
> > Philip Hallstrom wrote:
> > > Why not:
> > >
> > > $array = split("[ ,]", $line);
> > >
> > > ?
> > >
> > > On Wed, 22 Jan 2003, Kris wrote:
> > >
> > >
> > >>Hi
> > >>
> > >>I'm having dramers with fscanf
> > >>I have a line:
> > >>text, text, text
> > >>
> > >>I can't work out how to scan removing the comma and whitespace.
> > >>the text can be absolutle anything.
> > >>
> > >>at the moment I have
> > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]);
> > >>
> > >>Thanks
> > >>
> > >>Kris
> >
> >
> >
> > --
> > 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:
Thanx Brian...Works good enough for me :)
K
----- Original Message -----
From: "Brian T. Allen" <brian
gzmarketing.com>
To: "'Kris'" <kreid2
bigpond.net.au>; "'Jason k Larson'"
<jlarson
candlefire.org>
Cc: <php-general
lists.php.net>
Sent: Wednesday, January 22, 2003 10:58 AM
Subject: RE: [PHP] Re: fscanf
> Given the information below this works:
>
> <?php
>
> $string ="text1, text2, text3";
> $array = preg_split("/[, ]/", $string, -1, PREG_SPLIT_NO_EMPTY);
> echo "|" . $array[0] . "|" . $array[1] . "|" . $array[2] . "|";
>
> ?>
>
> I put it between pipes to confirm the absence of spaces...
>
> It may or may not be the best way, but it is one way.
>
> Brian
>
> > -----Original Message-----
> > From: Kris [mailto:kreid2
bigpond.net.au]
> > Sent: Tuesday, January 21, 2003 5:02 PM
> > To: Jason k Larson
> > Cc: php-general
lists.php.net
> > Subject: Re: [PHP] Re: fscanf
> >
> >
> > I've tried
> > $array = fscanf ($fp, "%s, %s, %s\n");
> > earlier. It picks up
> > array[0] == text,
> >
> > I need
> > array[0] == text
> > array[1] == text
> > array[2] == text
> >
> > Thanx
> >
> > K
> >
> > ----- Original Message -----
> > From: "Jason k Larson" <jlarson
candlefire.org>
> > To: "Kris" <kreid2
bigpond.net.au>
> > Cc: <php-general
lists.php.net>
> > Sent: Wednesday, January 22, 2003 9:52 AM
> > Subject: Re: [PHP] Re: fscanf
> >
> >
> > > I think he is looking more for:
> > > $array = fscanf ($fp, "%s, %s, %s\n");
> > >
> > > But with split, wouldn't that need to be:
> > >
> > > $array = split(', ', $line);
> > >
> > > http://www.php.net/manual/en/function.split.php
> > > or
> > >
> > > $array = preg_split ('/[\s,]+/', $line);
> > > using: http://www.php.net/manual/en/function.preg-split.php
> > >
> > > HTH,
> > > Jason k Larson
> > >
> > >
> > > Philip Hallstrom wrote:
> > > > Why not:
> > > >
> > > > $array = split("[ ,]", $line);
> > > >
> > > > ?
> > > >
> > > > On Wed, 22 Jan 2003, Kris wrote:
> > > >
> > > >
> > > >>Hi
> > > >>
> > > >>I'm having dramers with fscanf
> > > >>I have a line:
> > > >>text, text, text
> > > >>
> > > >>I can't work out how to scan removing the comma and whitespace.
> > > >>the text can be absolutle anything.
> > > >>
> > > >>at the moment I have
> > > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]);
> > > >>
> > > >>Thanks
> > > >>
> > > >>Kris
> > >
> > >
> > >
> > > --
> > > 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
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
Actually found a little problem
I forgot to mention some lines can be
text, t e x t, te xt t e xt, text, text
This splits it into more then 3 parts. Any ideas on this? Shouldn't I be able to use just fscanf to get the results I'm after??
Thanks
K
----- Original Message -----
From: "Brian T. Allen" <brian
gzmarketing.com>
To: "'Kris'" <kreid2
bigpond.net.au>; "'Jason k Larson'"
<jlarson
candlefire.org>
Cc: <php-general
lists.php.net>
Sent: Wednesday, January 22, 2003 10:58 AM
Subject: RE: [PHP] Re: fscanf
> Given the information below this works:
>
> <?php
>
> $string ="text1, text2, text3";
> $array = preg_split("/[, ]/", $string, -1, PREG_SPLIT_NO_EMPTY);
> echo "|" . $array[0] . "|" . $array[1] . "|" . $array[2] . "|";
>
> ?>
>
> I put it between pipes to confirm the absence of spaces...
>
> It may or may not be the best way, but it is one way.
>
> Brian
>
> > -----Original Message-----
> > From: Kris [mailto:kreid2
bigpond.net.au]
> > Sent: Tuesday, January 21, 2003 5:02 PM
> > To: Jason k Larson
> > Cc: php-general
lists.php.net
> > Subject: Re: [PHP] Re: fscanf
> >
> >
> > I've tried
> > $array = fscanf ($fp, "%s, %s, %s\n");
> > earlier. It picks up
> > array[0] == text,
> >
> > I need
> > array[0] == text
> > array[1] == text
> > array[2] == text
> >
> > Thanx
> >
> > K
> >
> > ----- Original Message -----
> > From: "Jason k Larson" <jlarson
candlefire.org>
> > To: "Kris" <kreid2
bigpond.net.au>
> > Cc: <php-general
lists.php.net>
> > Sent: Wednesday, January 22, 2003 9:52 AM
> > Subject: Re: [PHP] Re: fscanf
> >
> >
> > > I think he is looking more for:
> > > $array = fscanf ($fp, "%s, %s, %s\n");
> > >
> > > But with split, wouldn't that need to be:
> > >
> > > $array = split(', ', $line);
> > >
> > > http://www.php.net/manual/en/function.split.php
> > > or
> > >
> > > $array = preg_split ('/[\s,]+/', $line);
> > > using: http://www.php.net/manual/en/function.preg-split.php
> > >
> > > HTH,
> > > Jason k Larson
> > >
> > >
> > > Philip Hallstrom wrote:
> > > > Why not:
> > > >
> > > > $array = split("[ ,]", $line);
> > > >
> > > > ?
> > > >
> > > > On Wed, 22 Jan 2003, Kris wrote:
> > > >
> > > >
> > > >>Hi
> > > >>
> > > >>I'm having dramers with fscanf
> > > >>I have a line:
> > > >>text, text, text
> > > >>
> > > >>I can't work out how to scan removing the comma and whitespace.
> > > >>the text can be absolutle anything.
> > > >>
> > > >>at the moment I have
> > > >>$array = fscanf ($fp, %s%[^,] %s%[^,] %s%[^,]);
> > > >>
> > > >>Thanks
> > > >>
> > > >>Kris
> > >
> > >
> > >
> > > --
> > > 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
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
attached mail follows:
if ( $_POST['passwd'] != $db['password'] )
{ header("Location: loginfailed.html"); exit;
}
----- Original Message -----
From: "Shams" <shamskhanmalik
hotmail.com>
To: <>
Sent: Tuesday, January 21, 2003 3:48 AM
Subject: [PHP] $header = "Location:........" being ignored!
Hi Group,
I basically have some simple code such as:
==================================================
if ( $_POST['passwd'] != $db['password'] { header("Location: loginfailed.html"); }
//else
$header = "Location: success.html";
==================================================
however, when I run this code, using a <FORM> to submit password, username, etc...... if the passwords do not match, the page is forwarded to success.html !
Is there anything obvious that I am doing wrong?
Thanks, Shams
p.s. I don't want to use else{} because I have lots of if() checks!
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
SELECT risk_level, COUNT(*) FROM mytable GROUP BY risk_level;
----- Original Message -----
From: "[-^-!-%-" <monfort
engineering.sdsu.edu>
To: <php-general
lists.php.net>
Sent: Tuesday, January 21, 2003 6:06 AM
Subject: [PHP] ADV SQL Help Needed.
Hello everyone,
I need help with the following query.
I have a table with a column named 'RISK_LEVEL'. RISK_LEVEL can hold three values: Low, Moderate, and High.
I need a query that counts the number of occurences of each option. Now, I know I can do
'select count(risk_level) as levelCount where risk_level=low'
for each level (low, moderate, and high). But, I was wondering if there's anyway to merge the queries into one.
I'm looking for something like
"select count(risk_level='low') as lowCount, count(risk_level='moderate')as modCount, count(risk_level='high') as highCount "
Which will return, lowCount = 1 , modCount=3, and highCount=1, for table with
id | risk_level 1 | low 2 | moderate 3 | moderate 4 | high 5 | moderate
How do you do it? Can tha be done?
When I run the code above, I get the same number for each record. i.e. lowCount, modCount, and highCount all come out to 5--which is the number of records in the table.
Is this possible, or should I just run multiple queries? Please help.
=P e p i e D e s i g n s www.pepiedesigns.com Providing Solutions That Increase Productivity
Web Developement. Database. Hosting. Multimedia.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple:
. . . setcookie("testCookie", "testValue", time() + 3600, "/"); header("Location: http://newpage.php"); exit;
Later, I pull the cookie:
echo $_COOKIE["testCookie"];
and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set?
Thanks a ton!
Mike
attached mail follows:
--- Mike Potter <mike
mikenbob.com> wrote:
> I am using Microsoft IIS with the latest PHP installed.
> Here's a smple:
>
> setcookie("testCookie", "testValue", time() + 3600, "/");
> header("Location: http://newpage.php");
> exit;
This will not work with IIS. You need to use a meta refresh or something to work around it. You can find out more here:
http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2
Chris
attached mail follows:
Discussion on this list has suggested that it can work if PHP is set to run as ISAPI, not CGI.
HTH, Jason k Larson
Mike Potter wrote: > HELP! > I know I'm new at this so please don't laugh. But I can't get this to work! > I am using Microsoft IIS with the latest PHP installed. > Here's a smple: > > . > . > . > setcookie("testCookie", "testValue", time() + 3600, "/"); > header("Location: http://newpage.php"); > exit; > > > Later, I pull the cookie: > > echo $_COOKIE["testCookie"]; > > and there is no value. If I don't use the header function at the end, and > write something to the page, it works fine. > Why does this cookie not get set? > > Thanks a ton! > > Mike
attached mail follows:
Mike IIRC this is a known bug with IIS (not PHP) when it gets the http redirect it junks the cookie - sorry I can't remember much more detail than that... Workaround maybe is to spit out an HTML based META refresh redirect tag instead of using the header() call. HTH Rich
-----Original Message-----
From: Mike Potter [mailto:mike
mikenbob.com]
Sent: 21 January 2003 15:35
To: php-general
lists.php.net
Subject: [PHP] setcooke(...) before header("Location: XYZ") - Cookie
doesn't set!
HELP! I know I'm new at this so please don't laugh. But I can't get this to work! I am using Microsoft IIS with the latest PHP installed. Here's a smple:
. . . setcookie("testCookie", "testValue", time() + 3600, "/"); header("Location: http://newpage.php"); exit;
Later, I pull the cookie:
echo $_COOKIE["testCookie"];
and there is no value. If I don't use the header function at the end, and write something to the page, it works fine. Why does this cookie not get set?
Thanks a ton!
Mike
attached mail follows:
Do you know how do do this?
Thanks, Mike
"Jason K Larson" <jlarson
candlefire.org> wrote in message
news:3E2DDD9C.7050009
candlefire.org...
> Discussion on this list has suggested that it can work if PHP is set to
> run as ISAPI, not CGI.
>
> HTH,
> Jason k Larson
>
>
> Mike Potter wrote:
> > HELP!
> > I know I'm new at this so please don't laugh. But I can't get this to
work!
> > I am using Microsoft IIS with the latest PHP installed.
> > Here's a smple:
> >
> > .
> > .
> > .
> > setcookie("testCookie", "testValue", time() + 3600, "/");
> > header("Location: http://newpage.php");
> > exit;
> >
> >
> > Later, I pull the cookie:
> >
> > echo $_COOKIE["testCookie"];
> >
> > and there is no value. If I don't use the header function at the end,
and
> > write something to the page, it works fine.
> > Why does this cookie not get set?
> >
> > Thanks a ton!
> >
> > Mike
>
>
attached mail follows:
[top-posting fixed]
>"Jason K Larson" <jlarson
candlefire.org> wrote in message
>news:3E2DDD9C.7050009
candlefire.org...
>> Discussion on this list has suggested that it can work if PHP is set to
>> run as ISAPI, not CGI.
>>
>Do you know how do do this?
Although using the ISAPI dll version of PHP would definitely work, that's a bit of a drastic solution. Chris has pointed you in the direction of a workaround. Why don't you give it a shot and if you can't get it working send another message to myself or the list:
http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2
attached mail follows:
Follow the ISAPI module install instructions.
http://www.php.net/manual/en/install.iis.php
Regards, Jason k Larson
Mike Potter wrote:
> Do you know how do do this?
>
> Thanks,
> Mike
>
>
> "Jason K Larson" wrote in message
> news:3E2DDD9C.7050009
candlefire.org...
>
> >Discussion on this list has suggested that it can work if PHP is set to
> >run as ISAPI, not CGI.
> >
> >HTH,
> >Jason k Larson
> >
> >
> >Mike Potter wrote:
> >
> >>HELP!
> >>I know I'm new at this so please don't laugh. But I can't get this to
>
> work!
>
> >>I am using Microsoft IIS with the latest PHP installed.
> >>Here's a smple:
> >>
> >>.
> >>.
> >>.
> >>setcookie("testCookie", "testValue", time() + 3600, "/");
> >>header("Location: http://newpage.php");
> >>exit;
> >>
> >>
> >>Later, I pull the cookie:
> >>
> >>echo $_COOKIE["testCookie"];
> >>
> >>and there is no value. If I don't use the header function at the end,
>
> and
>
> >>write something to the page, it works fine.
> >>Why does this cookie not get set?
> >>
> >>Thanks a ton!
> >>
> >>Mike
attached mail follows:
I tried a test file with this, and the form is sent, and the nph-test2.php file returns this
Status: 302 Content-type: text/html X-Powered-By: PHP/4.3.0 Location: test.php Set-Cookie: testcookie=test
Here is my code:
<?php header("HTTP/1.0 302 Redirect"); header("Location: test.php"); header("Set-Cookie: testcookie=test"); ?>
Thanks for your time.
Mike
"Michael Sims" <mhsims
midsouth.rr.com> wrote in message
news:881s2vsfpndvia28ho2a1dniupkdfpbco3
4ax.com...
[top-posting fixed]
>"Jason K Larson" <jlarson
candlefire.org> wrote in message
>news:3E2DDD9C.7050009
candlefire.org...
>> Discussion on this list has suggested that it can work if PHP is set to
>> run as ISAPI, not CGI.
>>
>Do you know how do do this?
Although using the ISAPI dll version of PHP would definitely work, that's a bit of a drastic solution. Chris has pointed you in the direction of a workaround. Why don't you give it a shot and if you can't get it working send another message to myself or the list:
http://marc.theaimsgroup.com/?l=php-general&m=102929828515647&w=2
attached mail follows:
I tried this one as well. When trying to load, the browser says HTTP 500 - Internal server error Internet Explorer
I even rebooted! Mike
"Jason K Larson" <jlarson
candlefire.org> wrote in message
news:3E2E0493.1090806
candlefire.org...
> Follow the ISAPI module install instructions.
>
> http://www.php.net/manual/en/install.iis.php
>
> Regards,
> Jason k Larson
>
>
> Mike Potter wrote:
>
> > Do you know how do do this?
> >
> > Thanks,
> > Mike
> >
> >
> > "Jason K Larson" wrote in message
> > news:3E2DDD9C.7050009
candlefire.org...
> >
> > >Discussion on this list has suggested that it can work if PHP is set to
> > >run as ISAPI, not CGI.
> > >
> > >HTH,
> > >Jason k Larson
> > >
> > >
> > >Mike Potter wrote:
> > >
> > >>HELP!
> > >>I know I'm new at this so please don't laugh. But I can't get this to
> >
> > work!
> >
> > >>I am using Microsoft IIS with the latest PHP installed.
> > >>Here's a smple:
> > >>
> > >>.
> > >>.
> > >>.
> > >>setcookie("testCookie", "testValue", time() + 3600, "/");
> > >>header("Location: http://newpage.php");
> > >>exit;
> > >>
> > >>
> > >>Later, I pull the cookie:
> > >>
> > >>echo $_COOKIE["testCookie"];
> > >>
> > >>and there is no value. If I don't use the header function at the end,
> >
> > and
> >
> > >>write something to the page, it works fine.
> > >>Why does this cookie not get set?
> > >>
> > >>Thanks a ton!
> > >>
> > >>Mike
>
attached mail follows:
On Tue, 21 Jan 2003 20:17:40 -0700, you wrote:
>I tried a test file with this, and the form is sent, and the nph-test2.php >file returns this > >Status: 302 >Content-type: text/html >X-Powered-By: PHP/4.3.0 >Location: test.php >Set-Cookie: testcookie=test
I'm a bit confused. Is it working for you now, or not? What do you mean by "returns"....is the above sent as an HTTP response header? Or does this show up in the body of the response? Since the above contains the 'Set-Cookie' directive (which IIS would normally strip out) it should be working...
attached mail follows:
----- Original Message -----
From: <posting-system
google.com>
To: <soazine
erols.com>
Sent: Tuesday, January 21, 2003 5:36 PM
Subject: I need my PHP script to call a TCL proc
> From: soazine
erols.com (Phil Powell)
> Newsgroups: comp.lang.tcl,comp.lang.php
> Subject: I need my PHP script to call a TCL proc
> NNTP-Posting-Host: 65.201.150.91
> Message-ID: <1cdca2a7.0301211436.3950d68a
posting.google.com>
>
> It's either that my PHP script call a working TCL proc that converts
> all string text that looks like a URL ("http://...") into a hyperlink,
> or does someone have a PHP equivalent to do it? My PHP function
> VALIDATE_URL fails to do any conversion in its regexp, however, the
> TCL proc works every time, and the matching pattern is nearly
> identical in both!
>
> TCL:
>
> proc VALIDATE_URL {contents} {
> regsub -all "\\n" $contents "<br>" contents
> regsub -all {\.{2,}} $contents {. .} contents
> regsub -all
{(http://([a-zA-Z0-9_\-]+\.)+(/[a-zA-Z0-9_\-\.\~\^,%\+]+)*[^<\(\)>
> ]+)} $contents "<a href=\\1 target=_new><font
> style='text-decoration:none'>\\1</font></a>" contents
> regsub -all {\. \.} $contents {..} contents
> return $contents
> }
>
> PHP:
>
> function VALIDATE_URL($contents) {
> $contents = preg_replace("/\\n/e", '<br>', $contents);
> $contents = preg_replace('/\.{2,}/e', '. .', $contents);
> $contents =
preg_replace('/http[s]?:\/\/\([a-zA-Z0-9_\-]+\.\)+\(\/[a-zA-Z0-9_\-\.\~\^,%\
+]+\)*[^<\\(\\)>
> ]+\)/ei', "<a href=\\\\1 target=_new>\\\\1</a>", $contents);
> return preg_replace('/\. \./e', '..', $contents);
> }
>
> So who wins, TCL or PHP?
>
> Thanx
> Phil
attached mail follows:
Does anyone have any experience with or comments on blueshoes? I've not investigated it much, as the license seems a bit odd, but I thought I'd get some info on it if anyone had any, so far I haven't found anyone who has tried it, which seems a tad weird to me.
Cheers, Wes
attached mail follows:
If you are looking for Frameworks make sure you select one that you understand the internals of not just because it will reduce your dev time as sooner rather than later something in the internals will fail and you will need to deal with it or your rapid dev becomes the slowest on the planet.
Also look at the overheads some of these frameworks create as you will as long as you continue to use it have those inherited overheads.
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Weston Houghton [mailto:weslists
anapraxis.com]
> Sent: Wednesday, 22 January 2003 10:02 AM
> To: php-general
lists.php.net
> Subject: [PHP] Blueshoes App Framework
>
>
>
> Does anyone have any experience with or comments on
> blueshoes? I've not
> investigated it much, as the license seems a bit odd, but I
> thought I'd
> get some info on it if anyone had any, so far I haven't found anyone
> who has tried it, which seems a tad weird to me.
>
http://www.blueshoes.org/
Cheers, Wes
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
G'day all
I have a calculation which gives me a number ie 6976587.4169922 This number is works outed by dividing a variable with 1024
Is there any way to strip anything after the . so I just want the number 6976587 and not anything after the .
Thanks CJ
attached mail follows:
I just found the answer
-----Original Message-----
From: cj [mailto:cj
itonsite.com.au]
Sent: Wednesday, 22 January 2003 11:07 AM
To: Php-List (E-mail)
Subject: [PHP] numbers
G'day all
I have a calculation which gives me a number ie 6976587.4169922 This number is works outed by dividing a variable with 1024
Is there any way to strip anything after the . so I just want the number 6976587 and not anything after the .
Thanks CJ
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Which, for the list, can be number_format(), among other things.
Brian
> -----Original Message-----
> From: cj [mailto:cj
itonsite.com.au]
> Sent: Tuesday, January 21, 2003 5:18 PM
> To: Php-List (E-mail)
> Subject: RE: [PHP] numbers
>
>
> I just found the answer
>
> -----Original Message-----
> From: cj [mailto:cj
itonsite.com.au]
> Sent: Wednesday, 22 January 2003 11:07 AM
> To: Php-List (E-mail)
> Subject: [PHP] numbers
>
>
> G'day all
>
> I have a calculation which gives me a number ie 6976587.4169922
> This number is works outed by dividing a variable with 1024
>
> Is there any way to strip anything after the .
> so I just want the number 6976587 and not anything after the .
>
> Thanks
> CJ
>
> --
> 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:
I used the floor() function
-----Original Message-----
From: Brian T. Allen [mailto:brian
gzmarketing.com]
Sent: Wednesday, 22 January 2003 11:49 AM
To: cj
itonsite.com.au; 'Php-List (E-mail)'
Subject: RE: [PHP] numbers
Which, for the list, can be number_format(), among other things.
Brian
> -----Original Message-----
> From: cj [mailto:cj
itonsite.com.au]
> Sent: Tuesday, January 21, 2003 5:18 PM
> To: Php-List (E-mail)
> Subject: RE: [PHP] numbers
>
>
> I just found the answer
>
> -----Original Message-----
> From: cj [mailto:cj
itonsite.com.au]
> Sent: Wednesday, 22 January 2003 11:07 AM
> To: Php-List (E-mail)
> Subject: [PHP] numbers
>
>
> G'day all
>
> I have a calculation which gives me a number ie 6976587.4169922
> This number is works outed by dividing a variable with 1024
>
> Is there any way to strip anything after the .
> so I just want the number 6976587 and not anything after the .
>
> Thanks
> CJ
>
> --
> 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
>
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi,
Friday night I upgrade my server with the following:
Apache 1.3.27 PHP 4.3.0 MySQL 3.23.54a Mod_SSL 2.8.12 OpenSSL 0.9.7 ZendOptimizer 2.1.0
Immediately I started having really weird problems that proved almost impossible to debug.
I finally narrowed it down to a few lines of code that get included at the top of all the pages:
<?php if(!$REFER_SITE){ $REFER_SITE = $HTTP_REFERER; session_register("REFER_SITE"); } ?>
(I already know about the register_globals thing and I'm working on getting rid of it, but that will be a long road)...
If both $REFER_SITE and $HTTP_REFERER are uninitialized ($HTTP_REFERER may only be empty) then session_register() kills the database connection on the page and none of my queries work...
mysql_error() simply shows "Query was empty".
I created an otherwise empty page that had only the code above, a database connection, and a query and confirmed that this is the case.
I bring this to the list only to help others avoid the same 3 days of nightmarish hell I've just enjoyed on a large production site with goblins... And to confirm that the above is correct and seek possible long term solutions.
Adding this line above session_register() is a temporary solution:
if(!$REFER_SITE){ $REFER_SITE = ""; }
Thanks all!
Brian Allen
brian
gzmarketing.com
attached mail follows:
Is there a free ware program that will, allow me to take mysql dbase and convert it to ms ascess? Thanks Karl
attached mail follows:
what did you find with a google search? ----- Original Message ----- From: Karl James To: php Sent: Monday, January 20, 2003 7:01 PM Subject: [PHP] Read Mysql & Access
Is there a free ware program that will, allow me to take mysql dbase and convert it to ms ascess?
Thanks Karl ____________________________________________________ IncrediMail - Email has finally evolved - Click Here
attached mail follows:
howdy all,
a page with a link to a pop up window.. when a user clicks on it a window opens with a little form on it, now what i want to happen is when the user hits submit and it does all of it's processing it
1) closes the popup window 2) updates the original page where the user first started either by just a refresh or what eva.. and I can't just use meta refreash as it's only on this instance that the page needs to be refreashed ..
TIA
Peter
attached mail follows:
Post the results to the target being the parent window and have a JavaScript self.close() call on the window on submit/click.
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Peter Houchin [mailto:php
vfsa.com.au]
> Sent: Wednesday, 22 January 2003 11:13 AM
> To: php gen
> Subject: [PHP] working with pop up windows
>
>
> howdy all,
>
> a page with a link to a pop up window..
> when a user clicks on it a window opens with a little form on
> it, now what i want to happen is when the user hits submit
> and it does all of it's processing it
>
> 1) closes the popup window
> 2) updates the original page where the user first started
> either by just a refresh or what eva.. and I can't just use
> meta refreash as it's only on this instance that the page
> needs to be refreashed ..
>
> TIA
>
> Peter
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
ahh shoot!!!
forgot to add the values of the form once submitted go to another page before it's ment to go back to the parent page..
-----Original Message-----
From: Timothy Hitchens (HiTCHO) [mailto:hitcho
php.net]
Sent: Wednesday, 22 January 2003 11:18 AM
To: 'Peter Houchin'; 'php gen'
Subject: RE: [PHP] working with pop up windows
Post the results to the target being the parent window and have a JavaScript self.close() call on the window on submit/click.
Timothy Hitchens (HiTCHO)
Open Source Consulting
e-mail: tim
hitcho.com.au
> -----Original Message-----
> From: Peter Houchin [mailto:php
vfsa.com.au]
> Sent: Wednesday, 22 January 2003 11:13 AM
> To: php gen
> Subject: [PHP] working with pop up windows
>
>
> howdy all,
>
> a page with a link to a pop up window..
> when a user clicks on it a window opens with a little form on
> it, now what i want to happen is when the user hits submit
> and it does all of it's processing it
>
> 1) closes the popup window
> 2) updates the original page where the user first started
> either by just a refresh or what eva.. and I can't just use
> meta refreash as it's only on this instance that the page
> needs to be refreashed ..
>
> TIA
>
> Peter
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
If I have a text of string like this:
$stuff = "Hi my name is Phil, my email is xx
yy.com and you can find me at yy.com">http://www.xx.yy?username=xx
yy.com";
What I want to do is to "validate" all patterns resembling an email address EXCEPT those found within the query string of a URL. I would want to to urlencode(\\1) somehow onto the email address pattern found within the query string of the URL to ensure that it is not "validated" like any other email address (validate means to convert xx
yy.com to <a href=mailto:xx
yy.com>xx
yy.com</a>).
Can anyone figure this out for me? I tried using pattern matching and eval() but the results were completely wrong:
function VALIDATE_URL($stuff) {
$stuff = preg_replace('/[\n\r]/', '<br>', $stuff);
$stuff = preg_replace('/\.\./', ' . .', $stuff);
// URL ESCAPE ALL EMAIL ADDRESSES FOUND WITHIN QUERY STRINGS TO ENSURE PROPER VALIDATION
// IF USING VALIDATE_EMAIL
$stuff = preg_replace('/([\?&][a-zA-Z0-9]+=)([a-zA-Z0-9_\-\.]+
([a-zA-Z0-9_\-]+\.)+[a-zA-Z0-9_\-]+)/', '\\1' . '<? $stuff = urlencode("\\2"); echo $stuff; ?>', $stuff);
$stuff = eval('?>' . $stuff);
$stuff = preg_replace('/(http[s]?:\/\/([a-zA-Z0-9_\-]+\.)+(\/[a-zA-Z0-9_\-\.\~\^,%\+]+)*[^<\(\)> ]+)/', '<a href=\\1 target=_new>\\1</a>', $stuff);
return preg_replace('/ \. \./', '..', $stuff);
}
Thanx Phil
attached mail follows:
Hi all.
2nd try -- Is the following possible to work around, or is it a bug that I should be reporting?
I'm having issues uploading files whose names don't necessarily end with the correct extension, in particular text files which don't end in .txt. (Why they don't is complicated, and it's impractical to insist that they must.) The files are received, but altered -- they are prepended with binary data which makes them difficult to deal with in an elegant automated way.
No doubt this is a mime type issue, as the files are received as type "application/x-macbinary" when sent from OSX Explorer. Is there any way to force plain text, or raw data? All I want to happen is for the files to be uploaded completely unchanged.
Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on OpenBSD.
Thanks,
Alex
af
ax-im.com
attached mail follows:
I'm trying to compare two objects with == and === and getting the following error message:
Fatal error: Nesting level too deep - recursive dependency?
The object has several child objects which hold a reference to the parent in them.
I want to check the reference in the child object to make sure that it is the correct parent object.
This is part of a sanity check for debugging purposes. Its quite easy to forget one & somewhere when dealing with the parent which causes a copy to be made. The child objects in the copy then no longer point to the parent that is active (the copy), but instead point to the original parent. This manifests itself in subtle errors revolving around the changes to the parent after the copy was made. I would like to detect this situation.
Is there a workaround for this object comparison which involves determining if two variables reference the same object?
Thanks.
attached mail follows:
I'm trying to figure out if there is an easy way to measure how long my queries in PHP/MySQL are taking to execute.
Any tips or code examples most appreciated.
Thanks,
Peter Janett
New Media One Web Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New Upgrades Are Now Live!!! Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1 Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25, Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PostgreSQL coming soon!
http://www.newmediaone.net
webmaster
newmediaone.net
(303)828-9882
attached mail follows:
On Wednesday 22 January 2003 14:45, Peter Janett wrote: > I'm trying to figure out if there is an easy way to measure how long my > queries in PHP/MySQL are taking to execute.
Using microtime() before and after your query will give you an rough idea.
-- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* So much food; so little time! */
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]