php-general Digest 6 Mar 2007 17:04:46 -0000 Issue 4662
Topics (messages 249910 through 249931):
Re: Matching Proper Versions Of PHP and MySQL
249910 by: Chris
Re: Image storing
249911 by: tedd
Re: Problem with spam
249912 by: Bc. Radek Krejca
249917 by: Jochem Maas
problem in using ldap_add() function
249913 by: Arun Sadasivan
249914 by: Arun Sadasivan
Re: remote fopen not working, despite allow_url_fopen = on SOLVED
249915 by: alex handle
Re: module and access rights
249916 by: Sancar Saran
Opinion on on-line payment and banking gateway
249918 by: Seak, Teng-Fong
249925 by: Jochem Maas
249929 by: Mark
Re: [PHP-DB] array field type
249919 by: Tony Marston
249930 by: Myron Turner
249931 by: Mark
how to access private property?
249920 by: Nicholas Yim
249921 by: Németh Zoltán
249922 by: Arno Coetzee
249923 by: Edward Kay
249924 by: Mikey
Re: pictures stored in PostgreSQL DB
249926 by: tedd
Re: Turning serialize data into an array
249927 by: datsclark
249928 by: datsclark
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 ---
zerof wrote:
revDAVE escreveu:
Hello All,
I'm a newbie.
My server just upgraded to PHP version 5.1.2 from php 4.3.11
MySQL currently is v 4.0.27
Q: What is the oldest - best/safest version of mySQL to use with PHP
version
5.1.2.? The reason I mentioned the oldest - is because, for legacy
clients,
I would like to do the minimum upgrade to ensure best compatibility with
legacy code ( mySQL and NON php etc.). If it is OK to stay on mySQL
version
4.0.27 ... That would be good to know.
Q: Is PHP version 5.1.2 - relatively " stable " version of PHP 5?
--
Thanks - RevDave
[EMAIL PROTECTED]
[db-lists]
The last release version of PHP is 5.2.1.
The last relase version of MySQL is 5.0.27.
You can use php 5.2.1 with MySQL 5.0.27 without problems.
The system is very stable.
That wasn't his question.
Stability wise they should be fine. Functionality wise, it depends.
The best way to work out the minimum version for your software to work
is to check the functions that you're using. eg
http://www.php.net/manual/en/function.date-default-timezone-get.php
came in at 5.1.0.
So depending on what functions you are using, you may need to run a
newer version.
Mysql 4.0.27 should be ok - but that means you're losing sub-queries
(v4.1+) and database functions (v5.0+ I think, maybe 5.1+).
Also both are old versions - if you find bugs/have issues, you'll either
have to work around them or upgrade - the respective developers will not
try to fix bugs in them because they are old (comparatively speaking).
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
At 8:55 PM +0100 3/5/07, Børge Holen wrote:
This dude is just trying to start another skirmishand probably a riot.
Was there something I missed. :-)
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hello,
JM> grep -l "mail(" *.php
I of course tried this before but I have hundereds domains and a lot
of files where clients using function mail.
--
Regards,
Bc. Radek Krejca
ICQ: 65895541
--- End Message ---
--- Begin Message ---
Bc. Radek Krejca wrote:
> Hello,
>
> JM> grep -l "mail(" *.php
>
> I of course tried this before but I have hundereds domains and a lot
> of files where clients using function mail.
that sucks then doesn't it ... there is no better way, unless you search out the
patch someone wrote (which may be part of a future release) which automatically
adds some 'X' headers to each outgoing mail php sends (via mail()) - can't
remember
the details but I'm pretty sure it was posted to [EMAIL PROTECTED] not too long
ago.
>
--- End Message ---
--- Begin Message ---
Hi ,
i m trying to insert a new user account into the ldap using php . bt i m
getting the following warning and the data is not geting inserted
*Warning*: ldap_add()
[function.ldap-add<http://gsrv/%7Earun/globees_webservice/Authentication_Layer/function.ldap-add>]:
Value array must have consecutive indices 0, 1, ... in *
/home/arun/public_html/globees_webservice/Authentication_Layer/cls.authentication.php
* on line *148*
Could not add new entry!
following is my ldap details
openldap2.2
LDPv3
PHP Version 5.1.2
Server: Ubuntu 6.06.1 LTS
Apache2
the ldap is working queit fine with other systems.
here i am also inclding the code i was trying ....
____________________________________________________________________________
function addUser($username,$password){
$dn = "uid=arun,ou=People,dc=globees,dc=com";
$pass = 'arun';
$ds=ldap_connect('localhost'); // must be a valid LDAP server!
$session_id = '';
$error_status = '-';
if ($ds) {
if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3))
$error_status = "Failed to set protocol version
3";
[EMAIL PROTECTED]($ds,$dn,$pass);
if ($r == TRUE)
{
////
//do insertion
$dn = "uid=testarun,ou=People,dc=globees,dc=com";
$entry["uid"] = "testarun";
$entry["cn"] = "testarun";
$entry["sn"] = "test";
$entry['mail'] = "[EMAIL PROTECTED]";
$entry['objectClass'][0] = "inetLocalMailRecipient";
$entry['objectclass'][1] = "person";
$entry['objectclass'][2] = "organizationalPerson";
$entry['objectclass'][3] = "inetOrgPerson";
$entry['objectClass'][4] = "posixAccount";
$entry['objectClass'][5] = "top";
$entry['objectClass'][6] = "shadowAccount";
$entry["gidnumber"] = 100;
$entry['homeDirectory'] = "/home/arun";
$entry['gecos'] = "testarun";
$entry['loginShell']= '/bin/bash';
$entry['userPassword']='{MD5}' .
base64_encode(pack('H*',md5("testarun")));
$f = ldap_add($ds, $dn, $entry) or die("Could not
add new entry!");
if($f==TRUE) //return a success mesage if insertion
successful
echo "successfully added";
////////////////////
}
elseif ($r == FALSE)
$error_status = "Access Denied!!!";
else
$error_status = "LDAP ERROR!";
}
else
$error_status = "Connection Error";
return $error_status;
}//end of method
_________________________________________________________________________
if anybody has some possible solutions to solve this problem plzz.... give
me a reply
--
Regards,
...Arun
--- End Message ---
--- Begin Message ---
Hi ,
i m trying to insert a new user account into the ldap using php . bt i
m getting the following warning and the data is not geting inserted
_____________________________________________________
Warning: ldap_add() [function.ldap-add]: Value array must have
consecutive indices 0, 1, ... in
/home/arun/public_html/globees_webservice/Authentication_Layer/cls.authentication.php
on line 148
Could not add new entry!
______________________________________________________
following is my ldap details
_______________________________________________
openldap2.2
LDPv3
PHP Version 5.1.2
Server: Ubuntu 6.06.1 LTS
Apache2
the ldap is working queit fine with other systems.
________________________________________________________
here i am also inclding the code i was trying ....
____________________________________________________________________________
function addUser($username,$password){
$dn = "uid=arun,ou=People,dc=globees,dc=com";
$pass = 'arun';
$ds=ldap_connect('localhost'); // must be a valid LDAP server!
$session_id = '';
$error_status = '-';
if ($ds) {
if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3))
$error_status = "Failed to set protocol version 3";
[EMAIL PROTECTED]($ds,$dn,$pass);
if ($r == TRUE)
{
////
//do insertion
$dn = "uid=testarun,ou=People,dc=globees,dc=com";
$entry["uid"] = "testarun";
$entry["cn"] = "testarun";
$entry["sn"] = "test";
$entry['mail'] = "[EMAIL PROTECTED]";
$entry['objectClass'][0] = "inetLocalMailRecipient";
$entry['objectclass'][1] = "person";
$entry['objectclass'][2] = "organizationalPerson";
$entry['objectclass'][3] = "inetOrgPerson";
$entry['objectClass'][4] = "posixAccount";
$entry['objectClass'][5] = "top";
$entry['objectClass'][6] = "shadowAccount";
$entry["gidnumber"] = 100;
$entry['homeDirectory'] = "/home/arun";
$entry['gecos'] = "testarun";
$entry['loginShell']= '/bin/bash';
$entry['userPassword']='{MD5}' .
base64_encode(pack('H*',md5("testarun")));
$f = ldap_add($ds, $dn, $entry) or die("Could
not add new entry!");
if($f==TRUE) //return a success mesage if
insertion successful
echo "successfully added";
////////////////////
}
elseif ($r == FALSE)
$error_status = "Access Denied!!!";
else
$error_status = "LDAP ERROR!";
}
else
$error_status = "Connection Error";
return $error_status;
}//end of method
_________________________________________________________________________
if anybody has some possible solutions to solve this problem plzz....
give me a reply
--
Regards,
...Arun
--- End Message ---
--- Begin Message ---
On 2/21/07, alex handle <[EMAIL PROTECTED]> wrote:
On 2/21/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
>
> On Mon, February 19, 2007 9:43 am, alex handle wrote:
> > A minute ago i tried to run my test script (remote.php) on the shell
> > and the
> > remote fopen works!!
> > The problem must be within the php apache module or apache self.
> > Is there a way to debug the php apache module?
>
> Step #1.
> Create a page with <?php phpinfo();?> in it, surf to it, and find the
> allow_url_fopen setting within that output.
>
> I'm betting dollars to donuts that the php.ini you changed has not yet
> been read by your webserver, because it isn't the right php.ini, or
> because you forgot to re-start Apache.
>
> Step #2.
> It's possible that your httpd.conf is messed up so that Apache (and
> thus PHP module) cannot manage to do a hostname lookup. If that's the
> case, you probably need to be checking in httpd.conf and asking on the
> Apache list...
>
> --
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So?
>
>
When i disable allow_url_fopen, i get this error mesage:
[Wed Feb 21 13:12:20 2007] [error] [client xxx] PHP Warning: file() [<a
href='function.file'>function.file</a>]: URL file-access is disabled in
the server configuration in /home/domains/x/xxxx/tmp/remote.php on line 2.
With "allow_url_fopen = on" i get a different error message (see my
previous posts).
Thank you for the tip i will check my httpd.conf.
Alex
Hi,
i found a solution on this site:
http://danger.rulez.sk/articles/php-http-request-fails.php
PHP4 does not work reliable with more than 1024 filedescriptors (incl.
apache logfiles).
Alex
--- End Message ---
--- Begin Message ---
Hi,
On every request you have to check access rights.
So you need access rights. someting like this
rights table
page_id
user_login
right_type
select right_type from rights_table
where page_id = '".$PHP_SELF."'
and user_login ='".$_SESSION['user_login']."'
if this query returns someting, your code give the permission if not
you show "access denied message"
Regards
Sancar
On Monday 05 March 2007 16:05, Alain Roger wrote:
> I already started to use SSL, but i do not understand how to keep it
> running.
>
> I mean after user has been authenticated and authorized to go further, all
> next web pages are opened using PHP location(https://...); command.
> however, it does not certify that it can not be faked by just typing into
> browser address bar https://another_webpage.php
>
> for example :
> 1.my login page is called "index.php" and it is accessible only by https.
> if user type http://../index.php, the index.php redirect itself to
> https://.../index.php.
> 2. user type logon and password.
> 3. application control it with information stored into DB and authorize
> user to go further, so a session is created and user is redirected to
> https://.../welcome.php
>
> what avoid hacker to directly type https://.../welcome.php ?
> how to be sure that it works correctly as in my example ?
>
> thanks a lot,
>
> Al.
>
> On 3/4/07, Stut <[EMAIL PROTECTED]> wrote:
> > Tijnema ! wrote:
> > > On 3/4/07, Stut <[EMAIL PROTECTED]> wrote:
> > >> Tijnema ! wrote:
> > >> > Give your server a unique ID, and add that to your check string lets
> > >>
> > >> say
> > >>
> > >> > so you store in your cookie the username and the check string.
> > >> >
> > >> > example
> > >> > $user = "tijnema";
> > >> > $server_unique_key =
> > >> > "w#$#%#54dfa4vf4w5$2!@@$<w#$%23%25%2354dfa4vf4w5$2!@@$>
> > >> > ";
> > >> > $check_string = md5($server_unique_key.$user.$server_unqie_key);
> > >> >
> > >> > and check that each time the user does an action.
> > >>
> > >> How, exactly, is that any more secure than a standard session
> >
> > identifier?
> >
> > >> While it's good to worry about security, adding pointless activity
> > >> such as this to every request is not going to help. Anything you do is
> > >> going to involve some piece of data being transferred from client to
> > >> server, and can therefore be faked/shared by the client. Get over it.
> > >>
> > >> -Stut
> > >
> > > It is ofcourse possible to share it to another client, but when
> >
> > combining
> >
> > > this with the IP address. This means it can only be used in the same
> >
> > LAN.
> >
> > > To get to the point, using this means you cannot simply fake the
> > > username in
> > > the cookie, which is possible else. session identifiers can be faked
> >
> > too.
> >
> > As I said in another email, you *cannot* use the IP address for any
> > verification without causing usability issues. It is perfectly
> > legitimate for sequential requests from any given user to come from
> > different IP addresses. The biggest user of systems like this is AOL,
> > and that's a fairly large user base you may want to avoid annoying by
> > insisting that they login for every other request.
> >
> > In short, this issue has been discussed to death, not only by the PHP
> > community but also by the web community at large. If you're really
> > paranoid, use SSL to secure all data transferred, but just accept that
> > it's possible that a session may be hijacked. However, unless you're a
> > bank, is anyone really going to bother?
> >
> > -Stut
> >
> > >> On 3/4/07, Alain Roger <[EMAIL PROTECTED]> wrote:
> > >> >> Ok, but i would be very glad to know how can i REALLY authenticate
> >
> > the
> >
> > >> >> user.
> > >> >> for example, user is logged, so i have in the cookie his login
> > >> >> name.
> > >> >>
> > >> >> how can i be sure that it's the same user and not some hacker who
> > >>
> > >> hacked
> > >>
> > >> >> the cookie and the session ?
> > >> >> what should be checked and where those data should be stored ?
> > >> >>
> > >> >> because i can store in DB the sessionID, and check it to every DB
> > >>
> > >> request
> > >>
> > >> >> user does...but a sessionID can be easily fake.
> > >> >>
> > >> >> So what should I do ?
> > >> >>
> > >> >> Al.
> > >> >>
> > >> >> On 3/4/07, Tijnema ! <[EMAIL PROTECTED]> wrote:
> > >> >> > On 3/4/07, Stut <[EMAIL PROTECTED]> wrote:
> > >> >> > > Alain Roger wrote:
> > >> >> > > > I would like to implement a module access rights in my web
> > >> >> >
> > >> >> > application.
> > >> >> >
> > >> >> > > > Basically after authentication and authorization. Logged user
> > >>
> > >> has
> > >> a
> > >>
> > >> >> > > > particular profile which allow him to have access to some
> > >>
> > >> part of
> > >>
> > >> >> > the
> > >> >> >
> > >> >> > > web
> > >> >> > >
> > >> >> > > > application.
> > >> >> > > >
> > >> >> > > > after reading the security guide from *php*sec.org webpage,
> >
> > i'm
> >
> > >> >> > confused
> > >> >> >
> > >> >> > > > regarding how to store user login and password.
> > >> >> > > > I mean the encrypted password stored in database is compared
> >
> > to
> >
> > >> >> > > encrypted
> > >> >> > >
> > >> >> > > > password that user type.
> > >> >> > > >
> > >> >> > > > But where to store login and password once user is logged ?
> > >> >> > > >
> > >> >> > > > when i read the security guide it seems that it is not
> > >> >> > > > secured
> > >> >> >
> > >> >> > enough to
> > >> >> >
> > >> >> > > > store them in cookies or in sessions data...
> > >> >> > > > both can be hacked... So what is the best solution ?
> > >> >> > > >
> > >> >> > > > i will use those stored data to check if logged user can have
> > >> >>
> > >> >> access
> > >> >>
> > >> >> > to
> > >> >> >
> > >> >> > > a
> > >> >> > >
> > >> >> > > > particular part of the web application.
> > >> >> > > >
> > >> >> > > > What is your point of view in such domain ?
> > >> >> > >
> > >> >> > > Ok, once the user has logged in there is no need to store the
> > >> >> >
> > >> >> > password.
> > >> >> >
> > >> >> > > Simply store the username or other user details (but not the
> > >> >>
> > >> >> password)
> > >> >>
> > >> >> > > in the session - that's as secure as it's gonna get.
> > >> >> > >
> > >> >> > > *Never* store a password in a cookie. *Ever*.
> > >> >> > >
> > >> >> > > -Stut
> > >> >> >
> > >> >> > That's right, never store a password in a cookie or session,
> > >> >> > maybe
> >
> > a
> >
> > >> >> > little
> > >> >> > extra security could be added by locking the cookie to a IP
> >
> > address,
> >
> > >> >> but
> > >> >>
> > >> >> > even more secure isn't possible.
> > >> >> >
> > >> >> > Tijnema
> > >> >> >
> > >> >> > --
> > >> >> >
> > >> >> > > PHP General Mailing List (http://www.php.net/ )
> > >> >> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >> >>
> > >> >> --
> > >> >> Alain
> > >> >> ------------------------------------
> > >> >> Windows XP SP2
> > >> >> PostgreSQL 8.1.4
> > >> >> Apache 2.0.58
> > >> >> PHP 5
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm not a PHP programmer. I ask this question for a friend of
mine. So I'm not sure if I'm using the correct terms. He's making an
e-commerce website and he doesn't know much about how to validate credit
card, or how to make transactions. What he needs is called "banking
gateway", right?
After some search in php.net, I've found a link to
http://www.trustcommerce.com/. Is this what he's looking for? Has
anyone here used this? Actually, it doesn't matter to him if such thing
isn't open-source or isn't free. What he needs is something that
works. Anyone has any opinions or suggestions? Any tutorial to banking
gateway?
Thanks in advance (in his behalf) :)
----------
* Zoner PhotoStudio 8 - Your Photos perfect, shared, organised!
www.zoner.com/zps
You can download your free version.
--- End Message ---
--- Begin Message ---
Seak, Teng-Fong wrote:
> I'm not a PHP programmer.
you eloi, you. :-)
> I ask this question for a friend of
> mine. So I'm not sure if I'm using the correct terms. He's making an
> e-commerce website and he doesn't know much about how to validate credit
> card, or how to make transactions.
tell him this: "never ever ever ever so much as accept a creditcard number
as input to any of his scripts let alone store it somewhere - leave that to
the payment provider who has the expertise, secure (hopefully) system and
massive
liability fund to be able to deal with such things professionally."
> What he needs is called "banking
> gateway", right?
payment provider is probably a more used term. but yes her needs one of those.
one example is paypal - there are plenty of others.
>
> After some search in php.net, I've found a link to
> http://www.trustcommerce.com/. Is this what he's looking for?
no idea if trustcommerce.com is recommended but it's the kind of
thing he's looking for yes.
Has
> anyone here used this? Actually, it doesn't matter to him if such thing
> isn't open-source or isn't free. What he needs is something that
> works. Anyone has any opinions or suggestions? Any tutorial to banking
> gateway?
google/yahoo knows more than me :-)
--- End Message ---
--- Begin Message ---
Seak, Teng-Fong wrote:
> I'm not a PHP programmer. I ask this question for a friend of
> mine. So I'm not sure if I'm using the correct terms. He's making an
> e-commerce website and he doesn't know much about how to validate credit
> card, or how to make transactions. What he needs is called "banking
> gateway", right?
a couple years ago I did some research and while I'm not Sure who the
players are right now, I concluded it was not worth the effort. We
concluded it was better to subscribe to a credit card clearing service.
They provide a basic API that allows you to pass a billing amount to the
clearing service who, for a fee or percentage, process the credit card. You
never Have to deal with it, they just credit your account and you ship
goods.
--- End Message ---
--- Begin Message ---
"Sancar Saran" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 04 March 2007 23:04, Sancar Saran wrote:
>> Hi,
>>
>> I want to know is there any db server around there for store php arrays
>> natively.
>>
>> Regards
>>
>> Sancar
> Thanks for responses, it seems I have to give more info about situation.
>
> In my current project, we had tons of arrays. They are very deep and
> unpredictable nested arrays.
>
> Currently we are using serialize/unserialize and it seems it comes with
> own
> cpu cost. Xdebug shows some serializing cost blips. Sure it was not SO BIG
> deal (for now of course).
>
> My db expertise covers a bit mysql and mysql does not have any array type
> field (enum just so simple).
Wrong! Take a look at the SET datatype
http://dev.mysql.com/doc/refman/4.1/en/set.html. This allows you to have an
array of values in a single field, and the user can select any number of
them.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
> I just want to know is there any way to keep array data type natively in a
> sql
> field.
>
> Regards.
>
> Sancar
--- End Message ---
--- Begin Message ---
Tony Marston wrote:
"Sancar Saran" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Sunday 04 March 2007 23:04, Sancar Saran wrote:
Hi,
I want to know is there any db server around there for store php arrays
natively.
Regards
Sancar
Thanks for responses, it seems I have to give more info about situation.
In my current project, we had tons of arrays. They are very deep and
unpredictable nested arrays.
Currently we are using serialize/unserialize and it seems it comes
with own
cpu cost. Xdebug shows some serializing cost blips. Sure it was not
SO BIG
deal (for now of course).
My db expertise covers a bit mysql and mysql does not have any array
type
field (enum just so simple).
Wrong! Take a look at the SET datatype
http://dev.mysql.com/doc/refman/4.1/en/set.html. This allows you to
have an array of values in a single field, and the user can select any
number of them.
It might be worth looking at wddx. I can't speak about the cpu cost for
large numbers of arrays, but it's mechanism is simple. It saves data
types as XML strings, which can be written using
**wddx_serialize_vars()* <cid:[email protected]> *and read
using **wddx_deserialize()* <cid:[email protected]>.
--
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
--- End Message ---
--- Begin Message ---
Myron Turner wrote:
> Tony Marston wrote:
>> "Sancar Saran" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>
>>> On Sunday 04 March 2007 23:04, Sancar Saran wrote:
>>>
>>>> Hi,
>>>>
>>>> I want to know is there any db server around there for store php arrays
>>>> natively.
>>>>
>>>> Regards
>>>>
>>>> Sancar
>>>>
>>> Thanks for responses, it seems I have to give more info about situation.
>>>
>>> In my current project, we had tons of arrays. They are very deep and
>>> unpredictable nested arrays.
>>>
>>> Currently we are using serialize/unserialize and it seems it comes
>>> with own
>>> cpu cost. Xdebug shows some serializing cost blips. Sure it was not
>>> SO BIG
>>> deal (for now of course).
>>>
>>> My db expertise covers a bit mysql and mysql does not have any array
>>> type
>>> field (enum just so simple).
>>>
>>
>> Wrong! Take a look at the SET datatype
>> http://dev.mysql.com/doc/refman/4.1/en/set.html. This allows you to
>> have an array of values in a single field, and the user can select any
>> number of them.
>>
>>
> It might be worth looking at wddx. I can't speak about the cpu cost for
> large numbers of arrays, but it's mechanism is simple. It saves data
> types as XML strings, which can be written using
> **wddx_serialize_vars()* <cid:[email protected]> *and read
> using **wddx_deserialize()* <cid:[email protected]>.
WDDX is kind of dicey, it doesn't handle a lot of the data types correctly.
About a year an a half ago, I tried to use it as a serializer and it really
confused the datatypes in PHP. If you are doing something simple, it will
probably work, but I wouldn't count on it.
I have an extension to PHP that could work for you. Take a look at XMLDBX at
http://www.mohawksoft.org. You'll need to get it from CVS. Put it in
the "ext" directory and run ./buildconf.sh --force, then configure
with --with-xmldbx
It started out as a fix to wddx, but essentially became a rewrite. I've been
using it on a few sites for over a year now.
--- End Message ---
--- Begin Message ---
Hello Everyone,
[code]
class MyClass {
private $prop;
}
$obj=new MyClass;
[/code]
is there anyway to read and write MyClass->prop, except serialize
Best regards,
Nicholas Yim
[EMAIL PROTECTED]
2007-03-06
--- End Message ---
--- Begin Message ---
2007. 03. 6, kedd keltezéssel 20.08-kor Nicholas Yim ezt írta:
> Hello Everyone,
>
> [code]
> class MyClass {
> private $prop;
> }
> $obj=new MyClass;
> [/code]
>
> is there anyway to read and write MyClass->prop, except serialize
write methods to do this
class MyClass {
private $prop;
function getProp() {
return $this->prop;
}
function setProp($val) {
$this->prop = $val;
}
}
greets
Zoltán Németh
>
> Best regards,
>
> Nicholas Yim
> [EMAIL PROTECTED]
> 2007-03-06
>
--- End Message ---
--- Begin Message ---
Nicholas Yim wrote:
> Hello Everyone,
>
> [code]
> class MyClass {
> private $prop;
> }
> $obj=new MyClass;
> [/code]
>
> is there anyway to read and write MyClass->prop, except serialize
>
> Best regards,
>
> Nicholas Yim
> [EMAIL PROTECTED]
> 2007-03-06
>
>
why not have a public function that returns the value of the private
variable $prop...
--
Arno Coetzee
Flash Media Group
Developer
Mobile : 27 82 693 6180
Office : 27 12 430 7597
--- End Message ---
--- Begin Message ---
>
> Hello Everyone,
>
> [code]
> class MyClass {
> private $prop;
> }
> $obj=new MyClass;
> [/code]
>
> is there anyway to read and write MyClass->prop, except serialize
>
Not directly, that's the whole point of declaring something private. You
could use __set and __get methods in the class if you need to but I think
you need to consider your design further first.
Edward
--- End Message ---
--- Begin Message ---
Németh Zoltán wrote:
2007. 03. 6, kedd keltezéssel 20.08-kor Nicholas Yim ezt írta:
Hello Everyone,
[code]
class MyClass {
private $prop;
}
$obj=new MyClass;
[/code]
is there anyway to read and write MyClass->prop, except serialize
write methods to do this
class MyClass {
private $prop;
function getProp() {
return $this->prop;
}
function setProp($val) {
$this->prop = $val;
}
}
You could also use the __get() and __set() methods to write a generic
handler for all of your private vars.
http://uk.php.net/manual/en/language.oop5.overloading.php
Mikey
--- End Message ---
--- Begin Message ---
At 5:14 PM -0500 3/5/07, [email protected] wrote:
The "science" is computer science and that is mostly mathematics based.
The "art" is the creativity of coming up with novel solutions.
The thing that separates "engineering" from "art" is the fact that after
the abstract creativity takes place, it is verified against the science.
All hogwash -- and not even well said.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Looks like your serialized data isn't right. I added two curly brackets }}
to the end, and unserialized the string with no problems.
""Richard Kurth"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How can I get the data out of this string that has been serialize I need
> to
> get it into an array so I can access the data with something like
> $testdata[1]
> I have tried
> $testdata= unserialize($testdata);
> also
> $sst= base64_encode(serialize($testdata));
> $testdata1= unserialize(base64_decode($sst));
>
> I ether get an error bool(false) or the same data back.
> I do not have control of the script that serializes it
>
> $testdata='a:17:{s:11:"event_start";s:4:"2230";s:9:"event_end";s:4:"2300";s:
> 14:"start_unixtime";i:1173076200;s:12:"end_unixtime";i:1173078000;s:10:"even
> t_text";s:37:"Call+NANCYADKINS+-+%28276%29+681-6548";s:12:"event_length";i:1
> 800;s:13:"event_overlap";i:0;s:11:"description";s:17:"This+is+test+Data";s:6
> :"status";s:0:"";s:5:"class";s:7:"CONTACT";s:9:"spans_day";b:0;s:8:"location
> ";s:0:"";s:9:"organizer";s:6:"a:0:{}";s:8:"attendee";s:6:"a:0:{}";s:9:"calnu
> mber";i:1;s:7:"calname";s:5:"admin";s:3:"url";s:0:""';
>
>
>
--- End Message ---
--- Begin Message ---
btw, the code:
$testdata='a:17:{s:11:"event_start";s:4:"2230";s:9:"event_end";s:4:"2300";s:14:"start_unixtime";i:1173076200;s:12:"end_unixtime";i:1173078000;s:10:"event_text";s:37:"Call+NANCYADKINS+-+%28276%29+681-6548";s:12:"event_length";i:1800;s:13:"event_overlap";i:0;s:11:"description";s:17:"This+is+test+Data";s:6:"status";s:0:"";s:5:"class";s:7:"CONTACT";s:9:"spans_day";b:0;s:8:"location";s:0:"";s:9:"organizer";s:6:"a:0:{}";s:8:"attendee";s:6:"a:0:{}";s:9:"calnumber";i:1;s:7:"calname";s:5:"admin";s:3:"url";s:0:""}}';
$testdata = unserialize($testdata);
print_r($testdata);
""Richard Kurth"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How can I get the data out of this string that has been serialize I need
> to
> get it into an array so I can access the data with something like
> $testdata[1]
> I have tried
> $testdata= unserialize($testdata);
> also
> $sst= base64_encode(serialize($testdata));
> $testdata1= unserialize(base64_decode($sst));
>
> I ether get an error bool(false) or the same data back.
> I do not have control of the script that serializes it
>
> $testdata='a:17:{s:11:"event_start";s:4:"2230";s:9:"event_end";s:4:"2300";s:
> 14:"start_unixtime";i:1173076200;s:12:"end_unixtime";i:1173078000;s:10:"even
> t_text";s:37:"Call+NANCYADKINS+-+%28276%29+681-6548";s:12:"event_length";i:1
> 800;s:13:"event_overlap";i:0;s:11:"description";s:17:"This+is+test+Data";s:6
> :"status";s:0:"";s:5:"class";s:7:"CONTACT";s:9:"spans_day";b:0;s:8:"location
> ";s:0:"";s:9:"organizer";s:6:"a:0:{}";s:8:"attendee";s:6:"a:0:{}";s:9:"calnu
> mber";i:1;s:7:"calname";s:5:"admin";s:3:"url";s:0:""';
>
>
>
--- End Message ---