php-general Digest 19 Oct 2003 13:51:20 -0000 Issue 2364

Topics (messages 166631 through 166661):

apache httpd + PHP authentication
        166631 by: news.php.net
        166632 by: Chris Shiflett

Changing permissions
        166633 by: zavaboy
        166661 by: Eugene Lee

webppliance & include - aaargh!
        166634 by: pan

Re: SESSION Not behaving II: permission denied(13)
        166635 by: Tom Rogers

Choosing a CMS?
        166636 by: Joel Konkle-Parker
        166648 by: Becoming Digital
        166649 by: Justin French
        166654 by: J. Cox

Re: Yes!!! BTML v1.0 is here!!!
        166637 by: Curt Zirzow

Re: RESOLVED, sort of -- Re: [PHP] where is my session data on my new server?
        166638 by: Curt Zirzow
        166659 by: David T-G

Re: windows user_name
        166639 by: Curt Zirzow

Re: What's a good regex to validate an email address? ;)
        166640 by: Curt Zirzow

Re: Filemanager v1.0
        166641 by: Curt Zirzow

Darken and lighten color?
        166642 by: Leif K-Brooks
        166643 by: Chris Shiflett
        166644 by: Leif K-Brooks
        166646 by: Becoming Digital
        166647 by: Leif K-Brooks

Re: PHP/MySQL/Server not working
        166645 by: conbud

try
        166650 by: sun zheng

String to Array or Hash Table
        166651 by: sun zheng
        166660 by: David T-G

Re: php site
        166652 by: Burhan Khalid

Re: Merging document changes
        166653 by: Burhan Khalid

Re: 4.3.1 for Debian Woody?
        166655 by: Gal
        166656 by: daniel.electroteque.org
        166657 by: daniel.electroteque.org

Re: best way to use session vars?
        166658 by: David T-G

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message --- Hello,
httpd v1.3.27, php v4.3.0.
I have a web page I wish to restrict access. I prefer to use the standard apache httpd authentication with .htaccess and password file. This method does not seem to work with PHP.
A "parser" is called every time a page is accessed. If no page is defined, the home page is loaded. Subsequent pages are linked with URLs like "http://mysite.com/?page=nextpage.php";. In the parser I define a "base_dir" variable that allows access to a common set of code files regardless of where the page file is. The complete parser is:

  require('./php/lib/base-dir.inc');    // Assigns $base_dir
  $page = $_REQUEST['page'];
  if ("" == $page)
    $page = "main-index.php";
  include($base_dir . $page);

So the restricted page is in a subdirectory with a .htaccess file to indicate that a name/password is required. This is ignored, presumably because the file is include()'d.
I have looked at the authentication info in the docs. I have to do all the work of verifying the name/password. I do not wish to do so since an satisfactory method already exists.
Is there a way to use a parser as above and still have httpd recognize the need for a name/password?

--
jimoe at sohnen-moe dot com

--- End Message ---
--- Begin Message ---
--- "news.php.net" <[EMAIL PROTECTED]> wrote:
> I have a web page I wish to restrict access. I prefer to use the 
> standard apache httpd authentication with .htaccess and password
> file. This method does not seem to work with PHP.

This method is independent of the type of resource being used, so it works fine
with PHP.

> A "parser" is called every time a page is accessed. If no page is 
> defined, the home page is loaded. Subsequent pages are linked with
> URLs like "http://mysite.com/?page=nextpage.php";. In the parser I
> define a "base_dir" variable that allows access to a common set of
> code files regardless of where the page file is.

Please read this:

http://dictionary.reference.com/search?q=parser

I think I understand what you mean, but an improper use of terms can cause
confusion.

> So the restricted page is in a subdirectory with a .htaccess file to 
> indicate that a name/password is required. This is ignored,
> presumably because the file is include()'d.

That's right. The .htaccess is for Apache. If this resource is served directly
(e.g., the URL references it instead of your "parser"), Apache will require the
proper username/password.

> Is there a way to use a parser as above and still have httpd 
> recognize the need for a name/password?

I'm sure there are many ways. You could check for the .htaccess yourself before
including the file, and require HTTP authentication where appropriate. What you
can't do, however, is presume that you can write a script that handles requests
instead of Apache and magically have your code do everything Apache does.

Hope that helps.

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

--- End Message ---
--- Begin Message ---
Ok, I have a installer that only works if the directory that's being
installed to has public writing permissions. I tried chmod() on the
directory, but I get a error. How can I make it so my installer can write in
a directory with the incorrect writing permissions?

Thanks!

-- 

- Zavaboy
[EMAIL PROTECTED]
www.zavaboy.com

--- End Message ---
--- Begin Message ---
On Sat, Oct 18, 2003 at 10:28:49PM -0400, zavaboy wrote:
: 
: Ok, I have a installer that only works if the directory that's being
: installed to has public writing permissions. I tried chmod() on the
: directory, but I get a error. How can I make it so my installer can
: write in a directory with the incorrect writing permissions?

You can't.  That's what permissions are designed to do.

If you can't even chmod the directory, then the directory probably
doesn't belong to you.  You can't install your stuff into a directory
that isn't owned by you (or at least in the same group as you).

Otherwise, if it's your system, run your installer as root.

--- End Message ---
--- Begin Message ---
Anyone know how to get include to work with a webppliance web site?

If (web-server:document-root = x){
 switch(include-dir){
  case 'below document-root:
   <!---php.include works--->
  break;
  case 'above document-root':
   <!---php-include failes--->
  break;
  default:
   <!---intense frustration ensues--->
 }
}

ini_set('include_path') works except for directories above
the virtual server  document rooot

of course keeping .php includes with sensitive data in a directory
inaccesible
to browsers is a best-practice issue - it doesn't seem possible within a
webpplicance controlled virtual web server environment (unless someone has
figured out how)

Pan ' peeve:clients who buy web hosting accounts on MS2000/IIS5.0 instead of
a nice *nix server'

--- End Message ---
--- Begin Message ---
Hi,

Sunday, October 19, 2003, 7:35:23 AM, you wrote:


> That would be one solution, but I am on a shared hosting server. I cannot
> change the folder permissions.

> I've asked tech support to look into this.

> Does anyone know where I can get a class that will save the session vars
> to mysql?

Here is a class I wrote a while back which will give you a good start.
The only weird thing I did was start a new session if read failed rather than
wait to check when writing the session data but it worked fine.
<?php
/*
SQL for table creation in db called admin
CREATE TABLE phpsessions (
  sessionid varchar(64) NOT NULL default '',
  sessionsize int(10) default NULL,
  sessiondata mediumtext,
  sessionname varchar(255) default NULL,
  sesstime int(11) default NULL,
  username varchar(64) default NULL,
  sessend int(11) default NULL,
  authid varchar(100) NOT NULL default '0',
  PRIMARY KEY  (sessionid)
) TYPE=MyISAM PACK_KEYS=1;
*/
class sessionClass{
        var $ses;                       //session on flag
        var $sessionname;               //current name of session
        var $message;                   //error message holder
        var $modulename;                //type of module, should be user
        var $sessionid;                 //
        var $con;                       //datbase handle
        var $sessionlife;               //how long inactive before the session should 
time out
        var $maxgclife;                 //absolute time for session data to survive
        var $host;                      //client host
        var $Username;                  //username
        var $authid;                    // a unique id for authClass created for a new 
session
        function sessionClass($sessionname="",$lifetime="",$maxgc=""){
                global $session_ref;            //a reference array for access by 
buried functions
                $session_ref[] =& $this;
                ini_set( "session.save_handler", "user" ); 
                function open($save_path, $session_name) {
                        global $session_ref;
                        $con = @mysql_connect("localhost" , "username" , "password" );
                        if($con):
                                @mysql_select_db("admin",$con);
                                $session_ref[0]->con = $con;
                                return true;
                        else:
                                return false;
                        endif;
                }
                function close() {
                        //global $session_ref;
                        //$con = $session_ref[0]->getcon();
                        //@mysql_close($con);
                        return true;
                }
                function read($key) {
                        global $session_ref;
                        $con = $session_ref[0]->con;
                        $sessionname =  $session_ref[0]->sessionname;
                        $lifetime = $session_ref[0]->sessionlife;
                        $host = ereg_replace("www.","",$_SERVER["HTTP_HOST"]);
                        $Username = substr($host,0,strpos($host,"."));                 
         //format is username.domain.com
                        $session_ref[0]->setuser($host,$Username);
                        $val = "";
                        $sessiondata = "";
                        $now = time();
                        $insert = "Yes";
                        $result = @mysql_query("SELECT * FROM phpsessions WHERE 
sessionid = '$key'",$con);
                        if($row = @mysql_fetch_array($result)): 
                                $sesstime = $row["sesstime"];
                                $user = $row["username"];
                                $diff = $now - $sesstime;
                                if($Username != $user):
                                        $result = @mysql_query("DELETE FROM 
phpsessions WHERE sessionid = '$key'",$con);
                                        $session_ref[0]->message = "<font 
color=\"red\">Domain has changed, please login again.</font>";
                                else:
                                        if($diff < $lifetime):
                                                $sessiondata = $row["sessiondata"];
                                                $result = @mysql_query("UPDATE 
phpsessions SET sesstime = '$now' WHERE sessionid = '$key'",$con);
                                                $insert = "No";
                                        else:
                                                $result = @mysql_query("DELETE FROM 
phpsessions WHERE sessionid = '$key'",$con);
                                                $session_ref[0]->message .= "<font 
color=\"red\">Session has timed out, please login again.</font>";
                                        endif;
                                endif;
                        endif;
                        if($insert == "Yes"):
                                $authid = md5(uniqid (rand()));
                                $result = mysql_query("INSERT INTO phpsessions 
(sessionid,sessionsize,sessiondata,sessionname,sesstime,username,authid) VALUES 
('$key',1,'$val','$sessionname','$now','$Username','$authid')",$con);
                        endif;
                        return $sessiondata;
                }
                function write($key, $val) {
                        global $session_ref;
                        $con = $session_ref[0]->con;
                        $val = ereg_replace("'","''",$val);
                        $result = @mysql_query("UPDATE phpsessions SET sessiondata = 
'$val' WHERE sessionid = '$key'",$con);
                        return true;
                }
                function destroy($key) {
                        global $session_ref;
                        $con = $session_ref[0]->con;
                        $result = @mysql_query("DELETE FROM phpsessions WHERE 
sessionid = '$key'",$con);
                        $session_ref[0]->ses = 0;
                        $session_ref[0]->sessionid = "";
                        $session_ref[0]->authid = "";
                        return true;
                }
                function gc($maxlifetime) {
                        global $session_ref;
                        $con = $session_ref[0]->con;
                        $sessionname = $session_ref[0]->sessionname;            // 
this sesions name
                        $min = time() - $session_ref[0]->sessionlife;           //this 
session name lifetime
                        $amin   = time() - $session_ref[0]->maxgclife;          //all 
sessions max lifetime
                        $result = mysql_query("DELETE FROM phpsessions WHERE 
(sessionname = '$sessionname' AND sesstime < $min) OR sesstime < $amin",$con);
                        //$session_ref[0]->message .= "<font color=\"green\">Session 
gc called on $sessionname - min = $min .</font>";
                        return true;
                }
                session_set_save_handler("open", "close", "read", "write", "destroy", 
"gc");
                //set up some defaults
                $this->sessionname = $sessionname;
                $this->sessionlife = $lifetime;
                if($this->sessionname == ""):
                        $this->sessionname = "PHPSESSID";
                endif;
                session_name($this->sessionname);
                if($lifetime == ""):
                        $this->sessionlife = get_cfg_var("session.gc_maxlifetime");
                endif;
                if($maxgc == ""):
                        $this->maxgclife = 21600;       //6hours
                else:
                        $this->maxgclife = $maxgc;
                endif;
                //ok go for it
                session_start();
                $this->modulename = session_module_name();
                $this->sessionid = session_id();
                $this->ses = 1;
        }
        //oddball functions
        function session_restart(){
                session_destroy();
                $url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF";];
                header("Location: $url"); 
                exit;
        }
        function addmessage($mess){
                $this->message .= $mess;
        }
        function getmessage(){
                return $this->message;
        }
        function getmodulename(){
                return $this->modulename;
        }
        function getid(){
                return $this->sessionid;
        }
        function getlifetime(){
                return $this->sessionlife;
        }
        function setuser($host,$user){
                $this->host = $host;
                $this->Username = $user;
        }
        function getuser($type = ""){
                if($type == "u"):
                        return $this->Username;
                elseif($type == "h"):
                        return $this->host;
                else:
                        return $this->host." ".$this->Username;
                endif;
        }
}
?>

Usage:
include('sessionClass.inc');
$s =& new sessionClass('LOGIN',3600,7200);
//session named LOGIN 1 hour session lifetime and clear everything older than 2 hours

Then use $_SESSION like normal



-- 
regards,
Tom

--- End Message ---
--- Begin Message --- I'm looking for an open source PHP/MySQL CMS that I can use as the backend to my website.

My site consists of multiple quasi-independent sections, each with its own subdomain, that should be able to function as seperate sites. The range in style from blogs to articles to file libraries, but all share a consistent global menu system, footer text, 3-column layout, et c.

I've looked at PHPNuke, just because that's the only thing that jumps to mind, but I want to make sure I'm not missing anything before I dive in with it.

What are your suggestions? Is there anything better than PHPNuke for this type of thing out there?


-- Joel Konkle-Parker Webmaster [Ballsome.com]

Phone     [+1 662-518-1636]
E-mail    [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
You can try a templating system like Smarty or FastTemplate, but I'm not too fond of 
either.  I've recently begun exploring InterJinn, written by our own Robert Cummings, 
and I'm quite fond of how it works.  You'll need to spend some time going over the 
documentation but I think it's worthwhile.

Edward Dudlik
"Those who say it cannot be done
should not interrupt the person doing it."

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU



----- Original Message ----- 
From: "Joel Konkle-Parker" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, 19 October, 2003 00:16
Subject: [PHP] Choosing a CMS?


I'm looking for an open source PHP/MySQL CMS that I can use as the 
backend to my website.

My site consists of multiple quasi-independent sections, each with its 
own subdomain, that should be able to function as seperate sites. The 
range in style from blogs to articles to file libraries, but all share a 
consistent global menu system, footer text, 3-column layout, et c.

I've looked at PHPNuke, just because that's the only thing that jumps to 
mind, but I want to make sure I'm not missing anything before I dive in 
with it.

What are your suggestions? Is there anything better than PHPNuke for 
this type of thing out there?


-- 
Joel Konkle-Parker
Webmaster [Ballsome.com]

Phone     [+1 662-518-1636]
E-mail    [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- On Sunday, October 19, 2003, at 02:16 PM, Joel Konkle-Parker wrote:

I'm looking for an open source PHP/MySQL CMS that I can use as the backend to my website.

If you've got the time & skills, I'd actually recommend creating your own -- building my own CMS rapidly enhanced the way I work, streamlined my code, built up my knowledge and problem solving techniques, etc etc.

It's now a product I sell to my clients over and over, so it's also enhanced my earning potential :)

But the real bonus is I have exactly what I want -- nothing more, nothing less. Most templating engines and CMS have HUGE overheads, and from what I can tell, a HUGE learning curve before you can "get in and dirty" with modifications / enhancements to the functionality --- or even the look/feel.

When a client says "can I.....", I don't hesitate -- I just reply "yes" and get to work -- because I know my code inside out.


It'd be different with a large organisation with many contributors, all needing different levels of permissions -- in which case I'd consider using something with a lot of those features (editorials, approvals, etc) -- but from what I can tell this is outside your requirements.


That's just my take though :)


Justin
--- End Message ---
--- Begin Message ---
"Joel Konkle-Parker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I've looked at PHPNuke, just because that's the only thing that jumps to
> mind, but I want to make sure I'm not missing anything before I dive in
> with it.

Have a look at Xaraya -- http://www.xaraya.com

It may work for you better in the long run than PHP-Nuke.

* Bias note. I am on the Xaraya Team.

--- End Message ---
--- Begin Message ---
* Thus wrote Comex ([EMAIL PROTECTED]):
> >> Bas:
> >>> That tags? It should not be used anyway...
> >> what???
> >
> 
> > Yes, i think that you want to know the structure of the BTML-file:
> >
> > <bttag=btml>
> > </bttag>
> > <bttag=title>
> > Title of the page
> > </bttag>
> > <bttag=text>
> > Here any valid HTML-MARKUP
> > <br>
> > </bttag>
> > <bttag=image>
> > Path to a image
> > </bttag>
> >
> > This is the structure of a BTML file.
> 
> I like the idea, and make it more usable.

All this is is a xml, yet it breaks all xml rules, ironic as
it sounds.

Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
          http://zirzow.dyndns.org/html/mlists/

--- End Message ---
--- Begin Message ---
* Thus wrote David T-G ([EMAIL PROTECTED]):
> Hi, all --
> 
> It appears that the change from 4.2.3 to 4.3.4rc1 was not something that
> got broken but instead something that got fixed.  Oh, yay.  But what do I
> do now?  Hmmm...

I'm catching up in emails a little late but using $_SESSION[]
access would resovle this issue.

> 
> The code
> 
>   <?php
>     session_name('name') ;
>     session_start ;

hmm... doesn't session_start requrire the ()? ie :
 
 session_start();


>


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
          http://zirzow.dyndns.org/html/mlists/

--- End Message ---
--- Begin Message ---
Curt, et al --

...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
% > Hi, all --
% > 
% > It appears that the change from 4.2.3 to 4.3.4rc1 was not something that
% > got broken but instead something that got fixed.  Oh, yay.  But what do I
% > do now?  Hmmm...
% 
% I'm catching up in emails a little late but using $_SESSION[]
% access would resovle this issue.

Gotcha.  Thanks!


% 
...
% >     session_name('name') ;
% >     session_start ;
% 
% hmm... doesn't session_start requrire the ()? ie :
%  
%  session_start();

It seems that it does.  Oddly enough, everything always worked just fine.
Perhaps it was because the next line was a session_register which implied
a session_start() for me :-)


% 
% Curt


Thanks & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00000.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
* Thus wrote Burhan Khalid ([EMAIL PROTECTED]):
> Becoming Digital wrote:
> >I don't believe so.  It would depend entirely on the browser settings, 
> >too, so even if it's possible, I certainly wouldn't build an app around 
> >that idea.
> >
> 
> Actually, it is possible, but only under some very restrictive settings.
> 
> For example, php has to be running as a ISAPI module under IIS, and the 
> security settings should be NTLM, and the user is logged on to the same 
> domain as the IIS server, then $_SERVER['AUTH_USER'] should be the 
> logged in user name.
> 
> However, to design an app around that isn't the best way to do it.

Well put!


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
          http://zirzow.dyndns.org/html/mlists/

--- End Message ---
--- Begin Message ---
* Thus wrote CPT John W. Holmes ([EMAIL PROTECTED]):
> From: "Jeremy Russell" <[EMAIL PROTECTED]>
> 
> 
> > Will get nearly everything that resembles an email address.  
> 
> Holy crap, batman... did you even read the original message?

lol.. 

I'm more curious as how this topic got into this thread.


Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
          http://zirzow.dyndns.org/html/mlists/

--- End Message ---
--- Begin Message ---
* Thus wrote CPT John W. Holmes ([EMAIL PROTECTED]):
> From: "Ryan A" <[EMAIL PROTECTED]>
> 
> > and another thing, don't ask John H  for help (or sarcastic comments)...
> > that too is reserved just for me.
> > You have been warned....
> 
> This John H guy sounds like a dick. Someone should boot him.

/kick john h

hmm... it seems your unbootable :)

Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
          http://zirzow.dyndns.org/html/mlists/

--- End Message ---
--- Begin Message --- I'm looking for a nice alithogram to darken and lighten a color by a certain ammount. I know this isn't strictly a PHP question, but I'm doing it in PHP and there isn't anywhere better to ask.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.

--- End Message ---
--- Begin Message ---
--- Leif K-Brooks <[EMAIL PROTECTED]> wrote:
> I'm looking for a nice alithogram to darken and lighten a color by a 
> certain ammount.

Maybe you mean algorithm? :-)

To lighten, increase RGB values by 10% each. To darken, decrease RGB values by
10% each. Maybe replace 10 with whatever the "certain amount" is.

Is that all you're wanting to do?

Chris

=====
My Blog
     http://shiflett.org/
HTTP Developer's Handbook
     http://httphandbook.org/
RAMP Training Courses
     http://www.nyphp.org/ramp

--- End Message ---
--- Begin Message --- Chris Shiflett wrote:

--- Leif K-Brooks <[EMAIL PROTECTED]> wrote:


I'm looking for a nice alithogram to darken and lighten a color by a certain ammount.



Maybe you mean algorithm? :-)


Yep. My ability to spell decreases 5% every 15 minutes after 12AM.

To lighten, increase RGB values by 10% each. To darken, decrease RGB values by
10% each. Maybe replace 10 with whatever the "certain amount" is.


But what do I do with something like 40,40,255? What happens to the 255?

Is that all you're wanting to do?


Yup.


-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

--- End Message ---
--- Begin Message ---
> But what do I do with something like 40,40,255? What happens to the 255?

You just have to leave it at 255.  That's what Illustrator does.

Edward Dudlik
"Those who say it cannot be done
should not interrupt the person doing it."

wishy washy | www.amazon.com/o/registry/EGDXEBBWTYUU



----- Original Message ----- 
From: "Leif K-Brooks" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Php-General (E-mail)" <[EMAIL PROTECTED]>
Sent: Sunday, 19 October, 2003 01:18
Subject: Re: [PHP] Darken and lighten color?


Chris Shiflett wrote:

>--- Leif K-Brooks <[EMAIL PROTECTED]> wrote:
>  
>
>>I'm looking for a nice alithogram to darken and lighten a color by a 
>>certain ammount.
>>    
>>
>
>Maybe you mean algorithm? :-)
>  
>
Yep. My ability to spell decreases 5% every 15 minutes after 12AM.

>To lighten, increase RGB values by 10% each. To darken, decrease RGB values by
>10% each. Maybe replace 10 with whatever the "certain amount" is.
>  
>
But what do I do with something like 40,40,255? What happens to the 255?

>Is that all you're wanting to do?
>  
>
Yup.


-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message --- Becoming Digital wrote:

You just have to leave it at 255. That's what Illustrator does.


Hmm, seems to work, thanks. Note to self: try before you ask.

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.

--- End Message ---
--- Begin Message ---
Hey, Also the webhost only allows us database direct database connection
using phpMyadmin, I did notice that on the table that stores the info, it
keep getting an error after someone is posting the form. The error says
something about Overhead: 275 bytes, Is this just an MySQL limitation that
is set by the webhost ? and this overhead you think that would keep the info
from being entered into the database. To get the error to go away I have to
optimize the table.

ConbuD

"Conbud" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hey, just a quick question, I have a form that users can fill out to join
a
> certain group, we can then view that info from an admin page that requires
> logging in. When a user fills out the form I get an email letting me know
> that the form was submitted with the users info as well. Here recently,
I've
> been getting that info but their info isn't being saved into the database
> for somereason, anyone have any idea why ? I have filled out the form at
> least 15-25 times using different info and everyone of them worked for me.
I
> even filled out the form using different special characters and still with
> no problems, I am using stripslashes on the form data, but I don't think
> that could keep the info from being saved to the database, it only does
this
> periodically. Could this be due to a slow server ? or is there some sort
of
> special character that could conflict with my PHP or with the MySQL syntax
?
> I just have no clue now. Any thoughts are appreciated.
>
> Thanks
> ConbuD

--- End Message ---
--- Begin Message ---

with best wishes

Zheng Sun

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
--- End Message ---
--- Begin Message --- Hi, all,

The question is concerning a feedback String from a web-service.

"approved=yes&error=&authnumber=025968&transactionnumber=313869"

As you c, the String contains four parameters..

I explode it first by "&".
$execoutput = "approved=yes&error=&authnumber=025968&transactionnumber=313869";
$execoutput_array = explode("&", $execoutput);

I secondly explode every parameter=value string by "="..

for (@reset($execoutput_array); list($key,$value)[EMAIL PROTECTED]($execoutput_array);)
{
#output the result for debugging
$value_array = explode("=", $value);
for (@reset($value_array); list($key1,$value1)[EMAIL PROTECTED]($value_array);)
{
$first = $value1;
list($key1,$value1)[EMAIL PROTECTED]($value_array);
$second = $value1;

     if($first == "approved")
     {
       $approved = $second;
     }
     if($first == "error")
     {
       $error = $second;
     }
     if($first == "authnumber")
     {
       $authnumber = $second;
     }
     if($first == "transactionnumber")
     {
       $transactionnumber = $second;
     }
   }
 }

However, this way looks quite ugly.. I expect to get a concise code.. could you pls help me?


with best wishes

Zheng Sun

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail
--- End Message ---
--- Begin Message ---
Zheng --

...and then sun zheng said...
% 
% Hi, all,

Hi!


% 
...
% I explode it first by "&".
%  $execoutput = 
% "approved=yes&error=&authnumber=025968&transactionnumber=313869";
%  $execoutput_array = explode("&", $execoutput);

I don't see any problem with this.


% 
% I secondly explode every parameter=value string by "="..
% 
%  for (@reset($execoutput_array); 
% list($key,$value)[EMAIL PROTECTED]($execoutput_array);)
%  {
%    #output the result for debugging
%    $value_array = explode("=", $value);

I don't see a particular problem with this, either, though someone might
be able to do it more efficiently.


%    for (@reset($value_array); list($key1,$value1)[EMAIL PROTECTED]($value_array);)
%    {
%      $first = $value1;
%      list($key1,$value1)[EMAIL PROTECTED]($value_array);
%      $second = $value1;

I don't think you need to do this, though, because ...
% 
%      if($first == "approved")
%      {
%        $approved = $second;
%      }
[snip]

... I don't think you need to go through all of these if() tests.
You have each key and value in your value_array; you should be able
to just say

  $approved = $value_array['approved'] ;

and so on.

This is untested and I am in a hurry, but I hope it puts you on the right
track.


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00001.pgp
Description: PGP signature


--- End Message ---
--- Begin Message --- Lai, Kenny wrote:

hey, does anyone have any good links they use for their php references?

http://www.php.net/manual http://www.zend.com/zend/tut/

i'd also like to know how most people approach coding php from an OOP
standpoint

http://pear.php.net http://www.phpclasses.org

( wasn't there another thread like this not too long ago? )

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

--- End Message ---
--- Begin Message --- Jason Godesky wrote:


I'm working on a collection of functions for handling text documents; when a Document is added, its text is broken into paragraphs, and each paragraph is saved to the database as a separate record. The problem is editing the document, because I only want to update those paragraphs that have been changed (like CVS). I've been trying to find information on how some of the versioning software out there does it, but haven't found anything really helpful. As far as I can see, the troublesome points are when a new paragraph is added, or an old paragraph is deleted. How can you tell the difference between this, and simply a heavily edited paragraph?

In unix/linux, you can use diff to tell you the difference between two files. Why not integrate CVS in your php application? Just use PHP as a "wrapper" for CVS :)

--
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

--- End Message ---
--- Begin Message ---
as far as i know there are no DEB packages for 4.3.1 for Woody.
I'm using the unstable (Debian SID) and i have PHP 4.3.3

Joel Konkle-Parker wrote:
Does anyone have, or know where to get, a Debian Woody package for PHP 4.3.1? I've checked apt-get.org, but nobody seems to have that version.

Thanks in advance.



--- End Message ---
--- Begin Message ---
> as far as i know there are no DEB packages for 4.3.1 for Woody.
> I'm using the unstable (Debian SID) and i have PHP 4.3.3
>
Scuse the off topic, but is debian the way to go ? i have found great pain
to work with redhat even with rpm's. I just seriouslly cannot believe all
this dependancy bullshit that doesnt have links or isnt packaged with it. I
spent 4 hours just to try and get an IM client working which wasnt
fruitful ;\

--- End Message ---
--- Begin Message ---
>> as far as i know there are no DEB packages for 4.3.1 for Woody.
>> I'm using the unstable (Debian SID) and i have PHP 4.3.3
>>
> Scuse the off topic, but is debian the way to go ? i have found great
> pain to work with redhat even with rpm's. I just seriouslly cannot
> believe all this dependancy bullshit that doesnt have links or isnt
> packaged with it. I spent 4 hours just to try and get an IM client
> working which wasnt fruitful ;\

Mind you, when installing php/apache/mysql i only ever use source, and i
never have that much pain with linked libraries and dependancies like gnome
apps for instance ;\

--- End Message ---
--- Begin Message ---
Curt, et al --

...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
% > 
% > Should I use $_SESSION for everything or should I use session_start and
% > session_register and friends instead?  Is there a clear win with either
% > one?
% 
% $_SESSION is the proper way to do it (with globals off), you will still need to call
% session_start() on each page.

Ahhh...  OK; that's the key.  So I session_start but that's all, and then
I write into $_SESSION to save it and read from $_SESSION whenever I want
its value.  And to unset a var (incorrect password entered so I want to
wipe out that entry) can I unset($_SESSION[varname])?  And, finally, do I
need session_write_close() any more?

The way I'm doing things at the moment has all of my session stuff in my
main include file, which gets called first.  It looks like

  session_name('$sname') ;
  session_start() ;
  session_register('pw') ;
  session_register('authemail') ;
  ...

and it keeps all of "that session stuff" out of the way of the rest of
the code, where I later just check

  if ( $pw != $passwordcom )
  {
    ...
  }

and such.  It seems to me that for a fast fix I could set $pw and other
vars in my include file in place of registering them and then, later,
take my time to correctly switch over to $_POST['pw'] and $_SESSION['pw']
everywhere.  Does that sound like a good two-step approach to get all of
my code back up and running the soonest?  [I won't be able to check this
today but I'll be on it tomorrow morning at 0500ET when my day starts, so
please don't think I'm just fishing for answers; I'd love to see some by
then but if not I'll forge off on my own!]


% 
% Curt


Thanks & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgp00002.pgp
Description: PGP signature


--- End Message ---

Reply via email to