[PHP] return value from recursive function

2001-07-29 Thread Jaskirat

Hi,
How to get return value from a recursive function .. here is the test code 
which I was trying


Its printing "123" where as I was expecting "123xyz"
what is happening to $returnvalue

TIA
Jaski


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Breaking up a line and using the text?

2001-02-05 Thread jaskirat

Hi,
Read about ereg_replace() function in PHP.
some thing like 
$string = ereg_replace(" ","\n",$string)

should do the trick for you.

HTH
Jaski

At 01:00 PM 2/5/01 +, Sam wrote:
>Hi all, 
>
>I was wondering if it is possible to break up a line of text from a
>database, and split it into separate links, 
>
>eg 
>
>Original line
>   Hi my name is Sam Rose
>
>Which can then be broken down into
>   Hi
>   My
>   Names
>   is
>   Sam Rose
>
>Thanks in advance
>Sam
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] more on trimming

2001-02-16 Thread jaskirat

Since this thread is running I would like to know the gurus' opinons on the
similar following situation

Suppose there is a variable like this

$var = "This is a variable  ";

Now I want to strip off white spaces on the end without losing them in the
middle of the sentence ..


I had figured that there is a no direct way of doing it and some thing like
this 
works
$var = trim (ereg_replace("  ","",$var));

the first argument to ereg_replace is  "two spaces" so that single spaces
between the words are not removed
then trim to remove any space on the end which may still remain.

But I feel its still not a fool proof solution because there may be two
spaces in between words some where also
which will then be clubbed together. 

Any body has a better idea.

Jaskirat





At 09:51 PM 2/16/01 -0500, you wrote:
>> Trim() will in fact only strip whitespace from the beginning or end of
>> the string; if he has \n's anywhere in the middle of the string, trim
>> will do perform the desired operation.
>
>CORRECTION : "trim will not perform the desired operation"
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] location

2001-02-17 Thread jaskirat

make a function which validates users.

Then where ever you want to restrict access just call that function before
other things .. and it will
do the trick where ever you need .. no if statements needed.

HTH

Jaskirat

At 11:47 PM 2/16/01 -0800, Brandon Feldhahn wrote:
>how would i make somthing in a IF statement that would take somone to
>the members page when they get the login correct
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Php page runs from one computer but not another

2002-08-19 Thread Jaskirat Singh

Hi,

"I can run the same page on the machine with the problem if I 
simply rename it."

If you could tell what the name was when it didn't work and what 
when it worked.

If by rename you mean change of extension like say from php3 to 
php then it indicates that apache config file (I am not sure for 
IIS or others) is not configured to handle that particular 
extension through php.

regards
Jaski

On Tue, 20 Aug 2002 Jonathan Black wrote :
>Hello,
>
>php 4.2.1 Internet Explorer 6.
>
>After some server upgrades at my webhoster I can see the phpinfo 
>page from a
>computer running windows 98, but not from another computer 
>running windows
>2000 server. Here I just see the php code in my browser.
>I can run the same page on the machine with the problem if I 
>simply rename
>it.
>
>The relevant url is:
>http://www.natureinfo.org.il/users/webmaster/phpnatureinfo/phpinfo.php
>
>I have tried to disable caching as you can see from the code of 
>the page
>which follows but this does not help:
>
>added by jjb due to caching problems
>
>header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
>header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
>header("Cache-Control: no-cache,must-revalidate");
>header("Pragma: no-cache");
>
>
>// Show all information, defaults to INFO_ALL
>phpinfo();
>
>
>?>
>
>Thanks
>
>Jonathan
>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>


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




[PHP] Data management tool

2004-07-27 Thread Jaskirat Singh
Hi Everyone,
I am looking for a tool that lets me do simple data managment ie.
edit,update,insert and delete records in tables of a database. 

I am kinda fed up of writing those php scripts for back ends of
websites over and over :). I am looking for some thing generic to
replace that if possible.

PhpMyAdmin is a great tool but I don't want the user to have access to
drop table and empty table etc. I cannot change the permissions of
MySQL user.

Jas

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



[PHP] sessions getting destroyed for *Some* clients

2004-04-19 Thread Jaskirat Singh
Hi Guys,

I have some thing weird happening with sessions here.
They are getting destroyed/reset for *SOME* clients.
I wrote a shopping cart which obviously needs sessions to work.
It works perfectly fine on my development server .. but when I move it
to my production server it starts behaving strange. It works for some
client PCs and not so for others.

I tested with 2 servers and 2 clients.

Test Results
---
Client   Server   Result

PC   Development Server   OK
NoteBook Development Server   OK
PC   Production ServerPROBLEM
Notebook Production ServerOK
---

PC = Win 98, IE6/Opera7
Notebook = Win XP, IE 6
Devlopment Server = PHP 4.1.2
Production Server = PHP 4.3.5


Three out of four cases are working OK. And one is simply not working
and sessions keep getting reset on every page request. 
This kinda sounds as if its neither the server nor the client which is
the problem but some combination of the two which is the problem. The
combination which had the problem had it for IE 6 as well as Opera 7.


I asked my friends to test and 2 reported its OK and 1 reported the
same problem that I encountered.


The shopping cart code is written by me and is running on a couple of
other servers perfectly fine.

The production server is http://original-remote-control.co.uk
PHPinfo() page http://original-remote-control.co.uk/phpinfo.php

Any ideas on where to look would be highly appreciated.

Jas




__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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



[PHP] Re: Re: sessions getting destroyed for *Some* clients

2004-04-20 Thread Jaskirat Singh
I do not think it is the server name issue. I used
www.original-remote-control.co.uk for testing ..and I have done that
scores of times now :) ..

I do not use setcookie .. I just call session_start() in the beginning
to set the cookie for session.

Jas

--
Make sure it's not just a cookie-problem related to server name.  The
shopping 
cart session for "original-remote-control.co.uk" is different from the
shopping 
cart for "www.original-remote-control.co.uk".  If this is your problem,
I think 
you can fix it by changing how you call "setcookie".

Of course, this may not be the problem, in which case you can ignore
what I 
just said. :-)

cheers,

Travis






__
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash

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



[PHP] php training tips

2004-07-07 Thread Jaskirat Singh
Hello,
I am a PHP coder for the last 4 years doing mostly PHP MySQL stuff. Off
late I have been requested by a number of programmers and students to
teach PHP. I am wondering how different teaching is from coding and how
to design the contents of a 1-2 week training course. I am planning to
begin with a free of cost 1 hour per day class, but entry will be
restricted to keep it a small bunch of seriously interested people
only.

Any tips are welcome.

Jas

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



Re: [PHP] Get "nice" variables from POST

2004-03-12 Thread Jaskirat Singh
>if (is_array($_POST)) {
>  foreach($_POST as $name=>$value) {
>   ${$name} = $value;
> }
>}

or use this

if (is_array($_POST))
{
   extract($_POST);
}

Jaski

__
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com

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



[PHP] image files - upload and managment

2004-10-30 Thread Jaskirat Singh
Hi People,

I am writing a web app on LAMP.
The app is sort of yellow pages where people can login and post
advertisments with pictures.

App needs to allow users to upload pictures. (jpg and gif),
needs to create thumbnails of those pictures
and to store thumbnails and full pictures.

App needs to manage all those files - can be as much as 20K plus
images.

I think image file size, file type and image dimensions restrictions
should be easy to handle by using $_FILES array and  getimagesize
function.

The issues that I am thinking of and need suggestions about are

1) Storage and retrieval -  File system sounds like a better choice
over database. We are talking about 20 thousand plus pictures.

2) Thumbnails - Should I create those once and save it in a file when
the image is uploaded for the first time. Looks like a faster option
than creating them every time on the fly.

3) Security issues - I believe I must have a world writable "666"
permissions directory to keep images as users of the web app are
uploading them. Does that create any security holes in my application?

4) Any thing else related to image uploads that one might need to take
care of. Are there any tutorials on image upload issues.


Thanks and HAND.

Jas

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



[PHP] image uploads - part 2

2004-11-06 Thread Jaskirat Singh
Thanks  Robby Russell, Jason Wong , Greg Donald, raditha dissanayak and
every one else who answered part 1 of my email concerning image
uploads.

It was about where to store images uploaded by website users and
question was database vs filesystem and dedicated vs shared hosting 
and the conclusion I could understand was 

fast,secure,cheap pick any two 

1) database + shared = secure and cheap
2) filesystem + shared = fast and cheap
3) filesystem + dedicated = fast and secure
4) database + dedicated =  err.. stupid? ;)

For now I have decided to try option 1 and see how far I can go till
performance begins to become a limiting factor and then decide later if
I really need to, to choose between security and cost.

I have another question. I have used mysql mediumblob to store images.
They are jpeg files. When I retrieve that binary data with a query and
generate an image with PHP .. ie. I do



The image gets generated and displayed OK. But when I save that image
file on my work station it gets saved as a huge file .. a file which
was 36 Kb jpg when uploaded is saved as 5Mb bmp when downloaded.  The
data in mysql column is 36 Kb only. So why is it getting saved as such
a huge file and why bmp when header is 'image/jpeg'

thanks
Jas

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



[PHP] image uploads - part 2

2004-11-06 Thread Jaskirat Singh
Thanks  Robby Russell, Jason Wong , Greg Donald, raditha dissanayak and
every one else who answered part 1 of my email concerning image
uploads.

It was about where to store images uploaded by website users and
question was database vs filesystem and dedicated vs shared hosting 
and the conclusion I could understand was 

fast,secure,cheap pick any two 

1) database + shared = secure and cheap
2) filesystem + shared = fast and cheap
3) filesystem + dedicated = fast and secure
4) database + dedicated =  err.. stupid? ;)

For now I have decided to try option 1 and see how far I can go till
performance begins to become a limiting factor and then decide later if
I really need to, to choose between security and cost.

I have another question. I have used mysql mediumblob to store images.
They are jpeg files. When I retrieve that binary data with a query and
generate an image with PHP .. ie. I do



The image gets generated and displayed OK. But when I save that image
file on my work station it gets saved as a huge file .. a file which
was 36 Kb jpg when uploaded is saved as 5Mb bmp when downloaded.  The
data in mysql column is 36 Kb only. So why is it getting saved as such
a huge file and why bmp when header is 'image/jpeg'

thanks
Jas

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