[PHP] DB / Tables Question

2003-12-04 Thread Pushpinder Singh Garcha
Hello everyone,

   I have created a PHP and MySQL powered, web-based CRM package 
for our office. It simply takes care of our telephone marketing 
strategy. I need to provide this CRM package to our other clients as 
well. The CRM package makes use of 2 tables i.e. 'Admin' and 'Contacts' 
. The table 'Admin' stores the usernames and passwords of the people 
who are allowed to use the system. The other table 'Contacts' contains 
details of the contacts like name, email,city,state, tel,zip etc.

I want to be able to create a similar CRM package for other clients. My 
question is  should I create a separate DB for each client.
or is it a better design practice to create 2 tables (Admin and 
Contacts) per client within the same DB.  I am not sure if I have been 
able to clearly express my doubts here, but I will be more that happy 
to address any questions.

Thanks in advance
Pushpinder 

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


Re: [PHP] Display a JPG Image (continued)

2003-10-14 Thread Pushpinder Singh Garcha
Hello all again,

  I am still having trouble opening a jpg image using

header(Content-type: image/jpg);
$file = docs/picture1.jpg;
header(Content-disposition: attachment; filename=$file );
readfile($file);
The reason being that IE on the win platform does not seem to recognize 
the file extension. Mozilla on the Win and Mac Platform behave 
properly. Someone, suggested that just using image/jpeg. Even that duz 
not werk for me.
Suggestion welcome. Thanks in advance.

Pushpinder



On Friday, October 10, 2003, at 01:25 PM, Jon Shoberg wrote:

On Fri, 10 Oct 2003, Bertrand Moulard wrote:

try image/jpeg

cheers

.b


--
http://jon.shoberg.net
--
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] Display a JPG Image

2003-10-10 Thread Pushpinder Singh Garcha
Hello Everyone,

  I am trying to display a JPG image to a use, who has logged in. Some 
research on google revealed a way to do this. I am using the following 
code to display it.

if (session_is_registered(valid_user)){

   if(session_is_registered(cmi)){

header(Content-type: image/jpg);
$file = docs/picture1.jpg;
header(Content-disposition: attachment; filename=$file );
readfile($file);
} 

My question is that while this approach works fine with Mozilla on the 
MAC and Win platform. it throws up a dialog box asking whether the user 
wants to download  the file or view it. However IE on either platforms 
does not work fine. On the PC it does not recognize the file extension 
correctly. While on the MAC side of things, it just shows the image in 
the same frame.

Any suggestions would be most welcome. !

Thanks in advance
Pushpinder Singh


[PHP] Read a PDF File using php

2003-10-01 Thread Pushpinder Singh Garcha
Hello All

I need to allow a user to access a PDF file, only if he/she is logged 
in as a registered user. So here is the code that I am trying to use. I 
have been able to make this work in the past, when I had to read .html 
file, now since the file in question is a .pdf file, I am having 
trouble. The browser shows a long list of weird characters instead of 
the pdf file

if(session_is_registered(user_valid)){

$filepath =docs/any_file.pdf;
 $h1 = @fopen($filepath,r);
  
  while (!feof($h1)) {
$a = fread($h1,4096);
echo $a;
}
    }
Any ideas / suggestions would be welcome. Thanks in advance

Pushpinder




Re: [PHP] Read a PDF File using php

2003-10-01 Thread Pushpinder Singh Garcha
No I am not sending any headers to the browser. Any suggestions !

Thanks

On Wednesday, October 1, 2003, at 04:05 PM, Tyler Lane wrote:

Are you sending a Content-Type header to the browser to let it know 
what
type of file you are sending it?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Form variables lost when duplicate records are found !

2003-09-02 Thread Pushpinder Singh Garcha
Hello everyone,

 I am making use of a php form to add company details to a MySQL 
Database. Before I add the form variables I am checking to see if the 
SAME company name exists in the DB. If the same company exists, then a 
notification is provided. In between this , the variables that were 
entered on the form are LOST. Is there anyway I can store the variables 
so that if a duplicate record was found to be present, then the forms 
variables are stored and  NOT LOST ??

Any suggestions would be greatly appreciated !  Thanks in advance

--Pushpinder

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


Re: [PHP] Form variables lost when duplicate records are found !

2003-09-02 Thread Pushpinder Singh Garcha
I am currently using sessions on my site // are you suggesting that I 
store all the possible 30 form variables in a temp session array. ?? 
and destroy it afterwards

Thanks
-Pushpinder
On Tuesday, September 2, 2003, at 04:41 PM, Matt Matijevich wrote:

[snip]
then the forms
variables are stored and  NOT LOST ??
[/snip]
Have you looked into sessions?

http://www.php.net/manual/en/ref.session.php

--
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] '' Sign in _GET Parameter

2003-08-22 Thread Pushpinder Singh Garcha
Hello All,

 I am using an application where I retrieve user profile from a MySQL 
DB using the Company Name .  I pass the name of the company to the PHP 
script as a '$_GET' parameter. e.g. when the name of the company is 
'IBM'. , the URL with the query string would look like :
http://masterstream.com/CRM/full_profile_1.php?name=IBM

Now one of the records had a name : PSG  Inc. , in this case the URL 
with the query string would look like
http://masterstream.com/CRM/full_profile_1.php?name=PSG%20%20Inc.

However in the case of the latter I am not able to pull out any records 
from the MySQL database. It says that no records with the name were 
found.   I went ahead and tweaked the name of the company, to remove 
the  sign in 'PSG  Inc.'   Now the query works fine.  Can some one 
throw some light here. I am sure something minor is to be done when 
passing the name of the company in the parent script.

Thanks in advance
--Pushpinder



Re: [PHP] '' Sign in _GET Parameter

2003-08-22 Thread Pushpinder Singh Garcha
Thanks for the link,

$link = $row['company'];
a href=\full_profile_1.php?name=', urlencode($link),' \
However this does not seem to work / what am I missing ?

Thanks
-Pushpinder


On Friday, August 22, 2003, at 03:23 PM, CPT John W. Holmes wrote:

From: Pushpinder Singh Garcha [EMAIL PROTECTED]

  I am using an application where I retrieve user profile from a MySQL
DB using the Company Name .  I pass the name of the company to the PHP
script as a '$_GET' parameter. e.g. when the name of the company is
'IBM'. , the URL with the query string would look like :
http://masterstream.com/CRM/full_profile_1.php?name=IBM
Now one of the records had a name : PSG  Inc. , in this case the URL
with the query string would look like
http://masterstream.com/CRM/full_profile_1.php?name=PSG%20%20Inc.
However in the case of the latter I am not able to pull out any 
records
from the MySQL database. It says that no records with the name were
found.   I went ahead and tweaked the name of the company, to remove
the  sign in 'PSG  Inc.'   Now the query works fine.  Can some one
throw some light here. I am sure something minor is to be done when
passing the name of the company in the parent script.
The  character separates variables in the query string, so it must be
encoded if it appears in the data. Take a look at
http://us2.php.net/urlencode
---John Holmes...

--
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


Re: [PHP] Display variable with spaces -SOLVED

2003-08-14 Thread Pushpinder Singh Garcha
Thank you so much ! it works fine now ;)

--Pushpinder

On Wednesday, August 13, 2003, at 12:01 PM, Larry E. Ullman wrote:

And I try to display it in the table using this :
 input name=email_1 type=text id=email_1 size=50 value = ? 
echo $email_1; ?

if I try to echo the variable $email_1, I get the correct value i.e. 
thisisa long e-mail address
/// However when it comes to displaying it using the table all I get 
is the thisisa . It simply avoids the spaces. Can anyone tell me 
why this is happening..?? I am sure it is something pretty minor  
but I just cant seem to get it right.
You need to quote your value attribute.

Larry

--
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] Display variable with spaces

2003-08-14 Thread Pushpinder Singh Garcha
Hello,

  I am trying to display the rows of a MySql Query in a table.  I 
retrieve the result using the query :

while ($row = mysql_fetch_array($result1, MYSQL_ASSOC))
{
$email_1 =  $row[email_1];
}
And I try to display it in the table using this :
 input name=email_1 type=text id=email_1 size=50 value = ? 
echo $email_1; ?

if I try to echo the variable $email_1, I get the correct value i.e. 
thisisa long e-mail address
/// However when it comes to displaying it using the table all I get is 
the thisisa . It simply avoids the spaces. Can anyone tell me why 
this is happening..?? I am sure it is something pretty minor  but I 
just cant seem to get it right.

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


[PHP] Passing Values between Pages : $_SESSION / $_GET

2003-08-14 Thread Pushpinder Singh Garcha
Hello All,

 I am using php and mysql in my application which allows users to  
search/query a database. The database is cast and has about 32 rows per  
record. When the user fires the query, the result is in the form of a  
table that contains only the 6 important rows of the entire record.  
Also there is a provision to allow the user to see the full record set  
by clicking on the link under the 'complete profile' contained in the  
table. (as shown below). The name of this script is lookup_results.php

Here is the result for a companies in city = 'Charlotte' / Primary key  
of the table is the name of the company.
 
 
---
Company Name Main ContactCity Website
  E-Mail  Complete  
Profile
 
 
---
PSG   Pushpy  Charlotte  
http://www.psg.com[EMAIL PROTECTED]--Link--
TFNA Napier   Charlotte  
http://www.psg.com[EMAIL PROTECTED]--Link--
Micro Bates Charlotte   
http://www.psg.com   [EMAIL PROTECTED]--Link--
CNN  Garcha PSCharlotte   
http://www.psg.com   [EMAIL PROTECTED]--Link--
 
 
---

To see the complete profile of the company I use  
href=\full_profile_1.php?name=.$row['company'].
So once we are on the full_profile_1.php, we can see all the contents  
of the record. Also we display a form where we can edit the results in  
place. The logic works like this.

// full_profile_1.php LOGIC

?

session_start();

if (isset($_SESSION['validuser']))
  {
if($submit)
  {
   update the changes that the user has made to the form
  My question here is   How do I get the name of the company  
that was passed to this script as a $_GET Parameter. I cannot use the
  $company because it is out of scope. The only other option  
would be to use $_SESSION['link']  i.e. Store the names of the
  companies in a  session array. So now the array as per the  
example above would be {'PSG','TFNA', 'Micro', 'CNN' } . The way this
  will work is how do I get the index of the 'link' array that  
is applicable in this example.

   Here the name of the company would be $company  =  
$_SESSION['link'][0];
   If we had clicked the second row of the results table the  
name of the compnay would have been 'TFNA' i.e. $_SESSION['link'][1]
   and so on. How do I pass the index. ???



  }

   else
  {
  $company = $_GET['name'];
  USE  form name=form1 method=post  
action=full_profile_1.php
 ANDdisplay all the rows of the record where company_name  
='company'

 }

  }

else {
 redirect the user to the ERROR Page
}
// end of pseudo- code

Thanks in advance guys. I know this may sound a lil' vague , but I have  
tried to present the logic and the problem.



Re: [PHP] Passing Values between Pages : $_SESSION / $_GET

2003-08-14 Thread Pushpinder Singh Garcha
Thank you Jay for responding.

Let me clarify  again. The $_GET Parameter was used to to transfer the 
name from the results page (with the tables etc) to a 
full-profile_1.php page.  On the full_profile_1.php page the user is 
displayed a form with all the details about the company. On the same 
page there is a form where changes can be made to values of the fields. 
I am trying to pass the company name in this form as a POST Parameter. 
However the Update part of the full_profile.php page is not able to get 
this value.

The main point to remember is that full_profile_1.php does 2 things :
1.)  Display all the fields of the company as a form which is editable
2.)  Now if the user were to make changes in the values that were 
returned in the form above , the changes should be updated in the
   record. Now my problem is trying to transfer the name of the 
company from the 'form'  to the update query.

The way the logic on the full_profile_1.php is designed is as 
follows:

  if ($submit)
{
//   This is after the user has been displayed all the fields of 
the record and he has made some changes and wanst to Update them
//  The Problem is how do I get the same name of the company in 
this loop. I have tried to pass the name as another $_POST Variable
 from the Form in the else part below, but when I try to access 
it over here. nothing comes.
$temp1 = $_POST['temp'];  // RETURNS EMPTY
   :(
}

else{

  //  here we get the name of the company as a $_GET Parameter from the 
previous page
  // display all the records of the selected company as a editable Form
   form name=form1 method=POST 
action=full_profile_1.php?temp=$row['company']

}



Thanks again, and have a great weekend !

--Pushpinder

On Friday, August 8, 2003, at 04:20 PM, Jay Blanchard wrote:

[snip]
My question here is   How do I get the name of the company  that was
passed to this script as a $_GET Parameter. I cannot use the $company
because it is out of scope.
[/snip]
How about $_GET['company'] ? Or am I missing something?

Have a pleasant day.



Re: [PHP] Passing Values between Pages : $_SESSION / $_GET

2003-08-09 Thread Pushpinder Singh Garcha
Hello again,

I would appreciate if someone could help me out with this one.

Thanks again

--Pushpinder



On Friday, August 8, 2003, at 11:46 AM, Pushpinder Singh Garcha wrote:

Hello All,

 I am using php and mysql in my application which allows users to  
search/query a database. The database is cast and has about 32 rows  
per record. When the user fires the query, the result is in the form  
of a table that contains only the 6 important rows of the entire  
record. Also there is a provision to allow the user to see the full  
record set by clicking on the link under the 'complete profile'  
contained in the table. (as shown below). The name of this script is  
lookup_results.php

Here is the result for a companies in city = 'Charlotte' / Primary key  
of the table is the name of the company.
--- 
--- 
-
Company Name Main ContactCity Website   
   E-Mail  Complete  
Profile
--- 
--- 
-
PSG   Pushpy  Charlotte  
http://www.psg.com[EMAIL PROTECTED]--Link--
TFNA Napier   Charlotte  
http://www.psg.com[EMAIL PROTECTED]--Link--
Micro Bates Charlotte   
http://www.psg.com   [EMAIL PROTECTED]--Link--
CNN  Garcha PSCharlotte   
http://www.psg.com   [EMAIL PROTECTED]--Link--
--- 
--- 
-

To see the complete profile of the company I use  
href=\full_profile_1.php?name=.$row['company'].
So once we are on the full_profile_1.php, we can see all the contents  
of the record. Also we display a form where we can edit the results in  
place. The logic works like this.

// full_profile_1.php LOGIC

?

session_start();

if (isset($_SESSION['validuser']))
  {
if($submit)
  {
   update the changes that the user has made to the form
  My question here is   How do I get the name of the company  
that was passed to this script as a $_GET Parameter. I cannot use the
  $company because it is out of scope. The only other option  
would be to use $_SESSION['link']  i.e. Store the names of the
  companies in a  session array. So now the array as per the  
example above would be {'PSG','TFNA', 'Micro', 'CNN' } . The way this
  will work is how do I get the index of the 'link' array that  
is applicable in this example.

   Here the name of the company would be $company  =  
$_SESSION['link'][0];
   If we had clicked the second row of the results table the  
name of the compnay would have been 'TFNA' i.e. $_SESSION['link'][1]
   and so on. How do I pass the index. ???



  }

   else
  {
  $company = $_GET['name'];
  USE  form name=form1 method=post  
action=full_profile_1.php
 ANDdisplay all the rows of the record where company_name  
='company'

 }

  }

else {
 redirect the user to the ERROR Page
}
// end of pseudo- code

Thanks in advance guys. I know this may sound a lil' vague , but I  
have tried to present the logic and the problem.



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


Re: [PHP] Passing Values between Pages : $_SESSION / $_GET

2003-08-09 Thread Pushpinder Singh Garcha
Hello Jay ,

I am attaching snippet of the Form Code that displays the results of 
the first query

meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head
? echo Hello   ::: .$company.br;  ?
body bgcolor=aa leftmargin=14 topmargin=10
form name=form1 method=POST 
action=full_profile_1.php?temp=$company
  table width=780 border=1 align=center cellpadding=2 
cellspacing=2
tr
  td width=778 height=1007 table width=775 height=1151 
cellpadding=1 cellspacing=2 bordercolor=#FF bgcolor=#FF
  tr bgcolor=#3300CC
td height=29 colspan=2 div align=centerfont 
color=#FF size=2 face=Verdana, Arial, Helvetica, 
sans-serifstrongComplete
Candidate Profilebr
br
/strong/font
table width=770 height=27
  tr
td width=385font color=#FF size=1 
face=Verdana, Arial, Helvetica, sans-serif? echo 
$_SESSION['validuser']; ?/font/td
td width=385div align=rightfont 
color=#FF size=1 face=Verdana, Arial, Helvetica, 
sans-serifstronga 
href=logout.phpLogout/a/strong/font/div/td
  /tr
/table
font color=#FF size=2 face=Verdana, Arial, 
Helvetica, sans-serifstrongbr
/strong/font/div/td
  /tr
  tr
td width=149 height=28 bgcolor=99ccffstrongfont 
color=#66 size=1 face=Verdana, Arial, Helvetica, 
sans-serifCompany
  Name/font/strong/td
td width=614 bgcolor=#E7E7E7font size=2 
color=#552233 face=Verdana, Arial, Helvetica, sans-serifstrong? 
echo $company; ?/strong
  input name=company type=hidden id=company3  
size=40  value= ? echo $company; ? 
  /font/td
  /tr
  tr 

// END OF SNIPPET

However when I try to access it in the if($submit) part as 
$_POST['temp'] I get nothing !!!

Thanks in advance,

--Pushpinder



On Friday, August 8, 2003, at 04:57 PM, Jay Blanchard wrote:

[snip]
Let me clarify  again. The $_GET Parameter was used to to transfer the
name from the results page (with the tables etc) to a
full-profile_1.php page.  On the full_profile_1.php page the user is
displayed a form with all the details about the company. On the same
page there is a form where changes can be made to values of the fields.
I am trying to pass the company name in this form as a POST Parameter.
However the Update part of the full_profile.php page is not able to get
this value.
[/snip]
Clearer now.

Place the value in a hidden form field that can be passed along with 
the
POST



[PHP] _GET question

2003-08-01 Thread Pushpinder Singh Garcha
Hello All,

   My application has a search / query feature where in the user 
selects the search criteria and is displayed a page containing the 
reults. The user must also be allowed to edit these results and save 
them later on. On the results page I use the following logic,

//
// START OF PSEUDOCODE
//
?
session_start()
if ($submit)
  {
 yada yada yada
   Update the database with the changes the user has made in the form

$value = $_GET['val'];
echo : .$value.br;
   $UpdateString = UPDATE contacts SET

   ... 

.

where WHERE `company`  = '$value' ;

  }

elseif (isset(_SESSION['validuser'])) {

display the form with the results of the search
form name=form1 method=post 
action=full_profile_1.php?val=$company
...
...
...
...
/form

}

elseif ( ! isset(_SESSION['validuser'])) {

   // display an error page asking the user to login

}

//
//END OF PSEUDOCODE
//
Can some one tell me if the action parameter of the form is correct ? 
Since in the first part of the if() statement when I try to retrieve 
the value of $_GET['val'] I do not get anything.

All suggestions are welcome. Thanks in advance

--Pushpinder





[PHP] Array Question

2003-07-28 Thread Pushpinder Singh Garcha
hello everyone,

 I am trying to store one of the fields of the resultset into an array  
as I display the results.

  while ($row = mysql_fetch_array($result1)) {

// Alternate the bgcolor of each row for visibility
($even % 2) == 0 ? $bgcolor = #EFEFEF : $bgcolor =  
#ee;
$even = $even + 1;

// print the actual row
   echo   TR BGCOLOR=$bgcolor
  TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[company]/font/TD
  TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[name_1]/font/TD
  TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[phone_1]/font/TD
 TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[city]/font/TD
 TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[url]/font/TD
  TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[email_1]/font/TD
 TD align=\center\font color=\#33\ size=\1\  
face=\Verdana, Arial, Helvetica, sans-serif\a  
href=\full-profile.php?name=.$row['company'].\--Link--/a/ 
font/TD
  /TR;
	
		// try to store the name of the company in an array called companyname
	
$companyname = array($row['company']);

		 // try to register the variable
		
		 $_SESSION['link'] = $companyname;
		   //$_SESSION['link'] = $row[company];

} // end while



I am trying to store the variable $row['company'] into a array called  
companyname[], so that I am able to register it as a session variable  
and use it on subsequent pages. I keep getting errors and am not able  
to store the values in array $row['company'] . I would appreciate if  
someone could throw some light on this.

Thanks in advance.
--Pushpinder


[PHP] Store array as Session Variable

2003-07-28 Thread Pushpinder Singh Garcha
hello All,

 I am trying to store an array as a session variable.

   while ($row = mysql_fetch_array($result))
{
	if ( !is_array($company_name) ) $company_name = array();	  
  array_push($company_name, $row['company']);

   // try to register session variable
$_SESSION['link'] = $company_name;
}

Now when I try to access this session variable in another file...I am 
getting a junk value.I am not sure if I am getting this right.

$details = $_SESSION['link'];
 echo LINK: .$details.br;
Can some one fill me in on this. Appreciate it !  Thanks in advance.

--Pushpinder Singh

Re: [PHP] Store array as Session Variable

2003-07-28 Thread Pushpinder Singh Garcha
$details is empty !!

Thanks
--Pushpinder
On Monday, July 28, 2003, at 03:31 PM, CPT John W. Holmes wrote:

$details is an array (just like $company_name was). Try to view
print_r($details); and see what you get.
---John Holmes...

- Original Message -
From: Pushpinder Singh Garcha [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, July 28, 2003 3:18 PM
Subject: [PHP] Store array as Session Variable
hello All,

  I am trying to store an array as a session variable.

while ($row = mysql_fetch_array($result))
{
if ( !is_array($company_name) ) $company_name = array();
   array_push($company_name, $row['company']);
// try to register session variable
 $_SESSION['link'] = $company_name;
}

Now when I try to access this session variable in another file...I am
getting a junk value.I am not sure if I am getting this right.
$details = $_SESSION['link'];
  echo LINK: .$details.br;
Can some one fill me in on this. Appreciate it !  Thanks in advance.

--Pushpinder Singh



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


Re: [PHP] Store array as Session Variable

2003-07-28 Thread Pushpinder Singh Garcha
Thanks Chris,

I am able to see the contents of the $company_name array. The next  
part involves storing this as a session variable.

I am trying to link this page to another search page using the  a  
href=\full-profile.php?name=.$row['company']. \--Link--/a

while ($row = mysql_fetch_assoc($result))
{
TR BGCOLOR=$bgcolor
 TD align=\left\font color=\#66\ size=\1\  
face=\Verdana, Arial, Helvetica,  
sans-serif\$row[company]/font/TD
  TD align=\left\font color=\#66\ size=\1\  
face=\Verdana, Arial, Helvetica,  sans-serif\$row[name_1]/font/TD
   TD align=\left\font color=\#66\ size=\1\  
face=\Verdana, Arial, Helvetica,  
sans-serif\$row[phone_1]/font/TD
	TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[city]/font/TD
	TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[url]/font/TD
	TD align=\left\font color=\#66\ size=\1\ face=\Verdana,  
Arial, Helvetica, sans-serif\$row[email_1]/font/TD
   TD align=\center\font color=\#33\ size=\1\  
face=\Verdana, Arial, Helvetica, sans-serif\a  
href=\full-profile.php?name=.$row['company'].\--Link--/a/ 
font/TD	/TR;

$company_name[] = $row['company'];
 // try to register the variable
$_SESSION['link'] = $company_name;
}


  What would be the best way to register the array $company_name as a  
session var and access it on the following page. $_SESSION['link'] =  
$company_name;
does not seem to work since it gives NULL when i try to echo  
$_SESSION['link'];

Thanks in advance
--Pushpinder


On Monday, July 28, 2003, at 03:43 PM, Chris Shiflett wrote:

--- Pushpinder Singh Garcha [EMAIL PROTECTED] wrote:
I am trying to store the value in row['company'] in an array
called $company_name.
I see now. I think you might find this a bit simpler (if I understand
correctly):
$company_name = array();
while ($row = mysql_fetch_assoc($result))
{
 $company_name[] = $row['company'];
}
Also, at this point, you should probably examine the contents of  
$company_name
before bothering with the session stuff. You may be having trouble  
with your
query or something that is totally unrelated to sessions. Try John's  
suggestion
of print_r() by doing something like this:

echo 'pre';
print_r($company_name);
echo '/pre';
Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/


Re: [PHP] Store array as Session Variable

2003-07-28 Thread Pushpinder Singh Garcha
Thanks John,

  I used the $_GET['name'] on the next page to access the 
selection.

http://psg.local/~psgarcha/CRM/full-profile.php?name=jack
http://psg.local/~psgarcha/CRM/full-profile.php?name=tim
http://psg.local/~psgarcha/CRM/full-profile.php?name=mary
http://psg.local/~psgarcha/CRM/full-profile.php?name=evian
My full-profile.php page first checks for a session before displaying 
the results.

However if I decided to use the sessions approach how would I go about 
it ? I am just curious to find out why $_SESSION['company_name'] = 
$company_name; duz not werk for me !

Thanks in advance
--Pushpinder




On Monday, July 28, 2003, at 04:14 PM, CPT John W. Holmes wrote:

 I am able to see the contents of the $company_name array. The 
next
part involves storing this as a session variable.

I am trying to link this page to another search page using the  a
href=\full-profile.php?name=.$row['company']. \--Link--/a
If you're passing the company name in the URL, why are you adding the 
entire
array to the session? You can just use $_GET['name'] to get the name 
of the
company that was clicked on...

---John Holmes...

--
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


Re: [PHP] Store array as Session Variable

2003-07-28 Thread Pushpinder Singh Garcha
Hello Chris,

  I am using session_start(). All the pages after the login page use 
sessions and will redirect the user to the login page, if he/she is NOT 
logged in. So I am guessing the error lies in my logic somewhere.

Thanks again.
--Pushpinder
On Monday, July 28, 2003, at 04:51 PM, Chris Shiflett wrote:

--- Pushpinder Singh Garcha [EMAIL PROTECTED] wrote:
However if I decided to use the sessions approach how would I go about
it? I am just curious to find out why $_SESSION['company_name'] =
$company_name; duz not werk for me!
Did you use session_start() like I mentioned?

If so, you are probably making an error somewhere due to the 
complexity of your
script(s). If you want to learn how to use sessions, focus on that and 
nothing
else (e.g., forget interacting with a database, passing URL variables, 
etc.).
Start with a simple example, get that to work, then integrate it into 
what you
are trying to do.

Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
--
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


Re: [PHP] Store array as Session Variable

2003-07-28 Thread Pushpinder Singh Garcha
Hello Chris,

 I am using Apache webserver on the MAc Jaguar OS Platform

Regards
--Pushpinder
On Monday, July 28, 2003, at 05:02 PM, Chris Shiflett wrote:

--- Pushpinder Singh Garcha [EMAIL PROTECTED] wrote:
I am using session_start(). All the pages after the login page use
sessions and will redirect the user to the login page, if he/she is
NOT logged in.
You're not using IIS by chance are you? If so, I think you will find 
this link
helpful:

http://marc.theaimsgroup.com/?l=php-generalm=102929828515647w=2

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/


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


Re: [PHP] Display Records (brief summary and full details)

2003-07-25 Thread Pushpinder Singh Garcha
Thanks Tom,

I appreciate your help ! however I have a 2 quick questions...

1.)  should we not save the names of the companies as $companies[$row] 
= $row['company'];	
2.)  the approach of accessing the variable as $details = 
$_SESSION['link']['$_GET['name']] is not
   working , when I try to echo the $details is get something else. 
I am not sure how we use the
   $_SESSION[ ] [ ] with 2 variables as shown.

any help will be appreciated.

regards
--Pushpinder
On Thursday, July 24, 2003, at 08:10 PM, Tom Rogers wrote:

Hi,

Friday, July 25, 2003, 7:13:27 AM, you wrote:
PSG Hello All,
PSG   I am trying to create a  small MySQL application using PHP. I 
have a
PSG table of contacts with each record having over 30 fields. I have a
PSG search page where a logged-in admin can search for a particular 
record
PSG on the basis of certain parameters.

PSG This is a sample code:

PSG   $sql1 = SELECT * from `contacts` WHERE $where;

PSG  while ($row = mysql_fetch_array($result1)) {

PSG  // Alternate the bgcolor of each row for visibility
PSG  ($even % 2) == 0 ? $bgcolor = #EFEFEF : $bgcolor =
PSG #ee;
PSG  $even = $even + 1;
PSG  // print the actual row
PSG echo   TR BGCOLOR=$bgcolor
PSG  TD align=\left\font color=\#66\ size=\1\
PSG face=\Verdana, Arial, Helvetica, 
sans-serif\$row[company]/font/TD
PSG  TD align=\left\font color=\#66\ size=\1\
PSG face=\Verdana, Arial, Helvetica, 
sans-serif\$row[name_1]/font/TD
PSG  TD align=\left\font color=\#66\ size=\1\
PSG face=\Verdana, Arial, Helvetica, 
sans-serif\$row[phone_1]/font/TD
PSG  TD align=\left\font color=\#66\ size=\1\
PSG face=\Verdana, Arial, Helvetica, 
sans-serif\$row[city]/font/TD
PSG  TD align=\left\font color=\#66\ size=\1\
PSG face=\Verdana, Arial, Helvetica, 
sans-serif\$row[url]/font/TD
PSG  TD align=\left\font color=\#66\ size=\1\
PSG face=\Verdana, Arial, Helvetica, 
sans-serif\$row[email_1]/font/TD
PSG  TD align=\center\font color=\#33\ size=\1\
PSG face=\Verdana, Arial, Helvetica, sans-serif\a
PSG href=\profile.php\Link/a/font/TD
PSG /TR;

PSG  // try to register the variable
PSG$_SESSION['link'] = $row[company];
PSG  } // end while
PSG // print the end of the table
PSGecho /TABLE/body/html;
PSG The above tables displays the results of the query in a table form
PSG with only the main fields of the record.  The last column of the 
table
PSG contains a link to view the full-contents of the record. when the 
user
PSG clicks this link, he will go to another script called
PSG profile.php which will display all the contents of the record.  
In
PSG order to do this I will need to store all the primary keys  (in 
this
PSG case the name of the company) of each record from the result set 
and
PSG then use it to retrieve all the contents. I have been successful 
in
PSG trying to do this for a single row (record) of the result by
PSG registering it as an session variable called ['link']

PSG I am at a loss to figure out how to store the names of the first 
column
PSG of the result set i.e. the company name. Is it possible to create 
an
PSG array of the session variable ['link']   ??  Another approach 
would be
PSG to get the names of the companies as a separate query and 
register them
PSG as an array of session variables.

PSG any suggestions will be welcome. Thanks in advance.

PSG --Pushpinder

in the href put

...a href=\profile.php?name=.$row['name'].\...

Make a seperate array as you loop

$companies[$row['name']] = $row;

in your session store it as

$_SESSION['link'] = $companies;

You can then access it in profile php as

$details = $_SESSION['link']['$_GET['name']]

--
regards,
Tom
--
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


Re: [PHP] I'm really getting annoyed with PHP

2003-07-24 Thread Pushpinder Singh Garcha
try this,

use a meta-refresh ...

echo META HTTP-EQUIV=\refresh\ 
content=\3;URL=http://wherever_u_wana_go.com/hello.html\;;

hth
--Pushpinder


On Thursday, July 24, 2003, at 11:24 PM, Beauford.2005 wrote:

It's obvious though that PHP can not handle it. This is why I am forced
to use javascript. I have already spent a week on this and am not going
to waste any further time. I have posted all my code and if someone can
see a problem I'll look at it, but it just ain't worth the effort at
this point.
-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: July 23, 2003 10:52 PM
To: Curt Zirzow
Cc: PHP
Subject: Re: [PHP] I'm really getting annoyed with PHP


On Thursday, July 24, 2003, at 12:18  PM, Curt Zirzow wrote:

And in my case I would never see the next page. I have javascript
turned
off.
Never rely on javascript to do the work, excpecially in small cases
like
this when php can handle it without any issues, such as javascript
being
turned off.
To follow on from this, the W3 accessibility guidelines
(http://www.w3.org/TR/WCAG10/checkpoint-list.html) state:
---
6.3  Ensure that pages are usable when scripts, applets, or other
programmatic objects are turned off or not supported.  If this is not
possible, provide equivalent information on an alternative accessible
page. [Priority 1]
For example, ensure that links that trigger scripts work when scripts
are turned off or not supported (e.g., do not use javascript: as the
link target). If it is not possible to make the page usable without
scripts, provide a text equivalent with the NOSCRIPT element, or use a
server-side script instead of a client-side script, or provide an
alternative accessible page as per checkpoint 11.4. Refer also to
guideline 1.
---
In short, do as much as you can server side (PHP), and ensure the page
doesn't break without JS.  Then use JS on the client side IF YOU MUST
to enhance the experience for those with it switched on.
Yes, it's more work, and yes this is optional (but be aware that SOCOG
(Sydney Olympics) were sued for having an inaccessible site, so it's
only a matter of time before we have huge class action everywhere :)),
and yes you'll reach a greater market share with an accessible page.
Sorry for getting OT

Justin

--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] I'm really getting annoyed with PHP

2003-07-24 Thread Pushpinder Singh Garcha
hello everyone,

Can somebody tell me why meta-refresh is not preferred to do re-directs 
?
I know Javascript is browser dependent, so its undependable.

using headers in php requires that no output is sent to the browser, 
what if the code logic requires that there is some output sent to the 
browser. I am sorry if this is a repeat question because someone 
earlier did mention abt output buffering as a way around.

TIA
--Pushpinder
On Thursday, July 24, 2003, at 12:11 PM, Curt Zirzow wrote:

* Thus wrote Pushpinder Singh Garcha ([EMAIL PROTECTED]):
try this,

use a meta-refresh ...

echo META HTTP-EQUIV=\refresh\
content=\3;URL=http://wherever_u_wana_go.com/hello.html\;;
This has already been discussed, and is not the preferred method of
doing redirects. PHP can handle what he is doing just fine.


Curt
--
I used to think I was indecisive, but now I'm not so sure.
--
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] Display Records (brief summary and full details)

2003-07-24 Thread Pushpinder Singh Garcha
Hello All,

 I am trying to create a  small MySQL application using PHP. I have a 
table of contacts with each record having over 30 fields. I have a 
search page where a logged-in admin can search for a particular record 
on the basis of certain parameters.

This is a sample code:

 $sql1 = SELECT * from `contacts` WHERE $where;

while ($row = mysql_fetch_array($result1)) {

// Alternate the bgcolor of each row for visibility
($even % 2) == 0 ? $bgcolor = #EFEFEF : $bgcolor = 
#ee;
$even = $even + 1;

// print the actual row
   echo   TR BGCOLOR=$bgcolor
TD align=\left\font color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, sans-serif\$row[company]/font/TD
TD align=\left\font color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, sans-serif\$row[name_1]/font/TD
TD align=\left\font color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, sans-serif\$row[phone_1]/font/TD
TD align=\left\font color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, sans-serif\$row[city]/font/TD
TD align=\left\font color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, sans-serif\$row[url]/font/TD
TD align=\left\font color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, sans-serif\$row[email_1]/font/TD
TD align=\center\font color=\#33\ size=\1\ 
face=\Verdana, Arial, Helvetica, sans-serif\a 
href=\profile.php\Link/a/font/TD
/TR;
	
// try to register the variable
	   $_SESSION['link'] = $row[company];
} // end while
   // print the end of the table
  echo /TABLE/body/html;

The above tables displays the results of the query in a table form  
with only the main fields of the record.  The last column of the table 
contains a link to view the full-contents of the record. when the user 
clicks this link, he will go to another script called
profile.php which will display all the contents of the record.  In 
order to do this I will need to store all the primary keys  (in this 
case the name of the company) of each record from the result set and 
then use it to retrieve all the contents. I have been successful in 
trying to do this for a single row (record) of the result by 
registering it as an session variable called ['link']

I am at a loss to figure out how to store the names of the first column 
of the result set i.e. the company name. Is it possible to create an 
array of the session variable ['link']   ??  Another approach would be 
to get the names of the companies as a separate query and register them 
as an array of session variables.

any suggestions will be welcome. Thanks in advance.

--Pushpinder







[PHP] Small Error in Login Script

2003-06-30 Thread Pushpinder Singh Garcha
Hello All,

 I am trying to setup a simple login script on my development server 
running Mac OS Jaguar. I keep getting an error

Parse error: parse error in /Users/psgarcha/Sites/CRM/ADMIN-LOGIN.php 
on line 2. I am at a complete loss !

Here is the source code. Please help.

-

?
session_start();
error_reporting(E_ALL);

if ( (isset($_POST['validuser']))  (isset($_POST['password']))  )  {

  mysql_connect( 'localhost', 'abc', 'pwd' )
 or die ( 'Unable to connect to server.' );
  // Select database on MySQL server
  //  mysql_select_db( 'masterstream' )
   or die ( 'Unable to select database' );
  // Formulate the query

  //  $sql1 = SELECT * from `admin` where `admin`.username = 
$_POST['validuser'] AND `admin`.password = $_POST['password'];

$result1 = mysql_query($sql1)
or die ( 'Database Error has occured.');

$num_results = mysql_num_rows($result1);


if ($num_results == 1 ) {
echo Success!br;
   if(!isset($_SESSION['validuser']))
  $_SESSION['validuser'] = $_POST['validuser'];
}
  else{
echo Please try again laterbr;
  }
  }
?

html
head
titleADMIN-LOGIN/title
/head
?

if (isset($_SESSION['validuser']))
  {
  echo You are already logged into the system !!!;
   }
else {
   echo test;
}
echo 
body bgcolor=\aa\
form name=\form1\ method=\post\ action=\ADMIN-LOGIN.php\
  table width=\713\ height=\132\ border=\1\ cellpadding=\1\ 
cellspacing=\1\ bgcolor=\#FF\
tr
  td width=\787\ height=\119\ table width=\707\ 
border=\1\ cellspacing=\3\ cellpadding=\2\
  tr bgcolor=\99ccff\
td colspan=\2\div align=\center\strongfont 
color=\#FF\ size=\2\ face=\Verdana, Arial, Helvetica, 
sans-serif\Please
enter your Username and Password 
/font/strong/div/td
  /tr
  tr bgcolor=\#E7E7E7\
td width=\214\strongfont color=\#66\ 
size=\1\ face=\Verdana, Arial, Helvetica, 
sans-serif\Login/font/strong/td
td width=\549\font size=\1\
  input name=\validuser\ type=\text\ id=\validuser2\
  /font/td
  /tr
  tr bgcolor=\#E7E7E7\
tdstrongfont color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, 
sans-serif\Password/font/strong/td
tdfont size=\1\
  input name=\password\ type=\password\ 
id=\password\
  /font/td
  /tr
  tr bgcolor=\#E7E7E7\
td height=\24\ colspan=\2\div align=\center\
input type=\submit\ name=\Submit\ value=\Submit\
  /div/td
  /tr
/table/td
/tr
  /table
/form
;
?

/body
/html


Thanks in advance.
Pushpinder


Re: [PHP] Small Error in Login Script ~~SOLVED

2003-06-30 Thread Pushpinder Singh Garcha
Thanks ...I figured out something myself



--Pushpinder



On Monday, June 30, 2003, at 11:41 AM, Pushpinder Singh Garcha wrote:

Hello All,

 I am trying to setup a simple login script on my development server 
running Mac OS Jaguar. I keep getting an error

Parse error: parse error in /Users/psgarcha/Sites/CRM/ADMIN-LOGIN.php 
on line 2. I am at a complete loss !

Here is the source code. Please help.

-

?
session_start();
error_reporting(E_ALL);

if ( (isset($_POST['validuser']))  (isset($_POST['password']))  )  {

  mysql_connect( 'localhost', 'abc', 'pwd' )
 or die ( 'Unable to connect to server.' );
  // Select database on MySQL server
  //  mysql_select_db( 'masterstream' )
   or die ( 'Unable to select database' );
  // Formulate the query

  //  $sql1 = SELECT * from `admin` where `admin`.username = 
$_POST['validuser'] AND `admin`.password = $_POST['password'];

$result1 = mysql_query($sql1)
or die ( 'Database Error has occured.');

$num_results = mysql_num_rows($result1);


if ($num_results == 1 ) {
echo Success!br;
   if(!isset($_SESSION['validuser']))
  $_SESSION['validuser'] = $_POST['validuser'];
}
  else{
echo Please try again laterbr;
  }
  }
?

html
head
titleADMIN-LOGIN/title
/head
?

if (isset($_SESSION['validuser']))
  {
  echo You are already logged into the system !!!;
   }
else {
   echo test;
}
echo 
body bgcolor=\aa\
form name=\form1\ method=\post\ action=\ADMIN-LOGIN.php\
  table width=\713\ height=\132\ border=\1\ cellpadding=\1\ 
cellspacing=\1\ bgcolor=\#FF\
tr
  td width=\787\ height=\119\ table width=\707\ 
border=\1\ cellspacing=\3\ cellpadding=\2\
  tr bgcolor=\99ccff\
td colspan=\2\div align=\center\strongfont 
color=\#FF\ size=\2\ face=\Verdana, Arial, Helvetica, 
sans-serif\Please
enter your Username and Password 
/font/strong/div/td
  /tr
  tr bgcolor=\#E7E7E7\
td width=\214\strongfont color=\#66\ 
size=\1\ face=\Verdana, Arial, Helvetica, 
sans-serif\Login/font/strong/td
td width=\549\font size=\1\
  input name=\validuser\ type=\text\ 
id=\validuser2\
  /font/td
  /tr
  tr bgcolor=\#E7E7E7\
tdstrongfont color=\#66\ size=\1\ 
face=\Verdana, Arial, Helvetica, 
sans-serif\Password/font/strong/td
tdfont size=\1\
  input name=\password\ type=\password\ 
id=\password\
  /font/td
  /tr
  tr bgcolor=\#E7E7E7\
td height=\24\ colspan=\2\div align=\center\
input type=\submit\ name=\Submit\ 
value=\Submit\
  /div/td
  /tr
/table/td
/tr
  /table
/form
;
?

/body
/html


Thanks in advance.
Pushpinder


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


[PHP] MySQL Query

2003-06-30 Thread Pushpinder Singh Garcha
Hello ,

Can someone tell me what is wrong with the following querys ?  I am 
pretty sure its got something to do with the quotes around $_POST[] 
variables.

$sql1 = SELECT * from `admin` where `admin`.user = 
'$_POST['validuser']' AND `admin`.pwd = '$_POST['password']';

$sql1 = SELECT * from `admin` where user = $_POST['validuser'] AND 
pwd = $_POST['pass'];
   

Thanks in advance,

--Pushpinder

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


Re: [PHP] MySQL Query ~~ SOLVED

2003-06-30 Thread Pushpinder Singh Garcha
Thanks to all you great ppl out there !!!

have a great weekend ;-) for those in north america

FYI : mine has just started !

cheers
--Pushpinder


On Monday, June 30, 2003, at 02:36 PM, Thorsten Körner wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi
Am Montag, 30. Juni 2003 20:10 schrieb Pushpinder Singh Garcha:
Hello ,

Can someone tell me what is wrong with the following querys ?  I am
pretty sure its got something to do with the quotes around $_POST[]
variables.
$sql1 = SELECT * from `admin` where `admin`.user =
'$_POST['validuser']' AND `admin`.pwd = '$_POST['password']';
$sql1 = SELECT * from `admin` where user = $_POST['validuser'] AND
pwd = $_POST['pass'];
You have forgotten to set the 'dots' 8-)

$sql1 = SELECT * from `admin` where `admin`.user =
 ' . $_POST['validuser'] . '
- ---^
AND `admin`.pwd = ' . $_POST['password'] . ';
- ----^
That's it.
CU
Thorsten
have fun
- --
Thorsten Körner http://www.123tkShop.org
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE/AIMZs5R35vLkl/cRAhzpAKCigPBeox92GTtjbGu8Ydiu5NlxIQCgqy27
SFw6/nEAUy4nsAvMzaQiFQk=
=Axl+
-END PGP SIGNATURE-
--
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] PhpMyAdmin / MySQL

2003-06-16 Thread Pushpinder Singh Garcha
Hello All,

I am using phpMyAdmin to administer my MySQl DB. I am running Mac OS 
Jaguar.
when I try to start up phpMyAdmin I get an error:

Welcome to phpMyAdmin 2.4.0

Error

MySQL said:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

So I try to start up the MySQL Server manually by typing the following 
on my command prompt:
and here are the results:

[psg:/usr/local/mysql] psgarcha% sudo ./bin/mysqld_safe 
[1] 558
[psg:/usr/local/mysql] psgarcha% Starting mysqld daemon with databases 
from /usr/local/mysql/data
030616 10:16:32  mysqld ended

Please help. Thanks in advance.

--Pushpinder



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


[PHP] Stumped @ MySql insert query

2003-06-13 Thread Pushpinder Singh Garcha
Hello everyone,

 I am trying to execute a simple query using $_POST variables, so 
that variable poisoning is not possible. note: I have register_globals 
ON on my site. I am getting the error shown below . Please advise ... 
as I can't seem to figure out why !

?

// connect to the BD/Table etc

  // Formulate the query

$sql1 = INSERT INTO `contacts`

VALUES (
   $_POST['company'],
   $_POST['pri_name'],
   $_POST['sec_name'],
   $_POST['assistant_1'],
   $_POST['assistant_2'],
   $_POST['pri_practice'],
   $_POST['sec_practice'],
   $_POST['sic'],
   $_POST['date_established'],
   $_POST['size'],
   $_POST['phone_1'],
   $_POST['phone_2'],
   $_POST['phone_3'],
   $_POST['email_1'],
   $_POST['email_2'],
   $_POST['email_3'],
   $_POST['url'],
   $_POST['city'],
   $_POST['msa'],
   $_POST['status'],
   $_POST['timezone'],
   $_POST['first_contact'],
   $_POST['next_contact'],
   $_POST['last_contact'],
   $_POST['notes'],
   $_POST['email_history'],
   $_POST['battery_started'],
   $_POST['details'],
   TIMESTAMP();
   $_POST['source']
);


$result1 = mysql_query($sql1)
or die ( 'Database Error has occured.');

$num_results = mysql_num_rows($result1);
echo $num_results. rows added !!;

?   
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or 
`T_NUM_STRING' in /home/ABCD/CRM/add.php

Thanks in advance.
Pushpinder





Re: [PHP] Stumped @ MySql insert query

2003-06-13 Thread Pushpinder Singh Garcha
On Friday, June 13, 2003, at 02:22 PM, Zak Johnson wrote:

$_POST variables are still subject to poisoning; in your case, SQL
injection.
How is variable poisoning possible when using $_POST  ?? I always felt 
that the php compiler should check to see if the variable was part of 
the POST Global array. At least this is is what I thought about the 
$_POST global array.

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


[PHP] Another Session Question

2003-06-09 Thread Pushpinder Singh Garcha
Hello all,

I have php ver 4.1.1 running with register_globals() ON on my site.  I 
am trying to use sessions to maintain state during a visit to the site. 
I have read thru the manual, but my mind is still cluttered with 
doubts. I understand that use of the $_SESSION global array will 
greatly add to the security of the site and will prevent variable 
poisoning.

How do I register a session?
The manual (http://www.php.net/manual/en/print/ref.session.php) says 
that there are 2 methods:

Example 1. Registering a variable with $_SESSION.
?php
session_start();
// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less
if (!isset($_SESSION['count'])) {
$_SESSION['count'] = 0;
} else {
$_SESSION['count']++;
}
?
---

Example 4. Registering a variable with register_globals enabled
?php
if (!session_is_registered('count')) {
session_register(count);
$count = 0;
}
else {
$count++;
}
?
-

This is a snippet of the code that I am testing:
? session_start();
require_once('../Connections/MasterStream.php');
if ( $_POST['validuser']  ($_POST['password']) ) {
mysql_select_db($database_MasterStream, $MasterStream);
$query_Recordset1 = SELECT * FROM `admin` WHERE `admin`.username = 
$_POST['validuser'] AND `admin`.password = $_POST['password'];
$Recordset1 = mysql_query($query_Recordset1, $MasterStream) or 
die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

if ($totalRows_Recordset1)
{
echo Success!br;
  if(!isset($_SESSION['validuser']))
  $_SESSION['validuser'] = 0;
  else $_SESSION['validuser']++;
}

else{
echo Please try again laterbr;
}
}
?
Thanks in advance,
Pushpinder

Re: [PHP] Session Question

2003-05-29 Thread Pushpinder Singh Garcha
Hello Ernest,

SInce register_globals() is ON on my server, I need to be able to 
figure out a way to ensure session security.
Another question I had was that,  with register_globals() ON can I 
still use the $_SESSION to set my variables ? I want to avoid recoding 
the entire application, so I want to see what can be done to enhance 
security with the current setup.

Does the super-global array approach i.e. $_SESSION work, irrespective 
of the fact that REGISTER_GLOBALS is ON / OFF ?
If I start setting session variables in the $_SESSION array from now 
on, will it improve the security of the session.  I am a newbie in PHP 
session handling and am sorry if any of the above questions sound 
extremely lame.

Thanks in advance,
--Pushpinder


On Wednesday, May 21, 2003, at 04:34 PM, Ernest E Vogelsinger wrote:

At 21:51 21.05.2003, Pushpinder Singh Garcha said:
[snip]
register_globals is ON on my site.
You should really rethink this - have a look at
http://www.php.net/manual/en/security.registerglobals.php
http://www.php.net/manual/en/ref.session.php section Sessions and
Security
register_globals=on simply enables anyone injecting globals to your 
site:
http://www.yoursite.com/myscript.php?valid_user=sam+spade

To keep sessions secure, one might consider these steps:

(1) Filesystem security:
session.save_path points to a directoy owned and readable by the 
webserver
user only:
session.save_path=/tmp/php
chown apache:apache /tmp/php
chmod 700 /tmp/php

(2) If security issues are high you may attempt to make sure that the
session identifier - be it via cookie or via URL parameter - gets
additional confirmation. I once used this approach: I am transmitting a
random cookie (random name, random value) to the browser, making a 
note (in
$_SESSION) of the cookie name and its value. When the session gets
revisited check for the existence and the value of this cookie. If the
values match construct another random cookie, having another name and
another value (also sending header information to delete the old 
cookie).
If the cookie doesn't match don't discard the session but merely 
redirect
the browser to another URL (usually a login page), clearing the 
session ID
if it was received it as cookie.
This has a drawback - clients are forced to accept cookies, or the 
system
wouldn't work at all. Thus you can only implement it where security is 
at
risk, and where acceptance of the additional cookie can be enforced
(extranet applications, for example).

(3) As a last resort one can remember the client IP that must match 
for the
same session. This is not secure at all, and it doesn't work with some 
AOL
connections where client IPs change at will (by AOL using random 
proxies
for every INet connection). You can however automatically rule out that
method if the client IP stems from the AOL-assigned range.

Keeping a very good eye on session security, sessions are the only 
thing
where you can keep login data and access rights, just like you're 
doing it.
I would only urge you NOT to use session_register() and
session_is_registered(), but to use the $_SESSION[] superglobal to be
absolutely sure you're using only data you yourself have put there, 
and not
injected data.

--
O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/


--
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


Re: [PHP] Installation help

2003-05-27 Thread Pushpinder Singh Garcha
I am having the same story on my Win XP system. I hv looked all over 
message brds @ phpbuilder/zend/php.net . No success
Please let me know if you are able to sort it out.

Thx
--Pushpinder
On Tuesday, May 27, 2003, at 12:07 PM, Brian Dunning wrote:

Hi,

I am a lamer  a newbie, and ran the PHP and MySQL installers on my XP 
box, but can't connect to any database and don't see any new processes 
running. Is there someplace I can find documentation for this that is 
optimized for the newbie lamer? Thanks,

- Brian

--
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] Help Needed

2003-03-10 Thread Pushpinder Singh Garcha
Hey All

My Php App is trying to fopen() and fread() a File that is located in 
the Web Server. This works if the file is a simple html file. However 
the complicated  part is that the file is not displayed correctly i.e. 
it has missing gifs if, it was created using Fireworks and then 
subsequently exported as a html.

Any help will be highly appreciated
TIA
Pushpinder Singh Garcha
_
Web Architect


Re: [PHP] Help Needed

2003-03-10 Thread Pushpinder Singh Garcha
Thanks for the prompt reply Michael

I am trying to protect files on the site, my script checks for a valid 
session ID and fopens() a File. This file is located in a different Dir 
from the php script. When the file is a simple html file , I can easily 
fopen() the file  (Even though it contains gifs)

The real problem arises is when this html file has been exported from 
Fireworks (I.E. .png file ) The resulting file shows many missing 
links wihen  I try to fread() the html file. Although the file is 
displayed fine when I point my Browser (Mozilla)
to it. I am testing on the MAC OS Jaguar Platform

Thanks again
--pS
On Tuesday, March 11, 2003, at 09:12 AM, Michael Roger C. Bianan wrote:

Garcha,

Kindly check your file paths.  When you export it, it may not point
to what really is the real path online.
May I ask what are you trying to achieve?

-Original Message-
From: Pushpinder Singh Garcha [mailto:[EMAIL PROTECTED]
Sent: Monday, March 10, 2003 1:45 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help Needed
Hey All

My Php App is trying to fopen() and fread() a File that is located in
the Web Server. This works if the file is a simple html file. However
the complicated  part is that the file is not displayed correctly i.e.
it has missing gifs if, it was created using Fireworks and then
subsequently exported as a html.
Any help will be highly appreciated
TIA
Pushpinder Singh Garcha
_
Web Architect
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Pushpinder Singh Garcha
_
Web Architect


[PHP] .htaccess Help

2003-03-10 Thread Pushpinder Singh Garcha
Hello All

I need to allow users to be able to access ONLY non-html files in a 
Secret Dir.
Can anyone suggest a .htaccess method to do just that.

I have a .htaccess script which will prevent anybody from viewing the 
contents of a Dir via http, but this time , I need to allow users to 
view the PHP Files

TIA

Pushpinder Singh Garcha
_
Web Architect


[PHP] Php File/Dir Protection

2003-03-06 Thread Pushpinder Singh Garcha
Hello All

My application is based on PHP / MySQL. I am using Sessions to 
validate users before they can access the SIte.
I need to use the same login to allow the users to gain access to a 
secret  Dir.

This directory is within the webfolder. I have gone through many 
previous threads and figured out a way.
I need to make sure that it is correct:

1.  Take the secret dir out of the website and place it on the ISP 
server
 i.e.
~/my_web_site/www/secret_dir   would be changed to make it 
~/my_web_site/www.secret_dir

2. Check if a valid session in the name of a user exists

3. If seesion exists , I  would fopen() the file provided the correct 
file name is passed to the script

Thanks

Pushpinder Singh Garcha
_
Web Architect : www.MasterStream.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Help Needed

2003-03-06 Thread Pushpinder Singh Garcha
Hello All

I am writing again with reference to my dir Protection PHP script.

The scenario is explained below.

Whenever a user clicks a particular URL, it triggers a php file which 
first checks if the user's session exists or not. If the user's session 
exists, it should fopen() the particular file for him. My question is: 
after checking for the session, how does the php script know what file 
to open..meaning what file was linked by that URL.

Please help!



Pushpinder Singh Garcha
_
Web Architect : www.MasterStream.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] File Access Rights

2003-03-05 Thread Pushpinder Singh Garcha
Hello all

My php script needs to read a text file that is stored in the same Dir 
as the php file. However I do not want to allow users to be able to see 
the contenst of the file from the Browser. Please suggest some remedy.

Thanks in advance

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


Re: [PHP] File Access Rights

2003-03-05 Thread Pushpinder Singh Garcha
Thanks Kevin

I have tried to chmod the file ...but I need to give others the 
permission to read the file...or the script itself cannot open the file 
!

--Pushpinder

On Wednesday, March 5, 2003, at 03:27 PM, Kevin Stone wrote:

chmod($file, 0600);

This sets the file to Owner read and write, Group nothing, Public 
nothing.
If you're on a shared server then chances are this function has been
disabled so you may have to FTP or SSH into your account and set the
permissions for the file manually using the chmod command.  Good luck.

- Kevin

- Original Message -
From: Pushpinder Singh Garcha [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 12:51 PM
Subject: [PHP] File Access Rights

Hello all

My php script needs to read a text file that is stored in the same Dir
as the php file. However I do not want to allow users to be able to 
see
the contenst of the file from the Browser. Please suggest some remedy.

Thanks in advance

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




Pushpinder Singh Garcha
_
Web Architect : www.MasterStream.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Access Rights

2003-03-05 Thread Pushpinder Singh Garcha
The error that I get is a Permission Denied Message !!

--Puspinder

On Wednesday, March 5, 2003, at 03:27 PM, Kevin Stone wrote:

chmod($file, 0600);

This sets the file to Owner read and write, Group nothing, Public 
nothing.
If you're on a shared server then chances are this function has been
disabled so you may have to FTP or SSH into your account and set the
permissions for the file manually using the chmod command.  Good luck.

- Kevin

- Original Message -
From: Pushpinder Singh Garcha [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, March 05, 2003 12:51 PM
Subject: [PHP] File Access Rights

Hello all

My php script needs to read a text file that is stored in the same Dir
as the php file. However I do not want to allow users to be able to 
see
the contenst of the file from the Browser. Please suggest some remedy.

Thanks in advance

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




Pushpinder Singh Garcha
_
Web Architect : www.MasterStream.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Help with Arrays

2003-02-27 Thread Pushpinder Singh Garcha
Hello all

I am having some problem with arrays

THIS IS THE PHP CODE

 $temp = file(file.txt);

   if(!$temp)
   {
 echo File could not be read by array !! br;
 exit;
   }
   else
   echo Array was opened !!brbr;
 $x = count($temp);
 echo Array Count is: $xbrbr;
 echo $temp[0]br;
 //$P = str_replace(\r\n, \n , $temp);

 echo brFirst: $temp[0];
 $P_new = explode( ,$temp);
 echo brNext: $P_new[0];

THIS IS THE TEXT FILE CALLLED ''file.txt''

abc111
asd123
aqw234
www234
edr234
vfr456


When I echo $temp[0] ... I get abc111 asd123 aqw234 www234 edr234 
vfr456 on one straight line, which is weird. I should get it on 
separate lines.. Also I am unable to separate the lines of the file 
using the explode().

Any help will be highly appreciated

--Pushpinder



Pushpinder Singh Garcha
_
Web Architect


Fwd: [PHP] Help with Arrays

2003-02-27 Thread Pushpinder Singh Garcha


Begin forwarded message:

From: Pushpinder Singh Garcha [EMAIL PROTECTED]
Date: Thu Feb 27, 2003  7:57:38 PM US/Eastern
To: olinux [EMAIL PROTECTED]
Subject: Re: [PHP] Help with Arrays
Thanks

My question was that each line of the file should be stored as one 
element of the array.
This is because, I need to compare each line of the text file against 
some user values.

TIA
--Pushpinder


On Thursday, February 27, 2003, at 04:33 PM, olinux wrote:

and what problem is that?

how about just using the example?
http://www.php.net/manual/en/function.file.php
$lines = file ('http://www.example.com/');

// Loop through our array, show html source as html
source; and line numbers too.
foreach ($lines as $line_num = $line) {
echo Line #b{$line_num}/b :  .
htmlspecialchars($line) . br\n;
}


--- Pushpinder Singh Garcha [EMAIL PROTECTED]
wrote:
Hello all

I am having some problem with arrays

THIS IS THE PHP CODE

  $temp = file(file.txt);

if(!$temp)
{
  echo File could not be read by array !!
br;
  exit;
}
else
echo Array was opened !!brbr;
  $x = count($temp);
  echo Array Count is: $xbrbr;
  echo $temp[0]br;
  //$P = str_replace(\r\n, \n , $temp);

  echo brFirst: $temp[0];
  $P_new = explode( ,$temp);
  echo brNext: $P_new[0];
THIS IS THE TEXT FILE CALLLED ''file.txt''

abc111
asd123
aqw234
www234
edr234
vfr456


When I echo $temp[0] ... I get abc111 asd123
aqw234 www234 edr234
vfr456 on one straight line, which is weird. I
should get it on
separate lines.. Also I am unable to separate the
lines of the file
using the explode().
Any help will be highly appreciated

--Pushpinder



Pushpinder Singh Garcha
_
Web Architect


__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Pushpinder Singh Garcha
_
Web Architect

Pushpinder Singh Garcha
_
Web Architect


[PHP] File Trouble

2003-02-24 Thread Pushpinder Singh Garcha
Hello All

I am trying to load the contents of a file stored on the server in to 
an array. The file has 125 or so lines. However when I load the file 
into the array and try to print the array elements..all I see is one 
continuos line.

   $PASSPORT_CODES=file(../GUEST/list.txt);

   if(!$PASSPORT_CODES)
   {
 echo File could not be read by the system !! br;
 exit;
   }
   else
   echo File was opened !!br;
   $x = count($PASSPORT_CODES);
   echo Count is : $xbr;
   for($i=0; $icount($PASSPORT_CODES); $i++){
   echo $PASSPORT_CODES[$i];
   echo br;
   }
  
Can you please help me out with this  I need to get a 125 element 
array...so that my code can check the individual elements of the Array. 
Thanks in advance

Pushpinder Singh Garcha
_
Web Architect


[PHP] Still having File trouble

2003-02-24 Thread Pushpinder Singh Garcha
Hello all,

I am trying to read the contents of a file called 'file.txt' into an 
array and then compare it with the user inputs.
when I read the file it gets stored as a single line. I am trying to 
get a way around that but alas.

I would really appreciate any help. Thanks

--Pushpinder

HERE IS THE TEST CODE
?
// These are the contents of the file file.txt
// Note the file is exactly as it is
/*

abc111
asd123
aqw234
www234
edr234
vfr456
*/

 $p_code = abc111;
 echo The passport code that was entered in the system was 
$p_codebrbr;

 $PASSPORT_CODES = file(file.txt);

   if(!$PASSPORT_CODES)
   {
 echo File could not be read by array !! br;
 exit;
   }
   else
   echo Array was opened !!brbr;
 $x = count($PASSPORT_CODES);
 echo Array Count is: $xbr;
 for($j=0; $j$x; $j++){
   echo $PASSPORT_CODES[$j]br;
 }
 $A = array(\r\n, \n\r, \r, \n);
 $P = str_replace($A, \n , $PASSPORT_CODES);
 //then simple explode() the data to receive an array of lines:

 $P = explode($P,\n);

 for($i=0; $icount($P); $i++) {

  if (rtrim($P[$i])==$p_code) {
 $flag = true;
		 echo Congratulations, $f_name your passport code has been accepted 
by our system !brbr;
		 break;
}

  else {
   $flag = false;
   }
   }
   if ($flag == false) {
  echo br Sorry,  your passport Code was not accepted by our 
system !brbr;
	  exit;

   }

?

RESULTS OF THE ABOVE CODE

The passport code that was entered in the system was abc111

Array was opened !!

Array Count is: 1
abc111 asd123 aqw234 www234 edr234 vfr456
Sorry, your passport Code was not accepted by our system !

Pushpinder Singh Garcha
_
Web Architect


[PHP] Date/Time Logic

2003-02-19 Thread Pushpinder Singh Garcha
Hello  Everyone,

My php/mysql application needs to keep track of the first time that a 
User logs on to the site. Afterwards the User should be allowed either  
3 days / 3 months/1 year of access to the site. Once the stipulated 
time period is over the system should invalidate the login of the user. 
The Admin/ User should get email notification about this. The 
notification part is easy the hard part to figure out is how to be able 
to keep and tab on the Time Period stipulated for a user.

Thanks in advance
Pushpinder Singh Garcha
_
Web Architect


[PHP] Cron Job help Needed

2003-02-19 Thread Pushpinder Singh Garcha
Hello All,

I need to ask you about some resources for cron jobs. Please suggest 
some online help

Thanks
Pushpinder Singh Garcha
_
Web Architect


[PHP] Error Opening file

2003-02-17 Thread Pushpinder Singh Garcha
Hello All;


I am trying to open a File called cmi_list.txt  ( stored at the same 
level as the php file) and then load these into an array.
Now I check the $passport_codes with the value the User has entered and 
set the $flag accordingly

?  
.

 $PASSPORT_CODES =file(cmi_list.txt);
 $count = count($PASSPORT_CODES);

 for($i=0 ; $i  $count ; $i++) {

  if ($PASSPORT_COUNT[$i] != $p_code )   $flag = true;

  else $flag = false; 	

  }

  if ($flag == false)
{
	echo Passport Code did match record on file\n\n;
	exit;
}

.
.
?
This does not seem to work correctly.

[PHP] PhpBB2 Error

2003-02-07 Thread Pushpinder Singh Garcha

Hello All,

I have been runing PHP BB2 successfully on my site for a couple of 
months . Recently I got this error.

phpBB : Critical Error

Could not connect to the database


Can someone tell what this means..??

Many Thanks

--Pushpinder Singh Garcha
_
Web Architect


Pushpinder Singh Garcha
_
Web Architect


[PHP] Php security

2003-02-06 Thread Pushpinder Singh Garcha
Hi all

i wanted to check with if it is possible to  see the contents of a .php 
file.
I have heard of the Zend Encoder, but I was wondering how could a 
person see my php script ?

Any information in this direction would be useful?

TIA
--Pushpinder Singh Garcha
_
Web Architect


[PHP] Help Needed

2003-02-04 Thread Pushpinder Singh Garcha
Hello All:

My question is related to authentication. I have made a login system 
using PHP Sessions and MySQL. Once the user gets authenticated on the 
website I want to be able to allow him to see some html pages on the 
website. Only users who have logged in are able to see such a files. I 
have asked this question before , but still I have some doubts.

My code will check for:


  if (session_is_registered($valid_user))
{
  /// display the reqd page
}


else {

DISPLAY ERROR MESSAGE and ASK USER TO LOGIN
}


How should I display the page ... the page has a lot of html code and 
trying to write echoblah  blah blah . ;
will not be a an option. Please suggest a way out .


Many Thanks
Pushpinder




Pushpinder Singh Garcha
_
Web Architect


Re: [PHP] Re: Help Needed

2003-02-04 Thread Pushpinder Singh Garcha
Hello All:

Thanks again... I tried to use this and it is working fine for me.
Please comment:

?
session_start();

  if (session_is_registered(valid_user))
 include 'guest.html';

  else include 'not_logged_in.php';

?

Many Thanks
-Pushpinder


On Tuesday, February 4, 2003, at 12:32 PM, Goetz Lohmann wrote:


Pushpinder Singh Garcha schrieb:

Hello All:

My question is related to authentication. I have made a login system
using PHP Sessions and MySQL. Once the user gets authenticated on the
website I want to be able to allow him to see some html pages on the
website. Only users who have logged in are able to see such a files. I
have asked this question before , but still I have some doubts.

My code will check for:


  if (session_is_registered($valid_user))
{
  /// display the reqd page
}


else {

DISPLAY ERROR MESSAGE and ASK USER TO LOGIN
}


How should I display the page ... the page has a lot of html code and
trying to write echoblah  blah blah . ;
will not be a an option. Please suggest a way out .


you could include every page into a php script using

?php
   include('index.htm');
?

this mean, that this page is like being copyed in the php file

also instead of

?php
  echo bla bla bla:
?

you always can do

?php
...
?
   bla bla bla
?php
...
?




--
 @  Goetz Lohmann, Germany   |   Web-Developer  Sys-Admin
\/  --
()  He's the fellow that people wonder what he does and
||  why the company needs him, until he goes on vacation.


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




Pushpinder Singh Garcha
_
Web Architect




[PHP] Protect Access to a Directory

2003-02-04 Thread Pushpinder Singh Garcha
Hi,

I am using PHP and MySQL in my application. I have created a Login 
System for using Sessions. The problem that I am facing is that I 
need to protect a large number of pages in my website. So I have tried 
to use this method and it works fine for me :

?  session_start();
   if (session_is_registered(valid_user))
 include ('guest.html');
  else include 'not_logged_in.php';
?

I get stumped here   in order to be able to insert this code I have 
to write for each of the 400 html files, 400 php files with the same 
name. Most of the files are arranged in the form of directories. Is 
there a better way to be able to do this (Using PHP and MySQL). Thanks 
in advance !

Best Wishes
Pushpinder Singh Garcha
_
Web Architect


[PHP] PhpMyADmin Help

2003-02-04 Thread Pushpinder Singh Garcha
Hello ,

I am using PhpMyAdmin to control my MySQL Database. Untill now I had 
been using the Local Apache webserver  to test my scripts, so I had 
installed PhpMyAdmin in the 'Sites' Folder of my Mac. Now I need to 
beta test the Application on the Live Server. Do I need to upload 
PhpMyAdmin on to the remote site? Or can I let it remain sitting on the 
local server.

Also, I was wondering , what value should I assign to the 
$cfg['PmaAbsoluteUri'] variable in the config.inc.php file.

Many Thanks,
Pushpinder


Pushpinder Singh Garcha
_
Web Architect


[PHP] Help Needed

2003-01-31 Thread Pushpinder Singh Garcha
Hello All:

I am using PHP and MySQL in my application. I need to be able to allow 
ONLY authorized users access to some pages in the site. For this I am 
creating a session variable ''$valid_user, after the user has 
successfully authenticated himself with the Database. The pages that 
need to be protected are all HTML files. So far everything, works fine. 
I am wondering how to finally deploy the logic on all the pages that 
need to be protected.

Here is my point of view.

1). Change all the names of the protected documents to .php
2). Use the following script:


? session_start(); ?

if (session_is_registered($valid_user)) {

  // show the original page

PLEASE TELL me a way to display the same page

}


elseif  (!session_is_registered($valid_user)) {

 // display an error message to the user asking him to login before he 
can see this page

}

many thanks
--Pushpinder Singh


Pushpinder Singh Garcha
_
Web Architect


[PHP] help needed with session variables

2003-01-27 Thread Pushpinder Singh Garcha
hello,

I am making use of sessions in my PHp/MySQL Database application. When 
the user is successfully authenticated against the database, a session 
is created in following manner:


   session_register(valid_user,firstname,lastname);

   $valid_user = $login;
   $firstname  = $first_name;
   $lastname   = $last_name;

While I  am able to use the $valid_user variable all thru the sesion , 
when I try to use the $valid_user it works fine (i.e. I am able to 
access the value) throughout the session, however when I try to use the 
other two registered session variables i.e firstname and lastname,  I 
am not able to extract the value.  Can you suggest what might be going 
wrong. Note I am locally testing the setup on my Mac.

Many Thanks
Pushpinder Singh Garcha
_
Web Architect


[PHP] Ecard Senders

2003-01-23 Thread Pushpinder Singh Garcha
Hello there,

I am looking around for some E card senders based on PHP and MySQL . 
Duz anyone have any ideas which I should use.?
Please let me know... I really appreciate it,

best
Pushpinder


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



[PHP] Dynamic List Using Php

2003-01-21 Thread Pushpinder Singh Garcha
Hello All

I am wanting a create a dynamic List using php. When a user enters a 
value on a form, I need the value that he entered on the form to added 
to a dynamic list box, which is displayed on the next page. So the List 
Box continues to grow whenever a user adds a value on the form (note: 
The values entered every time have to be stored)

Thanks in advance.

Pushpinder Singh Garcha
_
Web Architect
T. Falcon Napier and Associates, Inc.
_

[PHP] Session Length

2003-01-16 Thread Pushpinder Singh Garcha
Hello Everyone:

I am using Sessions to secure parts of my website. I need to know if 
there is a way to set a lifetime for these sessions , so that they are 
automatically destroyed when say the user is inactive for 30 minutes.

Any help will be greatly appreciated. Thanks in advance

Pushpinder Singh


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



[PHP] Session Problem

2003-01-15 Thread Pushpinder Singh Garcha
Hello

I am trying to make use of sessions to auhenticate users on the secure 
parts of the website.  Things seems to work fine...but I keep getting 
this warning. Can some one pl  explain what this means ...
Warning: Cannot send session cache limiter - headers already sent 
(output started at /Users/pgarcha/Sites/edit.php:7) in 
/Users/pgarcha/Sites/edit.php on line 8


Thanks in advance
--pS

Pushpinder Singh Garcha


[PHP] Help Needed

2003-01-03 Thread Pushpinder Singh Garcha
hello all
  I am using php and mysql in my web application. I am making use of 
forms  to accept data from the user and add it to the mysql database. I 
also have a login system in place. I need to create a way for the user 
to edit the information that he/she entered. Can you suggest a way I 
can do that.

I want to be able to display a form to the user where his information 
is present ... and then he/she can go ahead and make updates.

thanks
--pS


Pushpinder Singh Garcha
_


[PHP] PHP and MySQL

2002-12-11 Thread Pushpinder Singh Garcha
Hello,

I am using PHP to create forms and then am entering the user input into 
a MySQL DB
In the first query I am trying to select the values that the user 
entered on the form

THIS DOES NOT WERK gives error  unable to execute query

  $sql = INSERT INTO `guest` (`title`, `first_name`, `last_name`, 
`login`, `password`, `passport_number`, `e_mail`, `question`, `answer`, 
`industry`, `job_title`, `state`, `city`, `company`, `last_visit`) 
VALUES ('\$select\', \'$f_name\', \'$l_name\', \'$login\', 
\'$password\', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 
NOW());;

WHEN I TRY TO HARD CODE THE VALUES INTO THE MYSQL QUERY, IT WERKS FINE

//  $sql = 'INSERT INTO `guest` (`title`, `first_name`, `last_name`, 
`login`, `password`, `passport_number`, `e_mail`, `question`, `answer`, 
`industry`, `job_title`, `state`, `city`, `company`, `last_visit`) 
VALUES (\'gh\', \'ghdfghhgj\', \'hgddj\', \'ggfgfg\', \'hfgdj\', NULL, 
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NOW());';

Can somebody please tell me where I am going wrong..??

Many thanks

Pushpinder Singh Garcha
_
Web Architect
T. Falcon Napier and Associates, Inc.


Re: [PHP] PHP and MySQL

2002-12-11 Thread Pushpinder Singh Garcha
Thanks Jason...that werked fine for me..

--pS


On Wednesday, December 11, 2002, at 03:50 PM, Jason Wong wrote:


On Thursday 12 December 2002 04:30, Pushpinder Singh Garcha wrote:

Hello,

I am using PHP to create forms and then am entering the user input 
into
a MySQL DB
In the first query I am trying to select the values that the user
entered on the form

THIS DOES NOT WERK gives error  unable to execute query


   $sql = INSERT INTO `guest` (`title`, `first_name`, `last_name`,
`login`, `password`, `passport_number`, `e_mail`, `question`, 
`answer`,
`industry`, `job_title`, `state`, `city`, `company`, `last_visit`)
VALUES ('\$select\', \'$f_name\', \'$l_name\', \'$login\',
\'$password\', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NOW());;

Not sure why you're escaping the single quote. It's unnecessary -- and 
I
suspect you mis-escaped $select as well. Any you can use this format, 
which
IMHO, is a lot easier on the eyes:

$sql = INSERT INTO `guest`
SET `title` = '$title',
`first_name` = '$first_name',
...,
...,
`last_visit` = NOW();


--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
I had a lease on an OEDIPUS COMPLEX back in '81 ...
*/


--
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] Session End

2002-11-27 Thread Pushpinder Singh Garcha
Hi

I am have created an authentication system, wherein the user is 
authenticated on the basis of a MySQL database.
Here is the code

?php

$auth = false; // Assume user is not authenticated

if (isset( $PHP_AUTH_USER )  isset($PHP_AUTH_PW)) {

// Connect to MySQL

mysql_pconnect( 'localhost', 'mysql', 'sunny' )
or die ( 'Unable to connect to server.' );

// Select database on MySQL server

mysql_select_db( 'testbed' )
or die ( 'Unable to select database.' );

// Formulate the query

$sql = SELECT * FROM guest WHERE
login= '$PHP_AUTH_USER' AND
password = '$PHP_AUTH_PW';

// Execute the query and put results in $result

$result = mysql_query( $sql )
or die ( 'Unable to execute query.' );

// Get number of rows in $result.

$num = mysql_numrows( $result );

if ( $num != 0 ) {

// A matching row was found - the user is authenticated.

$auth = true;
		session_start();

}

}

if ( ! $auth ) {

header( 'WWW-Authenticate: Basic realm=Pushpinder Singh\'s World' 
);
header( 'HTTP/1.0 401 Unauthorized' );
echo 'Authorization Required.';
exit;

} else {

echo 'PYou are authorized!/P';
}

? 


However this keeps the user logged on. I want to be able to close the 
session once the user has finished his work.

How do I do that??
Many Thanks
--pS


Pushpinder Singh Garcha
_
Web Architect
T. Falcon Napier and Associates, Inc.

Off   :  704 987 6500
Cell  :  704 236 2939
Fax   :  704 987 5002
_

[PHP] Help needed with the php.ini file

2002-11-21 Thread Pushpinder Singh Garcha
Hi all

I  am trying make changes with the register_global variable in the 
php.ini file, but I am unable to locate it.
I am running Mac OS JaguarPlease help me out

Many Thanks.

--Pushpinder

Pushpinder Singh Garcha
_
Web Architect
T. Falcon Napier and Associates, Inc.

Off   :  704 987 6500
Cell  :  704 236 2939
Fax   :  704 987 5002
_

[PHP] help needed with forms

2002-11-21 Thread Pushpinder Singh Garcha
Hello

I am using php based forms, which collect information from the client 
and send it in the form a email message to the admin.
I need to start using validation i.e. check whether some field/s  has 
been correctly entered in the from.
My application consists of 2 php pages
1).  info.php(this page consists of the plain form and the has its 
action parameter set to send_info.php)
2).  send_info.php  (this forms collects the information that the 
client entered and composes a message and mails it to
   admin)

So I use headers in the following manner:

The send_info.php code starts like this

?
if($email =='') {
header(Location: http://www.mysite.com/info.php;);
	}
?


This takes the user back to the info.php page with all the fields reset.
What I need is that
1).  An alert box must be displayed which tells the user where he went 
wrong
2).  Also the data that the user had entered on the form must not be 
reset to blank.

I know this sounds very trivial.
Please help me out.
Thanks
--pS

Pushpinder Singh Garcha




[PHP] Create Login Page

2002-11-18 Thread Pushpinder Singh Garcha
Hi All

I am trying to create  a login page using php and mysql database.

This is the code that I am trying to use:
?php
	// File Name: auth04.php
	// Check to see if $PHP_AUTH_USER already contains info

	if (!isset($PHP_AUTH_USER)) {
		// If empty, send header causing dialog box to appear
		header('WWW-Authenticate: Basic realm=My Private Stuff');
		header('HTTP/1.0 401 Unauthorized');
		exit;

	} else if (isset($PHP_AUTH_USER)) {
		// If non-empty, check the database for matches
		// connect to MySQL

		mysql_connect(localhost, mysql, sunny)
			or die (Unable to connect to database.);

		// select database on MySQL server

		mysql_select_db(masterstream)
			or die (Unable to select database.);

		// Formulate the query

		$sql = SELECT *
FROM guest
WHERE login='$PHP_AUTH_USER' and 
password='$PHP_AUTH_PW';

		// Execute the query and put results in $result
		$result = mysql_query($sql);

		// Get number of rows in $result. 0 if invalid, 1 if valid.

		$num = mysql_numrows($result);

		if ($num != 0) {
			echo PYou're authorized!/p;	
			exit;

		} else {	

			header('WWW-Authenticate: Basic realm=My Private Stuff');
			header('HTTP/1.0 401 Unauthorized');
			echo 'Authorization Required.';
			exit;
		}
	}
?

This is the error that I get when I point my browser to this page both 
when the script is run locally and on th eremte webserver.
btw: I am running Mac OS Jagaur

Warning: Cannot add header information - headers already sent by 
(output started at /Users/pgarcha/Sites/auth.php:7) in 
/Users/pgarcha/Sites/auth.php on line 13

Warning: Cannot add header information - headers already sent by 
(output started at /Users/pgarcha/Sites/auth.php:7) in 
/Users/pgarcha/Sites/auth.php on line 14


Many Thanks
--Pushpinder



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



[PHP] Help with using phpmailer

2002-10-31 Thread Pushpinder Singh Garcha
Hi All

I am new in the php development world. I have made a simple mail 
application using the phph mail() function.
I needed to use an attachment facility ith the mailing program...so I 
have tried to use this solution called phpmailer()
from http://sourceforge.net/projects/phpmailer

I am not able to find any installation info on the site...Has 
anyoneused this before?

Please help ..

Thanks
--Pushpinder




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



[PHP] help needed with phpmailer

2002-10-31 Thread Pushpinder Singh Garcha
Hi All

I am new in the php development world. I have made a simple mail 
application using the phph mail() function.
I needed to use an attachment facility ith the mailing program...so I 
have tried to use this solution called phpmailer()
from http://sourceforge.net/projects/phpmailer

I am not able to find any installation info on the site...Has 
anyoneused this before?

Please help ..

Thanks
--Pushpinder


Pushpinder Singh Garcha
_
Web Developer
T. Falcon Napier and Associates, Inc.
Off : 704 987 6500
Cell  :  704 236 2939
Fax   :  704 987 5002
_


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



[PHP] Secure PHP Form

2002-10-30 Thread Pushpinder Singh Garcha
hi all

I am using a php form to collect credit card information from clients 
and so have hosted the page on a secure server i.e. https
After filing out the form ...the browser displays a confirmation page.

I am using IE 5.2 on MAC OS Jaguar when I point IE to the secure 
site and submit the form I get this error

Security Failure Data Decryption Failure

When I used Mozilla browser...things worked fine and I got no such error
Please help me

thanks
Pushpinder


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



[PHP] Multiple Addresses Mailer

2002-10-30 Thread Pushpinder Singh Garcha
Hi All

I am creating a mailing list system in which I should be able to 
broadcast a message to  multiple recipients
I am using the mail() function and putting all the recipients names in 
the to argument separated by commas. When I do this the mail goes to 
all the people but they come to know that it was sent to others as well.

I want to be able to send mail so that each recipient thinks that this 
mail was ONLY sent to him/her.

Thanks
--pS

Pushpinder Singh Garcha


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



[PHP] Secure Connection

2002-10-29 Thread Pushpinder Singh Garcha
Hi,

I am making a secure page where users will be able to send credit card 
information.
What kind of support does php offer?

Thanks
Pushpinder Singh Garcha


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



[PHP] PhpMyAdmin Help Needed

2002-10-16 Thread Pushpinder Singh Garcha

Hi

I am wanting to use PhpMyAdmin for my project . I am developing using 
PHP and MySQl and the OS is Jaguar
I have downloaded the latest version of phpmyadmin and have made 
necessary changes in the 'config.inc.php' file
When I try to access PhpMyAdmin using  
http://localhost/~pgarcha/phpmyadmin/index.php; I get the folowing error

Not Found
The requested URL /~pgarcha/phpmyadmin/index.php was not found on this 
server.


Apache/1.3.26 Server at pushpinder-garchas-computer.local Port 80

This is the list of things that I have changed:
1).  $cfg['PmaAbsoluteUri'] = 'http://localhost/~pgarcha/phpmyadmin/';
2).  $cfg['Servers'][$i]['auth_type'] = 'http';  // 
Authentication method (config, http or cookie based)?
3).  $cfg['Servers'][$i]['user']   = 'root'; // 
MySQL user
4).  $cfg['Servers'][$i]['password']  = 'sunny'; // MySQL 
password (only needed
 
  // with 'config' auth_type)

I am not sure about the user attribute that I have put above  
actually pgarcha' is the admin of the system.
Please help me out.

Thanks in advance
Pushpinder


Pushpinder Singh Garcha
_
Web Developer
T. Falcon Napier and Associates, Inc.
Off : 704 987 6500
Cell  :  704 236 2939
Fax   :  704 987 5002
_


[PHP] Jaguar OS help

2002-10-16 Thread Pushpinder Singh Garcha

Hi

i have recently upgraded from OS 10.1.5 to Jaguar. I previously had 2 
users on the system. and using the main login screen I could select the 
user that I wanted to log on as. Now that I have installed Jaguar ...I 
do not get any such screen to select user and so I  am unable to log on 
the other user. I ahve tried to play with System Preferences / Users  
option ...but that did not help.
The other user exists in the /Users Directory.

Thanks
Pushpinder

Pushpinder Singh Garcha
_


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




[PHP] Help Needed

2002-10-15 Thread Pushpinder Singh Garcha

Hi

I am trying to create an online survey using PHP ...I am using MySQL as 
the database and MAC OS Jaguar. I do not need the results to be added to 
the database. I need to be able to send the results of the survey to an 
email addressI know that this is possible using MS FrontPage but 
with PHP I am not so sure. Please help.

Thanks,
Pushpinder

Pushpinder Singh Garcha

Web Developer
T. Falcon Napier and Associates, Inc.
Url  : http://www.masterstream.com
Off   : 704 987 6500
Cell : 704 236 2939
Fax  : 704987 5002



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