[PHP] Re: [PHP-DB] Restaurant menu

2006-07-21 Thread kartikay malhotra

Hey Craig,

Place all items whatever way you want in a table. Its while presenting the
menu, you have the query the database like:

 $query = SELECT menu_id, menu_category, menu_item FROM $menu_name ORDER
BY $menu_item_attribute ASC;

You can choose multiple tables for menu_category, in which case you shall
have to pull out a custom menu by 'joining tables'.

Regrds
KM



On 7/22/06, Craig Hoffman [EMAIL PROTECTED] wrote:


Hey there,
I'm working on a menu system for a catering company.  I'm having a
difficult time sorting and grouping items together.  For example,
there may be three or four appetizers that should be group together.
But I only want to display the category (appetizers) once and then
the corresponding items (A, B, C,...). I'm drawing a blank on how to
go about this.

My DB consists of 4 tables (categories, items, item_attributes,
menu) but the menu table is most the important. The menu schema is
below.

menu_id
menu_name
menu_category = pulls from the categories table (appetizers,
starters, etc...)
menu_item = pulls from the items table (Cherry Pie)
menu_item_atttribute = pulls from the attribute table (Hot, cold, etc)

Example:
Menu Name: x
Appetizers
A
B
C
D

Desserts
A
B

I'm open to all suggestions / ideas.
Thanks
- Craig

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




Re: [PHP] login problem

2006-06-26 Thread kartikay malhotra

Dear SK,

alternately, close previously opened A/C and allow current one. this is
similar to wat yahoo messenger does and is a good safety measure.

1. If u use this technique, ur problem of shutdown would be solved.

2. Alternately, maintain sessions (using session ID) in PHP.

2a. Or just monitor user activity periodically. If no activity for x
minutes, log the user off. Keep an activity counter, and run a script in the
background, to reduce the counter ever y minutes. On activities like click,
mouse movement, page request, etc, increment the counter. Think semaphores
in Linux...

3. Try AJAX. You can keep sessions alive from server side. When no feedback
is received, log the user off.

KM
P.S. Pls send mails to the group rather than to me.


On 6/26/06, suresh kumar [EMAIL PROTECTED] wrote:


Tnxs for ur reply,i am very happy to receive response from u.I am storing
all the user account in my database.I am facing one problem.Suppose i am
setting a flag fot that login user.suddenly if there is any power shutdown
or user forgot to logout.then the flag always be set.In MySQL is there any
query is available for automatic update.I am waiting for ur reponse

A.suresh

*kartikay malhotra [EMAIL PROTECTED]* wrote:

strange problem, but very similar to links in linux.

you must be maintaining a database or a record file. u can maintain all
links ('users' as u put it) for a given user. if a user logs in through
any
of his accounts, check if he/she is logged in another A/C and stop this
one.
else, allow log-in and set a flag.

alternately, close previously opened A/C and allow current one. this is
similar to wat yahoo messenger does and is a good safety measure.

Q. why do you want to assign more than one A/C anyway? and if its an
invitation to someone else, then you MUST not stop that new person. he
would
be a valid subscriber, won't he?

No PHP here :(, guys would frown...


KM


On 6/24/06, suresh kumar wrote:

 Hi,
 I am facing one problem.i previously mailed ,but there is no
 response,its running out of time.i want to implement that logic as soon
as
 possible.This is my problem

 We are developing an online software for displaying ads
 in big mall.I want to restrict only one user can login to his own
account
 at that particular time.suppose users1 created a new user users2 for
 another user.If user1 login to the users2 account and at that same
 time i want to restrict user2  for log in to his account.i want at a
 time only one user can access his account.I am waiting reponse from u


 A.suresh


 -
 Yahoo! India Answers: Share what you know. Learn something new Click
here
 Catch all the FIFA World Cup 2006 action on Yahoo! India Click here


--
Yahoo! India Answers: Share what you know. Learn something new Click 
herehttp://us.rd.yahoo.com/mail/in/mailanswersshare/*http://in.answers.yahoo.com/
Catch all the FIFA World Cup 2006 action on Yahoo! India Click 
herehttp://us.rd.yahoo.com/mail/in/mailfifa/*http://in.sports.yahoo.com/football/football_fifa.html




Re: [PHP] login problem

2006-06-24 Thread kartikay malhotra

strange problem, but very similar to links in linux.

you must be maintaining a database or a record file. u can maintain all
links ('users' as u put it) for a given user. if a user logs in through any
of his accounts, check if he/she is logged in another A/C and stop this one.
else, allow log-in and set a flag.

alternately, close previously opened A/C and allow current one. this is
similar to wat yahoo messenger does and is a good safety measure.

Q. why do you want to assign more than one A/C anyway? and if its an
invitation to someone else, then you MUST not stop that new person. he would
be a valid subscriber, won't he?

No PHP here :(, guys would frown...


KM


On 6/24/06, suresh kumar [EMAIL PROTECTED] wrote:


Hi,
 I am facing one problem.i previously mailed ,but there is no
response,its running out of time.i want to implement that logic as soon as
possible.This is my problem

 We are developing an online software for  displaying ads
in big mall.I want to restrict only one user can login to his own account
at that particular time.suppose users1 created a new user users2 for
another user.If user1 login to the  users2 account  and at that same
time i want to restrict user2  for log in to his account.i want at a
time only one user can access his account.I am waiting reponse from u


A.suresh


-
Yahoo! India Answers: Share what you know. Learn something new Click here
Catch all the FIFA World Cup 2006 action on Yahoo! India Click here



[PHP] Mail in Spam Box

2006-06-18 Thread kartikay malhotra

Hi all!

I've use PHP mail to send mail to my Gmail ID. But it gets delivered to my
Spam box and not the Inbox :(

Am I missing a header, signature, certificate?

Thanks
KM


Re: [PHP] Re: Mail in Spam Box - its working now

2006-06-18 Thread kartikay malhotra

Hey!

Its working now. I replaced @mydomain with some valid mail address (gmail
address) and the mail was delivered to the Inbox. Feel free to use the code
if it helps. Attachments are allowed.

Also, it works without a subject (for gmail), but the mail address I used
now was genuine. Also genuine yahoo addresses are allowed, but not fake
ones. Pls tell me how does gmail know if the address from some remote domain
is genuine and not fake? After all, everything else is same.

Thanks Community
KM

On 6/19/06, Manuel Lemos  [EMAIL PROTECTED] wrote:


on 06/18/2006 12:29 PM kartikay malhotra said the following:
 I've use PHP mail to send mail to my Gmail ID. But it gets delivered to
my
 Spam box and not the Inbox :(

 Am I missing a header, signature, certificate?

Maybe if you show how you are composing the message you are sending we
can advise.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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




Fwd: [PHP] Re: Mail in Spam Box - my code

2006-06-18 Thread kartikay malhotra

Oops, sent this previous mail to Manuel instead of the group... :)

Hi All!

Sure, here is what I've:


?php

 $uploaddir='/tmp/';
 $account_file = account.txt; //Substitute with a valid file on ur system
 $account_file = $uploaddir.basename($account_file);

 $file = fopen($account_file,'rb');
 $data = fread($file,filesize($account_file));
 fclose($file);

//  echo $data;

 $to =  [EMAIL PROTECTED];
 $from = [EMAIL PROTECTED];
 $message = Hi! Where are you these days?;

 $headers = From: $from;


// Generate a boundary string
 $semi_rand = md5(time());
 $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

// Add the headers for a file attachment
 $headers .= \nMIME-Version: 1.0\n .
Content-Type: multipart/mixed;\n .
 boundary=\{$mime_boundary}\;



// Add a multipart boundary above the plain message
 $message = This is a multi-part message in MIME format.\n\n .
   --{$mime_boundary}\n .
   Content-Type: text/plain; charset=\iso-8859-1\\n .
   Content-Transfer-Encoding: 7bit\n\n .
$message . \n\n;

// Base64 encode the file data
 $data = chunk_split(base64_encode($data));


$fileatt_type=text/plain;
$fileatt_name=Hola;

// Add file attachment to the message
 $message .= --{$mime_boundary}\n .
Content-Type: {$fileatt_type};\n .
 name=\{$fileatt_name}\\n .
Content-Disposition: attachment;\n .
 filename=\{$fileatt_name}\\n .
Content-Transfer-Encoding: base64\n\n .
$data . \n\n .
--{$mime_boundary}--\n;

// echo $message;

// Send the message

$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo pMail sent Successfully/p;
} else {
echo pMail send failed/p;
}



?

Thanks  Regards
KM

On 6/19/06, Manuel Lemos [EMAIL PROTECTED] wrote:


on 06/18/2006 12:29 PM kartikay malhotra said the following:
 I've use PHP mail to send mail to my Gmail ID. But it gets delivered to
my
 Spam box and not the Inbox :(

 Am I missing a header, signature, certificate?

Maybe if you show how you are composing the message you are sending we
can advise.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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




Fwd: [PHP] Automatic email sending

2006-06-16 Thread kartikay malhotra

u can use PHP as an offline scripting language. it gives u the power of PHP
without the web interface. see tutorial on that. make a PHP and run it in
the background by appending .

Or add it to  /etc/rc.d/rc.local/ and run it automatically from system
startup onwards

KM


On 6/16/06, Murtaza Chang [EMAIL PROTECTED] wrote:


Hi everyone, my website need to automatically send an email to people
when thier account is about to expire, but iam not sure how to do it.
In other words its easy to put a check if an account is about to
expire and send automatic email when admin logs in to system, but how
is it possible to do it in background.


--
Murtaza Chang
http://dirtinme.blogspot.com/
A Place to throw personal trash

http://milddreamerz.blogspot.com
For Photoshopers And Digital Art Enthusiasts

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




Re: [PHP] File downloads

2006-06-08 Thread kartikay malhotra

Thanks to Tedd, Barry, George and others for help over download file
problem.

I'm going to receive an ACK if the file downloads correctly. In absence of
such an ACK, a script would quitely remove the temporary files after a fixed
interval of time. Temporary files have unique filenames.


New problem:
Is there a way for the server to notify the client that a new file has
become available for download, provided the client was online in the past X
minutes?

This could be done if

1. The client queries the server after a set interval of time. I DO NOT WANT
THIS FOR SOME SILLY REASON.

2. The connection is kept alive (?). With my current knowledge of PHP, I am
not able to manage this.
Cookies or sessions? Can't find a related example directly dealing with this
issue.

All wild ideas/links/examples are welcome.

What changes would be required in Apache conf file (if any)?

Thanks  Regards
KM






On 6/7/06, tedd [EMAIL PROTECTED] wrote:


At 8:42 AM + 6/7/06, kartikay malhotra wrote:
Dear All,

I have a HTTP server + MySQL database. Everytime a file is requested for
download, my PHP script loads the content from the database into a
temporary
file (on the server). I then pass a URL to the client, with a link to
this
file. The client can thus download the file at any time.

However, I can foresee many problems with this approach. One is, when to
delete the temporary file? Also with more than one client, this approach
would have to be refined. Security is also an issue: One user may read
another's files.

Can anyone kindly give me an alternative approach?

I reiterate, I cannot supply static URLs as the downloadable file is
generated on-demand.

Thanks  Regards
KM

KM:

Thinking off the top of my head (not always the best for me) -- why not
give the user a static url AND a key?

The static url would have a php program sitting there waiting for a user
to come along and provide the correct key. After which, your program would
then create the file (in a random named folder); provide the user with a
link; and clean-up after he's done.

That way you have the control over what's happening. The key approach
handles security and when to clean-up.

hth's

tedd
--


http://sperling.com  http://ancientstones.com  http://earthstones.com

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




[PHP] server sending notifications to clients

2006-06-08 Thread kartikay malhotra

Hi All,

Is there a way for the server to notify the client about an event, provided
the client was online in the past X minutes?

To elaborate:

A client comes online. A script PHP executes (serves the client), and
terminates. Now if a new event occurs, how can the server notify the client
about that event?

Thanks
KM


Re: [PHP] server sending notifications to clients

2006-06-08 Thread kartikay malhotra

Dear Adam,


You can do it without polling. I've seen web applications that open a
neverending GET request in order to get updates to the browser
instantaneously.

Regards, Adam.

Kindly elaborate on neverending GET request. Shall I call the script from
within itself?

Regards
KM

On 6/8/06, Adam Zey [EMAIL PROTECTED] wrote:


Barry wrote:
 Angelo Zanetti schrieb:
 kartikay malhotra wrote:
 Hi All,

 Is there a way for the server to notify the client about an event,
 provided
 the client was online in the past X minutes?

 To elaborate:

 A client comes online. A script PHP executes (serves the client), and
 terminates. Now if a new event occurs, how can the server notify the
 client
 about that event?

 Thanks
 KM



 what kind of event??

 Server bored and fooling around with the neighbor servers hardware :P

 But Ajax would be the best method using.

 Anyway else isn't possible (well refreshing would be one way)

 But since you don't want php files to execute forever you will have to
 stick to AJAX.


You can do it without polling. I've seen web applications that open a
neverending GET request in order to get updates to the browser
instantaneously.

Regards, Adam.

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




[PHP] File downloads

2006-06-07 Thread kartikay malhotra

Dear All,

I have a HTTP server + MySQL database. Everytime a file is requested for
download, my PHP script loads the content from the database into a temporary
file (on the server). I then pass a URL to the client, with a link to this
file. The client can thus download the file at any time.

However, I can foresee many problems with this approach. One is, when to
delete the temporary file? Also with more than one client, this approach
would have to be refined. Security is also an issue: One user may read
another's files.

Can anyone kindly give me an alternative approach?

I reiterate, I cannot supply static URLs as the downloadable file is
generated on-demand.

Thanks  Regards
KM


[PHP] HTTP HEADERS

2006-06-02 Thread kartikay malhotra

Hi all!

I use HTTP POST to upload a file. I've a PHP script running on the server.
Are HTTP headers passed with this request? How can I see the headers passed
to the server?

Thanks
KM


Re: [PHP] $_FILES doesn't work but $_POST works

2006-05-31 Thread kartikay malhotra

Thanks for your replies.

1. Did you put the enctype=multipart/form-data into the FORM tag?
Ans: I do not have a form! I'm using a gateway utility to upload files


From documentation of Mbuni MMS gateway:


post-url
Response content is obtained as result of sending a HTTP POST request to the
provided URL. The POST message is *always* encoding (such as that used by a
web browser when an HTML form has the submitted using the
multipart/form-dataenctype=multipart/form-data parameter set). If
http-post-parameters field is given (see below), then the relevant
parameters are sent as part of the request. *X-Mbuni* headers are sent as
well.


http-post-parameters
Used in conjunction with post-url. Parameters are provided in the same way
as would be provided in an HTTP GET request (e.g. *
message=truemyname=testimage=%i*).

2.  Have you tried simply saving $_POST['userfile'] to a file?

$save = $_POST['userfile'];
$f=fopen($out,'a');
copy($save, $out);


Nothing is copied. Opened file is empty.

Pls suggest
KM

On 5/31/06, Rabin Vincent [EMAIL PROTECTED] wrote:


On 5/31/06, kartikay malhotra [EMAIL PROTECTED] wrote:
 However, with Mbuni MMS Gateway (which provides HTTP POST),  the above
 condition in if loop isn't satisfied. I think $_FILES isn't working.
However
 the following code works:

 ?php

 $in='/usr/share/wallpapers/alien-night.jpg';
 $out='/tmp/alien.jpg';

 if(isset($_POST['userfile'])/* || $_FILES['userfile']['size']  0*/ )
 {

 $f=fopen($out,'a');
 echo HEL;
 copy($in, $out);
 }

 ?

 This implies, $_POST works, and a file has been uploaded. I  however, do
not
 know how to access it

Have you tried simply saving $_POST['userfile'] to a file?

Rabin



[PHP] $_FILES doesn't work but $_POST works

2006-05-30 Thread kartikay malhotra

Hi All,

I'm using Mbuni MMS gateway, which provides me the facility to upload .mms
files.

Now with my little exposure to PHP, to upload files (say from the browser),
I use $_POST, namely:

if($_FILES['userfile']['size']  0)
{
 $fileName = $_FILES['userfile']['name'];
 $tmpName  = $_FILES['userfile']['tmp_name'];
...
...
}

However, with Mbuni MMS Gateway (which provides HTTP POST),  the above
condition in if loop isn't satisfied. I think $_FILES isn't working. However
the following code works:

?php

$in='/usr/share/wallpapers/alien-night.jpg';
$out='/tmp/alien.jpg';

if(isset($_POST['userfile'])/* || $_FILES['userfile']['size']  0*/ )
{

$f=fopen($out,'a');
echo HEL;
copy($in, $out);
}

?

This implies, $_POST works, and a file has been uploaded. I  however, do not
know how to access it

How to access the uploaded file, determine its size and save its contents in
a database?


Thanks in advance
KM


[PHP] MMS Gateway + PHP

2006-05-29 Thread kartikay malhotra

Hi All,

I've a typical problem. I'm using Mbuni MMS gateway. This gateaway provides
a method of forwarding an incoming MMS file to a HTTP Server, where it could
be uploaded.

I run a PHP script on the server, to dump the MMS into a database.

Now I do not have a typical HTML form to upload the MMS. Only 2 fields in
the configuration file :

post-url = http://localhost/one.php/
http-post-parameters = userfile=%z

where %z signifies all parts of the MM.

I'm used to seeing PHP code for uploading files which resembles:

if($_FILES['userfile']['size']  0 )
{
 $fileName = $_FILES['userfile']['name'];

}

Unfortunately, the condition $_FILES['userfile']['size'] is never satisfied.
Can anyone help me determine that my file is properly reaching the HTTP
server in the first place?


If the problem statement isn't clear, all fault is mine :)

Thanx
KM