|
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: Wed Jul 03 2002 - 10:59:10 CDT
php-general Digest 3 Jul 2002 15:59:10 -0000 Issue 1442
Topics (messages 105121 through 105228):
Re: Help and advice sought - search/replace
105121 by: Richard Lynch
Re: Strings with embedded quotes and double quotes
105122 by: Richard Lynch
Re: SESSION newbie question
105123 by: Richard Lynch
Re: Setting a cookie and redirecting
105124 by: Richard Lynch
105125 by: Richard Lynch
105154 by: Cord Schneider
105180 by: Erik Price
Re: Will mail() function work for SMTP servers which needs Authentication
105126 by: Jason Wong
105127 by: Balaji Ankem
105128 by: Jason Wong
105129 by: Manuel Lemos
TEST-PLEASE IGNORE
105130 by: Lord Loh.
Does Location: headers constantly
105131 by: Henry
Find all combinations of numbers
105132 by: Michael Benbow
105136 by: Martin Towell
Re: help with PHPwebsite
105133 by: admin
Re: Dealing with XML charsets
105134 by: Peter
105135 by: Peter
105178 by: B i g D o g
Re: svg graphics and php : is it possible
105137 by: William S.
Re: synchronizing php functions
105138 by: Philip MacIver
105188 by: Erik Price
Re: DOCUMENT_ROOT disappeared on me!
105139 by: Jesper Brunholm
Re: Help please!
105140 by: joakim.andersson.cybercom.se
$this in an XML data handler ... in a class
105141 by: Clay Loveless
105190 by: Peter Clarke
Installation de PHP 4.2.1 with Apache and extension Frontpage 200 2
105142 by: Claudio Valgoi
105161 by: Aaron Gould
Program executing in PHP. Please help
105143 by: Latex Master
Submitting Form Data
105144 by: Mark Colvin
105152 by: 1LT John W. Holmes
PHP and COM - Excel
105145 by: MindHunter
Problem With ora_do
105146 by: Grimes, Dean
How do I split an alphabetical list (array) into A-M and N-Z?
105147 by: Daevid Vincent
105156 by: Jason Wong
105159 by: Martin Clifford
105220 by: Joshua E Minnie
Simple Example of Passing on a file through a PHP script
105148 by: JJ Harrison
105165 by: joakim.andersson.cybercom.se
105167 by: 1LT John W. Holmes
Displaying the table records along with check boxes.
105149 by: Balaji Ankem
105151 by: 1LT John W. Holmes
105155 by: Balaji Ankem
Stock Prices
105150 by: David Russell
105219 by: Analysis & Solutions
revecom + php
105153 by: val petruchek
whats wrong with this function
105157 by: Adrian Murphy
105162 by: Jason Wong
105163 by: 1LT John W. Holmes
105172 by: Adrian Murphy
105179 by: Stuart Dallas
105186 by: Adrian Murphy
Re: cURL in an exec() . more
105158 by: jay.blanchard.niicommunications.com
105166 by: Latex Master
105168 by: Jay Blanchard
105173 by: Latex Master
105176 by: Jay Blanchard
105182 by: Latex Master
105192 by: Scott Fletcher
105202 by: Jay Blanchard
105211 by: B i g D o g
105213 by: Latex Master
105215 by: Scott Fletcher
105216 by: Jason Wong
105217 by: Jay Blanchard
105224 by: Scott Fletcher
Compiling PHP with Java support on a virtual server
105160 by: Revathi
Why can't I get imagepstext to work?
105164 by: Victor Spång Arthursson
Re: RegEx question
105169 by: Tracker 1
105170 by: Tracker 1
Re: does a form submit from a http page to a https ensure secure data?
105171 by: Erik Price
Re: Where do I specify a DSN?
105174 by: Tracker 1
sample javascript popup+php - newbie
105175 by: adi
105204 by: Bogdan Stancescu
105227 by: adi
Re: blank (OT)
105177 by: Scott Fletcher
Re: $_POST into a formatted string, help!
105181 by: Scott Fletcher
105193 by: Erik Price
105199 by: 1LT John W. Holmes
Security: PHP: how to "harden" PHP scripts?
105183 by: Jean-Christian Imbeault
105225 by: Justin French
addslahes and magic quote woes
105184 by: Jean-Christian Imbeault
105187 by: Martin Clifford
105189 by: Jean-Christian Imbeault
105194 by: Erik Price
105195 by: Jean-Christian Imbeault
105196 by: 1LT John W. Holmes
105197 by: Latex Master
105198 by: 1LT John W. Holmes
105209 by: Erik Price
php execution a server side program updated problem please help
105185 by: Latex Master
PHP in South Africa
105191 by: MindHunter
V basic newbie problem
105200 by: Duncan Ellwood
105201 by: Jay Blanchard
105203 by: Scott Fletcher
105205 by: Ray Hunter
105206 by: Jay Blanchard
105207 by: Julie Meloni
105210 by: Martin Clifford
105214 by: Erik Price
$_SESSION (turned off, destory??)
105208 by: Scott Fletcher
using xsl:value-of select within form
105212 by: William S.
Re: php and apache path...
105218 by: Nightshade
105221 by: Erik Price
problem with submit-event script from php.net
105222 by: Dave - Technical Support
Re: Stupid PDF...
105223 by: Cord Schneider
Re: .htpasswd
105226 by: Chris Hewitt
15 pieces Puzzle
105228 by: Calin Uioreanu
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:
>> Just looking for a pointer or functions I can use to do this...
>>
>> I have a spreadsheet with a couple thousand entries that I'll be using for
>> populating a MySQL database. The spreadsheet has names listed in "last,
>> first" - the database I'll be populating has separate fields for first and
>> last names.
>>
>> I exported the names column from the spreadsheet in tab-delimited format
>and
>> I figured I could come up with a quick PHP script that would open the text
>> file, find each instance of ", ", take all that's before that delimiter
>and
>> move it after all that's after that delimiter, inserting a tab in between.
>> So "last, first" would become "first[tab]last".
>>
>> So far, I've gotten:
>> <?php
>> $filename = "NAMES.txt"; //name the file...
>> $fp = fopen($filename,"r+"); //open it...
>> echo "Reading $filename...";
>>
>> $contents = fread($filename, filesize($filename)); //read it...
>>
>> $names = explode("\n", $contents);
>>
>> foreach($names as $name);
>> echo "$name<br>";
>>
>> fclose($filename);
>> ?>
$file = file("NAMES.txt") or die("Could not open file");
$output = fopen("NAMES.out") or die("Could not open NAMES.out -- Do 'touch
NAMES.out; chmod 666 NAMES.out' REMOVE NAMES.out when DONE!!!");
while(list(,$line) = each($file)){
$fields = explode("\t", $fields);
$name = $fields[3]; # 3 is probably wrong... Which field is last, first?
$parts = explode(',', $name);
$last = trim($parts[0]);
$first = trim($parts[1]);
$fields[3] = $last; # Again, 3 is the old name field.
$fields[] = $first; # Take first name on to the end.
$newline = implode("\t", $fields);
$wrote = fputs($output, $newline);
if ($wrote != strlen($newline)){
echo "Only wrote $wrote of ", strlen($newline), " characters!<BR>\n";
}
-- Like Music? http://l-i-e.com/artists.htm
attached mail follows:
>I need to echo a string that contains both quotes and double >quotes. > >I remember doing this once using a special construct where the >string started on a new line with a triple slash if I remember well. Or >it was a triple something... > >I can't find the topic in the online PHP doc... > >Anybody remember this construct?
You are talking about "here docs":
It's something goofy like:
<<<HERE Blah blah blah HERE
Either <<< or >>>
But you don't really need that...
Just use \ in front of the kind of quotes you are using on the outside part:
$foo = 'You need to use \\ in front of any \'apostrophes\' but not "quotes" inside here'; $bar = "You need to use \\ in front of any \"quotes\" but not 'apostrophes' inside here";
-- Like Music? http://l-i-e.com/artists.htm
attached mail follows:
>www.net.co.cr/test/test.php
<? if ($QUERY_STRING == "") { session_start(); $_SESSION['tree'] = "green";
Change the line above to these two lines: session_register('tree'); $tree = 'green';
Think of $_SESSION (and the other $_XXX vars) as "read-only"
Use session_register() to say which variables should "live long and prosper" and then just use them like regular variables.
echo '<HTML> <HEAD> <TITLE>frame session test</TITLE> </HEAD>
<FRAMESET cols="165,*" border=0 frameborder=0 framespacing=0"> <FRAME SRC="?1.html" name="mainMenu" MARGINWIDTH="0" MARGINHEIGHT="0" border=0 frameborder=0 FRAMESPACING="0" NORESIZE SCROLLING="no"> <FRAME SRC="?2.html" name="right" MARGINWIDTH="0" WIDTH="0" border=0 frameborder=0 FRAMESPACING="0">
</FRAMESET>
</HTML>'; }
if ($QUERY_STRING == "1.html") { echo "<b>This is just a dummy frame.</b>"; }
if ($QUERY_STRING == "2.html") { echo "<b>"; echo "The value of \$_SESSION['tree'] is:"; echo gettype($_SESSION['tree']); echo "</b>"; }
?>
-- Like Music? http://l-i-e.com/artists.htm
attached mail follows:
>> If you have to do header("Location: ...") you have a >> design/engineering/organizational problem in your code/pages/site. >> >> I'm sure a zillion people will disagree with this "rule" > >I agree, except there's one exception to this that I can't see a way around. > >When dealing with form submissions the receiving file needs to validate all >the code before anything is sent to the browser, update the database (or >whatever) and then redirect to itself with some sort of GET flag that issues >a thankyou note or something. > >Otherwise people can hit "refresh" and post the data twice, or 10 times :) > > >I can't see any SERVER SIDE way around this.
Just send a uniquid() with each <FORM>
One, and only one, "submit" can be allowed for that uniquid().
They can still work at it and go back and reload the FORM and then re-fill it out, and then submit again...
If you want to stop *that* you need to identify them, (cookies, sessions, whatever) and then time-stamp submissions, and then rule out submissions from the same person within a given time stamp.
You don't really need to re-direct for that...
In fact, it doesn't really stop a hard-core person from working around your re-direct anyway, unless you already are doing all the above...
And at that point, just spew out your error message about multiple posts, instead of re-directing.
-- Like Music? http://l-i-e.com/artists.htm
attached mail follows:
>I don't agree with the general rule of thumb that the use of the >"Location" header is bad, but I have reviewed plenty of code where >people misuse it terribly, as a lazy goto-style operation. In most >cases, you do want to design your application to: >1) receive data >2) analyze data >3) respond with appropriate response > >If you instead do this: >1) receive data >2) analyze data >3) respond with a "Location" header telling the Web client where to get >the appropriate response >4) receive the subsequent GET request >5) respond with appropriate response > >then this is the type of misuse that runs rampant and makes people like >Mr. Lynch have a distaste for its use.
Pretty much. I've wasted too much time trying to chase down the "paper trail" of re-direct after re-direct from badly-designed applications.
Unfortunately, some very popular software packages (which shall remain nameless) are rampant with this second "style" of coding.
>Like many things, it is all a matter of the developer. Personally, I >like PHP's general approach of giving the developer the power to do >anything, even if it is bad. *shrug* Most criticism I've heard of PHP >(like the bogus security vulnerabilities cited in PHP) stems from this >characteristic.
Hey, I like the flexibility.
I just wish more PHP scripters were better programmers so there was a better quality of code out there, so PHP wouldn't be getting slagged for "security vulnerabilities" that are the fault of the programmer, not PHP.
If you do a lot of Location: headers, re-think your design.
-- Like Music? http://l-i-e.com/artists.htm
attached mail follows:
> No, it just happens to have sent them in the order his browser liked. > > ASP can't do anything "different" from PHP. > > I used to laugh when ASPers asked why PHP had to do all this extra stuff > with cookies and stuff to do sessions. Sigh. :-) > > Some browsers will process the headers in one order, others in the reverse. > > Some will see the Location: and ignore the rest. > > You can't do both and support all browsers.
Actually Richard, I'll have to disagree. I replied to Chris Shiflett privately but perhaps I should cc my reply to the group (it is rather lengthy & I hate cluttering mailboxes). The long and the short of it is that, after analysing the data returned to the browser from both ASP and PHP, there is a difference. Essentially, the redirect headers are identical (including the status code), but ASP appends the rest of the header including the "Set-Cookie" header and the Cache requirements. While some of this data is no doubt redundant it allows the the browser to process the cookie correctly. I tested this on numerous different browsers (IE, Netscape, Opera, Mozilla and NeoPlanet) and in all cases without exception, the ASP script worked and the PHP didn't.
Unless returning all the headers as ASP does totally deviates from the HTML protocol specification, why not make PHP a more well-rounded product and include this functionality? Just because using "goto" is bad programming practice and should be avoided (like the plague!), it has stopped it being included in most decent languages...
> Re-design and re-factor your code so you don't need to re-direct. :-)
Please understand that I am not defending ASP in any way - I am merely pointing out that there *is* a difference in the way that the two languages process the pages. Frankly, I believe that ASP is very poor as scripting languages go and have spent 3 months motivating a move to PHP. I am not however that proficient in PHP yet (although I already know more PHP than ASP) and cannot afford the time it would require to "re-design and re-factor" all of my code to avoid using redirects and accomodate PHP idiosyncrasies.
In my mind, the migration from one scripting language to another should really be a case of changing language syntax. It took three hours to convert all my code from ASP-based to PHP-based scripting. If PHP wants to gain market share, this is the kind of bonus a developer is looking for.
> I'm sure a zillion people will disagree with this "rule" I can only say > that when I started focussing on what my code was *really* doing, and really > factoring out the common things, and organizing my pages better, the > header("Location: ...") tool got thrown out (mostly) of my tool box.
I agree 100%. There is no excuse for poor programming, and no substitute for good programming. But, that comes with experience in the language and as one learns the ins and outs of the environment one can improve one's code. And, since I don't do anything but sleep between 3am and 6am, I may just redevelop the legacy code into a better solution.. :)
Kind regards, Cord
attached mail follows:
On Tuesday, July 2, 2002, at 11:10 PM, Justin French wrote:
> on 03/07/02 11:54 AM, Richard Lynch (rich
phpbootcamp.com) wrote:
>
>> Rule of Thumb:
>> If you have to do header("Location: ...") you have a
>> design/engineering/organizational problem in your code/pages/site.
>>
>> I'm sure a zillion people will disagree with this "rule"
>
> I agree, except there's one exception to this that I can't see a way
> around.
>
> When dealing with form submissions the receiving file needs to validate
> all
> the code before anything is sent to the browser, update the database (or
> whatever) and then redirect to itself with some sort of GET flag that
> issues
> a thankyou note or something.
>
> Otherwise people can hit "refresh" and post the data twice, or 10
> times :)
Justin! That's a great idea. No one ever mentioned that to me before (and I've been on and off this list for months). Or actually, I think YOU mentioned it once but I didn't understand it.
So let me ask: do you have one giant script that validates all data, depending on the variables sent to it? Or do you have a "formcheck" script for each individual form?
This is a great way to stop someone from hitting refresh and resubmitting their POST data accidentally, since you've got that GET flag which basically says "do not process this form!" It's not -secure-, since anyone can remove this flag (even if you used POST), but it will work for Joe User to stop him from accidentally resubmitting.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
On Wednesday 03 July 2002 11:57, Balaji Ankem wrote: > Hi friend, > Will mail()function work for SMTP servers which needs authentication? > If so how can pass the username and password to my SMTP server. > > Any help would be greatly appreciated.
Did you check on google like I suggested in an earlier post?
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* To spot the expert, pick the one who predicts the job will take the longest and cost the most. */
attached mail follows:
Yes Jason, I have checked and still checking......but I couuldn't get proper information.
Thanks and Regards Balaji
-----Original Message-----
From: Jason Wong [mailto:php-general
gremlins.com.hk]
Sent: Wednesday, July 03, 2002 9:45 AM
To: php-general
lists.php.net
Subject: Re: [PHP] Will mail() function work for SMTP servers which
needs Authentication
On Wednesday 03 July 2002 11:57, Balaji Ankem wrote: > Hi friend, > Will mail()function work for SMTP servers which needs authentication?
> If so how can pass the username and password to my SMTP server. > > Any help would be greatly appreciated.
Did you check on google like I suggested in an earlier post?
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* To spot the expert, pick the one who predicts the job will take the longest and cost the most. */
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- text/plain attachment: Wipro_Disclaimer.txt
attached mail follows:
On Wednesday 03 July 2002 12:17, Balaji Ankem wrote: > Yes Jason, I have checked and still checking......but I couuldn't get > proper information.
The first page of results I got from google included a reference to Pear, check that out. I'm sure there are others that'll be useful to you.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* There are never any bugs you haven't found yet. */
attached mail follows:
Hello,
On 07/03/2002 12:57 AM, Balaji Ankem wrote: > > Hi friend, > Will mail()function work for SMTP servers which needs authentication? > If so how can pass the username and password to my SMTP server.
No, you need to communicate directly with the SMTP server to authenticate. mail() has no support for authentication.
You may want to try this PHP Class that does exactly what you need:
http://www.phpclasses.org/smtpclass
It is better used in conjunction with this:
http://www.phpclasses.org/mimemessage
--Regards, Manuel Lemos
attached mail follows:
TEST-PLEASE IGNORE
attached mail follows:
Dear All,
I was reading the post Re: [PHP] Setting a cookie and redirecting started 03 July 2002 02:54 in this news group.
If one is providing a redirection service (the likes of domain name only hosting with redirection support), but you have no access to facilities other than php. (An odd senario I'll admit). It seems to me that header location is a "godsend".
However,
1) does this HTTP protocol work with all browsers? 2) are there any complications that need to be addressed 3) is there an accepted best style of the header text to maximise multiple browser compatibility
4) should I be asking this in a different new group? Perhaps http.general? (if it exists)
Henry
Thanks in advance
attached mail follows:
Hi,
I searched through the archives and found the following snippit of code from Tim Converse from late 2000. This is great, but does anyone know how I can adapt this so I can return all values from a multidimensional array? I have an id number which corresponds to a record which I need to revisit once I get all possible combinations (not just the max which below gives us) and I do not want to lose the link between the id and the number. For instance:
$number[0]['id']=5; $number[0]['number']=500; $number[1]['id']=7; $number[1]['number']=500; $number[2]['id']=23; $number[2]['number']=750; $number[3]['id']=3; $number[3]['number']=1500;
$max is assigned the value 1350 in this example, so we know id 3 will be eliminated off the bat.
What I need to get back are the combinations of ID's where their corresponding number are less than or equal to value $max. So in this instance I might get something like;
5 7 23 5&7 5&23 7&23
I have spent about 40 hours in the last three days on this problem alone and I can honestly say I am stuck. You guys are my last hope. Please help a desperate man!
Thanks, Michael.
-~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~-
Tim's code:
function maximum_subset_sum ($max, $candidate_array) { $working_array = array(); while ($next = each($candidate_array)) { $candidate = $next['value']; $sums_to_date = array_keys($working_array); while ($marked_sum = each($sums_to_date)) { $known_sum = $marked_sum['value']; $possibly_new = $known_sum + $candidate; if(($possibly_new <= $max) && !IsSet($working_array[$possibly_new])){ $working_array[$possibly_new] = $candidate; } } if(($candidate <= $max) && !IsSet($working_array[$candidate])){ $working_array[$candidate] = $candidate; } } $max_sum = max(array_keys($working_array)); $return_array = array($working_array[$max_sum]); while ($max_sum != $working_array[$max_sum]) { $max_sum = $max_sum - $working_array[$max_sum]; array_push($return_array, $working_array[$max_sum]); } return($return_array); }
// example use $best_sum = maximum_subset_sum(40, array(39,23,19,14,9,5,3,2,1)); print("Largest sum is " . array_pop($best_sum)); while ($value = array_pop($best_sum)) { print(" + $value"); } // will print "Best sum is 23 + 14 + 3"
-~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~-
attached mail follows:
The way I would tackle this is in several steps (and maybe combine them later?) Here goes - in pseudo code/point form
1. Find max 2. Find all array elements who's number in less than max 2a. create a temp array that holds these indexes 3. Do the ol' nPr (or is it nCr?) thingo on the temp array, then using that to refer the the actual array.
HTH (and it's not too confusing) Martin
-----Original Message-----
From: Michael Benbow [mailto:Michael.Benbow
CeLTS.monash.edu.au]
Sent: Wednesday, July 03, 2002 4:07 PM
To: php-general
lists.php.net
Subject: [PHP] Find all combinations of numbers
Hi,
I searched through the archives and found the following snippit of code from Tim Converse from late 2000. This is great, but does anyone know how I can adapt this so I can return all values from a multidimensional array? I have an id number which corresponds to a record which I need to revisit once I get all possible combinations (not just the max which below gives us) and I do not want to lose the link between the id and the number. For instance:
$number[0]['id']=5; $number[0]['number']=500; $number[1]['id']=7; $number[1]['number']=500; $number[2]['id']=23; $number[2]['number']=750; $number[3]['id']=3; $number[3]['number']=1500;
$max is assigned the value 1350 in this example, so we know id 3 will be eliminated off the bat.
What I need to get back are the combinations of ID's where their corresponding number are less than or equal to value $max. So in this instance I might get something like;
5 7 23 5&7 5&23 7&23
I have spent about 40 hours in the last three days on this problem alone and I can honestly say I am stuck. You guys are my last hope. Please help a desperate man!
Thanks, Michael.
-~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~-
Tim's code:
function maximum_subset_sum ($max, $candidate_array) { $working_array = array(); while ($next = each($candidate_array)) { $candidate = $next['value']; $sums_to_date = array_keys($working_array); while ($marked_sum = each($sums_to_date)) { $known_sum = $marked_sum['value']; $possibly_new = $known_sum + $candidate; if(($possibly_new <= $max) && !IsSet($working_array[$possibly_new])){ $working_array[$possibly_new] = $candidate; } } if(($candidate <= $max) && !IsSet($working_array[$candidate])){ $working_array[$candidate] = $candidate; } } $max_sum = max(array_keys($working_array)); $return_array = array($working_array[$max_sum]); while ($max_sum != $working_array[$max_sum]) { $max_sum = $max_sum - $working_array[$max_sum]; array_push($return_array, $working_array[$max_sum]); } return($return_array); }
// example use $best_sum = maximum_subset_sum(40, array(39,23,19,14,9,5,3,2,1)); print("Largest sum is " . array_pop($best_sum)); while ($value = array_pop($best_sum)) { print(" + $value"); } // will print "Best sum is 23 + 14 + 3"
-~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~--~=**=~-
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I get the following error when i try to install an app called "PHPwebsite" ( http://phpwebsite.appstate.edu/ )
Warning: Cannot add header information - headers already sent by (output started at C:\apache\htdocs\php\setup\index.php:9) in C:\apache\htdocs\php\htmlheader.php on line 30
I also installed php,apache,perl,mysql etc using a program called: "PHPtriad" ( an app that installs/configures everything at once)
Why am I getting that error, can anyone help?
===================================================== below is the header.php file I'm having trouble with: =====================================================
<?php
/**
* This file contains the html-header core function definitions for
phpWebSite.
*
* The functions defined here are essential for the phpWebSite
* system. This file gets included almost all the time, you should be
* able to use the functions defined here everywhere in the code.
*
*
module mainfile
*
modulegroup core
*
package phpWebSite
*/
/**
* Wrapper around header("Location: url") to deal also with IE
*
*
param URL
*
author: Alessandro Pisani
*/
function html_header_location($url) {
$agent = (phpversion() > "4.1.0") ? $_SERVER[HTTP_USER_AGENT] :
$HTTP_SERVER_VARS[HTTP_USER_AGENT];
// Both IE 5.x and Mozilla >= 0.9.8 now require header() to be postfixed by // exit, otherwise they do not execute headers send
if (stristr($agent, 'msie')) { Header("Refresh: 0;url=$url"); exit; } else { Header("Location: $url"); exit; } }
?>
<*** http://www.myispnet.net ***>
Administrator
My ISP Network
admin
myispnet.net
<*** http://www.myispcentral.net ***>
attached mail follows:
On Tue, 02 Jul 2002 14:33:35 -0700, clay
killersoft.com (Clay Loveless) wrote:
> I haven't tried this myself yet, but will soon be facing a similar need.
>
> http://www.php.net/iconv
>
> That's probably the way I'll start off on tackling this problem ... Grab
> your XML document, check to see if it's in windows-1252, and if it is, run
> it through the iconv functions, then parse the XML data.
Thanks. I tried this on my Windows development server and got absolutely no output from these functions, so gave up. Now i'm wondering whether it's just a Windows-only bug: I'll have to look and see if my web hosting has this installed as it would be a smart option if it did work.
Using the unicode translation tables I built some kind of translation table which seemed to work, but it converted to utf-16 rather than utf-8, so everything showed as little squares rather than characters :-( Otherwise this would have worked nicely (contact me if you want more details).
Thanks Peter
attached mail follows:
On Tue, 2 Jul 2002 15:23:38 -0600, rhunter
venticon.com (Ray Hunter) wrote:
> Check here:
> http://www.chilkatsoft.com/ChilkatXml.asp
Doesn't look as if it'll run under Unix?
> Google search: > http://www.google.com/search?sourceid=navclient&q=convert+xml+charset
I've been googling ont he topic for the past couple of days, and had no luck :-(
attached mail follows:
Peter,
What OS are you running this on...if you are on windows then uncomment the php_iconv.dll in your php.ini file and then you can see if you can run the iconv functions.
If you are running under unix/linux then you need to compile php with the iconv functions.
Example
./configure --with-iconv=/location/of/iconv
Iconv is a gnu app that you use for the conversions.
You can get more info GNU's website about iconv...
B i g D o g
----- Original Message -----
From: "Peter" <peter
mapledesign.co.uk>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 12:46 AM
Subject: Re: [PHP] Dealing with XML charsets
> On Tue, 2 Jul 2002 15:23:38 -0600, rhunter
venticon.com (Ray Hunter)
wrote:
> > Check here:
> > http://www.chilkatsoft.com/ChilkatXml.asp
>
> Doesn't look as if it'll run under Unix?
>
> > Google search:
> > http://www.google.com/search?sourceid=navclient&q=convert+xml+charset
>
> I've been googling ont he topic for the past couple of days, and had no
luck :-(
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Perhaps this relates to the original question as an additional feature.
What would be the best way to offer SVG content from the main opening page? Since SVG requires a browser that has the approprite plugin or a dedicated browser, is it better to create a hyperlink or maybe have the SVG capability detected and content redirected automatically.
Another question. What is the best and lightest way to offer SVG content from the server side? Java seems real slow and resource hungry at sites I visit that use it.
On Wed, Jul 03, 2002 at 12:39:21PM +1000, Justin French wrote:
> If you output the right headers, then output the file (by either passing
> thru an existing file or "building" a file), then it should work....
> although I have no experience with exactly what you want -- only with MP3s,
> images, etc.
>
> Justin French
>
>
> on 01/07/02 7:52 PM, Herve le Martret (lemart
mpl.ird.fr) wrote:
>
> > Hello,
> >
> > I am interested in creating svg graphics with php like creating a image with
> > gd.
> > I tried a PHP script with :
> >
> > header ("Content-type: image/xml+svg");
> >
> > but I don't know how to output correctly svg lines.
> >
> > It is not possible to ouput svg lines with the print command and a command
> > like
> > "imagesvg($im);" does'nt exit.
> >
-- Bill Amsterdam, NL
attached mail follows:
Well I have a system that people can login to, and I want to produce an array (or something of the sort) that holds who is logged in so that I can monitor it. The problem is that sessions are local to the clients machine so if I tried to put this information in the session then the only information that I would get back is the people that are logged in on my machine, not the server (Please tell me if I wrong in what I say here). Therefore I need to be able to but this information in the session and have it available to all sessions (sort of like the way static variables in Java belong to the class and not the individual objects that are created from that class). So if you undersatnd what I'm trying to do here and know of a way to do it I would love to here it.
On Tue, 02 Jul 2002 18:45:40 -0500
rich
phpbootcamp.com (Richard Lynch) wrote:
> >Does anyone know anyway to synchronize calls to php functions. > >I was thinking of writting a hack that uses a lock file on the server put > >if there is a proper way to do it then I would > >rather use that. > >Any suggestions would be good. > > Shared memory may be faster than lock files... > > *WHY* you think you need synched PHP functions might be an interesting > discussion, though if it's just for fun, have at it. > > -- > Like Music? http://l-i-e.com/artists.htm >
|-----------------------------------------------------------| Philip MacIver |-----------------------------------------------------------|
attached mail follows:
On Wednesday, July 3, 2002, at 04:08 AM, Philip MacIver wrote:
> The problem is that sessions are local to the clients machine
Huh?
> so if I tried to put this information in the session then the only > information that I would get back is the people that > are > logged in on my machine, not the server (Please tell me if I wrong in > what I say here). Therefore I need to be able to > but this > information in the session and have it available to all sessions (sort > of like the way static variables in Java belong > to the class and > not the individual objects that are created from that class). So if you > undersatnd what I'm trying to do here and know > of a way > to do it I would love to here it.
This has been discussed on the list before, and even I think just last week (so check the archives, using "server variables asp" as your search criteria). Some theories suggest that it would entail a lot of overhead, unless you only have a few users to keep track of simultaneously. Possible suggestions are
1) if the data doesn't change, put it into an includefile 2) if the data is dynamic, be clever and implement this yourself with database-managed persistence (but beware the overhead).
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
David E. Weekly wrote: >>IMHO you're better off > > I agree and understand why, but... > >>but yes, if you set register_globals = on then >>you shouldn't need to have retooled your scripts. > > I agree. =) > >>Did you restart your >>webserver after you adjusted php.ini? > > Yes. Full stop/start cycle.
And you're sure to be out of any caching?
regards
Jesper Brunholm
-- Phønix - Danish folk music from young musicians - http://www.phonixfolk.dk
attached mail follows:
Hi,
Maybe you can do something like this (if you have access to GD on the server): <? $str_image = my_function_to_read_image_from_db($_GET['id']); $im_old = imagecreatefromstring($str_image); $im_new = imagecreatetruecolor($_GET['width'], $_GET['height']); imagecopyresampled($im_new, $im_old, 0, 0, 0, 0, $_GET['width'], $_GET['height'], imagesx($im_old), imagesy($im_old)); header("Content-type: image/jpeg"); imagejpeg($im_new, '', 90); ?>
/Joakim
> -----Original Message-----
> From: Steve Vernon [mailto:steve
extremewattage.co.uk]
> Sent: Tuesday, July 02, 2002 9:43 PM
> To: php-general
lists.php.net
> Subject: [PHP] FW: Help please!
>
>
> Hello,
> I have a PHP script which gets data from a MySQL database and
> returns an image. So <img src="getdata.php?id=3"> returns the image of
> id 3 from the database. What I really want is to state width
> is 100 and
> height is 100 for example so I do not have to downlaod the entire
> picture and specify the width and height as part of the image:
>
> Do not want
> <img src="getdata.php?id=3" width="100" height="100">
>
> WHat I want
> <img src="getdata.php?id=3&width=100&height=100">
>
> WHich will be a lot quicker on the client side.
>
> I cannot make a permanent file to use when I get the information
> from the PHP database due to server security, only a tmpfile which the
> data can then be placed. But to use the image functions you need to
> specify a filename. THere does not seem to be a way to get
> the filename
> of a file pointer so how do I do it please?
>
> I have asked the ISP to give me permissions to create files int
> he server directory but they will not let me.
>
> Thanks you!
>
> Steve
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Here's a brain-bender ... At least it is for me at the moment. : )
When I use an XML parser inside a class, the xml_*_handler functions aren't recognizing "$this->" variables. I can kind of see why ... But would like it to work anyway. : )
Here's an example:
class Blah { var $xmlparser; var $current_element;
// ...
function _parseXML($data) { $this->xmlparser = xml_parser_create(); xml_set_element_handler( $this->xmlparser, array($this,"_xml_start_element"), array($this,"_xml_end_element")); xml_set_character_data_handler( $this->xmlparser, array($this,"_xml_character_data")); xml_parse($this->xmlparser, $data); xml_parser_free($this->xmlparser); }
function _xml_start_element($p, $e_name, $e_attributes) { $this->current_element = $e_name; }
function _xml_end_element($p, $e_name) { // ... }
function _xml_character_data($p, $data) { echo "element is: ".$this->current_element."\n"; echo "data is: $data\n"; }
} // end of class Blah
When this XML parser gets called from within the Blah class, the "element is:" portion of _xml_character_data comes out blank!
This sort of makes sense, because the callback functions are "children" of the xml_parser_create "parent" ... But should that make the children ignorant of the "grandparent" variables referred to by $this->varname?
I hope this makes sense ... Has anyone else encountered this sort of problem? I'm an old hat at PHP, but am relatively new to both XML parsing and writing my own classes.
Thanks, Clay
attached mail follows:
"Clay Loveless" <clay
killersoft.com> wrote in message
news:B9481008.158BF%clay
killersoft.com...
> Here's a brain-bender ... At least it is for me at the moment. : )
>
> When I use an XML parser inside a class, the xml_*_handler functions
aren't
> recognizing "$this->" variables. I can kind of see why ... But would like
it
> to work anyway. : )
>
> Here's an example:
>
> class Blah
> {
> var $xmlparser;
> var $current_element;
>
> // ...
>
> function _parseXML($data)
> {
> $this->xmlparser = xml_parser_create();
> xml_set_element_handler(
> $this->xmlparser,
> array($this,"_xml_start_element"),
> array($this,"_xml_end_element"));
> xml_set_character_data_handler(
> $this->xmlparser,
> array($this,"_xml_character_data"));
> xml_parse($this->xmlparser, $data);
> xml_parser_free($this->xmlparser);
> }
>
> function _xml_start_element($p, $e_name, $e_attributes)
> {
> $this->current_element = $e_name;
> }
>
> function _xml_end_element($p, $e_name)
> {
> // ...
> }
>
> function _xml_character_data($p, $data)
> {
> echo "element is: ".$this->current_element."\n";
> echo "data is: $data\n";
> }
>
> } // end of class Blah
>
>
>
> When this XML parser gets called from within the Blah class, the "element
> is:" portion of _xml_character_data comes out blank!
>
> This sort of makes sense, because the callback functions are "children" of
> the xml_parser_create "parent" ... But should that make the children
> ignorant of the "grandparent" variables referred to by $this->varname?
>
> I hope this makes sense ... Has anyone else encountered this sort of
> problem? I'm an old hat at PHP, but am relatively new to both XML parsing
> and writing my own classes.
>
> Thanks,
> Clay
>
Have a look at: http://www.php.net/manual/en/function.xml-set-object.php
xml_set_object($this->parser, &$this);
attached mail follows:
Hello,
I've recently installed Mandrake v 8.1 on my computer and then successfully compiled and installed PostgreSQL and Apache 1.3.24 and PHP 4.2.1... All that works well...
When I installed Frontpage 2002 extensions on the same computer, PhP didn't work any more. I then tried to compile again php with "make clean"; but same result PhP isn't working....
I then tried to make a "/configure --with-apxs=/usr/local/apache/bin/apxs --with-pgsql=/usr/local/pgsql dans php" and the following error appeared :
Sorry, I was not able to successfully run APXS
attached mail follows:
If you have Apache installed as an RPM, make sure you have the "apache-devel" RPM installed as well. I remember I had this problem once in RedHat... apxs is included in the devel package if I recall correctly.
-- Aaron Gould agouldpartscanada.com Web Developer
----- Original Message ----- From: "Claudio Valgoi" <claudio.valgoi
fordahl.com> To: <php-general
lists.php.net> Sent: Wednesday, July 03, 2002 5:37 AM Subject: [PHP] Installation de PHP 4.2.1 with Apache and extension Frontpage 2002
> Hello, > > I've recently installed Mandrake v 8.1 on my computer and then successfully > compiled and installed PostgreSQL and Apache 1.3.24 and PHP 4.2.1... All > that works well... > > When I installed Frontpage 2002 extensions on the same computer, PhP didn't > work any more. > I then tried to compile again php with "make clean"; but same result PhP > isn't working.... > > I then tried to make a > "/configure --with-apxs=/usr/local/apache/bin/apxs > --with-pgsql=/usr/local/pgsql dans php" and the following error appeared : > > Sorry, I was not able to successfully run > APXS > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello php-general,
Dear php list,
I've got completely lost in program execution under php. I need to run a command grab it's output for the next processing, So I wrote a script:
<? $output = shell_exec("uudeview -i /bla/bla.txt -p /bla/bla/"); echo "<pre>"; echo $kick_my_ass; echo "</pre>"; ?> And I get nothing :(. Script like below: <? $output = shell_exec("uudeview"); echo "<pre>"; echo $kick_my_ass; echo "</pre>"; ?> Work fine outputting me command line parameters.
What have I done wrong?
-- Best regards, Latex mailto:freemansubmission.org.ru
BTW: PHP not running SAFE MODE
attached mail follows:
I have a php script that performs a query and then dynamically builds a section of a page for every row returned. Each section has some fields and three submit buttons. My problem is this. If I make a change to one particular section, how can I submit the form passing only the relevant section data?
**************************************************** This e-mail is intended for the recipient only and may contain confidential information. If you are not the intended recipient then you should reply to the sender and take no further ation based upon the content of the message. Internet e-mails are not necessarily secure and CCM Limited does not accept any responsibility for changes made to this message. Although checks have been made to ensure this message and any attchments are free from viruses the recipient should ensure that this is the case. ****************************************************
attached mail follows:
Put a form around each section, so only the data in the form will be submitted. You can have more than one form on a page, and only the form containing the submit button that's pressed will be sent, the others will be ignored/dropped/whatever...
---John Holmes...
----- Original Message -----
From: "Mark Colvin" <mark.colvin
ccmltd.co.uk>
To: "Php (E-mail)" <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 6:58 AM
Subject: [PHP] Submitting Form Data
> I have a php script that performs a query and then dynamically builds a > section of a page for every row returned. Each section has some fields and > three submit buttons. My problem is this. If I make a change to one > particular section, how can I submit the form passing only the relevant > section data? > > > **************************************************** > This e-mail is intended for the recipient only and > may contain confidential information. If you are > not the intended recipient then you should reply > to the sender and take no further ation based > upon the content of the message. > Internet e-mails are not necessarily secure and > CCM Limited does not accept any responsibility > for changes made to this message. > Although checks have been made to ensure this > message and any attchments are free from viruses > the recipient should ensure that this is the case. > **************************************************** > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
I am trying to create a Pivot Table with PHP's COM functions. I managed to get the data and charts functions going but the pivot table is tricky. Anyone that managed it before? I am looking for examples, plz.
Tx MH
attached mail follows:
I'm having a weird problem with ora_do. It works fine as long as I don't have a "WHERE" clause in the query. For example:
select * from table_name
works just fine but ....
select * from table_name where col_name = value
returns nothing.
However, if I use ora_open, ora_parse and ora_exec everything works fine. I'm running on Compaq Tru64 ver 5.1. I compiled PHP with gcc 3.1. I'm not getting any errors or warnings and nothing is being logged in the Apache logs. I guess it's not a big deal since I have been able to work around it, but it would be nice to know what the problem is.
Thanks,
Dean
attached mail follows:
Anyone have a function that will take an alphabetical list of names (in an array already) and split it into two 'chunks' (arrays) A-M and N-Z?
So, let's say I have:
Abby Road BobbyCraft Darren's doodads Farenheit 456 generic name MyCom.com Ninety Nine NoCo O U 1 O'reilly Publishing Oracle PSI Test Company
I want to end up with one array/chunk that has (A-M):
Abby Road BobbyCraft Darren's doodads Farenheit 456 generic name MyCom.com
And the other that contains (N-Z):
Ninety Nine NoCo O U 1 O'reilly Publishing Oracle PSI Test Company
attached mail follows:
On Wednesday 03 July 2002 19:52, Daevid Vincent wrote: > Anyone have a function that will take an alphabetical list of names (in > an array already) and split it into two 'chunks' (arrays) A-M and N-Z?
Psuedo-code:
loop through array array_shift() if element is A-M add to the A-M array, else add to N-Z array
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* I wish I was on a Cincinnati street corner holding a clean dog! */
attached mail follows:
Try using a regular expression to go through each of the array elements, sending to one array if the first letter is [a-mA-M], to another if the first letter is [n-zN-Z]. If you're not searching by first letter in the array elements, and they are comma-delimited name sets, do it that way.
HTH
Martin
>>> php-general
gremlins.com.hk 07/03/02 08:50AM >>>
On Wednesday 03 July 2002 19:52, Daevid Vincent wrote:
> Anyone have a function that will take an alphabetical list of names (in
> an array already) and split it into two 'chunks' (arrays) A-M and N-Z?
Psuedo-code:
loop through array array_shift() if element is A-M add to the A-M array, else add to N-Z array
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* I wish I was on a Cincinnati street corner holding a clean dog! */
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Try looking up in the manual about array_slice (http://us2.php.net/manual/en/function.array-slice.php).
-- 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."
"Daevid Vincent" <daevid
daevid.com> wrote: > Anyone have a function that will take an alphabetical list of names (in > an array already) and split it into two 'chunks' (arrays) A-M and N-Z? > > So, let's say I have: > > Abby Road > BobbyCraft > Darren's doodads > Farenheit 456 > generic name > MyCom.com > Ninety Nine > NoCo > O U 1 > O'reilly Publishing > Oracle > PSI > Test Company > > I want to end up with one array/chunk that has (A-M): > > Abby Road > BobbyCraft > Darren's doodads > Farenheit 456 > generic name > MyCom.com > > And the other that contains (N-Z): > > Ninety Nine > NoCo > O U 1 > O'reilly Publishing > Oracle > PSI > Test Company
attached mail follows:
I want to show info when my docs are viewed though my stats program. I have decieded the best way would be to put the info into a DB through php file then output the PDF, Excel, Zip or Powerpoint file.
Only trouble is I have no Idea how to do this
-- JJ Harrison webmastertececo.com www.tececo.com
attached mail follows:
Hi,
Store all files in a 'secret' folder, preferably outside the www-root. Store filename, size, type, date, whatever in your dB. To link to a file, use something like this <a href="download.php?fileid=3">MyDoc.pdf</a>
Then in download.php you update your stats table with the relevant info and then send the file to the user.
| download.php | <?php updatemystatsdb($_GET['id']);
$filename = getfilenamefromdb($_GET['id']); $filetype = getfiletypefromdb($_GET[id]); $completefilepath = "/your/path/here/$filename";
header('Cache-Control: no-cache, must-revalidate'); header('Pragma: no-cache'); header("Content-type: application/octet-stream\nContent-Disposition:inline; filename=\"".$fileName."\"\nContent-length:".(string)(filesize($completefile path)));
$fd = fopen($filename,'r'); fpassthru($fd); ?> This is not complete and I'm not really sure about the headers, but you can read more at http://www.php.net/manual/en/function.fpassthru.php
/Joakim
> -----Original Message-----
> From: JJ Harrison [mailto:webmaster
tececo.com]
> Sent: Wednesday, July 03, 2002 2:05 PM
> To: php-general
lists.php.net
> Subject: [PHP] Simple Example of Passing on a file through a
> PHP script
>
>
> I want to show info when my docs are viewed though my stats
> program. I have
> decieded the best way would be to put the info into a DB
> through php file
> then output the PDF, Excel, Zip or Powerpoint file.
>
> Only trouble is I have no Idea how to do this
>
>
> --
> JJ Harrison
> webmaster
tececo.com
> www.tececo.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
> $fd = fopen($filename,'r'); > fpassthru($fd);
or
readfile($filename);
Saves you an fopen call, same result...
---John Holmes...
attached mail follows:
Hi friend, I would like to display the table records along with check boxes for the purpose of selecting particular records or select all and for deleteing them or for other purpose.
Anybody have ready made code for this type...
Any help would be greatly appreciated.
Thanks and Regards Balaji
- text/plain attachment: Wipro_Disclaimer.txt
attached mail follows:
The code to create a check box is:
<input type="checkbox" name="whatever" value="something">
HTH, ---John Holmes...
PS: It might help if you actually try to do something yourself and then ask a question. We're not here to feed you code. Anyways, a way you might approach it is to name all of your checkboxes the same, something like
<input type="checkbox" name="delete[]" value="$id">
Where $id is a unique identifier for the row/field/etc... Then, you simply use some code like this to delete all of the rows where the box was checked.
<? $delete_ids = implode(",",$_REQUEST['delete']); $result = mysql_query("DELETE FROM your_table WHERE id IN ($delete_ids)"); ?>
HTHSM, ---John Holmes...
----- Original Message -----
From: "Balaji Ankem" <balaji.ankem
wipro.com>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 8:05 AM
Subject: [PHP] Displaying the table records along with check boxes.
> Hi friend, > I would like to display the table records along with check boxes for > the purpose of > selecting particular records or select all and for deleteing them or > for other purpose. > > Anybody have ready made code for this type... > > Any help would be greatly appreciated. > > Thanks and Regards > Balaji > >
----------------------------------------------------------------------------
----> -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hi John, Thanks for the reply. Here the thing is I already tried and I desparately need urgently, thats why I mailed to the group. Anyway thanx for u'r suggestion.
Rgds Balaji
-----Original Message-----
From: 1LT John W. Holmes [mailto:holmes072000
charter.net]
Sent: Wednesday, July 03, 2002 5:56 PM
To: Balaji Ankem; php-general
lists.php.net
Subject: Re: [PHP] Displaying the table records along with check boxes.
The code to create a check box is:
<input type="checkbox" name="whatever" value="something">
HTH, ---John Holmes...
PS: It might help if you actually try to do something yourself and then ask a question. We're not here to feed you code. Anyways, a way you might approach it is to name all of your checkboxes the same, something like
<input type="checkbox" name="delete[]" value="$id">
Where $id is a unique identifier for the row/field/etc... Then, you simply use some code like this to delete all of the rows where the box was checked.
<? $delete_ids = implode(",",$_REQUEST['delete']); $result = mysql_query("DELETE FROM your_table WHERE id IN ($delete_ids)"); ?>
HTHSM, ---John Holmes...
----- Original Message -----
From: "Balaji Ankem" <balaji.ankem
wipro.com>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 8:05 AM
Subject: [PHP] Displaying the table records along with check boxes.
> Hi friend, > I would like to display the table records along with check boxes for > the purpose of > selecting particular records or select all and for deleteing them or > for other purpose. > > Anybody have ready made code for this type... > > Any help would be greatly appreciated. > > Thanks and Regards > Balaji > >
------------------------------------------------------------------------
---- ----> -- > 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
- text/plain attachment: Wipro_Disclaimer.txt
attached mail follows:
Hi all
How would I get recent stock prices in a page? I obviously need to get this from some source.
I am looking for local (South African) and international share prices for a portal-type system. What I will probably do (for the sake of speed) is have a cron job periodically fetch the relevant prices, and put them in a database. This will then be displayed from the database (I know - delayed stock prices are ok)
What I am really after is a method of getting share prices from the net. I have no idea about how to go about doing this - where to get them from, etc. Please help...
Thanks
David R
attached mail follows:
On Fri, Mar 29, 2002 at 03:00:29AM +0200, David Russell wrote: > > How would I get recent stock prices in a page? I obviously need to get > this from some source. > > I am looking for local (South African) and international share prices > for a portal-type system.
This may or may not be of some assistance:
http://www.analysisandsolutions.com/code/phpxml.htm
I don't know if it'll obtain South African stocks.
--Dan
--
PHP classes that make web design easier
SQL Solution | Layout Solution | Form Solution
sqlsolution.info | layoutsolution.info | formsolution.info
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
attached mail follows:
Hi again, php gurus!
Does anyone of you have any experience working with revecom rfom php script?
Will be grateful for any comments and links to articles of the subject
-- Sincerely, val petruchek http://val.zp.ua
attached mail follows:
whats wrong with this. it's getting stuck somewhere
function urls_clickable($string) { for($n=0; $n < strlen($string); $n++) { if(strtolower($string[$n]) == 'h') { if(!strcmp("http://", strtolower($string[$n]) . strtolower($string[$n+1]) . strtolower($string[$n+2]) . strtolower($string[$n+3]) . $string[$n+4] . $string[$n+5] . $string[$n+6])) { $startpos = $n; while($n < strlen($string) && eregi("[a-z0-9\.\:\?\/\~\-\_\&\=\%\+\'\"]", $string[$n])) $n++; if(!eregi("[a-z0-9]", $string[$n-1])) $n--; $link = substr($string, $startpos, ($n-$startpos)); $link = $link; $string_tmp = $string; $string = substr($string_tmp, 0, $startpos); $string .= "<a href=\"$link\" target=\"_blank\">$link</a>"; $string .= substr($string_tmp, $n, strlen($string_tmp)); $n = $n + 15; } } } return $string; }
$text = "http://www.somewhere.org <br><br>"; echo urls_clickable($text);
attached mail follows:
Content-Type: text/plain; charset="iso-8859-1" From: Jason Wong <php-general
gremlins.com.hk>
Reply-To: php-general
lists.php.net
To: php-general
lists.php.net
Date: Wed, 3 Jul 2002 21:05:02 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200207032105.02359.php-general
gremlins.com.hk>
Subject: Re: [PHP] whats wrong with this function
On Wednesday 03 July 2002 20:47, Adrian Murphy wrote: > whats wrong with this. > it's getting stuck somewhere
Stick in some echo statements at strategic points in the loops to find out _where_ it is getting stuck.
> function urls_clickable($string) { > for($n> { > if(strtolower($string[$n]) = 'h') { > if(!strcmp("http://", strtolower($string[$n]) . strtolower($string[$n+1]) . > strtolower($string[$n+2]) . strtolower($string[$n+3]) . $string[$n+4] . > $string[$n+5] . $string[$n+6])) { $startpos = $n; > while($n < strlen($string) && eregi("[a-z0-9\.\:\?\/\~\-\_\&\=\%\+\'\"]", > $string[$n])) $n++; if(!eregi("[a-z0-9]", $string[$n-1])) $n--; > $link = substr($string, $startpos, ($n-$startpos)); > $link = $link; > $string_tmp = $string; > $string = substr($string_tmp, 0, $startpos); > $string .= "<a href=\"$link\" target=\"_blank\">$link</a>"; > $string .= substr($string_tmp, $n, strlen($string_tmp)); > $n = $n + 15; > } > } > } > return $string; > } > > $text = "http://www.somewhere.org <br><br>"; > echo urls_clickable($text);
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* System going down at 1:45 this afternoon for disk crashing. */
attached mail follows:
Yes, your problem is it doesn't work.
HTH, ---John Holmes...
PS: Think that's a worthless answer? Well...same for your question...
----- Original Message -----
From: "Adrian Murphy" <adrian.murphy
2020tourism.com>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 8:47 AM
Subject: [PHP] whats wrong with this function
whats wrong with this. it's getting stuck somewhere
function urls_clickable($string) { for($n=0; $n < strlen($string); $n++) { if(strtolower($string[$n]) == 'h') { if(!strcmp("http://", strtolower($string[$n]) . strtolower($string[$n+1]) . strtolower($string[$n+2]) . strtolower($string[$n+3]) . $string[$n+4] . $string[$n+5] . $string[$n+6])) { $startpos = $n; while($n < strlen($string) && eregi("[a-z0-9\.\:\?\/\~\-\_\&\=\%\+\'\"]", $string[$n])) $n++; if(!eregi("[a-z0-9]", $string[$n-1])) $n--; $link = substr($string, $startpos, ($n-$startpos)); $link = $link; $string_tmp = $string; $string = substr($string_tmp, 0, $startpos); $string .= "<a href=\"$link\" target=\"_blank\">$link</a>"; $string .= substr($string_tmp, $n, strlen($string_tmp)); $n = $n + 15; } } } return $string; }
$text = "http://www.somewhere.org <br><br>"; echo urls_clickable($text);
attached mail follows:
relax friend.i was just asking....
----- Original Message -----
From: "1LT John W. Holmes" <holmes072000
charter.net>
To: "Adrian Murphy" <adrian.murphy
2020tourism.com>;
<php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 2:08 PM
Subject: Re: [PHP] whats wrong with this function
> Yes, your problem is it doesn't work.
>
> HTH,
> ---John Holmes...
>
> PS: Think that's a worthless answer? Well...same for your question...
>
> ----- Original Message -----
> From: "Adrian Murphy" <adrian.murphy
2020tourism.com>
> To: <php-general
lists.php.net>
> Sent: Wednesday, July 03, 2002 8:47 AM
> Subject: [PHP] whats wrong with this function
>
>
>
> whats wrong with this.
> it's getting stuck somewhere
>
>
>
> function urls_clickable($string) {
> for($n=0; $n < strlen($string); $n++)
> {
> if(strtolower($string[$n]) == 'h') {
> if(!strcmp("http://", strtolower($string[$n]) . strtolower($string[$n+1])
.
> strtolower($string[$n+2]) . strtolower($string[$n+3]) . $string[$n+4] .
> $string[$n+5] . $string[$n+6])) {
> $startpos = $n;
> while($n < strlen($string) && eregi("[a-z0-9\.\:\?\/\~\-\_\&\=\%\+\'\"]",
> $string[$n])) $n++;
> if(!eregi("[a-z0-9]", $string[$n-1])) $n--;
> $link = substr($string, $startpos, ($n-$startpos));
> $link = $link;
> $string_tmp = $string;
> $string = substr($string_tmp, 0, $startpos);
> $string .= "<a href=\"$link\" target=\"_blank\">$link</a>";
> $string .= substr($string_tmp, $n, strlen($string_tmp));
> $n = $n + 15;
> }
> }
> }
> return $string;
> }
>
> $text = "http://www.somewhere.org <br><br>";
> echo urls_clickable($text);
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
On Wednesday, July 3, 2002, 1:47:05 PM, "Adrian Murphy" wrote: > whats wrong with this. > it's getting stuck somewhere
"Somewhere" isn't very helpful. When asking for help be sure to include as much information as possilble.
Laying out your code so the structure can be seen...
<?php function urls_clickable($string) { for($n=0; $n < strlen($string); $n++) { if(strtolower($string[$n]) == 'h') { if(!strcmp("http://", strtolower($string[$n]) . strtolower($string[$n+1]) . strtolower($string[$n+2]) . strtolower($string[$n+3]) . $string[$n+4] . $string[$n+5] . $string[$n+6])) { $startpos = $n;
while($n < strlen($string) && eregi("[a-z0-9\.\:\?\/\~\-\_\&\=\%\+\'\"]", $string[$n])) $n++;
if(!eregi("[a-z0-9]", $string[$n-1])) $n--;
$link = substr($string, $startpos, ($n-$startpos)); $link = $link; $string_tmp = $string; $string = substr($string_tmp, 0, $startpos); $string .= "<a href=\"$link\" target=\"_blank\">$link</a>"; $string .= substr($string_tmp, $n, strlen($string_tmp)); $n = $n + 15; } } } return $string; }
$text = "http://www.somewhere.org <br><br>"; echo urls_clickable($text); ?>
It's getting stuck because you're moving the goalposts. It's a very bad idea to base a loop on a variable that is changed within the loop. I suggest you loop through one string while building a second string as the return value.
On the other hand, I seem to remember seeing a regex posted on this list recently that did exactly this. I suggest you search the archives for it because it would save you a lot of hassle.
-- Stuart
attached mail follows:
thnks,
i didn't write the function so i've now replaced it
with something better.
----- Original Message -----
From: "Stuart Dallas" <stuart
sharedserver.net>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 2:30 PM
Subject: Re: [PHP] whats wrong with this function
> On Wednesday, July 3, 2002, 1:47:05 PM, "Adrian Murphy" wrote: > > whats wrong with this. > > it's getting stuck somewhere > > "Somewhere" isn't very helpful. When asking for help be sure to include as much > information as possilble. > > Laying out your code so the structure can be seen... > > <?php > function urls_clickable($string) > { > for($n=0; $n < strlen($string); $n++) > { > if(strtolower($string[$n]) == 'h') > { > if(!strcmp("http://", strtolower($string[$n]) . strtolower($string[$n+1]) . strtolower($string[$n+2]) . strtolower($string[$n+3]) . $string[$n+4] . $string[$n+5] . $string[$n+6])) > { > $startpos = $n; > > while($n < strlen($string) && eregi("[a-z0-9\.\:\?\/\~\-\_\&\=\%\+\'\"]", $string[$n])) > $n++; > > if(!eregi("[a-z0-9]", $string[$n-1])) > $n--; > > $link = substr($string, $startpos, ($n-$startpos)); > $link = $link; > $string_tmp = $string; > $string = substr($string_tmp, 0, $startpos); > $string .= "<a href=\"$link\" target=\"_blank\">$link</a>"; > $string .= substr($string_tmp, $n, strlen($string_tmp)); > $n = $n + 15; > } > } > } > return $string; > } > > $text = "http://www.somewhere.org <br><br>"; > echo urls_clickable($text); > ?> > > It's getting stuck because you're moving the goalposts. It's a very bad idea to > base a loop on a variable that is changed within the loop. I suggest you loop > through one string while building a second string as the return value. > > On the other hand, I seem to remember seeing a regex posted on this list > recently that did exactly this. I suggest you search the archives for it > because it would save you a lot of hassle. > > -- > Stuart > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
[snip] As a matter of fact, when viewing the source (which should display properly if word wrap is off in Notepad) the line appears to be broken up. I have an idea...write the line to a file then open the file and get the line for exec()...blabbering now, must go... [/snip]
I have fixed many things and had many great suggestions pointed my way, I appreciate all of it! So to state the problem in the light of this new day here is what I have;
From the command line this works perfectly; curl -d "name=myname&password=mypassword&btnsubmit=submit" -s -o cdrlist.html https://theserver.com/download/list.html
Using exec() (or shell_exec(), or others in the family) like this;
exec("curl -d \"name=myname&password=mypassword&btnsubmit=submit\" -s -o cdrlist.html https://theserver.com/download/list.html");
does not work. I have made sure that the output of the exec() is all on one line through many tests. I have placed the command line arguements in variables and re-done the exec() call as many ways as I can think of. Is anyone aware of any problems with exec() that may be causing this behavior? Any insight would be grandly appreciated.
Thanks!
Jay
attached mail follows:
Hello jay, Jay try just to execute php <yourfilename>
And see what is done. For example i have problems with execution read my e-mail in the list.
Wednesday, July 3, 2002, 4:56:39 PM, you wrote:
jbnc> [snip] jbnc> As a matter of fact, when viewing the source (which should display properly jbnc> if word wrap is off in Notepad) the line appears to be broken up. I have an jbnc> idea...write the line to a file then open the file and get the line for jbnc> exec()...blabbering now, must go... jbnc> [/snip]
jbnc> I have fixed many things and had many great suggestions pointed my way, I jbnc> appreciate all of it! So to state the problem in the light of this new day jbnc> here is what I have;
>>From the command line this works perfectly; jbnc> curl -d "name=myname&password=mypassword&btnsubmit=submit" -s -o jbnc> cdrlist.html https://theserver.com/download/list.html
jbnc> Using exec() (or shell_exec(), or others in the family) like this;
jbnc> exec("curl -d \"name=myname&password=mypassword&btnsubmit=submit\" -s -o jbnc> cdrlist.html https://theserver.com/download/list.html");
jbnc> does not work. I have made sure that the output of the exec() is all on one jbnc> line through many tests. I have placed the command line arguements in jbnc> variables and re-done the exec() call as many ways as I can think of. Is jbnc> anyone aware of any problems with exec() that may be causing this behavior? jbnc> Any insight would be grandly appreciated.
jbnc> Thanks!
jbnc> Jay
-- Best regards, Latex mailto:freemansubmission.org.ru
attached mail follows:
[snip] Jay try just to execute php <yourfilename>
And see what is done. For example i have problems with execution read my e-mail in the list. [/snip]
Still not working. I have the script check for the existence of the file and return an error if it is not downloaded. That is the only error I get
Thanks!
attached mail follows:
Hello Jay, Let's try it in the different way. create an executable command file. and try to execute it via php it must work.
Wednesday, July 3, 2002, 5:20:49 PM, you wrote:
JB> [snip] JB> Jay try just to execute php <yourfilename>
JB> And see what is done. For example i have problems with execution JB> read my e-mail in the list. JB> [/snip]
JB> Still not working. I have the script check for the existence of the file and JB> return an error if it is not downloaded. That is the only error I get
JB> Thanks!
-- Best regards, Latex mailto:freemansubmission.org.ru
attached mail follows:
Trying that now...
-----Original Message-----
From: Latex Master [mailto:freeman
submission.org.ru]
Sent: Wednesday, July 03, 2002 8:26 AM
To: Jay Blanchard
Cc: php-general
lists.php.net
Subject: Re[4]: [PHP] cURL in an exec() . more
Hello Jay, Let's try it in the different way. create an executable command file. and try to execute it via php it must work.
Wednesday, July 3, 2002, 5:20:49 PM, you wrote:
JB> [snip] JB> Jay try just to execute php <yourfilename>
JB> And see what is done. For example i have problems with execution JB> read my e-mail in the list. JB> [/snip]
JB> Still not working. I have the script check for the existence of the file and JB> return an error if it is not downloaded. That is the only error I get
JB> Thanks!
-- Best regards, Latex mailto:freemansubmission.org.ru
attached mail follows:
Hello Jay, Let us know if it worked Wednesday, July 3, 2002, 5:27:21 PM, you wrote:
JB> Trying that now...
JB> -----Original Message-----
JB> From: Latex Master [mailto:freeman
submission.org.ru]
JB> Sent: Wednesday, July 03, 2002 8:26 AM
JB> To: Jay Blanchard
JB> Cc: php-general
lists.php.net
JB> Subject: Re[4]: [PHP] cURL in an exec() . more
JB> Hello Jay, JB> Let's try it in the different way. create an executable command JB> file. and try to execute it via php it must work.
JB> Wednesday, July 3, 2002, 5:20:49 PM, you wrote:
JB>> [snip] JB>> Jay try just to execute php <yourfilename>
JB>> And see what is done. For example i have problems with execution JB>> read my e-mail in the list. JB>> [/snip]
JB>> Still not working. I have the script check for the existence of the file JB> and JB>> return an error if it is not downloaded. That is the only error I get
JB>> Thanks!
JB> --
JB> Best regards,
JB> Latex mailto:freeman
submission.org.ru
-- Best regards, Latex mailto:freemansubmission.org.ru
attached mail follows:
Awww Nut! I post a reply a while ago and probably accidenly delete it instead of sending it. Dang! I hate this MS-Outlook software! Anyway! I"m not going to start over, so I'll be brief!
1) Check the file path, like "/usr/local/bin/curl" instead of "curl" as an example. Sometime environment variable couldn't be access that way.
2) I had that problem with different script, so I use "putenv("PATH=/usr/bin:");" so I can get the modem to work.
Hope that help! FletchSOD
"Latex Master" <freeman
submission.org.ru> wrote in message
news:41112791695.20020703173426
submission.org.ru...
> Hello Jay,
> Let us know if it worked
> Wednesday, July 3, 2002, 5:27:21 PM, you wrote:
>
> JB> Trying that now...
>
> JB> -----Original Message-----
> JB> From: Latex Master [mailto:freeman
submission.org.ru]
> JB> Sent: Wednesday, July 03, 2002 8:26 AM
> JB> To: Jay Blanchard
> JB> Cc: php-general
lists.php.net
> JB> Subject: Re[4]: [PHP] cURL in an exec() . more
>
>
> JB> Hello Jay,
> JB> Let's try it in the different way. create an executable command
> JB> file. and try to execute it via php it must work.
>
> JB> Wednesday, July 3, 2002, 5:20:49 PM, you wrote:
>
> JB>> [snip]
> JB>> Jay try just to execute php <yourfilename>
>
> JB>> And see what is done. For example i have problems with execution
> JB>> read my e-mail in the list.
> JB>> [/snip]
>
> JB>> Still not working. I have the script check for the existence of the
file
> JB> and
> JB>> return an error if it is not downloaded. That is the only error I get
>
> JB>> Thanks!
>
>
>
>
> JB> --
> JB> Best regards,
> JB> Latex mailto:freeman
submission.org.ru
>
>
>
>
>
>
> --
> Best regards,
> Latex mailto:freeman
submission.org.ru
>
attached mail follows:
OK, here is where I am (between handling other pre-holiday/long weekend processese here);
I have the PHP script create a shell script containing the needed code for the cURL process. Of course the shell script will execute from the command line with me as 'root'. But the exec() that calls the shell script will not execute the script because of improper permissions. (Has to do with the permissions on the topmost directory for where the file lives, changing that could be dangerous from a security standpoint).
So I have tried to change those (I am on a Linux box) via the PHP, no luck. It will let me chmod the shell script via the PHP script. So I tried to move the script to /usr/local/bin;
rename("getlist.sh", "/usr/local/bin/getlist.sh"); Permission denied exec("mv getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied exec("cp getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied
I am looking into posix_setuid() to change the permissions for the time needed, but I've a feeling, after a couple of tests, that this is not going to be the way to do this either.
I wish permissions in Linux were more straigtforward. Anyone have an idea how to do this with opening the server wide? Thanks for all your help.
Jay
attached mail follows:
Check out setuid and sticky bits for the file permissions.
Remember that if you are running php under apache and you try the exec with a command php is running with apaches permissions. So apache needs to be able to run what ever you are trying to run with the exec command.
B i g D o g
----- Original Message -----
From: "Jay Blanchard" <jay.blanchard
niicommunications.com>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 8:49 AM
Subject: RE: [PHP] cURL in an exec() . more
> OK, here is where I am (between handling other pre-holiday/long weekend > processese here); > > I have the PHP script create a shell script containing the needed code for > the cURL process. Of course the shell script will execute from the command > line with me as 'root'. But the exec() that calls the shell script will not > execute the script because of improper permissions. (Has to do with the > permissions on the topmost directory for where the file lives, changing that > could be dangerous from a security standpoint). > > So I have tried to change those (I am on a Linux box) via the PHP, no luck. > It will let me chmod the shell script via the PHP script. So I tried to move > the script to /usr/local/bin; > > rename("getlist.sh", "/usr/local/bin/getlist.sh"); Permission denied > exec("mv getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied > exec("cp getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied > > I am looking into posix_setuid() to change the permissions for the time > needed, but I've a feeling, after a couple of tests, that this is not going > to be the way to do this either. > > I wish permissions in Linux were more straigtforward. Anyone have an idea > how to do this with opening the server wide? Thanks for all your help. > > Jay > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Hello Jay, That wasn't what i recommended you LOL :). Ok from the beginning PHP executes and writes files with permissions (like userid and groupid) Webserver is running. So what i think will be the best way for you to do. Is to create an executable with the same owner. and then execute it. As for /usr/local/bin directory it allows to write in it only to root or superuser. I recommend you to create a user like foo then in his home directory create a subdirectory like web and chmod it to 777. and use it as an output for the script. Got an idea? Also you always can use /tmp directory :)
Wednesday, July 3, 2002, 6:49:08 PM, you wrote:
JB> OK, here is where I am (between handling other pre-holiday/long weekend JB> processese here);
JB> I have the PHP script create a shell script containing the needed code for JB> the cURL process. Of course the shell script will execute from the command JB> line with me as 'root'. But the exec() that calls the shell script will not JB> execute the script because of improper permissions. (Has to do with the JB> permissions on the topmost directory for where the file lives, changing that JB> could be dangerous from a security standpoint).
JB> So I have tried to change those (I am on a Linux box) via the PHP, no luck. JB> It will let me chmod the shell script via the PHP script. So I tried to move JB> the script to /usr/local/bin;
JB> rename("getlist.sh", "/usr/local/bin/getlist.sh"); Permission denied JB> exec("mv getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied JB> exec("cp getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied
JB> I am looking into posix_setuid() to change the permissions for the time JB> needed, but I've a feeling, after a couple of tests, that this is not going JB> to be the way to do this either.
JB> I wish permissions in Linux were more straigtforward. Anyone have an idea JB> how to do this with opening the server wide? Thanks for all your help.
JB> Jay
-- Best regards, Latex mailto:freemansubmission.org.ru
attached mail follows:
Ah! I know what you're feeling about Linux. I had that problem using PHP and text editing software (for programming) with Caldera, like ftp timeout, security, file path, etc. It become too much for me, so I junked it and went back to AIX. I haven't tried it on Red Hat but I can easily turned off hte ftp timeout, etc. from there. Haven't tried PHP stuffs on Red Hat.
FletchSOD
"Jay Blanchard" <jay.blanchard
niicommunications.com> wrote in message
news:002701c222a0$c958ffc0$8102a8c0
niigziuo4ohhdt...
> OK, here is where I am (between handling other pre-holiday/long weekend
> processese here);
>
> I have the PHP script create a shell script containing the needed code for
> the cURL process. Of course the shell script will execute from the command
> line with me as 'root'. But the exec() that calls the shell script will
not
> execute the script because of improper permissions. (Has to do with the
> permissions on the topmost directory for where the file lives, changing
that
> could be dangerous from a security standpoint).
>
> So I have tried to change those (I am on a Linux box) via the PHP, no
luck.
> It will let me chmod the shell script via the PHP script. So I tried to
move
> the script to /usr/local/bin;
>
> rename("getlist.sh", "/usr/local/bin/getlist.sh"); Permission denied
> exec("mv getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied
> exec("cp getlist.sh /usr/local/bin/getlist.sh"); Permissiion denied
>
> I am looking into posix_setuid() to change the permissions for the time
> needed, but I've a feeling, after a couple of tests, that this is not
going
> to be the way to do this either.
>
> I wish permissions in Linux were more straigtforward. Anyone have an idea
> how to do this with opening the server wide? Thanks for all your help.
>
> Jay
>
>
attached mail follows:
On Wednesday 03 July 2002 22:49, Jay Blanchard wrote:
> I have the PHP script create a shell script containing the needed code for > the cURL process. Of course the shell script will execute from the command > line with me as 'root'. But the exec() that calls the shell script will not > execute the script because of improper permissions. (Has to do with the > permissions on the topmost directory for where the file lives, changing > that could be dangerous from a security standpoint).
I'm not sure I understand you. You have a php script which creates a shell-script. Then you have a php script which exec('shell-script')? Assuming that the php script is run by the same user throughout then I don't see why it cannot exec your shell-script. Perhaps you can elaborate.
> So I have tried to change those (I am on a Linux box) via the PHP, no luck. > It will let me chmod the shell script via the PHP script.
OK ...
> So I tried to > move the script to /usr/local/bin;
so why do you need to move it? Why can't you exec() it where it is?
Try hand writing a script then exec() it from php.
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Alcohol, hashish, prussic acid, strychnine are weak dilutions. The surest poison is time. -- Emerson, "Society and Solitude" */
attached mail follows:
[snip] Ok from the beginning PHP executes and writes files with permissions (like userid and groupid) Webserver is running. So what i think will be the best way for you to do. Is to create an executable with the same owner. and then execute it. As for /usr/local/bin directory it allows to write in it only to root or superuser. I recommend you to create a user like foo then in his home directory create a subdirectory like web and chmod it to 777. and use it as an output for the script. Got an idea? Also you always can use /tmp directory :) [/snip]
Apache runs as 'nobody' and 'nogroup', so therefore PHP runs as the same. (Security, don't you know.) :) I cannot change file owner or group through PHP. The executable (getlist.sh) is created with the same owner/group. I do change the file permissions to '755' to allow the file to be an executable.
{snip] Try hand writing a script then exec() it from php. [/snip]
Tried that, no go.
crud, I knew this was gonna' happen because of the very tight deadline I am on. I had a feeling that this is why the original exec(curl) didn't work.
Thanks,
Jay
attached mail follows:
Bingo! That will work! This is what I do with the modem script. Since there's no PHP function or script for the modem, so I used the C programming that is already written by someone and just use PHP to execute the file.
"Jay Blanchard" <jay.blanchard
niicommunications.com> wrote in message
news:002901c222a3$8c2a6f00$8102a8c0
niigziuo4ohhdt...
> [snip]
> Ok from the beginning PHP executes and writes files with
> permissions (like userid and groupid) Webserver is running.
> So what i think will be the best way for you to do. Is to create an
> executable with the same owner. and then execute it. As for
> /usr/local/bin directory it allows to write in it only to root or
> superuser. I recommend you to create a user like foo
> then in his home directory create a subdirectory like web and chmod it
> to 777. and use it as an output for the script. Got an idea?
> Also you always can use /tmp directory :)
> [/snip]
>
> Apache runs as 'nobody' and 'nogroup', so therefore PHP runs as the same.
> (Security, don't you know.) :) I cannot change file owner or group through
> PHP. The executable (getlist.sh) is created with the same owner/group. I
do
> change the file permissions to '755' to allow the file to be an
executable.
>
> {snip]
> Try hand writing a script then exec() it from php.
> [/snip]
>
> Tried that, no go.
>
> crud, I knew this was gonna' happen because of the very tight deadline I
am
> on. I had a feeling that this is why the original exec(curl) didn't work.
>
> Thanks,
>
> Jay
>
>
attached mail follows:
Hi all, I have compiled PHP with Java support using the option ./configure --with-prefix="path to lib directory" --with-java="jdk path" on a virtual server. There is no problem with compilation. During compilation it gives Checking for Java Support yes . I made modifications to the php.ini file also. but when I tried a test php script <?php phpinfo(); ?> , I was not able to see anything related to java in the output file.
As the previous option was not working , we tried setting JAVA_HOME to jdk_path and used the option ./configure --with-prefix="path to lib directory" --with-java(without the jdkpath) . Even not I was not able to get anything related to Java. phpinfo() gives me the configure option as ./configure --with-prefix="path to lib directory" --with-java="jdk path" and not ./configure --with-prefix="path to lib directory" --with-java . Am I doing anything wrong ?
Then we removed all PHP related files for usr/local/bin and usr/local/lib and compiled PHP again. Even now we were not able to get that working ...
what are the steps to be followed to install PHP with Java support on a virtual server??? previously we had installed the same version of PHP on our local m/c and everything was working fine. The only difference is I am not using --with-prefix option when compiling on my local m/c . we don't have access to /usr/local/lib of the virtual server m/c and so we cannot put our ini file in /usr/local/lib.
Regds, Revathi.
attached mail follows:
Date: Wed, 3 Jul 2002 15:11:53 +0200 Mime-Version: 1.0 (Apple Message framework v482) Content-Type: text/plain; charset=WINDOWS-1252; format=flowed From: =?ISO-8859-1?Q?Victor_Sp=E5ng_Arthursson?= <scooterbabe
mac.com>
To: php-general
lists.php.net
Content-Transfer-Encoding: quoted-printable
Message-Id: <71C64530-8E86-11D6-99F5-00039344A3C4
mac.com>
Subject: Why can't I get imagepstext to work?
No matter what I try, it doesn't work=85
I have GD installed and my phpinfo is on this link: <adversus.no- ip.com/test/phpinfo.php>
Please, someone, help=85
Sincerely
Victor
attached mail follows:
as a preg "/(...)$/"
this gives you the last three chars..
-- ======================================================================= Michael J. Ryan - tracker1[*at*]theroughnecks.com Roughneck BBS: http://www.theroughnecks.net telnet://theroughnecks.net ======================================================================= Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email One program for aim/icq/yahoo/msn/irc - http://www.trillian.cc/"David Busby" <busby
pnts.com> wrote in message news:3D2211C2.7010008
pnts.com... > List, > How can I regex to compare the last three chars of a string to "php"? > > /B >
attached mail follows:
"Richard Lynch" <rich
phpbootcamp.com> wrote in message...
> > How can I regex to compare the last three chars of a string to "php"?
>
> if (substr($foo, -3) == 'php'){
> }
>
> Oh, wait, you wanted to use RegEx. Sorry, can't help you there. :-)
>
> Don't use a cannon to swat a fly.
probably a good call.. :)
-- ======================================================================= Michael J. Ryan - tracker1[*at*]theroughnecks.com Roughneck BBS: http://www.theroughnecks.net telnet://theroughnecks.net ======================================================================= Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email One program for aim/icq/yahoo/msn/irc - http://www.trillian.cc/
attached mail follows:
On Tuesday, July 2, 2002, at 09:48 PM, Richard Lynch wrote:
> My old ISP had SSL on another server (or at least directory) and > personally > vetted every line of code that went on it. Royal PITA, but more secure.
What does "vetted" mean? I didn't see it in the Jargon File so maybe it's OT but I'm curious.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
"Richard Lynch" <rich
phpbootcamp.com> wrote in message...
> > I'm getting this error message...where does it come from?
> >
> >Warning: SQL error: [unixODBC][Driver Manager]Data source name not
> >found, and no default driver specified, SQL state IM002 in SQLConnect in
> >/var/www/html/index.php on line 4
>
> Microsoft. :-)
>
> Microsoft defines possible database connections as "DSN" in the ODBC Control
> Panel.
>
> Open up the ODBC Control Panel, and make a DSN named "foo" and point it to
> the database you want to access.
it said unixODBC, not sure what he was trying to connect to though, may be best to use the native connection drivers?
-- ======================================================================= Michael J. Ryan - tracker1[*at*]theroughnecks.com Roughneck BBS: http://www.theroughnecks.net telnet://theroughnecks.net ======================================================================= Y!: aztracker1 - aim: azTracker1 - icq: 4935386 - msn: see email One program for aim/icq/yahoo/msn/irc - http://www.trillian.cc/
attached mail follows:
hi, I want to make an app with properties: -i have a file1.php with a textbox1 and button1; when i press button1, file2.php is popup-ed. - in file2.php i have textbox2 and button2; when button2 is pressed, file2 is closed, and value of textbox2 is submited to texbox1. There is somewere an sample app like this?
tx in adv for any help adi
attached mail follows:
Message-ID: <3D230F31.8030303
canad.ro>
Date: Wed, 03 Jul 2002 17:50:25 +0300
From: Bogdan Stancescu <mgv
canad.ro>
MIME-Version: 1.0
To: php-general <php-general
lists.php.net>
Content-Type: text/plain; charset=us-ascii; formatowed
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP] sample javascript popup+php - newbie
Submitted or filled in? i.e. do you want textbox1 to contain whatever is in textbox2 or do you want the form in file2.php to be submitted to file1.php? The difference is that in the first case no PHP gets to run when button2 is pressed, whereas in the second case file1.php gets to run with the data in the form in file2.php.
Bogdan
adi wrote:
>hi, >I want to make an app with properties: >-i have a file1.php with a textbox1 and button1; when i press button1, file2.php is popup-ed. >- in file2.php i have textbox2 and button2; when button2 is pressed, file2 is closed, and value of textbox2 is submited to texbox1. >There is somewere an sample app like this? > >tx in adv for any help >adi > > >
attached mail follows:
filled in
----- Original Message -----
From: "Bogdan Stancescu" <mgv
canad.ro>
To: "php-general" <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 5:50 PM
Subject: Re: [PHP] sample javascript popup+php - newbie
> Submitted or filled in? i.e. do you want textbox1 to contain whatever is > in textbox2 or do you want the form in file2.php to be submitted to > file1.php? The difference is that in the first case no PHP gets to run > when button2 is pressed, whereas in the second case file1.php gets to > run with the data in the form in file2.php. > > Bogdan > > adi wrote: > > >hi, > >I want to make an app with properties: > >-i have a file1.php with a textbox1 and button1; when i press button1, file2.php is popup-ed. > >- in file2.php i have textbox2 and button2; when button2 is pressed, file2 is closed, and value of textbox2 is submited to texbox1. > >There is somewere an sample app like this? > > > >tx in adv for any help > >adi > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
No problem! Just saw the "www.the-spa.com" link so I thought it was an
advertisement. It wasn't until after I submitted did I realize I was in
error. FletchSOD
"Chris Shiflett" <shiflett
php.net> wrote in message
news:3D2248EC.6010401
php.net...
> Scott Fletcher wrote:
>
> >This is a PHP newsgroup, it is for PHP discussion. This is not a PHP
> >discussion, so it is a spam mail. Please refrain from using it.
> >
> >
>
> Actually, I think it is pretty obvious that this guy is just trying to
> subscribe. Your email (and consequently mine) are more easily
> categorized as spam, and yous even adds a dash of bad attitude.
>
> >"Matthew" <matthew
the-spa.com> wrote in message
> >news:5.1.0.14.2.20020702155330.01fff2a8
mail.the-spa.com...
> >
> >
> >>subscribe matthew.de.jongh
the-spa.com
> >>
> >>matthew de Jongh
> >>president
> >>the spa! internet
> >>voice (413) 539-9818
> >>www.the-spa.com
> >>
>
attached mail follows:
Hey, that is new to me! Thanks! FletchSOD
"Kevin Stone" <kevin
helpelf.com> wrote in message
news:01de01c22216$984c5740$6501a8c0
kevin...
> Oh man I hope you don't shoot yourself when you realize how easy this is..
>
> foreach ($_POST as $key => $val)
> {
> $str .= "&$key=$val";
> }
>
> Then just crop the first char off and there you go.
>
> -Kevin
>
> ----- Original Message -----
> From: <php
net.co.cr>
> To: <php-general
lists.php.net>
> Sent: Tuesday, July 02, 2002 4:10 PM
> Subject: [PHP] $_POST into a formatted string, help!
>
>
> > Hello,
> >
> > I need to get _$POST into a string in this form:
> > tree=green&sky=blue&sun=yellow , how can i accomplish this?
> >
> > THanks.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
attached mail follows:
> Oh man I hope you don't shoot yourself when you realize how easy this > is.. > > foreach ($_POST as $key => $val) > { > $str .= "&$key=$val"; > } > > Then just crop the first char off and there you go.
Even easier, though maybe requiring a tiny bit extra memory to deal with the array:
$arr = array(); foreach ($_POST as $key => $val) { $arr[] = $key . '=' . $val; } $str = implode('&', $arr);
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
----- Original Message -----
From: "Erik Price" <pricee
hhbrown.com>
> > foreach ($_POST as $key => $val)
> > {
> > $str .= "&$key=$val";
> > }
Make sure you define $str = ""; before it enters the loop, othewise you'll throw some warnings if your error reporting level is set high. It's because $str is undefined on the first loop, yet your adding something to it.
> Even easier, though maybe requiring a tiny bit extra memory to deal with > the array: > > $arr = array(); > foreach ($_POST as $key => $val) { > $arr[] = $key . '=' . $val; > } > $str = implode('&', $arr);
Hmmm...doesn't look easier, but whatever works! :)
---John Holmes...
attached mail follows:
I'm writing my first commercial site and of course I am thinking about security. I'm worried about someone using a flaw in my PHP script logic to access information they shouldn't.
I've read the PHP books I have and Googled around but can't quite find specific answers to my questions about PHP and security.
In general how does one go about hardening a PHP script. i.e. making it as "hacker-proof" as possible. General things like:
- verifying user inputted data - not putting clear-text passwords in php scripts - use "safe-mode"?
And specifically, what are some things one can do? Things like:
- use addslashes with user data - use mysql_escape_string for data submitted to mysql
Thanks,
Jc
attached mail follows:
on 03/07/02 11:36 PM, Jean-Christian Imbeault (jean_christian
myrealbox.com)
wrote:
> In general how does one go about hardening a PHP script. i.e. making it > as "hacker-proof" as possible. General things like:
I think the general answer is "you can't", but you can make it more secure.
> - verifying user inputted data
"verify user inputted data" means nothing... you should take a specific example, like "make sure a text box is less than 500 words, contains only <B> <BR> <I> & <U> tags, and starts with a capital letter", and then let us help you solve it.
Obviously verifying a date is different to a password, verifying that a certain select box was selected is different from making sure that their phone number contains only numbers, etc etc.
The string functions will do most of this for you with very little effort.
empty(), isset(), strlen(), is_int(), is_str(), strip_tags(), ereg() & eregi() and many others will all help, but you need to approach them one at a time.
You should also be concerned about character sets.
If you wanna get anal about it, you should be using register_globals OFF in your php.ini file, and should be treating any $_GET var as unsafe, and same with all other such variables (cookies, sessions, post, etc)
> - not putting clear-text passwords in php scripts
A thread started in here about two weeks back with the subject "Keeping "Secrets" in PHP Files"... you should read that end-to-end... HEAPS of infomation.
> - use "safe-mode"?
I have no idea about safe mode.
This list really does work best (ie best results for you) if you come to us with a specific problem, rather than something general.
Justin French
attached mail follows:
I am trying to make my PHP safe against malicious data user inputs. Reading up on this most people suggest using addslashes(), magic_quotes on and other things like mysql_escape_string();
But I have been running into the problem that I mess up the user's input because I use more then one of these functions in succession on the data.
Is there any way to prevent the "re-escaping"/"re-slashing" of data that has already been escaped or slashed?
Jc
attached mail follows:
Try stripslashes() before addslashes(), to ensure that it doesn't already contain slashes.
HTH
Martin
>>> Jean-Christian Imbeault <jean_christian
myrealbox.com> 07/03/02 09:40AM >>>
I am trying to make my PHP safe against malicious data user inputs.
Reading up on this most people suggest using addslashes(), magic_quotes
on and other things like mysql_escape_string();
But I have been running into the problem that I mess up the user's input because I use more then one of these functions in succession on the data.
Is there any way to prevent the "re-escaping"/"re-slashing" of data that has already been escaped or slashed?
Jc
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Martin Clifford wrote:
> Try stripslashes() before addslashes(), to ensure that it doesn't already contain slashes. > > HTH > > Martin
But what if the original data contained a slash? I want to keep that slash in the data ...
Jc
attached mail follows:
On Wednesday, July 3, 2002, at 09:40 AM, Jean-Christian Imbeault wrote:
> I am trying to make my PHP safe against malicious data user inputs. > Reading up on this most people suggest using addslashes(), magic_quotes > on and other things like mysql_escape_string(); > > But I have been running into the problem that I mess up the user's > input because I use more then one of these functions in succession on > the data. > > Is there any way to prevent the "re-escaping"/"re-slashing" of data > that has already been escaped or slashed?
Turn off magic_quotes and do addslashes() explicitly every time you do a database insert. Then make sure you always stripslash() data returned from a database query.
magic_quotes is convenient for newbies, but after a while you'll find it only trips you up, as you've discovered.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
Erik Price wrote:
>
> Turn off magic_quotes and do addslashes() explicitly every time you do a > database insert. Then make sure you always stripslash() data returned > from a database query. > > magic_quotes is convenient for newbies, but after a while you'll find it > only trips you up, as you've discovered.
I totally agree.
Security question: Is turning off magic_quotes and using strip/addslashes() a 100% effective solution against malicious user input?
Jc
attached mail follows:
Just pick one, and use only one. If you have magic_quotes ON, then you don't need addslashes, etc.
---John Holmes...
----- Original Message -----
From: "Jean-Christian Imbeault" <jean_christian
myrealbox.com>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 9:40 AM
Subject: [PHP] addslahes and magic quote woes
> I am trying to make my PHP safe against malicious data user inputs. > Reading up on this most people suggest using addslashes(), magic_quotes > on and other things like mysql_escape_string(); > > But I have been running into the problem that I mess up the user's input > because I use more then one of these functions in succession on the data. > > Is there any way to prevent the "re-escaping"/"re-slashing" of data that > has already been escaped or slashed? > > Jc > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
attached mail follows:
Hello Jean-Christian, The answer is NO NO NO. At the beginning you have talked about security. You have to realize that there is no 100% protection against hackers. Using strip/addslashes will help you to filter some user input not all. :) So try to pick one way and go that way. if magic quotes are turned on you want need addslashes if they are off you will need them.
Wednesday, July 3, 2002, 6:21:37 PM, you wrote:
JCI> Erik Price wrote:
>>
>> Turn off magic_quotes and do addslashes() explicitly every time you do a >> database insert. Then make sure you always stripslash() data returned >> from a database query. >> >> magic_quotes is convenient for newbies, but after a while you'll find it >> only trips you up, as you've discovered.
JCI> I totally agree.
JCI> Security question: Is turning off magic_quotes and using JCI> strip/addslashes() a 100% effective solution against malicious user input?
JCI> Jc
-- Best regards, Latex mailto:freemansubmission.org.ru
attached mail follows:
From: "Jean-Christian Imbeault" <jean_christian
myrealbox.com>
> Erik Price wrote:
>
> >
>
> > Turn off magic_quotes and do addslashes() explicitly every time you do a
> > database insert. Then make sure you always stripslash() data returned
> > from a database query.
You don't need to strip slashes from data coming out of a database. The only reason you add the slashes in the first place is to get the data into the database, the actual slashes don't go into the database.
> > > > magic_quotes is convenient for newbies, but after a while you'll find it > > only trips you up, as you've discovered.
I haven't discovered this....
> I totally agree. > > Security question: Is turning off magic_quotes and using > strip/addslashes() a 100% effective solution against malicious user input?
Nothing's 100%, of course. It will make sure that your strings are treated properly, but slashes don't do anything for integers.
If you have a query like:
UPDATE admin SET something = 'this' where user_id = $user_id
Then using addslashes doesn't help you at all because $user_id doesn't have quotes around it. Since it's supposed to be an integer, it shouldn't have quotes, but you need to validate that $user_id is indeed an integer without any other data in it, otherwise you're open to SQL attacks.
Bottom line, validate everything from the user. POST, GET, COOKIE, etc... If it's supposed to be a number, make it a number with (int). If it's supposed to be a string, make sure it's had addslashes() applies to it, either through magic_quotes or manually...etc, etc, etc...
---John Holmes...
attached mail follows:
On Wednesday, July 3, 2002, at 10:21 AM, Jean-Christian Imbeault wrote:
> Security question: Is turning off magic_quotes and using > strip/addslashes() a 100% effective solution against malicious user > input?
No.
Think about what {add|strip}slashes() does. It simply adds slashes to strings, and strips them from strings, depending on certain rules (like the location of apostrophes or other special characters in those strings).
There are far more ways for malicious users to insert their own input than I even know of, let alone know how to handle.
Consider using add/strip a requirement, not a security precaution.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
Hello php-general,
Hello php-general,
Dear php list,
I've got completely lost in program execution under php. I need to run a command grab it's output for the next processing, So I wrote a script:
<? $output = shell_exec("uudeview -i /bla/bla.txt -p /bla/bla/"); echo "<pre>"; echo $output; echo "</pre>"; ?> And I get nothing :(. Script like below: <? $output = shell_exec("uudeview"); echo "<pre>"; echo $output; echo "</pre>"; ?> Work fine outputting me command line parameters. Also when i run this file via linux console i get the following mess: ******************************************************************************* php 6.php X-Powered-By: PHP/4.0.6 Content-type: text/html
Loaded from /bla/bla.txt: '' (cs99g021.idx): cs99g021.idx part 1 be gin end yEnc <html><body><pre> Found 'cs99g021.idx' State 16 yEnc Parts begin 1 end OK
File successfully written to /bla/bla/cs99g021.idx 1 file decoded from 1 input file, 0 failed </pre></html></body>
I think it must be in the other way, like this: <html><body><pre> Loaded from /bla/bla.txt: '' (cs99g021.idx): cs99g021.idx part 1 be gin end yEnc Found 'cs99g021.idx' State 16 yEnc Parts begin 1 end OK
File successfully written to /bla/bla/cs99g021.idx 1 file decoded from 1 input file, 0 failed </pre></html></body>
Please give me some clues where is my mistake, i'm getting little nuts.
-- Best regards, Latex mailto:freemansubmission.org.ru
attached mail follows:
I am looking for PHP programmers in South Africa, specifically in the Gauteng area. Please mail me.
Tx Bk
attached mail follows:
I'm not sure if this is the right place for this but I'm just starting out with php and MySQL....
I have succesfully got a database up and I have managed to populate the first row of the html table with the first row of dynamic content without too much problem. I have used the visual enviroment of DW Mx for this and it was staightforward enough
My problem arises when I want to fill in the subsequent rows of the table with the subesquent rows from the database. How do I create the recordset that will pull the info from the relevant subsequent rows for my columns?
The code for the first row and first column entry is:
<?php echo $row_RsSingStanDailybb['DailyBB']; ?>
but in the row below in the html table I want to refer to the second row DB entry for DailyBB but I cant see how to go about this:( The Repeat server behaviour in DW Mx simply puts all the values in one html cell which is not what I wish to achieve. Basically I want the html table to match the database but have only succeeded in getting the first row to display so far:(
I'm sure this is simple but its my first time at all this and any help would be appreciated:)
TIA
attached mail follows:
Put it in a WHILE loop and RTFM
-----Original Message-----
From: Duncan Ellwood [mailto:fraggaman
hotmail.com]
Sent: Wednesday, July 03, 2002 9:44 AM
To: php-general
lists.php.net
Subject: [PHP] V basic newbie problem
I'm not sure if this is the right place for this but I'm just starting out with php and MySQL....
I have succesfully got a database up and I have managed to populate the first row of the html table with the first row of dynamic content without too much problem. I have used the visual enviroment of DW Mx for this and it was staightforward enough
My problem arises when I want to fill in the subsequent rows of the table with the subesquent rows from the database. How do I create the recordset that will pull the info from the relevant subsequent rows for my columns?
The code for the first row and first column entry is:
<?php echo $row_RsSingStanDailybb['DailyBB']; ?>
but in the row below in the html table I want to refer to the second row DB entry for DailyBB but I cant see how to go about this:( The Repeat server behaviour in DW Mx simply puts all the values in one html cell which is not what I wish to achieve. Basically I want the html table to match the database but have only succeeded in getting the first row to display so far:(
I'm sure this is simple but its my first time at all this and any help would be appreciated:)
TIA
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Sorry to crash in! One quick question! Does the VB script work on NON-IE
browsers?
FletchSOD
"Jay Blanchard" <jay.blanchard
niicommunications.com> wrote in message
news:002601c222a0$8d8e7330$8102a8c0
niigziuo4ohhdt...
> Put it in a WHILE loop and RTFM
>
> -----Original Message-----
> From: Duncan Ellwood [mailto:fraggaman
hotmail.com]
> Sent: Wednesday, July 03, 2002 9:44 AM
> To: php-general
lists.php.net
> Subject: [PHP] V basic newbie problem
>
>
> I'm not sure if this is the right place for this but I'm just starting out
> with php and MySQL....
>
> I have succesfully got a database up and I have managed to populate the
> first row of the html table with the first row of dynamic content
without
> too
> much problem. I have used the visual enviroment of DW Mx for this and it
was
> staightforward enough
>
> My problem arises when I want to fill in the subsequent rows of the table
> with the subesquent rows from the database. How do I create the recordset
> that will pull the info from the relevant subsequent rows for my columns?
>
> The code for the first row and first column entry is:
>
> <?php echo $row_RsSingStanDailybb['DailyBB']; ?>
>
> but in the row below in the html table I want to refer to the second row
DB
> entry for DailyBB but I cant see how to go about this:( The Repeat server
> behaviour in DW Mx simply puts all the values in one html cell which is
not
> what I wish to achieve. Basically I want the html table to match the
> database but have only succeeded in getting the first row to display so
> far:(
>
> I'm sure this is simple but its my first time at all this and any help
would
> be appreciated:)
>
> TIA
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
attached mail follows:
try something like this
echo '<table>';
while( $result = mysql_fetch_array( $q ) ) { output here... }
echo '</table>';
S RAY HUNTER
email: rhunter
venticon.com
www: http://www.venticon.com
aim: spinebl8d3
----- Original Message -----
From: "Duncan Ellwood" <fraggaman
hotmail.com>
To: <php-general
lists.php.net>
Sent: Wednesday, July 03, 2002 8:43 AM
Subject: [PHP] V basic newbie problem
> I'm not sure if this is the right place for this but I'm just starting out > with php and MySQL.... > > I have succesfully got a database up and I have managed to populate the > first row of the html table with the first row of dynamic content without > too > much problem. I have used the visual enviroment of DW Mx for this and it was > staightforward enough > > My problem arises when I want to fill in the subsequent rows of the table > with the subesquent rows from the database. How do I create the recordset > that will pull the info from the relevant subsequent rows for my columns? > > The code for the first row and first column entry is: > > <?php echo $row_RsSingStanDailybb['DailyBB']; ?> > > but in the row below in the html table I want to refer to the second row DB > entry for DailyBB but I cant see how to go about this:( The Repeat server > behaviour in DW Mx simply puts all the values in one html cell which is not > what I wish to achieve. Basically I want the html table to match the > database but have only succeeded in getting the first row to display so > far:( > > I'm sure this is simple but its my first time at all this and any help would > be appreciated:) > > TIA > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
[snip] Sorry to crash in! One quick question! Does the VB script work on NON-IE browsers? FletchSOD [/snip]
VBscript works on ASP (Active Server Pages) servers...IIS most noteably, but you can get ChiliSOFT ASP for Linux and other *nix boxes. ASP can use VBscript, JSP, PerlScript, and other scripting languages.
HTH!
Jay
attached mail follows:
DE> I'm not sure if this is the right place for this but I'm just starting out DE> My problem arises when I want to fill in the subsequent rows of the table DE> with the subesquent rows from the database. How do I create the recordset DE> that will pull the info from the relevant subsequent rows for my columns?
Depending on your SQL query, and assuming that you have checked for more than one row before coding accordingly, then the answer is to loop through your results using a combination of while and the mysql_fetch_array function. (or another mysql result function of your choice).
That being said, without having seen your PHP code, we can't really tell you what exactly to do. This is a problem when using editors that "help" you to code.
The basic concepts for accessing MySQL and retrieving records are all in the mysql area of the manual, or in tutorials abound.
(including here: http://www.thickbook.com/extra/php_mysql.phtml)
- Julie
--> Julie Meloni
--> julie
thickbook.com
--> www.thickbook.com
Find "Sams Teach Yourself MySQL in 24 Hours" at http://www.amazon.com/exec/obidos/ASIN/0672323494/thickbookcom-20
attached mail follows:
while($row = mysql_fetch_array($result_set)) { $field1 = $row['field1']; $field2 = $row['field2'];
echo "<tr><td width=\"50%\">\n"; echo "$field1\n"; echo "</td><td width=\"50%\">\n"; echo "$field2\n"; echo "</td></tr>\n"; }
This will cycle through the rows, adding the values of field1 and field2 to the respective variables, then outputting table rows accordingly.
HTH
Martin
>>> "Duncan Ellwood" <fraggaman
hotmail.com> 07/03/02 10:43AM >>>
I'm not sure if this is the right place for this but I'm just starting out
with php and MySQL....
I have succesfully got a database up and I have managed to populate the first row of the html table with the first row of dynamic content without too much problem. I have used the visual enviroment of DW Mx for this and it was staightforward enough
My problem arises when I want to fill in the subsequent rows of the table with the subesquent rows from the database. How do I create the recordset that will pull the info from the relevant subsequent rows for my columns?
The code for the first row and first column entry is:
<?php echo $row_RsSingStanDailybb['DailyBB']; ?>
but in the row below in the html table I want to refer to the second row DB entry for DailyBB but I cant see how to go about this:( The Repeat server behaviour in DW Mx simply puts all the values in one html cell which is not what I wish to achieve. Basically I want the html table to match the database but have only succeeded in getting the first row to display so far:(
I'm sure this is simple but its my first time at all this and any help would be appreciated:)
TIA
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Wednesday, July 3, 2002, at 10:43 AM, Duncan Ellwood wrote:
> My problem arises when I want to fill in the subsequent rows of the > table > with the subesquent rows from the database. How do I create the > recordset > that will pull the info from the relevant subsequent rows for my > columns? > > The code for the first row and first column entry is: > > <?php echo $row_RsSingStanDailybb['DailyBB']; ?> > > but in the row below in the html table I want to refer to the second > row DB > entry for DailyBB but I cant see how to go about this:( The Repeat > server > behaviour in DW Mx simply puts all the values in one html cell which is > not > what I wish to achieve. Basically I want the html table to match the > database but have only succeeded in getting the first row to display so > far:(
I haven't used DW Mx myself, I don't really like WYSIWYGs. But the way to do it is use a while loop.
// $db = your connection parameters // $sql = your query if (!$result = mysql_query($sql, $db)) { die('The query failed for some reason'); }
// this part goes through all the data in $result // and does something with that data on each iteration while ($row = mysql_fetch_assoc($result)) { echo $row_RsSingStanDailybb['DailyBB']; }
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
Say that the end-user closed the browser(s) without logging off. The $_SESSION can not be destroyed because the broswer(s) is closed. So, if hte end-user did log off and close the browser(s). How can I destroy the $_SESSION since the session_register() & session_destroy() can not be used with the register global turned off.
Thanks, FletchSOD
attached mail follows:
I am able to do this:
<xsl:for-each select="alot of stuff"> <form name="myform" action = "http:path to somewhere.php" method="post"> <input type="submit" name="insert" value="Boston"/></form> </xsl:for-each>
But would like to do something like this:
<xsl:for-each select="alot of stuff"> <form name="myform" action = "http:path to somewhere.php" method="post"> <input type="submit" name="insert" value="<xsl:value-of select="."/>"/></form> </xsl:for-each>
I know the latter does not work, so how do I correct it?
Thank you,
-- Bill Amsterdam, NL
attached mail follows:
Analysis & Solutions wrote:
> On Tue, Jul 02, 2002 at 10:34:32PM +0200, Nightshade wrote: >> Analysis & Solutions wrote: >> >> Document root doensn't solve my problem... >> ... snip ... >> Any solution? > > Read and heed what I already said: > >> > Whenever you have a question like this, run phpinfo() and see what's >> > there which produces the variable you're looking for. > > If that doesn't have what you're looking for, you need to craft your own > solution. > > --Dan >
Yea,I understood. But my question is: is right that my Document_root (shown in phpinfo) is /var/www/html/ and not /var/www/html/mysite? And if isn't right where I can change this? tnx again
attached mail follows:
On Wednesday, July 3, 2002, at 11:08 AM, Nightshade wrote:
> Yea,I understood. But my question is: is right that my Document_root > (shown > in phpinfo) is /var/www/html/ and not /var/www/html/mysite? And if isn't > right where I can change this?
I'm not sure -- is that the directory that you want to be your document root? I doubt it from what you're saying but nobody else has any way of knowing.
If you want your document root to be /var/www/html/mysite and it is currently something else, you need to set your httpd.conf file differently. Or perhaps a .htaccess file can be used. (This is assuming you are using Apache.)
Go to www.apache.org and read the httpd documentation there for more information about setting up the document root in httpd.conf.
Erik
----Erik Price Web Developer Temp Media Lab, H.H. Brown pricee
hhbrown.com
attached mail follows:
Hi there, this is my first time posting. I've set up the event calendar script that http://www.php.net uses on their front page. The only problem I'm having is getting the information from the mysql database to the backend.csv file that it uses. Everything is working properly included the submitting of the events, and the data is being imported correctly. Has anyone used this script before, or maybe has some ideas on what I need to check? Thanks in advance.
Dave
attached mail follows:
"Richard Lynch" <ceo
l-i-e.com> wrote in message
news:20020703015441.83554.qmail
pb1.pair.com...
> Okay, here's a stumper for the gurus:
>
> Why does PDF just "stop" on some strings and not print them?
>
[...snip...]
> You can even use "View Source" on the HTML to verify that there are no
funky
> newline characters in the data, as I have.
The HTML source looks perfect. This might sound like a stupid question but is there any way that you can look at the source (data) that is being passed to PDF? Maybe something is being screwed up in the array that you are building... The error is definitely consistant which seems to indicate that it's not simply a PDF quirk..
> I know I sound cranky and frustrated -- Sorry. But, well, I am. :-)
:))
attached mail follows:
"man htpassswd" shows it can be MD5, crypt or SHA.
Chris
Richard Lynch wrote:
>>Does anyone know what encryption is used on passwords in a .htpasswd file? >> > >I *THINK*: > >OS-dependent... >
attached mail follows:
As I started working on this contest and did not finish it, I will put here the code for this, as this code may help somebody
http://www.php9.com/index.php/section/articles
-- --Calin Uioreanu PHP Programmer ciao.com AG
www.ciao-ag.com Consumer Access Europewide
Phone : +49-89-25 55 1707 Fax : +49-89-25 55 1700 mailto:calin
ciao.com
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]