Re: [PHP] Re: Need login suggestions

2010-05-02 Thread Bobby Pejman
I would also agree that allowing parent registration could be risky.  What you 
may be able to do just off the top is create a UserLevel field in your users 
table and assign value 1 for all those who say they're students.  That is, if 
you have no student ids at your disposal.

Then, when parents register, you can ask who their kid is, and assign a user 
level 2, for example.  When a parent finishes their registration, don't allow 
them access.  Display a message saying you'll have to call in to get your 
password or something similar.

What you're essentially doing is identifying parents by their user level yet 
making sure parents are parents.

Just an idea I thought I share.
-Original Message-
From: Nathan Rixham nrix...@gmail.com
Date: Mon, 03 May 2010 03:21:12 
To: Ashley M. Kirchnerash...@pcraft.com
Cc: php-general@lists.php.net
Subject: [PHP] Re: Need login suggestions
Ashley M. Kirchner wrote:
 Slightly OT, but I can't think of a better forum to ask this in.  I'm sure a
 lot of us here have at some point or another built a system that requires
 registration to gain access.  What I'm trying to figure is how to set
 different levels of access.
 
  
 
 We're building a large site for a school district, to be used by both
 students and parents.  When a student logs in, they gain some access to the
 site, and when a parent logs in, they gain access to other sections on the
 site.  That's all fine and dandy, it's the actual registration process that
 I'm having a hard time with.
 
  
 
 How to determine if a registration is a student or a parent.  Do I simply
 give them a check box (or other method) to pick from (student or parent) and
 hope they're being honest?  Has anyone here have to deal with that in the
 past, and would you be willing to give me some ideas of what you did?
 Thanks!


Ideally you need to be able to unambiguously identify either a student
or a parent, you're best bet is to go for student - thus try and find a
single bit of information that both a student and you know about that
student, possibilities are:

  student id
  class
  teacher
  year

and so forth.. if the person signing up has any of these things then
they must be a student.

Best,

Nathan


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



[PHP] Overwrite value of true or false in PHP

2009-09-07 Thread Bobby Pejman
Hi,

I noticed that the following returns a 1.

echo (12) ? True : False

I was under the impression that true/false are of type boolean and not int.  
But in php anything other than 0 translates to true, meaning a 1.  What I am 
trying to achieve is for a 1 to be a 1 and a true or false to be a true and 
false respectively and I do not want to put quotes around the word true/false 
either because then it is no longer a boolean but string.

Is it possible to overwrite php's true/false and declare them as boolean?  You 
often see in C++, some use Define().

Thanks.

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



Re: [PHP] Overwrite value of true or false in PHP

2009-09-07 Thread Bobby Pejman
I see what's going on now.  Because of the type conversion, I am writing my 
code such that my return codes are translated to a strict 1 or 0.  The idea of 
having anything other than '' or 0 translating to a true scares me a little but 
thanks for pointing out the === operator.  I had to rewrite a lot of code after 
discovering it.  Good times...

Thanks for clarifying everyone.
-Original Message-
From: Martin Scotta martinsco...@gmail.com

Date: Mon, 7 Sep 2009 16:43:59 
To: bpej...@gmail.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] Overwrite value of true or false in PHP


On Mon, Sep 7, 2009 at 4:14 PM, Bobby Pejman bpej...@gmail.com wrote:

 Hi,

 I noticed that the following returns a 1.

 echo (12) ? True : False

 I was under the impression that true/false are of type boolean and not int.
  But in php anything other than 0 translates to true, meaning a 1.  What I
 am trying to achieve is for a 1 to be a 1 and a true or false to be a true
 and false respectively and I do not want to put quotes around the word
 true/false either because then it is no longer a boolean but string.

 Is it possible to overwrite php's true/false and declare them as boolean?
  You often see in C++, some use Define().

 Thanks.

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


Yes *true* and *false* are booleans.
PHP convert natively different types to boolean in order to help write
sentences like this

if( $object )
{
$object-something();
}

while( $data = mysql_fetch_assoc( $resource ) )
{
print_r( $data );
}

But we you try to print a boolean variable PHP convert it to string: true
becomes '1' and false becomes ''. That's why you can't just echo a boolean
variable to see the value, but you can rely on var_dump to show this.

$bool = true;
echo $bool;
var_dump( $bool );

$bool =! $bool;
echo $bool;
var_dump( $bool );


As other languages PHP as an special operator for checking types while
comparing values.

$a = 'false';
$b = true;

var_dump(
   $a == $b, # -- true
   $a === $b # -- false
);

This happens because values are converted before comparison so, 'false'
becomes true.
PHP converts everything different to an empty string as *true*
This also affect any type of variable.


-- 
Martin Scotta



Re: [PHP] how to check function's execution?

2009-09-07 Thread Bobby Pejman
Your dbupdate is probably executing a mysql_query command.  Is so, update 
results from mysql_query will be either true on success or false on failure.  
If your query also fails due to perms it will return false.


--Original Message--
From: A.a.k
To: php-general@lists.php.net
ReplyTo: A.a.k
Subject: [PHP] how to check function's execution?
Sent: Sep 7, 2009 2:52 PM

hello
I have a problem to check whether a function successfully inject to database 
or not, here is the code :
   if($object-dbupdate())
   echo 'done';
 else
echo 'damn!';
inside the 'if' statement $obj-dbupdate() doesn't execute , how can I 
execute and check if it was a successful inject within this function? is it 
even possible or should I check within class or something? 


-- 
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] PHP6 Stable Release Schedule

2009-09-05 Thread Bobby Pejman
Very nice!  Use of E_STRICT notifies the user of deprecated functions.  Thanks 
for the note. :)

I read that E_ALL forces variable declaration, though I have yet to get that 
working in my code.

--Original Message--
From: Richard Heyes
Sender: richard.he...@gmail.com
To: Bobby Pejman
Cc: php-general@lists.php.net
Subject: Re: [PHP] PHP6 Stable Release Schedule
Sent: Sep 5, 2009 8:11 AM

Hi (again),

 ?php
  error_reporting(E_STRICT);
 ?

This might work better:

?php
  error_reporting(E_ALL | E_STRICT);
?

-- 
Richard Heyes
HTML5 graphing: RGraph - www.rgraph.net (updated 5th September)
Lots of PHP and Javascript code - http://www.phpguru.org
50% reseller discount on licensing now available - ideal for web designers



[PHP] PHP6 Stable Release Schedule

2009-09-04 Thread Bobby Pejman
Hi,

Does anyone know when the stable release of PHP6 be ready for download?  I
hear there's a lot of goodies in version 6 including built-in Caching.
Yum.  Also, will PHP ever implement the Strict mode similar to Perl's 'using
Strict'?

Thanks,
Bobby


RE: [PHP] interview

2006-04-13 Thread Bobby Matthis
How about questions they want to hear?:

1) Would you mind receiving a very large paycheck?

2) Do company cars offend you?

3) Would you like a scholarship offered for every one of your children?


Ask those three questions, and you have hired them.that's all I know
:)

-Original Message-
From: Mad Unix [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 13, 2006 9:22 AM
To: php-general@lists.php.net
Subject: [PHP] interview

can you please send some interview questions for php i have in few days to
inteview some people.


--
madunix
Communications Engineering (RWTH Aachen University) Systems and Network
Engineer MCSE, IBM AIX System Specialist, CCNP, CCSP(SECUR,CSVPN)

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



[PHP] ZEND Certification

2006-04-05 Thread Bobby Matthis
I'm sure this has been asked in the past, but I figured up to date info
never hurts.  I'm going to be scheduling my certification soon, but I wanted
to hear from any of you that recently got zend certified recently and if you
had any advice.

Is there any particular portion I should make sure I have strong knowledge
of more than any other?

Any sites with good advice for this exam?

I have read countless online tutorials, but perhaps there are some good ones
out there I have passed upany good links?

I have read the official Zend Certification guide - which with all the
grammatical mistakes, I still was able to make sense of 98% of it or at
least knew that when they made a mistake, I knew it was a mistake and what
should have been there.

Anyway, any certification advice, any at all would be much
appreciated...

Thanks,
B

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



RE: [PHP] Why does this work on one server, but not another?

2006-03-23 Thread Bobby Matthis
I'm far from an expert:
But maybe one Server has magic quotes on and the other does not.  One
automatically escapes all the characters for you in the data string and the
other does not? 

Bobby

-Original Message-
From: Weber Sites LTD [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 23, 2006 10:53 AM
To: 'tedd'; php-general@lists.php.net
Subject: RE: [PHP] Why does this work on one server, but not another?

Are you escaping the image string before you insert it?

berber 

-Original Message-
From: tedd [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 23, 2006 7:48 PM
To: php-general@lists.php.net
Subject: [PHP] Why does this work on one server, but not another?

Hi gang:

I posted this question to a MySQL list, but apparently it stumped them. So,
I'll ask here:

On one server, the following code works without any problems whatsoever:

--- quote ---

$sqlString = INSERT INTO $dbtable (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', '{$type}', '{$image_large}', '{$image_small}',
'{$width}', '{$height}','{$name}', '{$size}', '{$date_time}',
'{$date_created}'); $result = mysql_query($sqlString)  or die(2. 
Error in query $sqlString  . mysql_error());

--- un-quote ---

However, on another server, it doesn't (remember the code is identical for
both).

I have looked at the PHP Info on both servers, the php versions are
different (4.3.10 v 4.4.2) but the mysql specifics are identical except the
version differs slightly (v 4.1.15 v 4.1.14).

A clue, on the server it chokes on, if I reduce the image size to 100 x 67
pixels, it will work. 
However, if the image is 150 x 100 pixels, or greater, it will crater.

The error message is:

2. Error in query INSERT INTO as_table2 (id, image_type, image_large,
image_small, image_width, image_height, image_name, image_size, date_time,
date_created ) VALUES ('', 'image/jpeg', 'ÿØÿà\0JFIF\
-snip- (the entire text file for the image) 'v_small.jpg', '32',
'2006-03-22 14:10:55',
'2006-03-22 14:10:55') You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax to
use near
'ö~?L-?æÏôÏjâ?(xÏJ?÷ÝԔsíHñåE(?êÏØʍÜÁíÎkiË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0m
ÿ\0¿' 
at line 2

Any ideas?

Many thanks in advance.

tedd
--


http://sperling.com

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



[PHP] explode() an array and grep out a string

2004-02-07 Thread Bobby R . Cox
Hi all.

Is it possible to explode an array and have it exclude a certain 
string.   I currently have an array that is an ldapsearch that returns 
sub-accounts of a parent account. These accounts are then displayed so 
customer can either change the passwd or delete them.Thing is 
ldapsearch returns everymatch which includes the parent account, which 
is already listed on the page as the parent account.  I would like to 
eliminate the second listing of the parent account where the 
sub-accounts are listed.

This is where the array is collected:

$search = ldap_search($connection,dc=isp,dc=com, 
ispParentAcct=$sessUsername);

$entries = ldap_get_entries($connection, $search);
$num = $entries[count];
if ($num) {
$sessSubAccounts = ;
$i = 0;
while ($i  $num) {
$sessSubAccounts .= 
$entries[$i][uid][0] . |;
$i++;
}
}
One thing I would like to point out is that I did not have this problem 
before, but when I updated to a new version of openldap the following 
ldapsearch would no longer return the subaccounts:

$search = ldap_search($connection,dc=isp,dc=com, 
homeDirectory=/home/$sessUsername/*);

Any idea why that may be?

This is where the array is exploded:

?
   $i = 0;
 if ($sessSubAccounts) {

   $accounts = explode(|, $sessSubAccounts);

while ($i  count($accounts) - 1)
  ?
TIA

Bobby R. Cox
Linux Systems Administrator
Project Mutual Telephone
[EMAIL PROTECTED]
208.434.7185

Fix the problem,  not the blame.   

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


[PHP] ldap_add - Error number 65: Object class violation

2004-02-06 Thread Bobby R . Cox
Hi All.

Our ISP has a web page that allows ISP customers to add sub-email 
accounts to their existing accounts.  The information is stored on an 
LDAP server and added via the ldap_add command.

Currently I am getting the following error when trying to add a sub 
account.

Warning: LDAP: add operation could not be completed. in 
/usr/web/pmt.coop/htdocs/userTools/email/doAddCheckEmail.php on line 63
An error occurred. Error number 65: Object class violation

The following is a list of the object classes and attributes as they 
appear in the script.

// prepare data
$info[uid]= $addEmail;
$info[cn]= $sessCN;
$info[l]= $sessL;
$info[givenname] = $sessGivenname;
$info[mail] = $addEmail . @pmt.org;
$info[userpassword] = {CRYPT}.crypt($password);
$info[loginshell] = /bin/bash;
$info[homedirectory] = /home/ . $sessUsername . / 
. $addEm
ail;
$info[gidnumber] = 101;
$info[uidnumber] = 9514;
$info[uidnumber] = 9514;
$info[gecos] = $sessCN;
$info[mailMessageStore] =/home/vmail/pmt/$addEmail/;
$info[ispParentAcct] =$sessUsername;

$info[objectclass][0] = person;
$info[objectclass][1] = organizationalPerson;
$info[objectclass][2] = inetOrgPerson;
$info[objectclass][3] = posixAccount;
$info[objectclass][4] = top;
$info[objectclass][5] = shadowAccount;
$info[objectclass][6] = qmailUser;
$info[objectclass][7] = ispAccount;
The following is the line that is generating the error.

 // add data to directory
$r=ldap_add($connection, $dn, $info);
  if ($r) {
echo Added LDAP data ;
  }
  else {
  echo An error occurred. Error number  . 
ldap_errno($connection) . :
  . ldap_err2str(ldap_errno($connection));
 }

I am beating my head trying to figure this one out.  I know it's an 
object class violation, but I can't figure out if it's one that is in 
place or one that I am missing.  I thought that it may have been the 
ispAccount OC, but removing that and the ispParentAcct did not resolve 
the error.  I hope someone can help.   I apologize if this is better 
directed to the openldap list.

TIA

Bobby R. Cox
Linux Systems Administrator
Project Mutual Telephone
[EMAIL PROTECTED]
208.434.7185

Fix the problem,  not the blame.   

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


[PHP] Dynamic Multi Dimensional Arrays

2003-09-09 Thread Bobby Patel
Hello Everyone,

I want to emulate session objects (as opposed to variables). I stumbled 
upon creating multi-dimensional arrays, so I can do this:
$name = 'Bob';
$year = '2003';

$HTTP_SESSION_VARS[$user][$year] = 'registered';
which gives $HTTP_SESSION_VARS['Bob']['2003'] = 'registered';
but  I want to append an options array in this so what I want is:

$options = array (
  'income' = 1,
  'age' = 25
);
$HTTP_SESSION_VARS[$user][$options] = 'registered';
which gives:
  $HTTP_SESSION_VARS['Bob'][ [income]=1, [age]=25 ] = 'registered';
but this doesn't work. Is there any way I can have objects saved in 
sessions?

Bobby

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


[PHP] Dynamic Multi Dimensional Arrays

2003-09-09 Thread Bobby Patel
Hello Everyone,

I want to emulate session objects (as opposed to variables). I stumbled 
upon creating multi-dimensional arrays, so I can do this:
$name = 'Bob';
$year = '2003';

$HTTP_SESSION_VARS[$user][$year] = 'registered';
which gives $HTTP_SESSION_VARS['Bob']['2003'] = 'registered';
but  I want to append an options array in this so what I want is:

$options = array (
  'income' = 1,
  'age' = 25
);
(Where the $options array is created dynamically from passed POST data).
$HTTP_SESSION_VARS[$user][$options] = 'registered';
which gives:
  $HTTP_SESSION_VARS['Bob'][ [income]=1, [age]=25 ] = 'registered';
but this doesn't work. Is there any way I can have objects saved in 
sessions?

Bobby

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


Re: [PHP] Dynamic Multi Dimensional Arrays

2003-09-09 Thread Bobby Patel
Brad Pauly wrote:
$HTTP_SESSION_VARS[$user]['options'] = $options;
yes this is what I wanted.

You could then add elements to this array like this:

$HTTP_SESSION_VARS[$user]['options']['registered'] = 1;

Is that what you are trying to do?

- Brad
I will try this out and see what happens.

Thank you Tom and Brad.

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


[PHP] Re: on specific time in the month do script!!

2003-08-07 Thread Bobby Patel
look into executing your php script through cron. (Cron is a Unix schedular
and nothing to do with PHP). Or you can use Tash Schedular (on windows
servers, I guess).

Also, check the archives but I think this issue was answered as above.

Nabil [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 HI all;
 how can i run somthing or a function that only run on every month from the
 first untill the second on a specific time:

 in other word :
 the first two day of every month but it end on like 2pm of the second..

 if ( today is 1/of any month untill 2/ of the same month at XX hour )
 { return true}
 else
 {return false}


 thanks
 Nabil





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



[PHP] Re: how to auto create a new page on the fly

2003-08-05 Thread Bobby Patel
also look into output buffering.
so you would then do these steps

1. start buffer
2. redirect all output to varaible $output
3. echo Static HTML code (from opening to closing html tags)
4. when completly done all output, the variable $output should have all the
html code
5. then using filesystem functions (fopen, etc...) dump variable into that
newly created file and then you are done.

If you have questions just post onto the list, but check the filesystem
methods and the output buffering methods (ob_start, ob_flush, etc...).

Bobby

Dougd [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I would like to create a new page on the fly - basically having the PHP
file
 to export content into a new static HTML file and save it as content.php.

 Make sense?

 Appreciate your help and insights.

 -Doug





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



[PHP] Re: Mail funtion question

2003-07-29 Thread Bobby Patel
I haven't worked with PHP mail for a while, but since no one has responded
I'll give you something to consider:

1. Why don't you try error suppression , @ ? or you can set error_reporting
down or you can capture all output by using output buffering.
2. You can trap the invalid email, but it may be *more* complex and result
in a slower script. You will have to evaluate this for yourself,

$emails = array (); #array of email info
# In the form
# $emails[0] = array (email = mailto:'[EMAIL PROTECTED]' , name = 'Reciever
Name');
# $emails[1] = array (email = mailto:'[EMAIL PROTECTED]' , name = 'Reciever Name
2');

$invalid_emails = array();
foreach ($emails as $index = $info){

$result = @mail ($info['email'], 'Bulk Newsletter Subject', 'email
messafge') ;
if (!$result) {
$invalid_emails [] = $info['email']; // capture invalid email
}
}

Please note, that the code above will call mail once for each email, so if
you have 100 emails this will run 100 times, where as if you stacked all the
emails into one mail call. But then you may not be able to find the invalid
emails.




Irvin Amoraal [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I am using the PHP mail() function to send subscribed-to bulk email. It
 successfully sends emails to the valid email addresses, but I get a series
 of error messages at the top of the PHP page like:
 /home/[my folder]/dead.letter... Saved message in
 /home/[my folder]/dead.letter 123... User unknown

 I'm almost positive the error msgs are caused by invalid email addresses
 that are stored in the database.

 I have two questions:
 1. How can I suppress the error msg's? @mail?
 2. Can the error be trapped and the invalid email address captured to be
 spit out in code?

 Thanks for your help.

 Irvin.





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



Re: [PHP] PHP should know my data!

2003-07-25 Thread Bobby Patel
Robert Cummings [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Unfortunately I don't think some people got the joke. Next thing you
 know their going to complain that PHP should have told them the
 punchline ;)

I guess I got burned on that. I honselty though I could save one soul after
not helping out that beuford guy with the longest thread that I have seen
I'm really getting annoyed with PHP.

I guess this shows that I'm not over 35 though, since I am not that familiar
with COBOL, and took what John said with a grain of salt.

Anyways, it's good to see some light humour after see that extremely long
eye sore of a thread.

Have a good one.
Bobby

 Cheers,
 Rob.





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



[PHP] Re: Hiding URL's...

2003-07-24 Thread Bobby Patel
If you want to restrict the download to once per user, the best is to use a
database (or a I guess a file) which keeps tracks of who can download it and
downloaded status, etc..

I haven't worked directly with this issue, but I would start by having a
table Permissions with columns username, articleID, downloaded, authKey (and
whatever else you may want). Then present the link to the user as
getFile.php?auth=$authKey.
where getFile.php is
?php
$query = select downloaded, articleID from Permissions Where authKey =
$_POST['auth'];
$result = mysql_query ($query);
if ($result) {
$row = mysql_fetch_array ($result, MYSQL_ASSOC);
if ($row ['downloaded'] == 'N') {
# Update table and set downloaded = 'Y'
# Select the text of article from Articles table or from disk and
store in variable $contents
header (content/type pdf); # or text/plain, or whatever type you
need
echo $contents;
exit();
}
}
?

OK, I got tired of coding near the end (since I know you can do that), but I
think that this may be better. If you just pass the file name to the script
then you have to do checks that the user has access but how? Unless the user
already logged in to a members area I guess.

Anyways, there are problems to this script, for example if the download was
terminated half way through, it's already set that it has been downloaded
(maybe you can do the update query after the echo $contents, but I don't
think that will help).

That's my $0.02
Bobby


Tristan Pretty [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
com...
 I read this article, and thought it was perfect for me... Just the same
 prob I'm having...
 http://forums.devshed.com/archive/5/2002/06/2/37330

 However, I don't understand how to get the file into an A tag where it
 can still find the file, AND make the URL useless if copied and pasted..

 Am I missing the point, or is it staring me in the face?


 *
 The information contained in this e-mail message is intended only for
 the personal and confidential use of the recipient(s) named above.
 If the reader of this message is not the intended recipient or an agent
 responsible for delivering it to the intended recipient, you are hereby
 notified that you have received this document in error and that any
 review, dissemination, distribution, or copying of this message is
 strictly prohibited. If you have received this communication in error,
 please notify us immediately by e-mail, and delete the original message.
 ***





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



[PHP] Re: PHP Webpage like MySql- need to be able to see all fields and edit

2003-07-24 Thread Bobby Patel
You could look at a nice GUI package that does all the database
modifications , its called phpMyAdmin (www.phpmyadmin.net).

But maybe this is too extrememe to what you want.

Matt Hedges wrote in message
news:[EMAIL PROTECTED]
 Hello.  I am building a webpage for a sorority- http://www.olemissaoii.com
.

 I built a basic php script where they add the sisters and their names,
grad.
 date, and email.  Is there anyway to build a page that shows all the
fields
 where someone could go in and edit/add what they need?  What I basically
 want is a webpage that works like MyCC SQL Database.  The only thing I've
 been able to figure out is a basic update page, but using that they have
to
 type in everything again- so for example if they want to change the email
 address, they'd have to retype the names and grad. date.  So I'd like a
 script that shows all the rows and columns and allows someone to go in and
 change whatever field they want.

 Any help greatly appreciated,
 Hedges




 --
 ___
 | Matt Hedges
 | http://hedgesinnovations.com
 |





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



[PHP] Re: PHP webpage like MySQL, PART 2

2003-07-24 Thread Bobby Patel
Are you talking about editing mutiple rows at the same time?
if so there is no efficient way to check what row has been edited and which
haven't. What I would is use HTML variable arrays for the names of the
fields.
example you have input type='text' name='FirstName' size='20'
maxlength='20' value='Allison'  change the name attribute to name =
[data][$id][FirstName], so now you have all variables grouped (note the use
if a fixed index 'data', explination in foreach loop ). Then your script
will loop through the POST variables and do sequential UPDATES
example
foreach ($_POST[data] as $ID = $Field) {
$query  =  Update tablename Set First = '$Field[FirstName'], Last =
'$Field[LastName'],  Where id = $ID; #List all fields in the set clause
mysql_query($query);

}

The reason for the initial 'data' index is so you can safely loop through a
cetrain part of the post array. If you left that out you would deal with
extra variables like submit, and other hidden fields.

It's a little hard to work with multi-dimensional arrays, so what I usually
do to help me is use the var_dump() on the passed POST array.
So take a look at var_dimp(), HTML with array indexes, the foreach loop
construct.

HOWEVER, if you need to just let the user edit 1 row, what you have is fine
all you have to do is pass the id number thourgh a HTML hidden field. So
when you pull the rest of the fields and spitting out HTML spit this out
somewhere in between the form tags :: input type='hidden' name='id'
value='$id' 

Bobby


Matt Hedges [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Many hanks for ya'lls help earlier.

 I've figured out how to pull the data and edit it:
 http://www.hedges.org/aoii/olemiss/updatesister.php

 However, for some reason I can't get it to edit whatever row.  In the code
 (pasted below) I have to specificy $id=row to edit...

 I can't figure out how to make it to where the user can select the field
 (which is the id/row) and edit it.  I've tried putting a ?id=# at the end
of
 the url, but that doesn't work...  Any thoughts?  So what I want is where
it
 says

 $id=1

 to have it someway where that is a variable that the user can define...





 Thank you.
 Matt



 --
 ___
 | Matt Hedges
 | http://hedgesinnovations.com
 |





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



[PHP] Re: PHP should know my data!

2003-07-24 Thread Bobby Patel
auto-populate data, as in putting in mock data depending on column type? or
transferring data from another data source.
If the former, you can look at 3rd party sources (I think I saw one from
winSQL), if the latter you can convert any data source to a (tab, comma,
etc.) delimeted  file which you can load into MySQL through your own PHP
script or I'm sure there is some php script out there that loads in CVS
files.

John Manko [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I just wrote a web app, but I'm completely disgusted with PHP.  The
 application works great, but PHP is not smart enough to know what data
 belongs in my database.  Really, I have to enter the stuff in myself.  I
 spent 2 long days writing this (sweating and crying), and you mean to
 tell me that it doesn't auto-populate my database information?  Come on,
 people!  Data entry is the thing of the past!  Maybe I'll convert my
 codebase to COBOL or something. At least, it has proven experience with
 user data!  Sometimes I wonder how long this innovative technology
 will last when there are incompetent languages like PHP, Perl, and
 Java.  Color me disappointed.

 John Manko
 IT Professional





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



[PHP] Re: Input Submi Help

2003-07-17 Thread Bobby Patel
I thought you could, but actually I dont think you can ... however there is
this little hack I just came up with.
FORM Example
form  action = 'redirect.php

input type = 'submit' name = 'Page1' value = goto Page 1
input type = 'submit' name = 'Page2' value = goto Page 2

/form

Code for redirect.php
?php

# Has button 1 been pushed/sent?
if (isset ($HTTP_POST_VARS['Page1'])) {
include ('page1.php');
exit(); #optional depending on programming style
}
# Has button 2 been pushed/sent?
elseif (isset ($HTTP_POST_VARS['Page2'])) {
include ('page2.php');
exit(); #optional depending on programming style
}
# Both buttons NOT been pushed/sent
else {
die ('no page selected');
}
?

I hope you are familiar enough with PHP to understand the above. Basically
depending on what Page variable was passed from the submit button, then you
pull that script (either page1.php or page2.php).  Note: The name attribute
of the submit button must match in the POST array and also are case
sensitive.


Bobby


Matt Palermo [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a script that contains a form which goes to page1.php on the
 click of a submit button.  Inside the form are lots of checkboxes and
 things to fill out that get passed to page1.php.  I want to put another
 button in there that send all the same names and values of the
 checkboxes to page2.php.  Is this possible to have 2 buttons going to 2
 different places, but using the same data for all other form elements?
 I would really appreciate any help I can get.  Thanks.

 Matt




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



[PHP] Re: Value for entire file

2003-07-17 Thread Bobby Patel
it should be in the $_GET or $HTTP_GET_VARS array in the index.php script.
put this at the top of your index.php script

var_dump ($_GET); # or $HTTP_GET_VARS depending on PHP version

and see if the value is there. Also, if you are using the value in a
function and you have PHP  4.1.0 (I think), GET array is not global so to
get this value you have to declare the array global
example

function some_function () {
global $_GET;
echo   $_GET['year'];
}

NOT

function some_function () {
  echo   $_GET['year'];
}


Bobby
Uma Shankari T. [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 Hello,

   I am facing one problem..i am getting one variable value from another
 file by using href..I need to use that value in the entire file..how can i
 do that..??

 for example i am using the href like this..

 a href=$next/index.php?year=Apr1998 target=right

 i am passing the Apr1998 to the index file..i need to use the Apr1998
 value fully in any places in index.php..how can i use that ??

 please advice me..

 Regards,
 Uma




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



[PHP] Re: session handling works on local server, but not when uploaded to ISP

2003-06-28 Thread Bobby Patel
It could be a warning in your script. On your local server, maybe you have
error reporting set to minimal (ie. don't report warnings), whereas the ISP
server might have it turned up higher by default.

near the top of your script reporter_view.php put in  the line
error_reporting(E_ALL); ie.
?php
error_reporting(E_ALL);
 PHP code
?

Maybe line 5 is causing a warning? After you have error_reporting on full
you may be able to solve the problem on your local server.

For more info checkout error_reporting() on php.net

Bobby

Anders Thoresson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

  I've a login script that works fine on my local server, but when I runs
it
 from my ISP I get the following error:

 Warning: Cannot send session cookie - headers already sent by (output
 started at /export/home/thore/public_html/phptest/reporter_view.php:5) in
 /include/accesscontrol.php on line 9

 Warning: Cannot send session cache limiter - headers already sent (output
 started at /export/home/thore/public_html/phptest/reporter_view.php:5) in
 /include/accesscontrol.php on line 9

  If I had made any mistake in my handling with the session functions,
 shouldn't that be the case also at my local server?

 --
 anders thoresson



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



Re: [PHP] Newbie and learning

2003-06-28 Thread Bobby Patel
I wanted to attach one more point (esp. since this is an ecomm solution),
you should also check your POST variables (in addition to the GET varaibles)
to make sure they are clean and what are expected. It's not that hard to
change posted values.

Bobby

Daniel J. Rychlik [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 PHP is, arguably, the better way to go when developing an ecomm solution.
 This list is full of very intelligent programmers that will help or direct
 you to the proper documentation.
 If you use $_GET you will be able to pass value pairs in the url.  Make
sure
 that in your data check script that you specifically assign variables to
 your $_GET in order to prevent malicious use.  $HTTP_POST_VARS is probably
a
 better way to go here.  Its cross platform and will almost guarantee that
 you will be able to use on any server.

 $HTTP_POST_VARS['name'];
 $HTTP_POST_VARS['email'];


 Good Luck!
 -Dan

 - Original Message -
 From: Larry R. Sieting [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, June 27, 2003 5:22 PM
 Subject: [PHP] Newbie and learning


  Hello All,
 
  I have been reading and digesting information from this list for about
two
  weeks now.
 
  I am doing some work and testing (both) and learning php on the way.
 
  Now I have seen several replies about using $_GET[] and $_POST[] and
that
  if you ARE sending variables using the URL you _should_ use $_GET[]
 whereas
  if you are _not_ passing variables in the URL you should use $_POST[].
 
  Is this correct?  I just want to make sure I have it in my mind so that
  when I start passing info via url I use the right method.  I ask this
  because I have a friend that wants to have me setup an e-commerce site
for
  him.  I am trying to decide if I should use ASP (gasp) or PHP (yeah).
It
  will be a db driven site which will have images in the db and probably
  multiple tables with inner and outer joins and search systems.
 
  Yes, I have the 4000+ (pdf) page manual on my system and refer to it and
  read sections of it at a time (chunk).  And I hope that I will be able
to
  answer most of my own questions there or in other resources before I
have
  to submit to the list.
 
  Thanks.
 
  Larry R. Sieting
 
 
  --
  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] Re: Weird comparison error.

2003-06-28 Thread Bobby Patel
In PHP there are two operators for comparisons, the double and triple
equivalance.

Double equivalance just check's the boolean type so if (0 == 'n') is
translated to if (False == False), where as triple equivalance checks the
data types as well so if (0==='n') becomes if (Int(False)==String(False))
but since the data types don't match that would be False.

to get a better reference check PHP.net for 'Bolean Types' , because  I
think I dodn't explain the double equivalance right, and also it will
clarify situations of the Null type.

Bobby


Rob Adams [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I don't need anything fixed, I'm just curious about something I noticed.

 I'm doing a comparison between a variable and a hard coded char.  Like
this:
 if ($k1 == n)

 The variable is usually the first key in an array (0) so it should usually
 evaluate false, but it was true every time until I changed it to:
 if ($k1 === n)

 So I'm assuming that it decided that since $k1 was an int to convert n
to
 an int (which would be 0) and conclude that 0 does indeed equal n.  So I
 decided for fun to try:
 if (n == $k1)

 And it still was true everytime.  So why does it always try convert my
 literal to an int instead of use the variable as a string?

 Just curious.  Thanks.

   -- Rob





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



[PHP] Re: differences in session handling between 4.1.1 and 4.3.1

2003-06-28 Thread Bobby Patel
maybe compare the php settings for both servers (using  phpinfo()). Also
check the register globals setting.  I know this might not be a big help,
but it's a start.

good luck

Bobby
Anders Thoresson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Are there any big differences in session handling between 4.1.1 and 4.3.1
 of PHP. Almost nothing works like it should since I have moved my site
from
 my local server (4.3.1 on Win2000) to my ISP (4.1.1 on SunOS 5.7).

 I just started to dump my four $_SESSION-variables on top of every page,
 and to my big suprise they changes all the time.

 At login is store the users userid in $_SESSION['u_id']. At later times,
 I'm working with $_POST['u_id'] when for example changing administrators
 for different parts of the site. When I'm doing this, also
 $_SESSION['u_id'] changes.

 And at my localhost, $_SESSION's stays put.

 I'm going crazy here.

 --
 anders thoresson



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



[PHP] Re: nl2br and br /

2003-06-27 Thread Bobby Patel
Since I haven't had any problems with br / I really don't care. However,
if you are concerned why don't you write a function like this:

my_nl2br($targetStr, XML = true) {
$buffer = '';
if (XML) {
return nl2br($targetStr);
}
else {
$buffer = nl2br($targetStr);
$buffer = str_replace ('br /', 'br', $buffer );
return $buffer
}
}


You might be able to call the function nl2br but I am sure you will get  a
function name class or function re-declartion error, but if you are doing
some OOP then you may be able to overide that.

Maybe this is not the post you were looking for, anyways my 2 cents.

Bobby

Raymond C. Rodgers [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm sure that this has probably been discussed before, but I couldn't
 seem to find any direct references to such a discussion. The line break
 tags that nl2br() produces have the forward slash embedded in them,
 which is not in the HTML 4.x standard. While this isn't a big deal
 really, the fact of the matter is that web browsers built to the
 specifications of the W3C HTML 4.x standards may not like this. In fact
 the W3C HTML validator reports this as an error.

 I read on the function description page that this is apparently an XHTML
 curiosity. Would it be possible for someone to add an optional flag to
 nl2br() to specify HTML rather than XHTML compliance? For instance, a
 call to nl2br() without XHTML compliance might look like this:

 $mystring=nl2br($myotherstring,false);

 For compatibility's sake, maybe default the flag to true and make the
 flag optional. If unspecified, the call to nl2br() would continue to
 function as it always has. However if specified, and set to false, the
 function would return the HTML compliant break tag br.

 Thoughts? Comments?
 --
 Raymond C. Rodgers
 http://bbnk.dhs.org/~rrodgers/
 http://www.j-a-n.net/




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



[PHP] Re: Array Dump

2003-06-27 Thread Bobby Patel
look at strlen() at php.net
Daniel J. Rychlik [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hmm, I just noticed that array dump counts the number of charaters and white
space and lables that number string...  What function name is that ?  The
string counter I mean ?

-Dan



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



[PHP] Re: Query mysql highest id number

2003-06-22 Thread Bobby Patel
you can you the Mysql MAX function, I believe
Select Max(ID) from Table;

Also, you may want to look at PHP's mysql_insert_id(), (if you are trying to
find the id number after an insert (if that's what you want)).


Chris Schoeman [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I want to make a query in a mysql database with as result
 the row with the highest id number. How can I do that?





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



[PHP] Re: Processing Form Data /w $_POST

2003-06-19 Thread Bobby Patel
What kind of 'logical' order do you need for the Post array?

To clarify:
Do you need to write to a file the POST variables passed to the script?


Kyle Babich [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I have a form (setup.php) that passes values to processSetup.php when they
are written into setup.txt.  I'm trying to instead of writing every
idividual value into setup.txt from setup.php, write a loop that will take
as many values as there are in the $_POST array and write them all into a
single array in logical order in setup.txt.  I'm new to php and can't figure
out how to do this.  I'm thinking of something like...

for ($_POST) {
 fwrite($setup, /*something to add current $_POST value to the end of an
array within $setup*/);
}

How should I go about this?

Thank you,
--
Kyle



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



[PHP] Re: Processing Form Data /w $_POST

2003-06-19 Thread Bobby Patel
$setup_filename = /path/to/file/on/the/server/;

$fd = fopen($setup_filename , 'a');  #a for appending to file, w to write
from the beginning checkout php.net for more details on fopen

$report = ;
#
#Apply any re-ordering of the Post array here to you 'logical' order
# look at the  manual for asort, ksort, etc

foreach ($HTTP_POST_VARS as $index = $value) {
$report = key:.$index. = .$value.\n;
}

fwrite($fd, $report );
fclose($fd);




Kyle Babich [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I have a form (setup.php) that passes values to processSetup.php when they
are written into setup.txt.  I'm trying to instead of writing every
idividual value into setup.txt from setup.php, write a loop that will take
as many values as there are in the $_POST array and write them all into a
single array in logical order in setup.txt.  I'm new to php and can't figure
out how to do this.  I'm thinking of something like...

for ($_POST) {
 fwrite($setup, /*something to add current $_POST value to the end of an
array within $setup*/);
}

How should I go about this?

Thank you,
--
Kyle



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



Re: [PHP] Re: Processing Form Data /w $_POST

2003-06-19 Thread Bobby Patel
Yes that's right. this was just from the top of my head and it's early for
me.

it should be
$report .= key:.$index. = .$value.\n;

as Dan has pointed out.
Dan Joseph [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

  $report = key:.$index. = .$value.\n;

 actually, shouldn't it be:

 $report .= key:.$index. = .$value.\n;

 If you don't have the . there, its going to keep overwriting the report,
 and thus writing only the last $report item that was built.  .= would
concat
 'em all together.  Am I misunderstanding?

 -Dan Joseph




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



Re: [PHP] call-time pass-by-reference feature really deprecated?

2003-06-19 Thread Bobby Patel
Isn't Call-time pass-by-reference the following

$variable = myFunction1($x); Where
myFunction1() is defined as function myFunction1($x)

Where as pass-be-reference is called as
$variable = myFunction2($x); Where is defined as function myFunction2
($Obj);

I think the latter is better anyways, because the caller shouldn't know the
internals of  the function, so you don't know if the function will copy the
argument and use that instead.

Dorgon [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
  Maybe, there's a setting for this in php.ini.

 yes. there is:
  declaration of [runtime function name](). If you would like to enable
  call-time pass-by-reference, you can set
  allow_call_time_pass_reference to true in your INI file.

  pass-by-reference has not been dropped, it is Call-time
pass-by-reference
  which is being deprecated.

 so call-time pass-by-reference is giving parameters as reference to
 functions, e.g.

 function returnObjectToAccumulator($obj) {...}

 If this feature is really dropped, how would you implement
 ConnectionPools for DB-connections for instance, or any classes
 managing a set of object and providing them by returning references?

 many OOP design patterns (primarily adopted from java) would not be
 possible anymore. I think this would be worth talking about.

 Is there any plausible reason for that decision?

 /dorgon




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



[PHP] Re: file downloading

2003-06-19 Thread Bobby Patel
create a script getFile.php

when this is called first update the database, then  using header you can
stipulate what type of document it is and it will prompt for download
for example  for a Word document
?php

#Query here to update the database

#then after successful  output the headers that will prompt for download

# $data  is the raw data of the document either from an fopen or from
the database
Header( Content-type: application/msword);
Header('Content-Length: ' . strlen($data));
Header('Content-Disposition: attachment; filename=document.doc');

echo $data;

?

Notes:
make sure you don't echo anything before the headers even suppress any
errors that may come from query
you can call the script through the web page as follows
a href ='getFile.php' Click here to download the document /a


Mark Roberts [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I need to provide a way for users to download data files from a web site.

I know that I could have then right click and save-as, however, I need to
record this action in a database. If they just right click, I don't have any
way to trigger the script to record the transaction.

Does some one have a good way to do this, or at least give me some ideas?
Thanks.

Mark Roberts
Sr. Systems Analyst







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



[PHP] Re: Pipe $var to a shell command

2003-06-13 Thread Bobby Patel
maybe try exec?
$instruction = $myOutput  command ;
# for piping (as I recall) I used to do the input from the right, but I
don't think that will make a difference
exec ($instruction);


Bobby
exec (command
Tim T [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a mem var $myoutput I would like to pipe it to the input of a
 shell_exec command.

 I tried  shell_exec(command  $myoutput) however this is not quite
right.
 Anybody have any ideas??





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



[PHP] Re: General question...

2003-06-12 Thread Bobby Patel
You can try using the cURL package with PHP. I use it with a system call.

$curl_path = /usr/bin/curl; # or full path of curl

$post = 'amount=3.40merchant_id=2351235'; #POST  key value pairs with ,
these variables will be POSTed to site

$command = $curl_path -d \$post\ $gateway_url;

exec($command, $responce);

the $responce variable holds any out put from the site.

Then you  will have to parse the HTML (which I hate).

The above technique is best for when the site you call post back variables
(thus no parsing).

Now, this is with PHP with no cURL package, if you have it installed than
maybe you can use the cURL Library to do the above.

Valentin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hi all,

 is it possible with php:
 first to pass request to another URL and after that to get the html
responce
 as a string and put it into php $variable?

 best,





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



[PHP] Re: REDIRECT

2003-06-07 Thread Bobby Patel
not with php directly, but you can do that with HTML meta tags, check google
for Meta refresh


Dale [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Does anybody know of a way to redirect to another page once you have
already
 outputted html to the screen. In other words, I want to output some text
to
 the screen for 10 secs and then re-direct to another page.

 Thanks,
 Dale





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



[PHP] Re: How do I display new lines in a textearea?

2003-06-06 Thread Bobby Patel
this is discussed in the posted comments under the function section of nl2br
on php.net.

But from what I remember there is no br2nl() (unfortunately).

just goto php.net/nl2br and search the posted comments for br2nl


Bobby


Petre Agenbag [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi

 I want to have a textarea that contains details read from a mysql table,
 but I want to echo each row so that it is on a new line. What is the
 new-line character for a textarea? ( in effect the reverse of nl2br()
 )

 Thanks






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



[PHP] Re: Using register_globals

2003-06-05 Thread Bobby Patel
If it's a preference it's a bad one.  Have register globals set to ON is one
way of leaving your script open to being exploitable.  I would suggest that
if you really need to use that code then either modify it or write something
from scratch and use that code as a guide line.

search php.net for register globals and the warnings associated with it.

Bobby
Todd Cary [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have noticed that quite a few applications are designed with the
 assumption that register_globals = Yes; in other words, the
 application does not use $HTTP_xxx_VARS.  In contrast, I always retrieve
 my vars.

 Is there a preference?

 Todd
 --







 I have noticed that quite a few applications are designed with the
assumption that register_globals = Yes; in other words, the application
does not use $HTTP_xxx_VARS.  In contrast, I always retrieve my vars.

 Is there a preference?

 Todd

 --





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



Re: [PHP] Re: Using register_globals

2003-06-05 Thread Bobby Patel
I agree that you can write secure scripts with register_globals set to ON.

I usually think that alot of rookie PHP programmers (I just started PHP a
year ago, myself) read the list, and the way I figure is that it is good to
make readers of the list aware of the issues of register globals.

Plus, after coding in both states of register globals, I personally like
explictly referring to the assoc array $HTTP_xxx_VARS to retrieve the
variable. Coders are familiar with magic numbers and we should stay away
from that, but to me register_globals seems like magic variables I look at
this variable and I think to myself Where did this variable come from?
(but that's just me).


Rasmus Lerdorf [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Wed, 4 Jun 2003, Jay Blanchard wrote:
  [snip]
  On Wed, 4 Jun 2003, Jay Blanchard wrote:
   [snip]
   Have register globals set to ON is one way of leaving your script open
 
   to being exploitable. [/snip]
  
   Please explain this, how does it make it more exploitable? I think
   that this is only true if the code is sloppy.
 
  Correct, if you properly initialize your internal variables there is
  nothing insecure about leaving register_globals on.
  [/snip]
 
  Then why has there been such a big deal about register_globals security?
  Is it because so much code is sloppy?

 From a robustness perspective, it is not a bad idea to be more explicit
 about where your user data is coming from and being able to easily
 distinguish user-oriented data from internal data.  What has been blown a
 bit out of proportion is the idea that you cannot possibly write secure
 code with register_globals on.  That is of course completely false, but
 you do have to be a little bit more careful which why the default was
 changed to error on the side of safety.

 -Rasmus



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



[PHP] (no) file creation by convert (ImageMagik)

2003-06-05 Thread Bobby Patel
I am working on creating a thumbnail script but the obsticle is that
'convert ' doesn't create a file from the script. I am doing a system call
with the following

?php
exec('convert -size 400x293 /home/original.gif -resize 8x8
/home/thumb.gif');
exec('cp /home/test1 /home/test2'); # Copying an existant file does work,
but calling convert to create a file doesn't
?

Where thumb.gif is the name of the new file to be created.

After I run this script, no file is created, however if I run it from the
command line (as httpd or any user) it works.

Bobby












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



[PHP] Re: Text file breaking!

2003-06-05 Thread Bobby Patel
try this
$string = ereg_replace ('\r\n|\n|\r', 'br', $string);
OR
$string = nl2br($string);

NOTE: for me the first case will remove the newline, whereas the second will
keep them (It might be becuase of my old php version [4.06]?)


Zavaboy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Ok, I don't get it... I put a string to one line ( $string =
 str_replace(\n, br, $string); ) but when I put it in a text file I
see
 breaks right before br. For example:

 I have a text area and type:
 1
 22
 333

 then, I take that string and replace \n with br.
 $string = str_replace(\n, br, $string);

 then, I put the string in a txt file...
 and here's what I see in the text file:
 1
 br22
 br333

 instead of:
 1br22br333

 How can I make it that way?
 Thanks in advance!

 --

 - Zavaboy
 [EMAIL PROTECTED]
 www.zavaboy.com





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



[PHP] sound

2003-05-30 Thread Bobby
Does anybody know of a way under php to add a background sound to a
webpage...i have sound on my page when it's local but as soon as I copy
it to the server, nothing :(
thanks

-bobby
Bobby Brooks
[EMAIL PROTECTED]  http://bobby-brooks.com
Public Key = bobby-brooks.com/pubring.pkr

Simulated disorder postulates perfect discipline; simulated fear
postulates courage; simulated weakness postulates strength.
Sun Tzu - The Art of War (Chap 5-17)

ICQ-33647303 AOL_IM-TX Copenhagen
Yahoo-tx_copenhagen1977  [EMAIL PROTECTED]



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



RE: [PHP] sound

2003-05-30 Thread Bobby
I know that...i'm just curious if somebody knows of a bit of php code
outside of the usual html embed src and background tags for sound on a
webpage...and I'm trying to avoid having to add flash unless I have
to...but yes that is an option
Thanks
-bobby

 -Original Message-
 From: Julien Wadin [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 29, 2003 9:40 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] sound


 Php is on the server, not on the local client
 You can make it with Flash

 -Message d'origine-
 De : Bobby [mailto:[EMAIL PROTECTED]
 Envoyé : jeudi 29 mai 2003 21:39
 À : [EMAIL PROTECTED]
 Objet : [PHP] sound


 Does anybody know of a way under php to add a background
 sound to a webpage...i have sound on my page when it's local
 but as soon as I copy it to the server, nothing :( thanks

 -bobby
 Bobby Brooks
 [EMAIL PROTECTED]  http://bobby-brooks.com
 Public Key = bobby-brooks.com/pubring.pkr

 Simulated disorder postulates perfect discipline; simulated
 fear postulates courage; simulated weakness postulates
 strength. Sun Tzu - The Art of War (Chap 5-17)

 ICQ-33647303 AOL_IM-TX Copenhagen
 Yahoo-tx_copenhagen1977  [EMAIL PROTECTED]



 --
 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] Re: Create Links on the fly?

2003-05-29 Thread Bobby Patel
###HTML snippet
form action = redirect.php
Enter Number : input type=text name=number
/form


###PHP

?php
$number = $HTTP_POST_VARS['number']; # or $_POST['number']; depnding on PHP
version
header (Location: http://www.mypage.com/.$number);
exit();
?

### NOTE: I just wrote this on the fly so there is no error checking or
sytnax checking
 Hopefully this makes sense and doesn;t need explanations, but if so
just post the list and me and I'll get back to you.


Bobby
Chase [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Salutations!

 I am trying to do something fairly simple, but I can't seem to make it
 work...  I want to have a form field on a page that the user will put in a
3
 to 5 digit number and when they click on Submit that number will become
 part of an URL that they are forwarded to.

 For example, if the user put in the number 123, then when they click on
 Submit they would be pushed to http://www.mypage.com/123.

 Can anyone offer help??





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



[PHP] RE: [newbie] drop down boxes

2003-04-06 Thread Bobby Rahman


Hiya,

I have created a dynamic table within my form.
Above the table I want to insert a filter to order by:the column names
Here is the static list:
select name=select4
   optionSeverity/option
   optionCrash/option
   optionMajor/option
   optionMinor/option
   optionReview/option
 /select
What I need suggestions on is:
1. recommended tutorials on lists and logic behind them.
2. How does the selected item in the list get stored (a variable?)and how 
can I place that in such a way to ORDER BY $filter_selected
3. also simple snippets of code always is appreciated (No one wants to 
reinvent the wheel) :)

Thanx

Bob

_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

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


[PHP] RE: newbie alternate row colours in dynamic table

2003-04-05 Thread Bobby Rahman


Hiya I have a dynamic table and am trying to get the rows to be two 
different alternate colours. well Ive looked at a couple of snippets of this 
colour code and previous mails regarding this. Im having major troubles 
intergrating any of these suggestions with my code. Can anyone suggest where 
I am going wrong. Main problems are
1. where to put the loop for changing the colour (complicated due to the 
loop retrieving data from db)i.e in the do loopin the while loop?

2. Also how to echo my rows in the colours.(something like this I think)
print tr bgcolor='$trcolor'$db_fetch['bugid']; ?/td;
e.g here is the code snippet for alternate coloured rows
$trcolor=#F0F8FF;
while ($myrow = mysql_fetch_array($result)){
$colorset=0;
if ($trcolor=='#F0F8FF'){
$trcolor='#B0C4DE';
$colorset=1;
}
if ($colorset==0){
if ($trcolor=='#B0C4DE'){
$trcolor='#F0F8FF';}
}
print tr bgcolor='$trcolor';
}


I have included my table file.  Any suggestions would be great (even further 
suggestions of code snippets I can look at)

thanx

here is my table.:
?
require_once('db_api.php');
db_connect();
$querystring= SELECT * FROM bug;
$db_result = mysql_query($querystring) or die(mysql_error());
$db_fetch = mysql_fetch_assoc($db_result);
$db_totalrows = mysql_num_rows($db_result);
//echo $db_totalrows;
?
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head
body bgcolor=#FF text=#00
pnbsp;/p
table  border=2 cellspacing=2 bgcolor=#FF
 tr
   td colspan=9 bgcolor=#FFnbsp;/td
 /tr
 tr
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifbugid/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifstatus/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifseverity/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifsummary/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifdescription/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifdate_opened/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifestimation_completion/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifrelated_file/font/td
   td bordercolor=#99font size=-1 face=Verdana, Arial, 
Helvetica, sans-serifcreated_by/font/td
 /tr
 ? do { ?

td? echo $db_fetch['bugid']; ?/td
   td? echo $db_fetch['status']; ?/td
   td? echo $db_fetch['severity']; ?/td
   td? echo $db_fetch['summary']; ?/td
   td? echo $db_fetch['description']; ?/td
   td? echo $db_fetch['date_opened']; ?/td
   td? echo $db_fetch['estimated_completion']; ?/td
   td? echo $db_fetch['related_file']; ?/td
   td? echo $db_fetch['created_by']; ?/td
  tr
?
 } while ($db_fetch = mysql_fetch_assoc($db_result));
 ?
td colspan=9 bgcolor=#FFnbsp;/td
/table

pnbsp;/p
pnbsp;/p
/body
/html
?
mysql_free_result($db_result);
?


_
Overloaded with spam? With MSN 8, you can filter it out 
http://join.msn.com/?page=features/junkmailpgmarket=en-gbXAPID=32DI=1059

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


Re: [PHP] RE: newbie alternate row colours in dynamic table

2003-04-05 Thread Bobby Rahman


Hiya people

After a lot of soul searching, exploring the web and help from many people I 
came up with this simple solution:

Thank you Chris for explaining the toggle $colorset. In the end I decided 
this made life alot simplier.

(clearly the brackets have to be correctly aligned)

while( $row = mysql_fetch_array($db_result) )
{
echo(
tr $c
td . $row['bugid'] . /td
/tr
);
if ( !isset($c) )
{
$c = bgcolor=#FF;
echo $c;
}
else
{
unset($c);
}
}



From: Chris Hayes [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [PHP] RE: newbie alternate row colours in dynamic table
Date: Sat, 05 Apr 2003 22:32:17 +0200
At 22:14 5-4-2003, you wrote:


Hiya I have a dynamic table and am trying to get the rows to be two 
different alternate colours. well Ive looked at a couple of snippets of 
this colour code and previous mails regarding this. Im having major 
troubles intergrating any of these suggestions with my code. Can anyone 
suggest where I am going wrong. Main problems are
1. where to put the loop for changing the colour (complicated due to the 
loop retrieving data from db)i.e in the do loopin the while loop?
Within the loop that prints the rows, whcih is usually a while loop. But 
that depends on your preferences.


2. Also how to echo my rows in the colours.(something like this I think)
print tr bgcolor='$trcolor'$db_fetch['bugid']; ?/td;
e.g here is the code snippet for alternate coloured rows
$trcolor=#F0F8FF;
while ($myrow = mysql_fetch_array($result)){
$colorset=0;
if ($trcolor=='#F0F8FF'){
$trcolor='#B0C4DE';
$colorset=1;
}
if ($colorset==0){
if ($trcolor=='#B0C4DE'){
$trcolor='#F0F8FF';}
}
print tr bgcolor='$trcolor';
}
I see that you are using a helping variable $colorset.
I have a problem reading your code in email, as i do not see hte indents 
well, so i restructure it here with _ underscores to make the indents 
survive the email program.

$trcolor=#F0F8FF; //1

while ($myrow = mysql_fetch_array($result))
{
___$colorset=0;
___if ($trcolor=='#F0F8FF')//1
___{$trcolor='#B0C4DE'; //2
$colorset=1;
___}
___if ($colorset==0)
___{ if ($trcolor=='#B0C4DE')   //2
__{$trcolor='#F0F8FF';   //1
__}
___}
print tr bgcolor='$trcolor';
}
Lets walk through.
In the 1st walk,
1a) you enter with color#1 and colorset=0.
2b) the first 'if' then sets it to color#2 and colorset=1
3c) The second if sees that both conditions are true and set the color back 
to color#1.

So the first row prints color1.

Ok. The code remembers the values, which are color#1 and colorset1.
In the next walkthrough,
2a) the colorset is set to 0 to start with.
At this moment you have the exact situation as with 1a).
do you see that? it would be much easier to see what is happening if you 
would have only colorset toggling its value and just before printing, 
decide what the color is as a result of the value of colorset.
Give it a try!

Basically:

$colorset=0;

while ()
{ toggle collorset (toggle: if 1 then 0 and opposite)
 if colorser=0 color=ff else color=a
 print color.
}
Chris Hayes













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


_
Surf together with new Shared Browsing 
http://join.msn.com/?page=features/browsepgmarket=en-gbXAPID=74DI=1059

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


[PHP] RE: newbie Dynamic Drop down lists using mysql

2003-04-03 Thread Bobby Rahman


Hiya

Im looking for any tutorials/snippets of code to show me how to code a 
dynamic drop down box/list in a php form.

e.g a drop down menu of all current users (I assume this will need to 
connect to mysql db and select all usernames from table user and place in 
the menu.

here what I have so far
?
$connection = db_connect();
$querystring = (select username from user);
$db_result = mysql_query($querystring);
(if mysql_num_rows($db_result))
{
 while ($row = mysql_fetch_row($db_result))
  {
 print(option value=\$row[0]\$row[0]/option);
  }
}
else
{
print(option value=\\No users created yet/option);
}
?

Any URLS will be much appreciated.

Thanks

Bob

_
Express yourself with cool emoticons http://www.msn.co.uk/messenger
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] RE: [newbie] embed php in html file

2003-04-03 Thread Bobby Rahman


Hiya

I need advice for an optimum solution to display the username that is logged 
in on every html form page of my application.

I have a header.php :
?
session_start();
echo BRfont face=\Verdana\font color=\red\size=\3\Logged in as: 
.$_SESSION['curr_user'].BR/fontbr;
?

Now I have many html forms which user's see
What I want to know is how to include the header.php into every html form 
page.

One way is to rename the html file with extension .php
then
?
require_once(header.php)
?
This seems a bit wasteful for one line of php to change all the forms to 
.php. Is there any other ways of embedding the header.php file in html 
forms.The reason I am so keen on keeping html and php files seperate is thus 
to make debugging easier and maintain a kinda three tier design.

Any suggestions will be much appreciated

Bob

_
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

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


[PHP] [Newbie] Password()

2003-03-31 Thread Bobby Rahman


Hi,

in my code I am trying to send an email (containing a password) to a user 
when he has forgotten his password.

The problem is that security leads to needing to encrypt passwords in the 
database. Im using the password function within mysql. Is there any way of 
reversing the password function() to get the original password to send out 
to the user?

Or are there any other suggestions in PHP to reverse encryption of 
passwords. I do understand the principles of encryption and can see the 
point of unreversible functions but Im sure that not all applications re-set 
passwords with random generated ones but do send out forgotten passwords.

Cheers

B





_
Worried what your kids see online? Protect them better with MSN 8 
http://join.msn.com/?page=features/parentalpgmarket=en-gbXAPID=186DI=1059

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


[PHP] RE: (newbie)calling GLOBAL arrays

2003-03-23 Thread Bobby Rahman


Hiya

Im having difficulties calling array values from outside script.

I have db.api.php
?
session_start();
function db_fetch($querystring)
{
$db_result = mysql_query($querystring);
$row = mysql_fetch_row($db_result);
   session_register('row');
   $username = $row[0];
$password = $row[1];
$email = $row[2];
   echo THE USERNAME IN DB.API IS $username;
   echo THE PASSWORD IN DB.API IS $password;
echo THE EMAIL IN DB.API IS $email;
}
?
// this works fine but now when I try and call these variables from
// another php script user.api.php
?
session_start();
require_once(db_api.php);
$querystring =   (select username, password , email
  		from user    		   where username= 
'$username');

db_fetch($querystring);
echo THE USERNAME IN USER API2 IS $row[0];
echo THE PASSWORD IN USER API IS $password;
?
// I have tried to print to screen these variables from the
//global array $row two different ways and seem to get nothing on screen
// I have also tried registering the variables seperately such as 
session_register('username'); with no luck

Can anyone see what I am doing wrong or suggest any tutorials which may 
describe using arrays with sessions.

Thanks

_
Worried what your kids see online? Protect them better with MSN 8 
http://join.msn.com/?page=features/parentalpgmarket=en-gbXAPID=186DI=1059

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


Re: [PHP] Passing variable from webpage to php (newbie?)

2003-03-20 Thread Bobby Rahman
Hiya

It could need setting register_globals =on in your php.ini

if after that still problems then you may need to look into sessions and in 
particular session_start() and $_SESSION['varname'] and make sure the 
variables are global so that more than one script can use them.

Hope this steers you in right direction
*warning im a newbie too so you may wait for some more replies to confirm 
what im saying*

Bobster











From: Joe Kupiszewski [EMAIL PROTECTED]
Reply-To: Joe Kupiszewski [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [PHP] Passing variable from webpage to php (newbie?)
Date: Wed, 19 Mar 2003 10:57:11 -0500
I think I already tried to post once, so sorry if this is a duplicate, but 
I
don't see my first attempt.  I am trying to do what should be a relatively
simple and basic task.  I've got a php script/page that has a switch/case
selection statement in it.  Obviously, depending on what value a particular
variable takes when passed to the script, the script SHOULD :) do different
things.  However, when I invoke the script using
www.somedomain.com/somephpscript.php?action=1  (substitute one with, 2, 3, 
4
or whatever) and then do a check whether any value is passed to my script,
it always tells me the value is empty ( if (empty ($action)) - it just
always thinks its empty.  I'm copying this script from a book, so I do not
have any reason to believe there is an error in the code, but obviously
something is not happening properly.  My thought is that perhaps something
needs to be turned on in the php.ini or in the apache httpd.conf file to
allow this variable passing to work.  Is there some other way to do this?

Sorry for the long paragraph sentence.  I'll be happy to post the code if
needed or provide any additional information or give the actual URL so you
can see what is happening.
Thanks for any thoughts



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


_
Overloaded with spam? With MSN 8, you can filter it out 
http://join.msn.com/?page=features/junkmailpgmarket=en-gbXAPID=32DI=1059

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


[PHP] Re: Missing session vars when doing var_dump()

2003-03-20 Thread Bobby Patel
I would think that they are 16 key/value pairs when the MySQL (TEXT) fields
are null thus the session variables are NOT set thus NOT present.

Hypothsis: I believe that your are using mysql_fetch_array($query_resource),
try using the second parameter as well ie.
mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example
mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net for
details of mysql_fetch_array).

By using the second parameter, even NULL values will has a variable set.

Example say you had a field called FirstName in the MySQL database. If it
was NULL, then without the additional parameter you would have NO key named
'FirstName' exisiting (ie it is not set). But if you used the second
parameter a key would be created with no value (ie it is set but empty).

So remember, the second parameter is OPTIONAL, but it has different
behaviors when you do (and do not) use it. Hopefully I cleared it up (or at
least shed  some light).

checkout : http://www.php.net/manual/en/function.mysql-fetch-array.php


Gavin Jackson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi

 I have come across a strange problem. I have an application that a user
 logs into and when I find the user in the database I load all the custom
 info for that use which I store. By the time I'm done, the session array
 has 18 key's. When I do a var_dump($_SESSION) I sometimes get
 18 variables and sometimes I only get 16. The two fields that are missing
 are TEXT fields from a MySQL database and they also appear to be
 the last two keys when var_dump() returns all 18 keys.

 Does anyone know what is causing this, it's driving me crazy at the
 moment with many late nights. The PHP version running is 4.2.3

 Regards

 Gavin

 Auckland, New Zealand




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



Re: [PHP] Re: Missing session vars when doing var_dump()

2003-03-20 Thread Bobby Patel
Are the queries the exact same every time you refresh them? This seems just
to be programming logic (I guess). Post some code and maybe someone (or I)
will be able to help you out.

Gavin Jackson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Thanks for your input Bobby

 I was using mysql_fetch_array() but changed to mysql_fetch_assoc()
 The funny thing is, I have a page that does the var_dump() and all
 I'm doing is refreshing the page and sometimes I get 18 other times
 16 variables


 Gavin
 Auckland, New Zealand

  -Original Message-
  From: Bobby Patel [SMTP:[EMAIL PROTECTED]
  Sent: Friday, March 21, 2003 11:29 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Re: Missing session vars when doing var_dump()
 
  I would think that they are 16 key/value pairs when the MySQL (TEXT)
  fields
  are null thus the session variables are NOT set thus NOT present.
 
  Hypothsis: I believe that your are using
  mysql_fetch_array($query_resource),
  try using the second parameter as well ie.
  mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example
  mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net for
  details of mysql_fetch_array).
 
  By using the second parameter, even NULL values will has a variable set.
 
  Example say you had a field called FirstName in the MySQL database. If
it
  was NULL, then without the additional parameter you would have NO key
  named
  'FirstName' exisiting (ie it is not set). But if you used the second
  parameter a key would be created with no value (ie it is set but empty).
 
  So remember, the second parameter is OPTIONAL, but it has different
  behaviors when you do (and do not) use it. Hopefully I cleared it up (or
  at
  least shed  some light).
 
  checkout : http://www.php.net/manual/en/function.mysql-fetch-array.php
 
 
  Gavin Jackson [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   Hi
  
   I have come across a strange problem. I have an application that a
user
   logs into and when I find the user in the database I load all the
custom
   info for that use which I store. By the time I'm done, the session
array
   has 18 key's. When I do a var_dump($_SESSION) I sometimes get
   18 variables and sometimes I only get 16. The two fields that are
  missing
   are TEXT fields from a MySQL database and they also appear to be
   the last two keys when var_dump() returns all 18 keys.
  
   Does anyone know what is causing this, it's driving me crazy at the
   moment with many late nights. The PHP version running is 4.2.3
  
   Regards
  
   Gavin
  
   Auckland, New Zealand
  
 
 
 
  --
  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] Re: Missing session vars when doing var_dump()

2003-03-20 Thread Bobby Patel
If you it's either ALL or Nothing then I would think it has something to do
with retrieving sessions from the client (in the form of the cookie) or on
the server (in the form of the session file, default is /tmp on *nix
systems).  I ran your script on my server where I have session varaibles and
I never had a problem.

I'm out of ideas now.



Gavin Jackson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi Bobby

 The following is a copy and paste of the page I'm using to
 generate the problem. I have 18 keys in the $_SESSION
 variable and just by simply refreshing the page with the
 following code, it returns either array(0){} or session info and
 array(18){ will all the correct variables }. I must be doing
 something fundamentally wrong somewhere.

 Thanks very much for your willingness to help me.

 ?php
 session_start();
 ?
 html
 head
 /head
 body
 ?php

 foreach( $_SESSION as $key = $value )
 {
 echo font color=\FF9900\SESSION[$key] = $valuebr;
 }
 echo brbr;
 var_dump( $_SESSION );
 ?
 /body
 /html





 Gavin Jackson, RD Software Engineer, Tru-Test Ltd.
 Phone: +64-9-9788757,  Fax: +64-9-979, [EMAIL PROTECTED]
 Tru-Test Ltd, P.O. Box 51-078, Pakuranga, Auckland, New Zealand

  -Original Message-
  From: Bobby Patel [SMTP:[EMAIL PROTECTED]
  Sent: Friday, March 21, 2003 3:28 PM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] Re: Missing session vars when doing var_dump()
 
  Are the queries the exact same every time you refresh them? This seems
  just
  to be programming logic (I guess). Post some code and maybe someone (or
I)
  will be able to help you out.
 
  Gavin Jackson [EMAIL PROTECTED] wrote in message
  news:[EMAIL PROTECTED]
   Thanks for your input Bobby
  
   I was using mysql_fetch_array() but changed to mysql_fetch_assoc()
   The funny thing is, I have a page that does the var_dump() and all
   I'm doing is refreshing the page and sometimes I get 18 other times
   16 variables
  
  
   Gavin
   Auckland, New Zealand
  
-Original Message-
From: Bobby Patel [SMTP:[EMAIL PROTECTED]
Sent: Friday, March 21, 2003 11:29 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Missing session vars when doing var_dump()
   
I would think that they are 16 key/value pairs when the MySQL (TEXT)
fields
are null thus the session variables are NOT set thus NOT present.
   
Hypothsis: I believe that your are using
mysql_fetch_array($query_resource),
try using the second parameter as well ie.
mysql_fetch_array($query_resource, TYPE_OF_ASSOCIATION) example
mysql_fetch_array($query_resource, MYSQL_ASSOC) (please see php.net
  for
details of mysql_fetch_array).
   
By using the second parameter, even NULL values will has a variable
  set.
   
Example say you had a field called FirstName in the MySQL database.
If
  it
was NULL, then without the additional parameter you would have NO
key
named
'FirstName' exisiting (ie it is not set). But if you used the second
parameter a key would be created with no value (ie it is set but
  empty).
   
So remember, the second parameter is OPTIONAL, but it has different
behaviors when you do (and do not) use it. Hopefully I cleared it up
  (or
at
least shed  some light).
   
checkout :
http://www.php.net/manual/en/function.mysql-fetch-array.php
   
   
Gavin Jackson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi

 I have come across a strange problem. I have an application that a
  user
 logs into and when I find the user in the database I load all the
  custom
 info for that use which I store. By the time I'm done, the session
  array
 has 18 key's. When I do a var_dump($_SESSION) I sometimes get
 18 variables and sometimes I only get 16. The two fields that are
missing
 are TEXT fields from a MySQL database and they also appear to be
 the last two keys when var_dump() returns all 18 keys.

 Does anyone know what is causing this, it's driving me crazy at
the
 moment with many late nights. The PHP version running is 4.2.3

 Regards

 Gavin

 Auckland, New Zealand

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



[PHP] Re: Passing variable from webpage to php (newbie?)

2003-03-19 Thread Bobby Patel
You have register_globals set to off (read up on register globals in
php.net).
your code should read
$HTTP_POST_VARS['action'] or $_POST['action'] (depending on PHP version)
INSTEAD of just $action.

so to test an if::
if ($HTTP_POST_VARS['action']==1) {
/*
Code for if action is equal to 1
*/
}

Of course checkingif the variable is set or empty might be a good idea as
well, is set example:
if (isset($HTTP_POST_VARS['action'])) {
/*
Code if the variable POSTed is set
*/
}



Joe Kupiszewski [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I think I already tried to post once, so sorry if this is a duplicate, but
I
 don't see my first attempt.  I am trying to do what should be a relatively
 simple and basic task.  I've got a php script/page that has a switch/case
 selection statement in it.  Obviously, depending on what value a
particular
 variable takes when passed to the script, the script SHOULD :) do
different
 things.  However, when I invoke the script using
 www.somedomain.com/somephpscript.php?action=1  (substitute one with, 2, 3,
4
 or whatever) and then do a check whether any value is passed to my script,
 it always tells me the value is empty ( if (empty ($action)) - it just
 always thinks its empty.  I'm copying this script from a book, so I do not
 have any reason to believe there is an error in the code, but obviously
 something is not happening properly.  My thought is that perhaps something
 needs to be turned on in the php.ini or in the apache httpd.conf file to
 allow this variable passing to work.  Is there some other way to do this?

 Sorry for the long paragraph sentence.  I'll be happy to post the code if
 needed or provide any additional information or give the actual URL so you
 can see what is happening.

 Thanks for any thoughts





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



[PHP] RE: (newbie) how to redirect to html page from php

2003-03-17 Thread Bobby Rahman


Hiya

I have a login_screen.html which on submit is sent to login.php.
Login.php does all the checking of usernames and passwords. I am trying to 
to produce this logic:
//In login.php
if password and username correct {
go to main page
}
else
{
go back to login.screen.html
echo Please try again;
echo login Incorrect;

I cannot seem to automatically go back to login_screen.html with the error 
message displayed in the else statment in login.php.

Any suggestions?

Thanks

_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk

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


[PHP] Re: SMTP Authenticate

2003-03-15 Thread Bobby Patel
There is another php mailer class which  is really good (and includes
authentication among alot of other things).
http://phpmailer.sourceforge.net

Aitor Cabrera [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi, I'm trying to use the mail() funtion but I can only use this funtion the
email myself (the same email that I put in the php.ini file). I f I try to
email someone else I get an error

530 delivery not allowed to non-local recipient, try authenticating -7

How can I authenticate myselft? Which is the SMTP comand to do it and how do
I use it? Thanks!!



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



[PHP] RE: newbie OOP?

2003-03-14 Thread Bobby Rahman


Hiya

I am new to PHP and was wondering whether to develop small applications (20 
pages ) is it worth it to use OOP?  Can any recommend any books or URLS that 
explain Object orientated programming and design in detail.
I have read articles in

www.phpbuilder.com and
www.phppatterns.com.
In particular I am having troubles breaking my application design-wise, into 
classes and operations.

Any suggestions and tips

Cheers

_
Stay in touch with MSN Messenger http://messenger.msn.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Page Rederection Problems

2003-03-13 Thread Bobby Patel
 header(location: http://www.website.com http://www.website.com/ );

I usually use header() like this :
header(location: http://www.website.com;);

you can try that, maybe it might work.



Kelly Protsko [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Basically what I am doing is having a post  call a page with the
 following code to email the form contents.
 I want the page to redirect back to the page it was sent from after the
 mail has been sent.   The top mailing part works fine but when I put the
 header redirect in at the bottom I get an error on my post saying the
 page doesn't exist anymore.
 Any idea what would be causing this?


 $formcontent =  $_POST[content];
  $toaddress = [EMAIL PROTECTED];
  $subjectline = $_POST[subject];
  $headers = From: $_POST[email];
  mail( $toaddress, $subjectline, $formcontent, $headers);

 header(location: http://www.website.com http://www.website.com/ );

 Thanks

 Kelly




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



[PHP] Re: Setting session variables from value in database

2003-03-13 Thread Bobby Patel
are you sure that $row['user_type'] has a (non-null) value?

Mike Tuller [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I have a login page and have sessions working so that if a user is in
 the database, they can login. I want to also add a user_type to the
 session so that I can have regular staff see certain things, and
 admin's see other things, but I can't seem to pull the information out
 of the database.

 Here is part of what I have.

 $query = select * from users where username='$username' and
 password='$password' ;
 $result = mysql_query($query);
 $num = mysql_num_rows($result);

 $row = mysql_fetch_array($result);

 $_SESSION['user_type'] = $row['user_type'];
 $user_type = $_SESSION['user_type'];

 if ($num  0 )
 {
 $_SESSION['valid_user'] = $username;
 $valid_user = $_SESSION['valid_user'];
 }

 Now if I tell it to print $valid_user, it shows the user logged in, but
 if I try to print $user_type I don't get anything in return. Any ideas
 as to what I am doing wrong? I have tried a separate query for the
 mysql_fetch_array, and that didn't seem to work either.

 Mike





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



[PHP] Re: need help with parsing form input ...

2003-03-11 Thread Bobby Patel
eregi_replace([^[:alnum:].], , $string_val);

notice the period after the first closing brace.



Kenn Murrah [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Thanks ... one more thing:  is there  a way to modify this to allow a
period
 (dot) to included, as well as the alha and num characters?

 once again, thanks.



 function make_alphanum($string_val) {
 return eregi_replace([^[:alnum:]], , $string_val);
 }
 strips everything except ALPHA and NUM Chars


 Joel


 Kenn Murrah [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Greetings.
 
  I'm out of my league here, not knowing enough about regular expressions
 yet
  to do this, so I desperately need someone's help ...
 
  I need to parse form input to eliminate unwanted characters
(punctuation,
  mostly) ... for instance, if the web site visitor types 
smith,susan--33
  into the field, i want to parse that line to eliminate the initial
space,
  the comma, and the dashes so that $myvariable=smithsusan33 
 
  any help in doing this would be GREATLY appreciate.
 
  thanks.
 
 





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



[PHP] Re: Checking for Null Variables

2003-03-07 Thread Bobby Patel
you can look at isset() and empty(). If you retrieve the query result with
Mysql association (ie. $field=mysql_fetch_array($resource, MYSQL_ASSOC),
then even the field has a blank value, there will be a blank variable
created ($field[Name] is created but with no value)), however if you grab
the resource values as such $field=mysql_fetch_array($resource), then a
blank field will not create a $field[Name].

So, if using :
$field=mysql_fetch_array($resource, MYSQL_ASSOC)
 if(empty($field[Name])) { do this }
 else { do this }

OR
$field=mysql_fetch_array($resource)
 if(!isset($field[Name])) { do this }
 else { do this }



Christopher J. Crane [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 How do I check if a variable is blank or not. I am returning data from a
 MySQL database and if a field is empty I would like to do something
 different.

 I tried
 if($field[Name] == ) { do this }
 else { do this }

 It does not work right. Actually, at one point, it was working in the
exact
 opposite manner.





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



[PHP] Re: Scroll through values sent from a form

2003-03-04 Thread Bobby Patel
$fields='';
$values='';

foreach ($_POST as $field - $value) {
$fields .= $field., ;
$values .=$value., ;
}
$fields = substr ($fields, -2); // strip off last comma and space
$values = substr ($values , -2); // strip off last comma and space

$query = INSERT INTO $_GET[table_name] (.$fields.) Values (.$values.);


St [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hi,

 Is it possible to scroll through values posted from a form using PHP? Here
 is my problem: I have a form on a page which is created dynamically from
the
 number of fields in a particular table, so when I POST the data how do I
 create the INSERT statement? I feel this will be awkward due to the
 construction of the INSERT statement and I would be very grateful for
 anyone's input. The form names are the same as the field alues in the
 table...

 It will need to be something like

 $query = 

 while (more Form Fields){
 $query = $query + 'form fieldname';
 }

 $query = $query + ) VALUES (;

 while (more POST Values){
 $query = $query + POST Value;
 }

 $query = $query + );

 I hope this makes sense to the reader!

 Thanks







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



[PHP] Re: All Code Executing Even After header() Redirect

2003-03-03 Thread Bobby Patel
Add an exit statement after the header call. But I thought the same thing
that after header nothing would be executed.

 if (!LoggedIn()) {  // If not logged in, take to Login page.
 header(Location: /login.php);
exit();
 }

I just gave you this soultion to solve your problem, maybe someone else can
shed some light why LogAccess() is executed.

Monty [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 At the top of every page in my site I have a snippet of code that
 authenticates the user by checking for valid SESSION vars and their
 contents. If they don't, they are redirected with a header() statement to
a
 log-in page like this:

 include_once(function_library.php);
 session_start();

 if (!LoggedIn()) {  // If not logged in, take to Login page.
 header(Location: /login.php);
 }

 LogAccess($_SESSION['user']);  // This function logs user's access.


 I noticed that the LogAccess() function I have after the header() redirect
 is executing, even if the user is not logged in and is redirected to the
 Log-In page. I did confirm that the LoggedIn() custom function is working
 properly and returning the right value.

 I thought the code below the header() redirect would not actually be
 executed unless the user was logged in and allowed to proceed. Is this how
 PHP is supposed to work? Is there any way to prevent the script from
 executing below a certain point if the user is not logged in?

 Thanks,

 Monty




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



[PHP] Re: date range assistance needed

2003-03-03 Thread Bobby Patel
I believe PHP and MySQL use two different definitions of the start of a time
stamp. One uses 1974 the other 1900 (I don't know exactly). If you echo
strtotime($attributes[startdate]) ,  UNIX_TIMESTAMP (datestamp)

Also, in your query you are looking for all headlines that have
strtotime($attributes[startdate]) ==  UNIX_TIMESTAMP (datestamp). you have
two strtotime($attributes[startdate]) but not an 'end date '



Charles Kline [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Here is my current query:

 $qAnnouncement =
 'SELECT id,headline
   FROM tbl_funding
 WHERE 1
 AND ((UNIX_TIMESTAMP (datestamp) = ' .
 strtotime($attributes[startdate]) . ') AND (UNIX_TIMESTAMP (datestamp)
 = ' . strtotime($attributes[startdate]) . ')) LIMIT 0, 30';

 Where datestamp is set in MySQL with a timestamp(14) and
 $attributes[startdate] and $attributes[enddate] are in the format
 mm/dd/

 My query does not return any results. I know there must be something
 wrong, can anyone point it out?

 Thanks,
 Charles




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



[PHP] Re: Creating MySQL Entry Forms

2003-03-01 Thread Bobby Patel
What I would recommend is PHPmyAdmin. I believe it's open source and written
in PHP specifically as a utility for mySQL.

I'm sure you can find it at sourceforge.net (or a similar site) .

Jeremy N.E. Proffitt [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
I need to create some simple web forms for entering, changing, deleteing
information from a fairly simple MySQL database.  This is to be for internal
use, so doesn't have to be really fancy or have alot of error checking.
  I could make a form for each table myself, but I would think their is an
easier way...

Cheers
Jeremy



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



[PHP] Re: Value of $var as a variable?

2003-02-24 Thread Bobby Patel
function getID($variable){
return $HTTP_GET_VARS[$variable];
}
Patrick Teague [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I know I've seen something about this (I can't remember whether yea or
nay),
 but I can't remember where I found it as at the time I was looking for
 something else...  and now that I'm looking for it I can't find it again.
 Anyways, what I've done is store variable names that end up being passed
as
 part of various query strings in some variables similar to -

 $var_id = id;
 $var_name = name;

 In the file that receives the information I'd like to know if there's a
 faster way of finding out the value of the passed variables in the query
 string than a function that explodes the query string  returns the value
of
 the requested variable. i.e. -

 function getID($variable)
 {
 // explode 'var=x' from query string
 $id = explode( , $_SERVER[QUERY_STRING] );

 // search to find correct 'var=x' from query string
 for( $i=0; $icount($id); $i++ )
 {
 // if $tag is found, extract value  assign to $value[]
 if( $r = eregi( $variable.=([0-9])*, $id[$i], $regs ) )
 {
 $value[] = $regs[1];
 }
 }
 return $value;
 }


 Patrick





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



[PHP] Re: Efficient db connect function?

2003-02-23 Thread Bobby Patel
As the previous post of using die would be better. Also try using
mysql_pconnect (for persistant connections) and also, if you are running
more than one query per script execution, then DON'T keeping trying to
connect/select database.

I suggest you do the first two things at the start of ALL the scripts that
will need to connect to the database, so make an include file with 2 things
(connecting and selecting a database). Then make another function just for
queries, this way on the second and onward queries will save overhead some
from connecting and selecting a database.

bobby


Cf High [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Hey all.

 I'm currently using the following db connection function, but I'm not sure
 if it's as efficient as it could be.

 function dbConnect($SQL) {

 global $result;

  // Connect to DB
  if (!$link = mysql_connect($db_host, $db_user, $db_pass)) {
 $result = 0;
 echo mysql_errno() . :  . mysql_error() . \n;
  }
  else

   // Select DB
   if ([EMAIL PROTECTED]($db_name, $link)) {
 $result = 0;
 echo mysql_errno() . :  . mysql_error() . \n;
   }
   else {
 // Execute query
 if (!$result = mysql_query($SQL, $link)) {
 $result = 0;
 echo mysql_errno() . :  . mysql_error() . \n;
}
   }
 }
 return $result;
 }

 *** Is there a faster way to establish a connection  run a query, or
am
 I wasting my time over nothing? *

 --Noah





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



[PHP] Re: Passing emails to database

2003-02-19 Thread Bobby Patel
I have an idea that might work in theory. Provided that you have php running
on a Unix based OS. You could forward all emails to an email that sits on a
Unix server. There they are stored as plain text files, then just parse what
you need on a daily basis and truncate that file to 0 bytes.

BUT it sounds that you have the whole setup on a Windows based
machine/server.  If you can get access to PHP and Mysql on a unix server
then you will have a chance.

I just did a quick check on the PC and it seems that Outlook express creates
files with a DBX extension to hold email folders.
I found mine at C:\WINDOWS\Application Data\Identities\{JIBBERISH
HEX}\Microsoft\Outlook Express. Try anyalsing these dbx files (open them up
in a text editor). But there HUGE even just if they have one message in
them.

good luck

Alberto Brea  wrote in message
00e501c2d81f$e66d3e20$[EMAIL PROTECTED]">news:00e501c2d81f$e66d3e20$[EMAIL PROTECTED]...
Hi, list
Is there any way in PHP to pass the emails received automatically into a
local MySQL database on the same machine (i.e. the fields datetime,
from, to, message, subject, etc), without copying and pasting each
message? Maybe by retrieving and parsing the Outlook Express files that keep
the emails? (the e-mail is received by Outlook Express, and via browser from
a Yahoo account).
Thanks for any help

Alberto




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




[PHP] RE: traversing and displaying directories in html [newbie]

2003-02-17 Thread Bobby Rahman



Hiya

I am trying to find a way to drill down on html file names, if there are 
directories to display the files in the new directory. Im assuming this 
needs the calling of the same page which displayed the intial file names 
again with the argument of new directory. Does anyone have any tips for me.

I can establish whether a file is an dir or not using is_dir...just not sure 
how to pass this new directory name and concatenate with the existing path 
to now show the file names in the new drill down directory.

(Also Im not sure if my a href statements are correct and wanted to know 
any good tutorials on string expressions?

So far I have knocked up this :

$start_dir = C:/Program Files/ApacheGroup/Apache2/cgi-bin/;
//default starting directory
if ($new_dir ==0)
//if new_dir is not set display files from start_dir
   {
		$current_dir = $start_dir;
   	}
   else
   {
	$current_dir = $start_dir.$new_dir;
	//if new_dir is set than the current directory becomes
   	//the starting directory and the new directory selected
	}

	$inside_dir = opendir($current_dir);
	//store contents of the file names in the current directory in $inside_dir

	echo Upload directory is $current_dirbr;
	echo Directory Listing:brhrbr;

   while  ($file = readdir($inside_dir))
	  if (is_dir($file))
	  	{
	echo a href=\displaydir.phpfile=
  .$file.\.$file./abr;

	  	}

	  	else
	{
 		echo a href=\openfile.php?
   file=.$file.\.$file./abr;
		}

	closedir($inside_dir);



_
It's fast, it's easy and it's free. Get MSN Messenger today! 
http://messenger.msn.co.uk


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



[PHP] Re: File not rewritable - why? Help needed.

2003-02-11 Thread Bobby Patel
Are you on a Windows platform, or *nix. I would assume *nix since you
mentioned chmod.

what did you chmod the file to? who owns the file? and what user does PHP
run as (maybe nobody, or httpd)?
Just to get it to work chmod the file to 777, BUT this is a security risk.
MAKE SURE this file is NOT in the web folder (or any of it's subfolders).
Remember to write to a file PHP (the user nobody or httpd) also needs Read
and eXecute permisions on all the directories from the root all the way to
the directory contaning the file.


[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Newbie question:

 I try to modify a txt-file but get not writable error.
 (just like in http://www.php.net/manual/en/function.fwrite.php )

 I've tried to change the chmode but now I need some help.

 All info welcome! Thanks in advance!

 Paul Dunkel
 --
 [EMAIL PROTECTED]




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




[PHP] Re: Session Time

2003-02-10 Thread Bobby Patel
What you could do, is get the current time stamp using time() or date() and
create a sesion variable with this value, when they login (and the session
is created.  Then when they logout, and the sesion is destoyed get the
current time stamp again and minus it from the start time.

Note: This requires the user to login and logout, if they just close the
browser then they will never get to your logour script, thus you can't
calculate their money owed.

Stephen Craton [EMAIL PROTECTED] wrote in message
004e01c2d11a$0e3a4590$0200a8c0@melchior">news:004e01c2d11a$0e3a4590$0200a8c0@melchior...
 Got a quick and easy question that I'm not sure about. What I need to do
is
 calculate how long someone has been in a chatroom, then update a members
 table to add some money to their account. Something like this:

 For every hour they're in the chatroom: 5 cents

 Thanks,
 Stephen Craton
 http://www.melchior.us





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




[PHP] Re: Read file and get what i want

2003-02-06 Thread Bobby Patel
Check out explode()
$file // say this variable has your file contents
$lines = explode (\n, $file); // lines contains each line of the file

foreach ($lines as $line - $content) {
if (strrpos($line, ':')) {
$values = explode (':', $content);
echo The first value is : .$values[0];
}
else {
echo This line doesn't contain a : moving to next line;
}

}


NOTE: if \n doesn't work try \r\n , I think. Also this is mostly from
the top of my head so there might be some syntax problems.

Miguel BráS [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello gents,

 I made a script to open a file on a server and write his content to a temp
 file on my server.

 A part of the temp file is below:

 ***temp file**

 !GENERAL
 VERSION = 1
 RELOAD = 1
 UPDATE = 20030206181916
 CONNECTED CLIENTS = 178
 CONNECTED SERVERS = 12
 !CLIENTS
 AHS5577:134723:RUBÉN FALCÓN

LEBG:PILOT::42.226630:-1.795440:35248:423:T/B763/F:410:LEBL:35000:LEST:IVANB
 E:1:1:4001:0:40:0:I:1715:1715:1:30:4:30:NONE:NONE
 :LEBL - LOBAR 1C - UN725 - LOMDA 1G - LEST:::20030206181830
 OBS::FRANCIS

BALLION:ATC:199.999:44.791670:0.541670:0:0::IVANDE:9:1:0:0:100::
 20030206181821
 I-JEST:127128:ROBERTO PIETRAFESA

LIBG:PILOT::41.791590:12.244720:17:0:T/B737/T:300:LIRF:15000:LICD:IVANBE:1:1
 :0:0:40:0:I:1930:1930:1:0:4:30:NONE:CHARTS ON BOARD

:LIRF-ROTUN-CORAD-GIANO-PAL-PAL14-LONDI-MABOX-RATOK-MADIR-ASDAX-DEDUK-LPD-LI
 CD:::20030206181816
 ELY0001:127632:OMRI ATAR

LLBG:PILOT::31.996330:34.892110:153:0:T/B772/F:486:LLBG:FL380:KJFK:IVANGR2:1
 :1:1200:0:40:0:I:1000:1100:1:30:4:30:NONE:NONE
 :DENA1E - SUVAS KAROL  APLON MAROS DASNI TOMBI AYT KUMRU ELMAS EKSEN KFK
 HANKO GAYEM WRN BALIK ARGES BUKEL PELUR DEMUN REBLA KARIL PITOK SLC BABUS
 BNO BODAL VLM ILNEK DONAD VARIK PEROX SODRO TABAT TAMEB ROBEL KEMAD HMM
 RELBI RKN TENLI FLEVO:::20030206181756
 DLH001:138912:MANUEL KAUFMANN

EDDT:PILOT::52.556900:13.294230:133:28::IVANDE2:1:1:1200:0:40:::
 :::20030206181755

 *End of temp file***

 Now the tricky part...

 Each part is separated by a :  Example AHS5577:134723:RUBÉN FALCÓN
 LEBG:PILOT::
 first part is callsign, then is the id, then the name, type and so on and
on
 (some parts has no data ::)

 Now, how do I get the first part (callsign) of each line so i can make
 something like:
 if ($first_part ==TAP){
 echo TAP is online;
 } else {
 echo TAP isn't online;
 }

 Was I clear enough?

 Anyone has an ideia for this?
 Miguel






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




Re: [PHP] php pages broken after moving to a newer version

2003-02-05 Thread Bobby Patel
try looking at the status of register_globals on both versions.
Chip Wiegand [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Jason Wong [EMAIL PROTECTED] wrote on 02/05/2003 12:49:16 PM:

  On Thursday 06 February 2003 04:41, [EMAIL PROTECTED] wrote:
   After copying the web site to the new server some pages no longer
 include
   the
   'include' pages. I am using php frames. I load the index page, it's
 just
   blank, white.
   I can load the included pages manually through the url and they load
 okay.
   I am
   wondering if there is something in the php config file I need to set
 for
   the include path,
   but when I was in that file I didn't see any such setting, like in the
   earlie versions of
   php.
 
  1) Read the changelog/history/release notes of all versions of php
  between the
  4.0.3 and up to 4.2.3
 
  2) Check the php log (turn on full error reporting).

 I checked the change log for all instances of 'include' but found nothing
 relevant. The log is 23 pages long and doesn't to all the way back to
 4.0.3. Could you perhaps give me a hint as to something else to look for
 in
 the log?

 --
 Chip

  --
  Jason Wong - Gremlins Associates - www.gremlins.biz
  Open Source Software Systems Integrators
  * Web Design  Hosting * Internet  Intranet Applications Development *
  --
  Search the list archives before you post
  http://marc.theaimsgroup.com/?l=php-general
  --
  /*
  Woodward's Law:
 A theory is better than its explanation.
  */
 
 
  --
  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] Re: Array find a element

2003-02-04 Thread Bobby Patel
look at array_key_exists

Narciso Miguel Rodrigues [EMAIL PROTECTED] wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Is possible to do something like

   if ($username in $users) ... or i need to do a foreach($user){...}

 Thks

 [MsR]




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




[PHP] Re: Session Variables

2003-01-26 Thread Bobby Patel
This variable is registered in the Session, and the variable isn't active
until the page refreshes.  It's hard to explain. I thought I would try.
There are some things you can do. If you need the variable right away, you
can do this:
if (isset($HTTP_SESSION_VARS[user1])) {
$user1 = $HTTP_SESSION_VARS[user1];
}
else {
$user1  = $HTTP_POST_VARS[user1];
}
echo $user1;

Hope that helps. This is natural for sessions, but I have been in the
situation where I needed the session variable right away, instead of the
script's next activation.






Jed R. Brubaker [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have a quirky problem that should be a breeze for someone who is smarter
 than I.

 I have a script where I am registering a HTML form post variable as a
 session variable and then echo it. In the real script I use it in a MySQL
 query, but for the sake of this post, here is the script:

 $user1 = $HTTP_POST_VARS[user1];
 session_register(user1);
 echo $HTTP_SESSION_VARS[user1];

 This doesn't work, however, if I hit the refresh button the var
miraculously
 appears!
 What am I doing wrong?





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




[PHP] Re: File upload problem

2003-01-21 Thread Bobby Patel
Since you have 'safe-mode' on, Register globals will be turned off, so you
should test $HTTP_POST_VARS['Submit'], instead.
John M [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,

 I have the code below. It's a simple file upload. But it doesn't work.
 Before the line if(isset( $Submit )) is an echo which can I read. But
after
 choosing a file and press a submit nothing happens. Why is if(isset(
 $Submit )) always false? Maybe my apache or php config is wrong?

 I use WinXp Prof, Apache 2.0.43, PHP 4.2.3, safe_mode is on ,
upload_tmp_dir
 is c:\tmp\ and upload_max_filesize is 2M in PHP config file.

 Thanks!


 html
 head
 titleUntitled Document/title
 meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
 /head
 body

 form name=form1 method=post action= enctype=multipart/form-data
 input type=file name=imagefile
 input type=submit name=Submit value=Submit

 ?
 echo Before submit br\n;
 if(isset( $Submit ))
 {
 echo After submit br\n;

 if ($_FILES['imagefile']['type'] == image/gif){
 copy ($_FILES['imagefile']['tmp_name'],
 files/.$_FILES['imagefile']['name'])
 or die (Could not copy);
 echo Name: .$_FILES['imagefile']['name'].;
}
  else {
 echo ;
 echo Could Not Copy, Wrong Filetype
 (.$_FILES['imagefile']['name'].);
 }
 }
 ?
 /form

 /body
 /html





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




[PHP] Re: Multiplication of double

2003-01-19 Thread Bobby Patel
It seems you have register globals set to off, thus when you have variables
$price and $qty they are just fresh variables, you might try
$HTTP_POST_VARS['price'] and $HTTP_POST_VARS['qty'] (don't forget the single
quote).


Cesar Aracena [EMAIL PROTECTED] wrote in message
01c2bfeb$cecbd5c0$7a00a8c0@NOTEBOOK">news:01c2bfeb$cecbd5c0$7a00a8c0@NOTEBOOK...
Hi all,

I guess this problem might sound childish for most of you, but I'm
having it right now. I get two numbers from a FORM, one price and one
quantity and I need to make a multiplication with them in order to store
the total amount also as a double expression... I'm trying with:

$totalprice = $price * $qty;

but when I echo the, it gives me just plain old 0 (zero). Any
suggestions?

Thanks in advance,

Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina






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




[PHP] Re: hyperlink and mySQL

2003-01-18 Thread Bobby Patel
I have done something similar:
write a script that takes an Article ID, and displays the text. So to
displat article #3, you would call it like getArticle.php?id=3.
Skelton for getArticle.php
- take id and store in $id
- Select FullBody from Articles where ID = $id
- $body = query['FullBody']
- then echo $body

That's the basic idea, if you have any problems email me and post to the
list.




M.E. Suliman [EMAIL PROTECTED] wrote in message
000f01c2bf1b$e95fff40$4abe1fc4@b1s0n2">news:000f01c2bf1b$e95fff40$4abe1fc4@b1s0n2...
 Hi

 I have created a simple script that pulls the three latest news entries
from
 a mySQL database and displays it on a webpage.   At the end of the preview
 paragraph of the news story there is a hyperlink to access the full text
 specific to that preview.  How would I do this?  Any ideas would be
 appreciated.

 Mohamed




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




[PHP] Re: Auto Incrementing in PHP

2003-01-18 Thread Bobby Patel
One quick note, if you DO NOT have access to a database, you could store
that incremented number to a file. And open and retrieve, and increment
every time you need. If you need to take this approach checkout php.net and
search for fopen.



Don Mc Nair [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi

 Is there a way for a php page to automatically increment a number and
store
 it every time the page is loaded.

 I want to generate an invoice number that goes up 1 everytime the HTML
form
 is sent to it.

 Thanks


 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.435 / Virus Database: 244 - Release Date: 01/01/2003





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




[PHP] Re: passing variables to a sql statement

2003-01-18 Thread Bobby Patel
It seems that error is from an ill-formed MySql statement. Try this,
$descripQuery = SELECT descrip from project_descrip where rowid=$foo;
echo $descripQuery ; // put in this echo after the query.
$descripResult = mysql_query($descripQuery);
echo mysql_error(); file://put this echo after query execution

Now, run it and see on screen what query is actually executed.

Jennifer [EMAIL PROTECTED] wrote in message
003401c2bf2b$0a042d20$8101a8c0@fvcrx01">news:003401c2bf2b$0a042d20$8101a8c0@fvcrx01...
 hi, i'm hoping someone can help me out here - im trying to pass a variable
from a string in the href tag, however my sql breaks when i put a var in the
statment.
 when i replace $foo with a number, the page works fine. can someone please
tell me what im doing wrong?

 here is the error i get:

 Warning: Supplied argument is not a valid MySQL result resource in
/home/villany2k1/www.villany2k1.com/htdocs/projects/projects_descrip.php on
line 11



 here is my code:

 ?php
 $hostName=localhost;
 $userName=;
 $password=;
 $database= projects;
 $tableName=project_descrip;

 $descripQuery = SELECT descrip from project_descrip where rowid=$foo;
 mysql_connect($hostName, $userName, $password);
 $descripResult = mysql_db_query($database,$descripQuery);
while($row = mysql_fetch_object($descripResult)){

 $foo = $row-descrip;

 echo(font face=verdana size=1);
 echo(a href='projects_descrip.php?rowid=$foobar' . $foo/a .  |
);
 echo(/font);

   }


 ?

 thanks in advance,
 jennifer




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




Re: [PHP] Re: Images : Store in dB or disk?

2003-01-17 Thread Bobby Patel
That makes sense. When Marek explained it I didn't realise that IMG tags
can't use the raw data, and needs to make a seperate HTTP request for the
Headers.

Now, I understand. Unfortunately the desicion has been made to go with the
database.

Oh well, I can always code the scripts to store and grab from the
filesystem, after if need be.

Thank you everyone, who has responded.


John W. Holmes [EMAIL PROTECTED] wrote in message
004d01c2be5c$631f4ea0$7c02a8c0@coconut">news:004d01c2be5c$631f4ea0$7c02a8c0@coconut...
  With regards to Marek,
  I don't see how there would be two queries, because there row
 conisists of
  image properties and image data. So when i select the required row(s),
 I
  will have properties and images. So it will be 1 query, of course it
 is a
  big (size-wise) query.

 Hopefully you've gotten the point that this isn't true. If you store
 your images in the database, it's going to make your main script execute
 one query to output something like img src=file.php?id=xxx
 ...properties... for each image. Each one of those img tags will be a
 separate request where file.php would pull the data for _one_ image,
 send the headers and then send the data.

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/





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




[PHP] Re: Question about using session and logging out

2003-01-17 Thread Bobby Patel
I believe there something (a meta tag?) called  meta-refresh or just
refresh.

But I believe you have to set the refresh interval. and if you set the
interval to small it might eat your server's resources.

OR I just thought of this, sometimes when you get to a page (usually with
forms?) it says that the page is expired and must be refreshed. Maybe you
can get that behaviour, so that when someone hits back, they have to
refresh.

Bobby

Don [EMAIL PROTECTED] wrote in message
020401c2be4f$c5420fd0$c889cdcd@enterprise">news:020401c2be4f$c5420fd0$c889cdcd@enterprise...
Hi,

I have an application that uses sessions to allow customers to access a
restricted area.  That is, they are prompted for a user login and password.
I then use sessions to track each customer.  At the top of each page, I have
placed the following PHP code:

session_cache_limiter('Cache-control: private');
session_start();

Everything works fine.  However, I have a logout link that when clicked,
runs the following PHP code (where userid is the login name):

session_cache_limiter('nocache');
if (isset($HTTP_SESSION_VARS['userid'])) {
   $HTTP_SESSION_VARS['userid'] = '';
   session_unregister($HTTP_SESSION_VARS['userid']);
}
session_unset();
session_destroy();
Header('Location: ' . 'http://www.lclnav.com' . $globals-relative_path .
'customerlogin_standard.html');

I think the above is all that is needed to end the session.  I use the
Header() function to take the user back to the login  page.

Here is my question:  Once I click on the logout link and am taken back to
the main login page, I can click on the browser BACK button and still get my
previous page 'as if I was still logged in'.  Please note that clicking on
REFRESH tells me that I am not really logged in.

I know that browsers cache pages and there may not be anything I can do,
however, I have seen sites that seem to work around this; i.e.., clicking on
the back button loads a pages telling the user that they are no longer
logged in.  This is what I want to emulate.  Is there a PHP method to always
force a reload the first time a page is called?

Thanks,
Don


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003



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




[PHP] Re: Images : Store in dB or disk?

2003-01-16 Thread Bobby Patel
With regards to Marek,
I don't see how there would be two queries, because there row conisists of
image properties and image data. So when i select the required row(s), I
will have properties and images. So it will be 1 query, of course it is a
big (size-wise) query.

With regards to Jason,
Your approach is reasonable. I guess I will have to judge for myself!



Bobby Patel [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hello,
 I have the Images table setup with columns (width, height, size, type,
 etc...) the question is should I have the image data stored in this table
or
 disk?

 I know, alot of people have said it is faster in disk, which is 1 page
I/O.
 But I need these images for displaying product pages, and I believe that
it
 would be faster to just pluck the properties from the dB (including the
 image file) .

 Usually I will need to pull 6 or 10 images per page, this is my rational
for
 this situation:

 If all stored on db:
 One query  - will take about 4-5 page I/O (assumiing index on filename)

 If just properties stored on dB and image on disk:
 One query to grab the rows of properties - 2-3 page I/O
 to grab 6 or 10 images - 6 or 10 page I/O
 Total - 8 - 13 Page I/O's

 If all images stored on disk, no dB whatso ever:
 to grab 6 or 10 images - 6 or 10 page I/O
 cpu time to run getimagesize()  for each image - CPU time unknown?

 I assume that page I/O is that same as disk access.

 I AGREE that storing images strored on disk is a valid approach PROVIDED
 that you only need 1 image per page, but if you need to grab a bunch at a
 time, I do beleieve that storing the actual file on the dB is faster.

 I would like to hear from the list, of people that have worked with images
 and PHP. I just started with images, so I just want to take the right
path.





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




[PHP] Images : Store in dB or disk?

2003-01-15 Thread Bobby Patel
Hello,
I have the Images table setup with columns (width, height, size, type,
etc...) the question is should I have the image data stored in this table or
disk?

I know, alot of people have said it is faster in disk, which is 1 page I/O.
But I need these images for displaying product pages, and I believe that it
would be faster to just pluck the properties from the dB (including the
image file) .

Usually I will need to pull 6 or 10 images per page, this is my rational for
this situation:

If all stored on db:
One query  - will take about 4-5 page I/O (assumiing index on filename)

If just properties stored on dB and image on disk:
One query to grab the rows of properties - 2-3 page I/O
to grab 6 or 10 images - 6 or 10 page I/O
Total - 8 - 13 Page I/O's

If all images stored on disk, no dB whatso ever:
to grab 6 or 10 images - 6 or 10 page I/O
cpu time to run getimagesize()  for each image - CPU time unknown?

I assume that page I/O is that same as disk access.

I AGREE that storing images strored on disk is a valid approach PROVIDED
that you only need 1 image per page, but if you need to grab a bunch at a
time, I do beleieve that storing the actual file on the dB is faster.

I would like to hear from the list, of people that have worked with images
and PHP. I just started with images, so I just want to take the right path.



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




Re: [PHP] Images : Store in dB or disk?

2003-01-15 Thread Bobby Patel
It looks nice. It does take a couple of seconds, (but I guess that is to be
expected with dealing with images).
I guess seeing your example, it seems that I can go with the filesystem. But
do you use the getimagezise function? do you set the width and height for
the IMG tag dynamically, or you don't use the image function and just have
the IMG tags already set in stone?

[EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Have a look at:

 http://vrscenes.com/2003/gallery.php?mls=230944

 and tell me what you think - all images are stored in the filesystem

 Don't worry about what it looks like - I extracted this from the frameset
it goes in

 Cheers!

 RW

 Quoting Bobby Patel [EMAIL PROTECTED]:

 ### Hello,
 ### I have the Images table setup with columns (width, height, size, type,
 ### etc...) the question is should I have the image data stored in this
table
 ### or
 ### disk?
 ###
 ### I know, alot of people have said it is faster in disk, which is 1 page
 ### I/O.
 ### But I need these images for displaying product pages, and I believe
that
 ### it
 ### would be faster to just pluck the properties from the dB (including
the
 ### image file) .
 ###
 ### Usually I will need to pull 6 or 10 images per page, this is my
rational
 ### for
 ### this situation:
 ###
 ### If all stored on db:
 ### One query  - will take about 4-5 page I/O (assumiing index on
filename)
 ###
 ### If just properties stored on dB and image on disk:
 ### One query to grab the rows of properties - 2-3 page I/O
 ### to grab 6 or 10 images - 6 or 10 page I/O
 ### Total - 8 - 13 Page I/O's
 ###
 ### If all images stored on disk, no dB whatso ever:
 ### to grab 6 or 10 images - 6 or 10 page I/O
 ### cpu time to run getimagesize()  for each image - CPU time unknown?
 ###
 ### I assume that page I/O is that same as disk access.
 ###
 ### I AGREE that storing images strored on disk is a valid approach
PROVIDED
 ### that you only need 1 image per page, but if you need to grab a bunch
at a
 ### time, I do beleieve that storing the actual file on the dB is faster.
 ###
 ### I would like to hear from the list, of people that have worked with
 ### images
 ### and PHP. I just started with images, so I just want to take the right
 ### path.
 ###
 ###
 ###
 ### --
 ### 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] Re: Template tutorials?

2003-01-10 Thread Bobby Patel
Hey, I have been using HTMLTMPL
 http://htmltmpl.sourceforge.net/

So far it works well, and emulates the more powerfull Perl Templating
system.

It seems alot of code, but whips up these templates in good response time
(of course, it might be becuase I work on a unstressed server).

Chad Day [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I'm googling around for template tutorials and such after seeing a link to
 the Smarty template engine .. can anyone point me to any particularly good
 ones?  I've always been going with the 'one-file' approach .. which I
think
 it's time I changed.

 Thanks,
 Chad




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




Re: [PHP] emulate Post with redirect

2003-01-06 Thread Bobby Patel
I was trying to do it without cURL, since it's not on our server. I guess
I'll just install it, and just use that. I checked out snoopy but when it
gets down to it, it just uses cURL, so I rather just use cURL directly and
cut the fat (of code that is).

Jason Wong [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Monday 06 January 2003 14:01, Bobby Patel wrote:
  Hello, I want to emulate a POST request to Paypal. Originally a POST
  request is sent from the user (through a form) and the user is
redirected
  to paypal's site. Now, what I want to do is to emulate a POST request
(so
  that the surfer can't see some of the hidden fields of the form) and to
  deter tampering. (If they could see all the fields, they could just
create
  their own form , and just change the amount).
 
  Possible solution:
  fsockopen to emulate POST, but that doesn;t redirect the user,  using
  header will direct the user to the paypal site, but then I have to use a
  GET request and then once again variables are visible and modifiable.
 
 
  Desired solution:
  a PHP script (toPaypal.php, say) that is called when a surfer wants to
buy
  something for a product for $5 , say.
  The Product form will direct to the toPaypal.php script that creates a
POST
  request and sends the request and the surefer to Paypal.
 
  Any ideas? or did I just make this confusing? One solution I guess is to
  just double check the total amount credited to the merchant account
matches
  the product. But then I ask this question out of curosity.

 Have a look at curl and snoopy.

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

 /*
 Remember, drive defensively! And of course, the best defense is a good
 offense!
 */




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




[PHP] Combine sockets and Header()

2003-01-05 Thread Bobby Patel
Hello, I want to emulate a POST request to Paypal. Originally a POST request
is sent from the user (through a form) and the user is redirected to
paypal's site. Now, what I want to do is to emulate a POST request (so that
the surfer can't see some of the hidden fields of the form) and to deter
tampering. (If they could see all the fields, they could just create their
own form , and just change the amount).

Possible solution:
fsockopen to emulate POST, but that doesn;t redirect the user,  using header
will direct the user to the paypal site, but then I have to use a GET
request and then once again variables are visible and modifiable.


Desired solution:
a PHP script (toPaypal.php, say) that is called when a surfer wants to buy
something for a product for $5 , say.
The Product form will direct to the toPaypal.php script that creates a POST
request and sends the request and the surefer to Paypal.

Any ideas? or did I just make this confusing? One solution I guess is to
just double check the total amount credited to the merchant account matches
the product. But then I ask this question out of curosity.



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




[PHP] emulate full post wth redirect

2003-01-05 Thread Bobby Patel
Hello, I want to emulate a POST request to Paypal. Originally a POST request
is sent from the user (through a form) and the user is redirected to
paypal's site. Now, what I want to do is to emulate a POST request (so that
the surfer can't see some of the hidden fields of the form) and to deter
tampering. (If they could see all the fields, they could just create their
own form , and just change the amount).

Possible solution:
fsockopen to emulate POST, but that doesn;t redirect the user,  using header
will direct the user to the paypal site, but then I have to use a GET
request and then once again variables are visible and modifiable.


Desired solution:
a PHP script (toPaypal.php, say) that is called when a surfer wants to buy
something for a product for $5 , say.
The Product form will direct to the toPaypal.php script that creates a POST
request and sends the request and the surefer to Paypal.

Any ideas? or did I just make this confusing? One solution I guess is to
just double check the total amount credited to the merchant account matches
the product. But then I ask this question out of curosity.





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




[PHP] emulate Post with redirect

2003-01-05 Thread Bobby Patel
Hello, I want to emulate a POST request to Paypal. Originally a POST request
is sent from the user (through a form) and the user is redirected to
paypal's site. Now, what I want to do is to emulate a POST request (so that
the surfer can't see some of the hidden fields of the form) and to deter
tampering. (If they could see all the fields, they could just create their
own form , and just change the amount).

Possible solution:
fsockopen to emulate POST, but that doesn;t redirect the user,  using header
will direct the user to the paypal site, but then I have to use a GET
request and then once again variables are visible and modifiable.


Desired solution:
a PHP script (toPaypal.php, say) that is called when a surfer wants to buy
something for a product for $5 , say.
The Product form will direct to the toPaypal.php script that creates a POST
request and sends the request and the surefer to Paypal.

Any ideas? or did I just make this confusing? One solution I guess is to
just double check the total amount credited to the merchant account matches
the product. But then I ask this question out of curosity.





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




Re: [PHP] Password Script

2002-11-28 Thread Bobby Patel
If you have access to a database on your server then you can do the
following:
- user logs in to site (user enters unique username and password)
- once in they will be displayed with the 3-6 Questions
- after they answer the questions they hit submit which sends it to a PHP
script
- the PHP script will check a table in the database for the username and
increment a counter
- then if the counter is less than 10 then validate questions for right
answer, .then you understand the rest


Vicky [EMAIL PROTECTED] wrote in message
006401c296d0$e287a6a0$0200a8c0@omnibook">news:006401c296d0$e287a6a0$0200a8c0@omnibook...
 A 'guessing'/knowledge game ^_^

 Basically I put a picture of a dog or cat up and they try to guess the
 breeds. If they get it right then they go to a page where they can
download
 their prize!

 Vicky




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




[PHP] Re: dynamic variable headache

2002-11-08 Thread Bobby Patel
try this:
$mmdd  = $foo.$bar.$bleh.$doh; /*note double-quotes and the concat
operator (the period) */
$$mmdd  = a_date_value;

To test;
echo $mmdd ;
echo $$mmdd;  /*provided that a_date_value is a string literal*/

Robert McPeak [EMAIL PROTECTED] wrote in message
news:sdcbab6c.044;ccp2.jhuccp.org...
My newbie brain is maxed out on this, and I'm sure one of you more
experience guys can quickly straighten me out.

I've got a variable:

$_mmdd =  a_date_value;

Later, I've got four variables;

$foo= _;
$bar=;
$bleh=mm;
$doh=dd;

I want to stick these variables together on the fly to get _mmdd  and
use that value as a variable name to return a_date_value.

It would be the equivalent of,

echo $foo$bar$bleh$doh;

That would give me a_date_value

I've read the docs on dynamic variables but still can't seem to break
through mentally on this one.  Can you clear this up for me?

Thanks in advance.





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




[PHP] Office XP pro - email attachments

2002-10-24 Thread Bobby
Hello, I know XP (argh...)
Anyways, I written a script where a user can upload a gif or jpeg and then I
email it to an email address. Now, everything works fine, the reciever can
view the attachments in Squirell Mail, Outlook Express, and Outlook (both
are Office 2000  versions). But under outlook for Office XP pro, it doesn't
even display that there is an attachment. I was wondering, are there some
email headers that I must send as well for XP to see it? Also, Outlook Xp
can see email attachments when I send from an email client so I don't think
it's a Xp settings issue.



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




[PHP] Problem with function declaration in include files

2002-01-04 Thread Bobby

I have been using the following function declaration syntax for ages with no
problems.

Main php file:

?php
include my-inc.php;
...
FuncExample(arg1,arg2);
...
?


Include file:

?php
...
FuncExample(arg1,arg2){
Function Content
}
...
?php

I have just finished some work for a client, after full testing on both my
Unix and Win32 test servers I moved the site over to their hosting company
and I get the following problem.

All my functions that are declared in my Inc files are spitting back the
error:

Fatal error: Call to undefined function:...

I have spoken with the hosting company, but they have considerable trouble
with 'backside' and 'elbow' recognition.

Are there any PHP.ini settings that affect this type of function
declaration?

Any help would be appreciated.

Bobby





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




Re: [PHP] Problem with function declaration in include files

2002-01-04 Thread Bobby

I wish it was that simple, I have already added debug 'echo' statements to
make sure the included file is being included correctly and it is?

This problem really has me beat, I never usually send out desperate pleas,
but I am not a happy bunny atm.

Any thoughts would be appreciated

Cheers



Bobby
Dennis Moore [EMAIL PROTECTED] wrote in message
003501c19526$a0968740$[EMAIL PROTECTED]">news:003501c19526$a0968740$[EMAIL PROTECTED]...
The problem is most likely with your include statement.  The include path
imay be incorrect...



Bobby [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 I have been using the following function declaration syntax for ages with
no
 problems.

 Main php file:

 ?php
 include my-inc.php;
 ...
 FuncExample(arg1,arg2);
 ...
 ?


 Include file:

 ?php
 ...
 FuncExample(arg1,arg2){
 Function Content
 }
 ...
 ?php

 I have just finished some work for a client, after full testing on both my
 Unix and Win32 test servers I moved the site over to their hosting company
 and I get the following problem.

 All my functions that are declared in my Inc files are spitting back the
 error:

 Fatal error: Call to undefined function:...

 I have spoken with the hosting company, but they have considerable trouble
 with 'backside' and 'elbow' recognition.

 Are there any PHP.ini settings that affect this type of function
 declaration?

 Any help would be appreciated.

 Bobby





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




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




  1   2   >