Fwd: [PHP] Re: Class variable value lost

2009-09-09 Thread Sumit Sharma
What I have done is declared one User class in a separate file and created
its object there only. After this included this file in all other file which
are using its object. So the object is creating only once and included in
every other file only once. Now when I over write its variable it value get
lost when I send the user in other file.

The confusion is if I have created only one object of a class and used the
same object through out the site how its value can get lost and I think this
is a separate issue than setting $_SESSION variables.





-- Forwarded message --
From: Ashley Sheridan 
Date: Wed, Sep 9, 2009 at 9:14 PM
Subject: Re: [PHP] Re: Class variable value lost
To: Shawn McKenzie 
Cc: Sumit Sharma , PHP General Mailing List <
php-general@lists.php.net>


On Wed, 2009-09-09 at 10:36 -0500, Shawn McKenzie wrote:
> Sumit Sharma wrote:
> > Hi,
> >
> > I have developed a listing site which is totally class based. Now when
it
> > authenticates a user login and set appropriate class variables to true
and
> > set user info in user class variables, value of all the set variables
are
> > lost when I forward the user to members page. When I check the the value
on
> > other page it is set to the default value of the class. Please help.
> >
> >
> > Regard,
> >Sumit
> >
>
> You needs to pass the object to the next page.  Look into sessions.
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
The object only exists for that instance of the script, so when the user
navigates to the next page, the object is freed up from the memory.
There are a couple of ways you could get round this:

 * don't navigate away from the page, and use AJAX calls to update
   parts of the page for the user (bad imho, as it relies on
   Javascript)
 * use sessions like Shawn recommended

If you use sessions, you can store the objects themselves as variables
into the session. You should be careful with this, as you may not want
too many sessions open with large objects in them as, depending on your
server setup, sessions could last quite a while, and there may also be a
limit on the amount of memory reserved for sessions.

Thanks,
Ash
http://www.ashleysheridan.co.uk


[PHP] Class variable value lost

2009-09-09 Thread Sumit Sharma
Hi,

I have developed a listing site which is totally class based. Now when it
authenticates a user login and set appropriate class variables to true and
set user info in user class variables, value of all the set variables are
lost when I forward the user to members page. When I check the the value on
other page it is set to the default value of the class. Please help.


Regard,
   Sumit


[PHP] Re: How to download and configure php mvc website locally

2009-08-20 Thread Sumit Sharma
Hi all,
The site I have download was developed using cake php. Now when trying to
access the website it is showing a blank page. As Sudheer suggested I went
to error log and noted down the errors there, which are as follows:

[Thu Aug 20 14:10:16 2009] [error] [client 127.0.0.1] File does not exist:
F:/Rabin/xampp/htdocs/favicon.ico

I think there is no file called favicon.ico but how to create this file. Is
this something related to cakephp configuration.

Regards,
Sumit



On Wed, Aug 19, 2009 at 8:25 PM, Sumit Sharma  wrote:

> Hi,
> Please help as I have downloaded a php website for my client which is
> developed using model view controller pattern. Now when I am accessing this
> site locally it is not showing any thing. Please tell me the what's the
> problem
>
> Thanks,
>   Sumit Sharma
>


[PHP] How to download and configure php mvc website locally

2009-08-19 Thread Sumit Sharma
Hi,
Please help as I have downloaded a php website for my client which is
developed using model view controller pattern. Now when I am accessing this
site locally it is not showing any thing. Please tell me the what's the
problem

Thanks,
  Sumit Sharma


[PHP] Sending mail from localhost

2009-05-30 Thread Sumit Sharma
Hi,

I am new to php and not able to send mail from localhost. when trying to do
so getting following response:


*Warning*: mail() [function.mail ]: Failed
to connect to mailserver at "localhost" port 25, verify your "SMTP" and
"smtp_port" setting in php.ini or use ini_set() in *C:\wamp\www\abc1.php* on
line *9

*Please Help,

Thanks,
Sumit


Re: [PHP] pdf_new()

2009-05-30 Thread Sumit Sharma
Hi Michael,

Now its working.

Thanks,
Sumit.



On Sat, May 30, 2009 at 1:51 PM, Michael A. Peters  wrote:

> Sumit Sharma wrote:
> > Hi,
> >
> > Unable the create new pdf file object. Getting an error when coding as
> > following:
> >
> >  >
> > $pdf=pdf_new();
> >
> > ?>
> >
> > *Fatal error*: Call to undefined function pdf_new() in
> *C:\wamp\www\abc1.php
> > * on line *3*
> >
> > Please Help.
> >
> > Thanks,
> >  Sumit.
> >
>
> You need to install PDFLib.
> If installed, you need to load the module (in your php.ini)
>
>


[PHP] pdf_new()

2009-05-30 Thread Sumit Sharma
Hi,

Unable the create new pdf file object. Getting an error when coding as
following:



*Fatal error*: Call to undefined function pdf_new() in *C:\wamp\www\abc1.php
* on line *3*

Please Help.

Thanks,
 Sumit.


Re: [PHP] change server time

2009-05-25 Thread Sumit Sharma
That's really a good bunch of information.


Thanks,
 Sumit.



On Mon, May 25, 2009 at 2:43 PM, Lester Caine  wrote:

> Sumit Sharma wrote:
>
>> Hi,
>>
>> What I mean is my windows time is set to local time but when I use any
>> date
>> function in PHP it shows time in GMT on web browser and to change this I
>> have to use putenv("TZ=asia/calcutta");
>>
>> Thus:
>>
>> 1 There is no problem with Windows time its according to IST.
>> 2 Problem start with PHP, which displays GMT time by default.
>> 3 To solve this I was advised to change the OS time which is already
>> changed.
>>
>> Now I am not aware how the php date functions picking GMT time and from
>> where?
>>
>
> Basic time is always UTC ( GMT is the same ) and so unless you TELL it
> otherwise, PHP displays UTC. That way if you have clients accessing from
> different time zones they get a consistent time.
>
> If you want to display a particular time zone for a client, then you need
> to know what timezone that client is in, which is where "TZ=asia/calcutta"
> sets it globally for your site. Windows does not provide sufficient data to
> identify the timezone and so PHP defaults to it not being set.
>
> http://us2.php.net/manual/en/book.datetime.php covers the date functions
> that were added in PHP5.1, and which replace the earlier methods since they
> actually handle daylight saving as well, something that TZ and the earlier
> browser based time zone information simply ignores ...
>
> --
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: Re: [PHP] change server time

2009-05-25 Thread Sumit Sharma
Hi,

What I mean is my windows time is set to local time but when I use any date
function in PHP it shows time in GMT on web browser and to change this I
have to use putenv("TZ=asia/calcutta");

Thus:

1 There is no problem with Windows time its according to IST.
2 Problem start with PHP, which displays GMT time by default.
3 To solve this I was advised to change the OS time which is already
changed.

Now I am not aware how the php date functions picking GMT time and from
where?



On Mon, May 25, 2009 at 11:01 AM, kranthi  wrote:

> what do you mean by "..does not change the server time permanently..."
>
> as far as i can understand you want your wamp server to take the time
> specified by your operating sys. as a mater of fact it is doing that.
> but it is not taking the timezone specified by your operating system.
>
> http://us2.php.net/date_default_timezone_get
>
> to set the env variable globally
> 1. right click on my computer
> 2. go to properties.
> 3. go to advanced tab.
> 4. click on environment variables button
>
> but i believe date.timezone php ini option is best for you
>
> PS: i dont use windows any more(not since an year) and the above is
> from my memory.
>


Re: Re: [PHP] change server time

2009-05-24 Thread Sumit Sharma
In my windows I have already selected the local time and its working fine
for window but by default WAMP server is picking GMT time so I have to use
putenv() function to change it for that page where I am using date function.
It seems there is some misunderstanding between the server and OS.




On Mon, May 25, 2009 at 9:24 AM,  wrote:

> In windows? I have no idea. I use linux for my server stacks. You'll have
> to ask Dr. Google! I'd expect it's just like with normal windows, in the
> date properties in the control panel.
>
>
> On May 24, 2009 11:44pm, Sumit Sharma  wrote:
> > That's great but how to do this?
> >
> >
> >
> >
> >
> > On Mon, May 25, 2009 at 9:11 AM, Eddie Drapkin oorza...@gmail.com>
> wrote:
> >
> > If you want to change the server time ocmpletely and independent of PHP,
> you're going to have to do it from the shell.
> >
> >
> >
> > On Sun, May 24, 2009 at 11:36 PM, Sumit Sharma sumitp...@gmail.com>
> wrote:
> >
> >
> > Yes, I works on windows as well well. Was looking for india time zone
> found
> >
> > it as putenv("TZ=Asia/Calcutta");. Thanks a lot, but this function does
> not
> >
> > change the server time permanently. Any Idea about any function which
> does
> >
> > so.
> >
> >
> >
> >
> >
> > Thanks,
> >
> >Sumit
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sun, May 24, 2009 at 12:33 PM, Michael A. Peters mpet...@mac.com>
> wrote:
> >
> >
> >
> > > Sumit Sharma wrote:
> >
> > >
> >
> > >> Hi,
> >
> > >>
> >
> > >>   Whenever I am using date('r') function It shows time in GMT instead
> of
> >
> > >> local time set on my machine. Do I need to configure the time
> separately.
> >
> > >> I
> >
> > >> am using WAMP server locally.
> >
> > >>
> >
> > >> Thanks,
> >
> > >> Sumit
> >
> > >>
> >
> > >>
> >
> > > Not sure about windows - but
> >
> > >
> >
> > > putenv("TZ=America/Los_Angeles");
> >
> > >
> >
> > > in your script should work (change the timezone to whatever you want
> >
> > > locally).
> >
> > >
> >
> > > You should be able to set the TZ variable globally in your php.ini
> file.
> >
> > >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>


Re: [PHP] change server time

2009-05-24 Thread Sumit Sharma
That's great but how to do this?





On Mon, May 25, 2009 at 9:11 AM, Eddie Drapkin  wrote:

> If you want to change the server time ocmpletely and independent of PHP,
> you're going to have to do it from the shell.
>
>
> On Sun, May 24, 2009 at 11:36 PM, Sumit Sharma wrote:
>
>> Yes, I works on windows as well well. Was looking for india time zone
>> found
>> it as putenv("TZ=Asia/Calcutta");. Thanks a lot, but this function does
>> not
>> change the server time permanently. Any Idea about any function which does
>> so.
>>
>>
>> Thanks,
>>     Sumit
>>
>>
>>
>> On Sun, May 24, 2009 at 12:33 PM, Michael A. Peters 
>> wrote:
>>
>> > Sumit Sharma wrote:
>> >
>> >> Hi,
>> >>
>> >>   Whenever I am using date('r') function It shows time in GMT instead
>> of
>> >> local time set on my machine. Do I need to configure the time
>> separately.
>> >> I
>> >> am using WAMP server locally.
>> >>
>> >> Thanks,
>> >> Sumit
>> >>
>> >>
>> > Not sure about windows - but
>> >
>> > putenv("TZ=America/Los_Angeles");
>> >
>> > in your script should work (change the timezone to whatever you want
>> > locally).
>> >
>> > You should be able to set the TZ variable globally in your php.ini file.
>> >
>>
>
>


Re: [PHP] change server time

2009-05-24 Thread Sumit Sharma
Yes, I works on windows as well well. Was looking for india time zone found
it as putenv("TZ=Asia/Calcutta");. Thanks a lot, but this function does not
change the server time permanently. Any Idea about any function which does
so.


Thanks,
Sumit



On Sun, May 24, 2009 at 12:33 PM, Michael A. Peters  wrote:

> Sumit Sharma wrote:
>
>> Hi,
>>
>>   Whenever I am using date('r') function It shows time in GMT instead of
>> local time set on my machine. Do I need to configure the time separately.
>> I
>> am using WAMP server locally.
>>
>> Thanks,
>> Sumit
>>
>>
> Not sure about windows - but
>
> putenv("TZ=America/Los_Angeles");
>
> in your script should work (change the timezone to whatever you want
> locally).
>
> You should be able to set the TZ variable globally in your php.ini file.
>


[PHP] change server time

2009-05-23 Thread Sumit Sharma
Hi,

   Whenever I am using date('r') function It shows time in GMT instead of
local time set on my machine. Do I need to configure the time separately. I
am using WAMP server locally.

Thanks,
 Sumit


Fwd: [PHP] SECURITY PRECAUTION BEFORE SUBMITTING DATA IN DATABASE

2009-05-22 Thread Sumit Sharma
Thanks to [0] => Ashley, [1] =>Bruce, [2] => Michael, [3] => Shawn, [4] =>
Eddie and php-general list for all your support from bottom of my heart.


Now it seems as if I will be able to design my project more secured than
before. If you get
any other idea please suggest me.


Thanks,
Sumit.







-- Forwarded message --
From: Michael A. Peters 
Date: Fri, May 22, 2009 at 4:50 AM
Subject: Re: [PHP] SECURITY PRECAUTION BEFORE SUBMITTING DATA IN DATABASE
To: Eddie Drapkin 
Cc: php-general@lists.php.net


Eddie Drapkin wrote:

> Suhosin is completely not-related to SQL, though, I don't know why you'd
> bring it up...
>

I brought it up because suhosin catches many exploits that otherwise get
through, including exploits that allow inclusion of remote files that can
then be used to run arbitrary commands on the server, send include files
(such as the db authentication script) as plain text, all kinds of nasty can
result.

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


[PHP] session.auto_start

2009-05-22 Thread Sumit Sharma
Hi All,

are there any *disadvantages of setting session.auto_start to true in terms
of system resources or security or any other*. I have set this element to
true in php.ini as follows.

session.auto_start = 1.


Millions of thanks,
   Sumit


Fwd: [PHP] SECURITY PRECAUTION BEFORE SUBMITTING DATA IN DATABASE

2009-05-21 Thread Sumit Sharma
One more thing, should I use @ for security purpose or not so that the use
can reply me with the errors so that I can troubleshoot the problem more
effectively.


Sumit

-- Forwarded message --
From: Ashley Sheridan 
Date: Thu, May 21, 2009 at 6:36 PM
Subject: Re: [PHP] SECURITY PRECAUTION BEFORE SUBMITTING DATA IN DATABASE
To: Sumit Sharma 
Cc: php-general@lists.php.net


On Thu, 2009-05-21 at 18:22 +0530, Sumit Sharma wrote:
> Hi,
>
> I am designing a php website for my client which interact with database.
> This is my first project for any client (I hope he is not reading this
mail
> ;-)  ). I am a bit more concerned with database security. Can somebody
shed
> some light on the security measurements, precautions, and functions
related
> to database security in general to make sure that the data is safely
stored
> updated and retried from database. I have already used htmlentities(),
> strip_tags(), addhashes(), and some regular expressions to check security.
> Looking for help beyond this.
>
>
> Thanks in advance...
> Sumit

I'd advise using something like mysql_real_escape_string() (assuming you
are using a MySQL database that is) on each variable of data before you
insert it into the database. You could go further and validate specific
data, so check that a field which you expect a number only contains a
number, etc.


Ash
www.ashleysheridan.co.uk


[PHP] SECURITY PRECAUTION BEFORE SUBMITTING DATA IN DATABASE

2009-05-21 Thread Sumit Sharma
Hi,

I am designing a php website for my client which interact with database.
This is my first project for any client (I hope he is not reading this mail
;-)  ). I am a bit more concerned with database security. Can somebody shed
some light on the security measurements, precautions, and functions related
to database security in general to make sure that the data is safely stored
updated and retried from database. I have already used htmlentities(),
strip_tags(), addhashes(), and some regular expressions to check security.
Looking for help beyond this.


Thanks in advance...
Sumit