|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general-digest-help_at_lists.php.net
Date: Sun Oct 20 2002 - 09:25:47 CDT
php-general Digest 20 Oct 2002 14:25:47 -0000 Issue 1655
Topics (messages 120650 through 120665):
Re: String extraction from blobs. Extracted string to be placed into field within another table.
120650 by: Manuel Lemos
Re: Working with frames ...
120651 by: Justin French
Re: how to build restreced area?
120652 by: Justin French
Undefined Symbol "pthread_getspecific"
120653 by: Tim Legg
Re: odbc_num_rows always returnes -1
120654 by: Jeff Bluemel
Re: PHP CGI
120655 by: .: B i g D o g :.
Re: Newbie NN4 help...
120656 by: . Edwin
120665 by: Stephanie Sullivan
native informix support with SDK? (error running apache)
120657 by: Jeff Bluemel
Re: Duplicating a Record in MySQL
120658 by: David McInnis
Re: time stamps
120659 by: Joona Kulmala
Function effecting global array.
120660 by: Noodle Snacks
120661 by: Jason Wong
120662 by: Noodle Snacks
Returning non-references still allows access to member variables?
120663 by: Matthew Bogosian
Why is there an outputbuffer here?
120664 by: Bas Jobsen
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:
Hello,
On 10/19/2002 11:13 PM, Dwalker wrote:
> What is the most effective method of extracting from a blob specified
> text to be placed into another table field.
If you use Metabase it allows you to create prepared queries where you
can pipe data from blob returned by a select query to a blob to be
updated or inserted by another query, with minimal memory usage, thus
allowing to manipulate large sized blobs.
Metabase is a database independent abstraction layer so it works with
many supported databases:
http://www.phpclasses.org/metabase
--Regards, Manuel Lemos
attached mail follows:
Depends on the browser. For what it's worth, this sorta of question falls in the category of "why bother -- this is what the web is, so why try and change it?"... really... people WANT to see the URLs, they WANT to bookmark stuff easily, send page links to their friends, etc etc. That's what the web "does".
They will also see the URL when they hover over links in the status bar of most browsers, unless you "hide" that with JS.
Incidently, if I had to choose between frames and hiding the address using a pop-up javascript window, the JS window would be easier to implement.
You could probably also hide the URLs using "cloaking" (not sure of the real term for it) with Apache.
Unless you're doing something REALLY secret, like banking or something, I'd just deal with the URLs in the address bar. Even then, it's easy for anyone to view the source... so what are you hiding?
Justin
on 20/10/02 12:40 AM, Jean-Marc Godart (jean-marc
godart.net) wrote:
> Hello, > > Not really a question about PHP but I am sure you will not mind helping me > ... > > To avoid the URL of the pages to appear in the address bar, I would like to > work with frames. Though, what happens then if the user wants to put the > site in his favorites ? Which page (frame or frame content ?) is stored in > the favorites ? How can I control this ? > > By advance, thank you for your help. > > Regards, > > Jean-Marc > > >
attached mail follows:
You have heaps of little issues hear, which you need to address one-by-one, then try to get them all integrated.
1. Restricting pages / sessions / user management:
I've answered this question maybe 50 times the exact same way. You should check the archives before posting.
There is a reasonable tutorial on "restricting selected pages with a login form" by Kevin Yank on sitepoint.com / webmasterbase.com.
http://www.webmasterbase.com/article/319
It taught me heaps about sessions, and was the basis for my session/authentication/user management library, which is now in use on heaps of sites.
Warning: The code in the article is written for register globals ON, and relies on cookies. You'll need to put in some extra work to overcome these (possible) problems.
2. Restricting files:
again, this gets asked constantly... once you have user management, you can restrict files to ONLY members. A good article, which again become the basis of my own code library, can be found on Zend:
http://www.zend.com/zend/trick/tricks-august-2001.php
on 19/10/02 7:57 PM, marcel.britsch (marcel.britsch
gmx.de) wrote:
> hi there, > although I was seeking at serveral sites, I could not find a solution for my > problem. hopefully one of yous has any ides: > > - project: > just a simple client area with restrected acces to folders and their > contents. > structure: a folder called clients. within this folder the admin creates a > folder for every project/client > with a start-page (html or php). this page links to other pages (html), > images or other files within this folder. > the client visits the webpages, is promted to login and is transferred to > his directory. > the files in theses directories must be protected, that it is not possible > to access them by typing the path (although it might be difficult to guess > the path). > > - problem: > my provider runs php as cgi-module (thats how it is called, right?) so (for > me it seems) that there is no access via the environmental or server vars > (sorry I am still new to php), referring to .htaccess. at least these vars > do not exist. > > I am not quite sure how, but I think I could modify the .htaccess files by > just writing into them (although I am not sure, if this is possible, if the > foler is protected). but anyway, my client wants his clients to login via a > user-pwd form. with .htaccess the client would have either to click on a > link (so all clients would have to be listed, which is regarding descrition > not possible) or the client would have to type the path of his directory, > which my client just does not want to. > > - question: > how can I solve this problem? > as my client will create all contents within the clients-folders, and theses > files will be very different everytime, I cant put everything outside the > server-root and create this content by php or use a database. > > how is this usually done? > am I digging in the totally wrong area? > > thank a lot in advance > marcel > >
attached mail follows:
FreeBSD 4.6 // Apache 2.0.43 //From source Mailman 2.0.13 //From source MySQL 3.23.52 //Binary, manually installed Perl 5.005_03 //Came with FreeBSD 4.6
I followed these install steps,
#./configure --prefix=/usr/local/php-4.2.3/ --with-mysql=/usr/local/mysql/ --with-apxs2=/usr/local/apache/bin/apxs --with-apache2=/usr/local/apache --with-openssl=/usr/local/ssl/
#make #make install
In Apache's httpd.conf, I verified that,
LoadModule php4_module modules/libphp4.so
existed. It resided on line 230 of /usr/local/apache/conf/httpd.conf
I had to manually enter,
AddType application/x-httpd-php .php
and when I restarted apache, it complained by saying that,
Syntax error on line 230 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/modules/libphp4.so into server: /usr/local/apache/modules/libphp4.so: Undefined symbol "pthread_getspecific"
What does this mean? What can be done about it? I apparently stumped the install list with this question. Are there are some unpublished compatibilty issues with Apache 2.0 that are unresolved? I think I can manage to go back to 1.3.27 Apache if it will get PHP to work.
attached mail follows:
thanks John - I'll try it...
"John W. Holmes" <holmes072000
charter.net> wrote in message
news:000701c277a1$83b0fe90$7c02a8c0
coconut...
> > I've got the following code, and regardless if it finds something or
> not
> > odbc_num_rows returns -1 as the value? curious what I should I use to
> > test
> > whether or not something was found? (the database I am connecting to
> is
> > Informix running on a different server)
> >
> > $sql = odbc_exec($$ntslink,"SELECT lot_card_num_k AS pin,
> current_balance
> > AS
> > balance, first_use_date AS first, lot_num_f AS batch, status_flag AS
> > status,
> > zombie_date AS expired, sequence_number AS serial, zombie_method AS
> reason
> > FROM lot_card WHERE lot_card_num_k = '$pin';") or
> > die("Invalid ODBCQuery");
> > $numrows = odbc_num_rows($sql) if ($numrows <= 0 )
>
> Maybe something like this?
>
> if($row = odbc_fetch_array($sql))
> {
> do{
> //process rows
> }while($row = odbc_fetch_array($sql));
> }
> else
> {
> echo "no rows returned";
> }
>
> ---John Holmes...
>
>
attached mail follows:
This is the output you get when the permissions on world are set to execute only...
Funny thing....
On Sat, 2002-10-19 at 19:46, .: B i g D o g :. wrote: > I am trying to set up PHP to run as CGI under apache.... > > I have my binary /usr/bin/php > > When i run this file (/cgi-bin/test.cgi): > > #!/usr/bin/php > <?php > > echo "Test...working"; > > ?> > > My result is: > > No input file specified. > > Does anyone know how to get this working? > > > -- > .: B i g D o g :. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
-- .: B i g D o g :.
attached mail follows:
Hello,
On Sunday, October 20, 2002 7:13 AM Stephanie Sullivan wrote:
...[snip]...
> > Why is that? I have no problem with NN4 SEEING and SHOWING my CSS > correctly...
How did you check it? Are you sure the paths are correct? (".././" etc. <- notice the dots)
> My problem lies with SWITCHING to another style sheet using my > PHP switcher... And it works in every other browser I tried
So, how come you suspect that PHP is the problem? If it works on other
browsers, that means, most likely the problem lies somewhere else. For
example, NN will not work with
import. (I think you know that.) NN also has
a lot of problems relative paths. And most of the time, putting the
(external) CSS in the webroot folder fixes many problems.
...[snip]...
> > It understands... There's no problem with the INITIAL load... Just the > switch...
Again, this depends on how you test it.
Try this, after "switching" check the resulting source code and see if what you're expecting is really there.
...[snip]...
Well, since we cannot see how you're doing it, it's really hard to tell where the problem lies.
Anyway, here's a very simple (and, I hope, easy to understand) code. It works on NN4. After each "switch" try checking the resulting code. Then, try removing the <style> tags and change the "echo" commands to echo your "<link /> 's ". During the process, you might just find out where the problem is. :)
- E
PS. If ever, just try posting your code esp. the portion where you think the problem lies...
---------- test.php ----------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>TEST</title> <style type="text/css"> <!-- <?php if (isset($_GET['var'])){ switch ($_GET['var']){ case 1: echo 'h1 { color:black; background:white; }'; break; case 2: echo 'h1 { color:white; background:blue; }'; break; case 3: echo 'h1 { color:blue; background:yellow; }'; break; default: echo 'h1 { color:black; background:white; }'; break; } } echo "\n"; ?> //--> </style> </head>
<body> <h1>TEST</h1> <br /> <a href="test.php?var=1">Original</a> | <a href="test.php?var=2">White - Blue</a> | <a href="test.php?var=3">Blue - Yellow</a> </body> </html>
attached mail follows:
on 10/20/02 0:04 AM,
Edwin at copperwalls
hotmail.com wrote:
>> Why is that? I have no problem with NN4 SEEING and SHOWING my CSS >> correctly... > > How did you check it? Are you sure the paths are correct? (".././" etc. <- > notice the dots)
Well, the reason I don't think it's related to my paths is that it shows the
ORIGINAL style sheet... It just won't switch to a new one... They all have
the same path...
>
>> My problem lies with SWITCHING to another style sheet using my
>> PHP switcher... And it works in every other browser I tried
>
> So, how come you suspect that PHP is the problem? If it works on other
> browsers, that means, most likely the problem lies somewhere else. For
> example, NN will not work with
import. (I think you know that.) NN also has
> a lot of problems relative paths. And most of the time, putting the
> (external) CSS in the webroot folder fixes many problems.
Then why would it see my path but then NOT see it when I "switch" the sheets? > > ...[snip]... > >> >> It understands... There's no problem with the INITIAL load... Just the >> switch... > > Again, this depends on how you test it. > > Try this, after "switching" check the resulting source code and see if what > you're expecting is really there.
It's not... It remains the original smreg.css sheet in the code and on the page... Which is what I'd expect since my page color and text size didn't change. > > ...[snip]...
> PS. > If ever, just try posting your code esp. the portion where you think the > problem lies...
Hmmm... The code you posted looks very similar to what I'm using... Here's my code: http://contrastsweb.com/switcher/
Stephanie Sullivan VioletSky Design http://www.violetsky.net "Your assumptions are your windows on the world. Scrub them off every once in a while, or the light won't come in." - Isaac Asimov
attached mail follows:
I've got a quesiton... I'm using informix through ODBC instead of native support because it was my understanding that if informix is running on another server I couldn't use the native informix support.
however, when I was looking at php's website php.net/ifx it mentioned support with newer versions of the informix SDK (which is used to connect to informix running on other servers).
I've got the following loading as enviroment variables in /etc/profile;
export INFORMIXDIR=/opt/informix export ODBCINI=/usr/local/etc/odbc.ini export INFORMIXSERVER=m_srv
now - I get php to compile, make, and make install. however, when I try to start apache I get the following error;
"Syntax error on line 211 of /usr/local/apache/conf/httpd.conf: Cannot load /usr/local/apache/libexec/libphp4.so into server: /opt/informix/lib/ esql/libifgen.so: undefined symbol: stat /usr/local/apache/bin/apachectl start: httpd could not be started"
attached mail follows:
Even if you select from an alias of the same table?
insert into tablex from (select * from tablex tabley)
David
----- Original Message -----
From: "Roger Lewis" <re.lewis
attbi.com>
To: "David McInnis" <david
dataovation.com>
Sent: Saturday, October 19, 2002 7:41 PM
Subject: RE: [PHP] Duplicating a Record in MySQL
> Yes, but you can't insert into the same table from which you select.
> Roger
>
> -----Original Message-----
> From: David McInnis [mailto:david
dataovation.com]
> Sent: Saturday, October 19, 2002 6:28 PM
> To: Roger Lewis; holmes072000
charter.net; 'Php-General'
> Subject: Re: [PHP] Duplicating a Record in MySQL
>
> Well, I confess that I have not read the entire thread. But MySQL does
> provide a INSERT from SELECT syntax which I have used often.
>
> David
>
> ----- Original Message -----
> From: "Roger Lewis" <re.lewis
attbi.com>
> To: <holmes072000
charter.net>; "'Php-General'"
<php-general
lists.php.net>
> Sent: Saturday, October 19, 2002 1:45 PM
> Subject: RE: [PHP] Duplicating a Record in MySQL
>
>
> >
> >
> > -----Original Message-----
> > From: John W. Holmes [mailto:holmes072000
charter.net]
> > Sent: Saturday, October 19, 2002 12:52 PM
> > To: 'Roger Lewis'; 'Php-General'
> > Subject: RE: [PHP] Duplicating a Record in MySQL
> >
> > * >> It's not strictly php, but does anyone know an easy way to
> > duplicate a
> > > >> record in MySQL. It would be nice if you could write something
> > like:
> > > >>
> > > >> COPY * from table WHERE id = 6;
> > > >>
> > > >> and have it insert a new record into the table with the next id
> > > >>number.
> > >
> > > >I think that if you have to do this, you've got design issues. Why
> > not
> > > >just keep a "count" column in the row and increment that, instead of
> > > >duplicating the row.
> > >
> > > >---John Holmes...
> > > John,
> > > Here's the application: I'm creating a daily report online, eg. with
> > > Title,
> > > Report no., Date, Author, Subject Headings, Text, etc., etc.. The
> > report
> > > is
> > > stored in a MySQL table. When it comes time to write a new report, I
> > > would
> > > like to be able to call up an existing report, upon which to base the
> > new
> > > one, and copy the record. Then make changes where necessary and
> > update
> > > the
> > > record.
> >
> > So have PHP select out the row you want to "copy", make your changes to
> > it with PHP or a form, then have PHP insert a new row into the database.
> > Why copy data when you're going to change it.
> >
> > ---John Holmes...
> > Well, you're probably right. I've been working with Adobe GoLive, and
> have
> > been using the CopyFormData command, so that's where I got the idea. I
> ran
> > into trouble with GoLive when I complicated my report form by adding
file
> > attachments. Anyway, here's a condensed version of code base on what
> > Stephen Knight suggested. (Thanks, Stephen). I'll work on this to try
> and
> > avoid the copying step as you are suggesting.
> >
> > $sql = "select * from daily_reports where report_no = '$report_no' ";
> > $result = mysql_query($sql);
> > $x = mysql_fetch_row($result);
> > $fields = "report_no, order_no, report_date, project_no, project_name,
> > client, title, subtitle, author, company, summary_heading,
> > summary, section1_heading, section1";
> > $values = " '$x[1]', '$x[2]', '$x[3]', '$x[4]', '$x[5]', '$x[6]',
'$x[7]',
> > '$x[8]',
> > '$x[9]', '$x[10]', '$x[11]', '$x[12]', '$x[13]', '$x[14]' ";
> > // Note: There must be a way to have PHP generate the previous line,
but
> I
> > don't know how.
> > $sql = "INSERT INTO daily_reports ($fields) VALUES ($values)";
> > mysql_query($sql);
> >
> > Thanks, Roger
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>
>
>
>
attached mail follows:
On Sun, Oct 20, 2002 at 02:03:08PM +1300, Philip J. Newman wrote: > Ok the server that i run my site on is in some american time and most of the > users are in new zealand, how can i make the time stamp ADD +16 Hours. > Any ideas
If you are using epoch timestamp (as I recommend) which you can get withing time()-function, you can just do the following:
$time = time()+(16*60);
But if you're using that very often, you should your own time()-function:
function mytime () { return (time() + ( 16 * 60 )); }
Hope this was even a bit helpfull.
-- Joona Kulmala joonaphpfi.org
attached mail follows:
I want to write a function that will add to the end of an array that can be accessed elsewhere.
To make the array variable global I just do this don't i?
function my_function($foo){ global $arrayoffoos;
etc.... }
-- JJ Harrison lizner2002yahoo.com.au
attached mail follows:
On Sunday 20 October 2002 18:14, Noodle Snacks wrote: > I want to write a function that will add to the end of an array that can be > accessed elsewhere. > > To make the array variable global I just do this don't i? > > function my_function($foo){ > global $arrayoffoos; > > etc.... > }
Yes.
Or you can address it directly through $GLOBALS:
function my_function($foo){ $GLOBALS['arrayoffoos'][] = $foo; # or similar }
-- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development */* Ya'll hear about the geometer who went to the beach to catch some rays and became a tangent ? */
attached mail follows:
thanks
"Jason Wong" <php-general
gremlins.com.hk> wrote in message
news:200210201847.06853.php-general
gremlins.com.hk...
> On Sunday 20 October 2002 18:14, Noodle Snacks wrote:
> > I want to write a function that will add to the end of an array that can
be
> > accessed elsewhere.
> >
> > To make the array variable global I just do this don't i?
> >
> > function my_function($foo){
> > global $arrayoffoos;
> >
> > etc....
> > }
>
> Yes.
>
> Or you can address it directly through $GLOBALS:
>
> function my_function($foo){
> $GLOBALS['arrayoffoos'][] = $foo; # or similar
> }
>
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Ya'll hear about the geometer who went to the beach to catch some
> rays and became a tangent ?
> */
>
attached mail follows:
Howdy all,
I have stumbled onto a reference behavior I cannot explain. Here's my problem: I'm trying to return a copy of a member variable. The function is not declared to return a reference, but it seems as if the user can override this. Here's a non-object example:
<?php
// Create an array $array = array('foo', 'bar', 'baz');
// This function merely returns a copy of the array function testArray() { global $array;
return $array; }
// Grab the return from the function (notice the '&') $copiedArray = &testArray();
// Modify it $copiedArray[] = 'quux';
// Print the original and the copy out echo "=== array ===\n"; var_dump($array); echo "=== copiedArray ===\n"; var_dump($copiedArray);
?>
Running this yields exactly what you would expect:
=== array === array(3) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(3) "baz" } === copiedArray === array(4) { [0]=> string(3) "foo" [1]=> string(3) "bar" [2]=> string(3) "baz" [3]=> string(4) "quux" }
So far, so good. This is as expected (even if the caller tries to use the '&', he's getting the reference to the copy). Now instead of a global array, let's try the exact same thing with a member of a global object:
<?php
// Dummy class class Test { var $array; }
// Instantiate it $object = &new Test(); // Create a member that is an array $object->array = array('baz', 'bar', 'foo');
// Same function as before, only it's returning a member variable function testObject() { global $object;
return $object->array; }
// Grab the return from the function (notice the '&') $copiedArray = &testObject(); // Modify it $copiedArray['lyx'] = 'quux';
// Print the original and the copy out echo "=== array ===\n"; var_dump($object->array); echo "=== copiedArray ===\n"; var_dump($copiedArray);
?>
Here, I would expect that the results would be exactly the same (remember, there are absolutely no references in the declaration of testObject() or in the body; everything *should* be a copy). Here's what gets printed when this is run:
=== array === array(4) { [0]=> string(3) "baz" [1]=> string(3) "bar" [2]=> string(3) "foo" ["lyx"]=> string(4) "quux" } === copiedArray === array(4) { [0]=> string(3) "baz" [1]=> string(3) "bar" [2]=> string(3) "foo" ["lyx"]=> string(4) "quux" }
Whoa! $copiedArray is now a reference for the member variable! But look what happens if I redefine the function slightly:
function testObject() { global $object; $array = &$object->array;
return $array; }
Now I get what I expect again ($copiedArray doesn't point to the member variable after calling testObject()). So what gives? Why is "return $object->member;" exempt from the return declaration of the function? This is an interesting "feature". Not very intuitive...I'd call it a bug. Has anyone else noticed this? The above behavior happens with scalars (e.g., strings, numbers) too, not just arrays.
By the way, I'm using PHP 4.2.3.
--Matt
-- Please do not sell or give away my information.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org
iD8DBQA9sptNnLpDzL5I7l8RAmhvAKCITTuQ8oc4uHHA/DbIJ8yExVQEyACdGQwC zM0EEWDIIWnk4T5DKcsouVc= =7b3L -----END PGP SIGNATURE-----
attached mail follows:
Hello,
In the code below ob_end_clean(); doesn't give a warning (No buffer to delete). So there seems to be a buffer, but i don't understand why? Who knows?
Thanks,
<? error_reporting(E_ALL); session_start(); unset($_SESSION['username'],$_SESSION['password']); $p = session_get_cookie_params(); setcookie(session_name(), '', time()-1, $p['path'], $p['domain']); ob_end_clean(); ?>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]