Re: [PHP] Need login suggestions

2010-05-03 Thread Karl DeSaulniers
I see, well I have a login that has multiple levels and here is how I  
have it.
Obvious pertinent info has been changed, but you can adopt and add  
your own.


a config file with userlevel values EG:

$parent = 2; //Parent Level
$student = 1; //Student Level
$guest = 0;//Guest level

A define.php file with things defined EG:
include or require the config.php in this file
define(PARENT, $parent);
define(STUDENT, $student);

Then work some functions to check the levels in your sessions php file.
That way every page thats pulled up, it checks the login status and  
the userlevel.

EG:
include or require the define.php in the session php

//Inside the session php
   function isParent(){
  return ($this-userlvl == PARENT);
   }
   function isStudent(){
  return ($this-userlvl == STUDENT);
   }

$this-userlvl  will be the level recorded after registration was  
completed the first time.
You should be checking this and retrieving this at login. Basically  
setting it as a session variable with it that gets carried through.


Eg usage:
if($this-isParent()) {
//do this
}

HTH,

On May 3, 2010, at 12:43 AM, Karl DeSaulniers wrote:


Hi Ashley,
I would have your database that is attached to this part of the  
website,
verify with another database that stores all your student and  
parent info for your school
and when they register, you can actually check against a database  
of students that actually
attend the school and the parents of that student on your server  
not through a login form.
I believe there is a way to set up a cron or something like that  
where the check is made at

the server level and no one else can check that way.

I am not a professional at php, but I believe I read about this  
capability somewhere.

If someone knows the actual term for this please, interject.

Also, I would probably ask how to do that on the PHP-Database list

Databases and PHP - choose this one
http://www.php.net/mailing-lists.php

HTH,

On May 2, 2010, at 9:09 PM, 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!



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



RE: [PHP] Need login suggestions

2010-05-03 Thread Ashley M. Kirchner
 -Original Message-
 From: Karl DeSaulniers [mailto:k...@designdrumm.com]
 Sent: Monday, May 03, 2010 12:03 AM
 To: PHP
 Subject: Re: [PHP] Need login suggestions
 
 I see, well I have a login that has multiple levels and here is how I
 have it.
 Obvious pertinent info has been changed, but you can adopt and add
 your own.

That part I already have and isn't the problem.  We're at the 'who is this
person registering' stage before I can even determine what level they belong
in.  :)


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



Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-03 Thread Jochen Schultz

 [snip]
And unless we are adding a multiple seconds to the load time is anyone 
going to notice a difference of 1 second? 


yes


regards
Jochen

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



Re: [PHP] ldap add Invalid DN syntax

2010-05-03 Thread Manolis Vlachakis
and my code begins like this...

$uploaddir =
$_SERVER['DOCUMENT_ROOT'].'/webteam/voiko/public_html/uploads/';
$file = $uploaddir . basename($_FILES['uploadfile']['name']);

$data = file_get_contents($uploaddir . $_FILES[uploadfile][name]);


$data=split([;\r],$data);

;

$num = count($data);


var_dump($data);


and goes on as i show you on the last mails..





On 30 April 2010 17:22, Manolis Vlachakis vlachakis.mano...@gmail.comwrote:

 on the array and on the server side i can see the names are added normally
 and with the correct encode(despite what i show you )
 and the only thing is tha i get that DN not valid...
 i used the \r cause i use it on my csv file at least one...
 but i am sure (i used a counter for the letters + i compered the name they
 are the same)

 so it is pretty strange why is not working...


 1.trust me after many times faced problems with delimiters i can tell you
 the correct is with [ ] and your delimiter in between
 2.print_r seems good exactly what i have in csv file..
 3.var_dump works fine counts everything and stuff but even though i get the
 right attributes ...
 i still have the same error(see below)
 it's made me crazy



 onoma--���|epwnimo--��
 *Warning*: ldap_add() 
 [function.ldap-addhttps://195.251.90.188:65007/~voiko/admin/function.ldap-add]:
 Add: Invalid DN syntax

 Thank you for your answer


 On 30 April 2010 16:53, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

  On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote:

 Hallo there everyone
 although i have built my code correctly according to the examples i found on
 the net..
 i get Invalid DN syntax error when i try to insert some attributes with ldap
 add..

 i get and read a csv file where i get the data correctly as i can see on the
 echos that follow:

*$data=split([;\r],$data);*
 *
 *
 * **$info[cn]= $data[$c];*
 * **echo |onoma--;*
 * **echo $info[cn] ;//*
 *** **   $c++;*
 * **$info[sn]= $data[$c];*
 * **echo |epwnimo--;*
 * **echo $info[sn] ;*
 * *
 * **$info[objectclass][0] = top;*
 *  ** **$info[objectclass][1] = organizationalPerson;*
 * *
 * ** *
 * ** $r = ldap_add($ldapconn,
 cn=.$info['cn'].,cn=*,ou=@@@,ou=.,ou=,dc=.dc=,
 $info);*

 funny thing is that when i put them absolute like *$info[sn]= bla
 bla;* it works fine...
 any ideas?


 Are you using the correct split() delimiter? What happens if you just
 output that array with print_r() or var_dump()? I see the delimiter as:

 [;
 ]

 Because the \r is recognised as a carriage return because your string is
 in double quotes.

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





 --
 Manolis Vlachakis

 Nelly's Family Hotel
 Visit:   www.nellys-hotel.gr
   www.nellys.gr
 Skype : manolis.vlachakis




-- 
Manolis Vlachakis

Nelly's Family Hotel
Visit:   www.nellys-hotel.gr
  www.nellys.gr
Skype : manolis.vlachakis


[PHP] Inserting rows with missing IDs

2010-05-03 Thread Andre Polykanine
Hello everyone,
It's not a strictly PHP question, however since I use that with PHP,
I'm asking it there.
How can I accomplish the task of inserting rows into MySql database
with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
195. How do I make the check that allows to insert firstly the missing
IDs and only then apply the auto-increment?
Thanks!


-- 
With best regards from Ukraine,
Andre
Http://oire.org/ - The Fantasy blogs of Oire
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: http://twitter.com/m_elensule


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



RE: [PHP] Inserting rows with missing IDs

2010-05-03 Thread Bob McConnell
From: Andre Polykanine

 It's not a strictly PHP question, however since I use that with PHP,
 I'm asking it there.
 How can I accomplish the task of inserting rows into MySql database
 with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
 195. How do I make the check that allows to insert firstly the missing
 IDs and only then apply the auto-increment?

Why are they missing? Were they present at one time then deleted? If so,
were they used as foreign keys from another table or referenced in
queries for other data that may still reference those empty rows?

Think about the ramifications of old data in other tables that may be
inherited when new rows are assigned a deleted ID.

Bob McConnell

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



Re[2]: [PHP] Inserting rows with missing IDs

2010-05-03 Thread Andre Polykanine
Hello Bob,

Nope; they're not. They are blog entries that were deleted along with
their comments. I'm just thinking about doing this when the amount of
entries exceeds a reasonable number.
-- 
With best regards from Ukraine,
Andre
Skype: Francophile; WlmMSN: arthaelon @ yandex.ru; Jabber: arthaelon @ 
jabber.org
Yahoo! messenger: andre.polykanine; ICQ: 191749952
Twitter: m_elensule

- Original message -
From: Bob McConnell r...@cbord.com
To: Andre Polykanine an...@oire.org
Date: Monday, May 3, 2010, 4:40:18 PM
Subject: [PHP] Inserting rows with missing IDs

From: Andre Polykanine

 It's not a strictly PHP question, however since I use that with PHP,
 I'm asking it there.
 How can I accomplish the task of inserting rows into MySql database
 with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
 195. How do I make the check that allows to insert firstly the missing
 IDs and only then apply the auto-increment?

Why are they missing? Were they present at one time then deleted? If so,
were they used as foreign keys from another table or referenced in
queries for other data that may still reference those empty rows?

Think about the ramifications of old data in other tables that may be
inherited when new rows are assigned a deleted ID.

Bob McConnell


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



[PHP] Re: [Bulk] [PHP] Inserting rows with missing IDs

2010-05-03 Thread Stephen

Andre Polykanine wrote:

Hello everyone,
It's not a strictly PHP question, however since I use that with PHP,
I'm asking it there.
How can I accomplish the task of inserting rows into MySql database
with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
195. How do I make the check that allows to insert firstly the missing
IDs and only then apply the auto-increment?
Thanks
  

Almost certainly you should not want to.

The ID should simply be unique, and have no inherent meaning.

Why do you care if there are gaps?

But if you must, just select the IDs, put them in an array, and query 
the elements.


Stephen

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



Re: [PHP] ldap add Invalid DN syntax

2010-05-03 Thread Manolis Vlachakis
the thing i just tried is with

  // Open a memory file for read/write...
  $fp = fopen('php://temp', 'r+');
  // ... write the $input array to the file using fputcsv()...
  fputcsv($fp, $input, $delimiter, $enclosure);
  // ... rewind the file so we can read what we just wrote...
  rewind($fp);
  // ... read the entire line into a variable...
  $data = fread($fp, 1048576); // [changed]
  // ... close the file...
  fclose($fp);
  // ... and return the $data to the caller, with the trailing newline from
fgets() removed.

and it comes back to me that is not an array
does anyone think that this may cause the problem on the problem i face?


On 3 May 2010 12:37, Manolis Vlachakis vlachakis.mano...@gmail.com wrote:

 and my code begins like this...

 $uploaddir =
 $_SERVER['DOCUMENT_ROOT'].'/webteam/voiko/public_html/uploads/';
 $file = $uploaddir . basename($_FILES['uploadfile']['name']);

 $data = file_get_contents($uploaddir . $_FILES[uploadfile][name]);


 $data=split([;\r],$data);

 ;

 $num = count($data);


 var_dump($data);

 
 and goes on as i show you on the last mails..





 On 30 April 2010 17:22, Manolis Vlachakis vlachakis.mano...@gmail.comwrote:

 on the array and on the server side i can see the names are added normally
 and with the correct encode(despite what i show you )
 and the only thing is tha i get that DN not valid...
 i used the \r cause i use it on my csv file at least one...
 but i am sure (i used a counter for the letters + i compered the name they
 are the same)

 so it is pretty strange why is not working...


 1.trust me after many times faced problems with delimiters i can tell you
 the correct is with [ ] and your delimiter in between
 2.print_r seems good exactly what i have in csv file..
 3.var_dump works fine counts everything and stuff but even though i get
 the right attributes ...
 i still have the same error(see below)
 it's made me crazy



 onoma--���|epwnimo--��
 *Warning*: ldap_add() 
 [function.ldap-addhttps://195.251.90.188:65007/~voiko/admin/function.ldap-add]:
 Add: Invalid DN syntax

 Thank you for your answer


 On 30 April 2010 16:53, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

  On Fri, 2010-04-30 at 14:34 +0300, Manolis Vlachakis wrote:

 Hallo there everyone
 although i have built my code correctly according to the examples i found on
 the net..
 i get Invalid DN syntax error when i try to insert some attributes with ldap
 add..

 i get and read a csv file where i get the data correctly as i can see on the
 echos that follow:

*$data=split([;\r],$data);*
 *
 *
 * **$info[cn]= $data[$c];*
 * **echo |onoma--;*
 * **echo $info[cn] ;//*
 *** **   $c++;*
 * **$info[sn]= $data[$c];*
 * **echo |epwnimo--;*
 * **echo $info[sn] ;*
 * *
 * **$info[objectclass][0] = top;*
 *  ** **$info[objectclass][1] = organizationalPerson;*
 * *
 * ** *
 * ** $r = ldap_add($ldapconn,
 cn=.$info['cn'].,cn=*,ou=@@@,ou=.,ou=,dc=.dc=,
 $info);*

 funny thing is that when i put them absolute like *$info[sn]= bla
 bla;* it works fine...
 any ideas?


 Are you using the correct split() delimiter? What happens if you just
 output that array with print_r() or var_dump()? I see the delimiter as:

 [;
 ]

 Because the \r is recognised as a carriage return because your string is
 in double quotes.

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





 --
 Manolis Vlachakis

 Nelly's Family Hotel
 Visit:   www.nellys-hotel.gr
   www.nellys.gr
 Skype : manolis.vlachakis




 --
 Manolis Vlachakis

 Nelly's Family Hotel
 Visit:   www.nellys-hotel.gr
   www.nellys.gr
 Skype : manolis.vlachakis




-- 
Manolis Vlachakis

Nelly's Family Hotel
Visit:   www.nellys-hotel.gr
  www.nellys.gr
Skype : manolis.vlachakis


Re: [PHP] Inserting rows with missing IDs

2010-05-03 Thread tedd

At 4:34 PM +0300 5/3/10, Andre Polykanine wrote:

Hello everyone,
It's not a strictly PHP question, however since I use that with PHP,
I'm asking it there.
How can I accomplish the task of inserting rows into MySql database
with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and
195. How do I make the check that allows to insert firstly the missing
IDs and only then apply the auto-increment?
Thanks!


Andre:

Why? Why worry about the ID's that are missing?

Does your code depend upon the data being in sequential ID's? If so, 
it's probably not a good idea to do that and you should rethink how 
you pull your data.


Cheers,

tedd

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

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



RE: [PHP] Need login suggestions

2010-05-03 Thread Ashley Sheridan
On Mon, 2010-05-03 at 00:07 -0600, Ashley M. Kirchner wrote:

  -Original Message-
  From: Karl DeSaulniers [mailto:k...@designdrumm.com]
  Sent: Monday, May 03, 2010 12:03 AM
  To: PHP
  Subject: Re: [PHP] Need login suggestions
  
  I see, well I have a login that has multiple levels and here is how I
  have it.
  Obvious pertinent info has been changed, but you can adopt and add
  your own.
 
 That part I already have and isn't the problem.  We're at the 'who is this
 person registering' stage before I can even determine what level they belong
 in.  :)
 
 


I just saw an article in a magazine for something that looks to do just
what you want. It's a PHP-based access manager called Sumo. I haven't
actually used the system myself yet, but the article about it says good
things and it looks to be promising.

Full URL is http://sumoam.sourceforge.net 

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




Re: [PHP] Need login suggestions

2010-05-03 Thread Nilesh Govindarajan

On 05/03/2010 09:56 PM, Ashley Sheridan wrote:

On Mon, 2010-05-03 at 00:07 -0600, Ashley M. Kirchner wrote:


-Original Message-
From: Karl DeSaulniers [mailto:k...@designdrumm.com]
Sent: Monday, May 03, 2010 12:03 AM
To: PHP
Subject: Re: [PHP] Need login suggestions

I see, well I have a login that has multiple levels and here is how I
have it.
Obvious pertinent info has been changed, but you can adopt and add
your own.


That part I already have and isn't the problem.  We're at the 'who is this
person registering' stage before I can even determine what level they belong
in.  :)





I just saw an article in a magazine for something that looks to do just
what you want. It's a PHP-based access manager called Sumo. I haven't
actually used the system myself yet, but the article about it says good
things and it looks to be promising.

Full URL is http://sumoam.sourceforge.net

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





You could also use Zend_Acl for that if you needed a framework. I 
personally don't like to use frameworks.


--
Nilesh Govindarajan
Site  Server Administrator
www.itech7.com
मेरा भारत महान !
मम भारत: महत्तम भवतु !

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



Re: [PHP] Need login suggestions

2010-05-03 Thread tedd

At 8:09 PM -0600 5/2/10, 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!


Ashley:

Excellent question.

My advice is to start at the top and work down. Set up an overall 
top-administrator who determines who is going to be the next level 
down and so forth. You may have as many levels as you need.


The operation is simply one of controlling who has access to what.

The top-admin [Level A] should have access to ALL authorizations and 
can change ALL authorizations.


The next level down [Level B] should have access to determine 
authorizations for Level C access and the top-admin can override such 
determinations.


The next level down [Level C] has access to determine authorizations 
for level D, but Levels A and B can override. The levels cascade down 
as demonstrated above.


The requirement for the various levels is dependant upon what *you* 
[Level A] determines beforehand.


The *requirements* for any *Level* might be an email address that 
works (double-opt-in); and/or a teacher ID ; and/or a student ID, 
and/or a legitimate mailing address; and/or whatever you can verify. 
The point is to verify all those who have access to any Level in the 
protected scheme. You absolutely do not want to allow anyone access 
to post anything on your site without first identifying themselves.


While all of this can become very confusing, it should be pointed out 
that this is simply restricting access to certain scripts by 
personnel authorized by those up the chain of command.


The way this can be done is to place an authorization script (i.e., 
require() ) on those scripts you want access restricted. The 
authorization script simply checks the database to see if the 
user/password match for the level of security required before 
allowing the user to continue with *this* script.


The way I do this is in the required auth.php script I use SESSIONs 
for each level. If the user has provided authorization for Level A 
anywhere in their current event, then they have access to everything. 
If the user passes only level C, then the user has access to only 
those things designated as Level C access.


At the start of every script I place the require(auth.php) AND I set 
a level for *this* script, such as this script is a Level C script 
(i.e., $level =C;). That way all users who have a Level A, B, or C 
clearance can run/access the script. Likewise for higher security 
scripts, such as Level A -- this script has a $level = A 
requirement and thus Level B and C users can't run the script.


Now, some of this organization layout will come out in the wash as 
you write scripts. Clearly you don't want the general public to have 
access to Level A scripts and thus you should keep those URL's from 
them. BUT, you don't need to*hide* the URL's (just in case someone 
finds out) because even if someone finds the URL, they need clearance 
to access them. You only need to provide the URL's necessary for 
whatever clearances the users of the scheme have.


I hope this gives you a better idea of how to handle this type of problem.

Cheers,

tedd

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

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



RE: [PHP] Need login suggestions

2010-05-03 Thread Bob McConnell
From: Ashley M. Kirchner

 From: Paul M Foster
 The only reliable way to resolve this is to let the school
 administration to handle it. Each registration would *attempt* to
 register as a student, parent or whatever. Those attempted
 registrations
 would go into a wait queue. Meantime, emails would be sent to an
 administrator whose job is would be to bless those registrations.
 They
 would check to see if a potential registrant was what they claimed to
 be. You'd give them a page where the queued registration attempts
would
 show up. And they would check the proper box for each potential
 registrant. Once done, the registration would be completed, and in
the
 proper category.
 
 Yeah, that would fall on our shoulders.  School administration won't
do
 this.  It comes back to the IT Department and we have to figure it
out.
 The problem is, while we can bless student registrations, we can't
always
 tell if the next one is a parent or not, or if it's a parent in our
 district.
 
 We do have another system in place, one in which we hand out 2 unique
keys
 for each student at each school and parents pick those up.  Internally
those
 keys are matched to that student so we know who it is that's
registering.
 However, that requires a lot of front work to get those keys out.
 
 For this particular project, we want to make it as painless as
possible, but
 the more I think about it, the more I'm accepting the impossible
nature of
 it.

It all boils down to a simple risk assessment. Is the administration
willing to live with the possibility that students can masquerade as
parents and vice versa? And that strangers can masquerade as either? If
so, then a simple check box on the registration page will suffice. If
not, they will need to establish a manual authentication step as part of
the registration process and control that check box themselves.

Bob McConnell

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



[PHP] classes and variables

2010-05-03 Thread Merlin Morgenstern

Hi there,

I am new to classes in PHP and do want to change a class that has been 
in a package I downloaded. I do simply want to access a variable from 
outside.


This is the code:

class search_helper extends AjaxACApplication
{

   //global $DB;

   var $db_database = 'test';
}

I would like to replace 'test' with $DB. This is the variable from 
outside that holds the name of the Database.


Thank you for any help!

Merlin

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



Re: [PHP] classes and variables

2010-05-03 Thread Israel Ekpo
You do not need to access $DB as a global variable

Since $db_database is a property of search_helper, you can initialize it by
passing a value via the constructor like this

class search_helper extends AjaxACApplication
{
 protected $db_database;

 public function __construct($database_name)
 {
   $this-db_database = $database_name;
 }

public function setDbName($database_name)
{
   $this-db_database = $database_name;
}

public function sayDbName()
{
 echo The database name is  . $this-db_database;
}
}


This should allow you to do this

$helper = new search_helper($DB);

Later on you can also change the database name like this

$helper-setDbName($newDB);

This should state what the database name is

$helper-sayDbName();







On Mon, May 3, 2010 at 5:05 PM, Merlin Morgenstern merli...@fastmail.fmwrote:

 Hi there,

 I am new to classes in PHP and do want to change a class that has been in a
 package I downloaded. I do simply want to access a variable from outside.

 This is the code:

class search_helper extends AjaxACApplication
{

   //global $DB;

   var $db_database = 'test';
}

 I would like to replace 'test' with $DB. This is the variable from outside
 that holds the name of the Database.

 Thank you for any help!

 Merlin

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




-- 
Good Enough is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.
http://www.israelekpo.com/


[PHP] upload directly into a resource?

2010-05-03 Thread Paul Halliday
I have some code that is currently static. It runs via Cron,
generating images which can then be viewed via some other PHP.

What I want to do is allow a user to upload data which I can then pipe
directly into the existing program to produce on the fly images. I am
looking at this:

http://www.php.net/manual/en/features.file-upload.post-method.php

My existing code looks like this:

$theData = aQuery($gType, $gSdate, $gStime, $gEdate, $gEtime, $gFilter, $base);

while ($row = mysql_fetch_array($theData[0])) {

$hit = yes;

$src_ip[] = $row[0];
$dst_ip[] = $row[1];
$sig_desc[] = wordwrap($row[2],20,\\n);

if ($gType == 02) {
$hit_count[] = $row[3];
}

$rec ++;
if ( $rec == $recCount ) {
break;
}

}

// Open Afterglow and feed it our results

$glowCmd = $glowPath -c $glowProps $glowArgs | $dotPath $dotArgs $dotOut;

$dspec = array(
0 = array(pipe, r),
1 = array(pipe, w),
2 = array(file, $glowErr, a)
);

$process = proc_open($glowCmd, $dspec, $pipes, $baseDir);


If you are following the gist, what is the easiest way to put the
uploaded file into $theData?

aQuery just returns the result of a mysql select; so is it just a
matter of using fgetcsv as the action in the stub taken from the file
upload link?

Thanks.

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