[PHP] Execing problems

2002-02-07 Thread Jason Rennie

Hi all,

I have a seperate perl script that I need to start running from a php
script. The script does a fork into the backgroup and exits.

when i do an

exec(funky script stuff here);

The page just hangs trying to load again, apparently after I call the
exec.

I've also tried 

exec(script stuff ) 

but it does the same thing.

Any ideas anybody ?

Jason

-- 
Hofstadter's Law : It always takes longer than you expect, even when you
take Hofstadter's Law into account.


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




RE: [PHP] Execing problems

2002-02-07 Thread Jason Rennie

 does using system() work?
 what about back-ticks? - `funky script stuff here`;

I'll give it a go, i hadn't tried that

Although I thought system would return the output. I was using exec
because it didn't (oops I think I forgot to mention that.)

Jason


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




[PHP] Syntax high lighting

2002-02-04 Thread Jason Rennie

Hi all,

A few months ago I saw a php class (?) for doing syntax high lighting of
various programming languages. But I lost the link in a compter crash and
now I cant find it again.

does anybody know of a php script to do this sort of code highlighting
similar to the show_source() function for php, but for c++,c,perl etc etc
?

Jason

-- 
Hofstadter's Law : It always takes longer than you expect, even when you
take Hofstadter's Law into account.


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




[PHP] Global Arrays ?

2001-12-20 Thread Jason Rennie

Hi all,

I've got an array in the global scope called $g_months which oddly enough
contains the names of the months.

Now when I try to import this into a function as

global $g_months;

it doesn't work. When php prints out the array as an option box I just
wind up with no options.

Any ideas why this is the case ? Am I doing something wrong ?

Jason

-- 
Hofstadter's Law : It always takes longer than you expect, even when you
take Hofstadter's Law into account.


-- 
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] Global Arrays ?

2001-12-20 Thread Jason Rennie

 Sounds quite odd - you may try an echo(serialize($g_months)) in the
 function and see what you get... It may be that the code generating the
 option box has problems - this way you make sure $g_months is empty indeed.

Thanks for that. IT appears to be a problem with the function itself, as
the array is full of stuff.

I guess the next question is, what am i doing wrong here, that lets it
work with a local array but not a global one ?

function html_option_months($selected_month) {

  global $g_months;
  echo(serialize($g_months));
  $result = ;
  while (list($key, $val) = each($g_months)) {
$result .= html_option($key,$val, ($selected_month == $key));
  }
  return $result;
}

Jason

-- 
Hofstadter's Law : It always takes longer than you expect, even when you
take Hofstadter's Law into account.


-- 
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] Global Arrays ?

2001-12-20 Thread Jason Rennie

 It may be a bug in your PHP - walking an array with each probably sets some
 internal position marker which may be buggy for your very situation (global
 variable in local function - something like that).

Thanks for that. I tried it with foreach and it works now.

Jason

-- 
Hofstadter's Law : It always takes longer than you expect, even when you
take Hofstadter's Law into account.


-- 
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] Bookmarking pages

2001-12-20 Thread Jason Rennie

Hi all, again,

I need to be able to have working bookmarkable pages in a system.

The user has session ID's which have to time out, so when they do the user
is kicked out of the system.

But i've been asked to set it up so that after a user gets kicked to a
login screen becasue they have an expired/invalid session id, to let them
go back to the page they where on before getting booted.

No all of the non-session id variables will be in the $HTTP_GET_VARS array
(right ?), but how do I get the file that the user has just come from ?

Jason

-- 
Hofstadter's Law : It always takes longer than you expect, even when you
take Hofstadter's Law into account.


-- 
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] Quoting strings

2001-11-29 Thread Jason Rennie

Hi all,

I have a fnction that needs to quote a strings in php to make them easy to
stick into an mysql db.

I need to do basically $msg, which is easy enough, but I would like to
not quote strings that are already quoted and also escape any single or
double quotes in the string. 

IS there a regex to do this that anybody knows of, or a php function that
i;ve missed ?

Ideas anybody ?

Thanks in advance

Jason

-- 
Hofstadter's Law : It always takes longer than you expect, even when you
take Hofstadter's Law into account.


-- 
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] php 4.0.6 and imap support

2001-08-13 Thread Jason Rennie

Hi all,

I tried to find an answer to this but nothing seemed to work.

I need to build php 4.0.6 with imap support. I'm running redhat 7.1 and
have build and installed the imap-2000-9 rpm's (including devel), php will
build correctly but complains about an undefined symbol mxdriver.

Has the library changed ? Is the lib it is looking for in the wrong spot ?

Have a linked it wrong ??

Jason


-- 
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] Modssl php 4 fears

2001-07-23 Thread Jason Rennie

Hi again all,

I recompiled apache with modssl and it works.

(Well the snake oil inc cert's work ;)

But i get a warning on apache load about, loading a standard module
(php4.so) and how this may crash becasue it isn't compiled to work with
EAPI. Please comile with -DEAPI

Now the question is, do i need to worry about this ?

I just did a quick recompile of PHP but didn't change the config at all.

Hence no -DEAPI. 

Jason


-- 
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] HTTP Authentication and PHP

2001-07-22 Thread Jason Rennie

Hi all,

I've been playing around with PHP authentication via HTTP.

I'm using apache, and when i use the header('WWW_Auth...)

headers i get a username/password dialog pop up (as i wanted).

How do i get those values unset in the browser, so that i can get a user
to re authenticate ?

I need to get a user to re-auth part way through the use of the app i'm
writing becasue they are deleting files from a file system.

Also how would i allow them to logout and let someone else log in.

The docs seemed to imply that the headers command should have repopped the
auth box.

Jason


-- 
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] mod_ssl php4

2001-07-21 Thread Jason Rennie

Hi all,

Are there any known problems with php4, modssl and apache 1.3.20 ?

I looked around but all of the information was dated.

Jason


-- 
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] File Upload Abject Misery Solved

2001-07-20 Thread Jason Rennie

Thank you for everybody tried to help with the file uploading problem.

I figured out the problem.

Don't you hate it how the obvious mistakes are the hardest to find.

The answer was, it is ENCTYPE not ENC_TYPE

doh!

Thanks again everybody

Jason


-- 
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] Re: More upload Problems

2001-07-19 Thread Jason Rennie

 Check your php.ini file to see if file_uploads = on - it is often turned
 off for security.

Yep it is turned on. 

And php.ini is in /usr/local/php/lib/php.ini 

Any other ideas ?

Jason


-- 
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] Re: More upload Problems

2001-07-19 Thread Jason Rennie

   Check your php.ini file to see if file_uploads = on - it is often
 turned
   off for security.
 
  Yep it is turned on.
 
  And php.ini is in /usr/local/php/lib/php.ini
 
  Any other ideas ?
 
  Jason
 
 
 need to see some code...

Here is the total chunk of code to date.

It does currently work, except for the file submission complaining about
the no file uploaded.

the current fragment of code to do with file submission is simply my
efforts to get the script to say that a file is being successfulyl
uploaded.

Jason


?php

//  submit_assign.php contains the 
//  dynamically genertaed pages for
//  the assignments.



include_once(function.php);
include_once(config.php);

// Check validity of the user
session_start();
check_session(session_id(),$username);
$priv = check_privledges($username,$subject);

if($priv == U)
{
login_bounce();
}


$student_dir = $current_assignment_directory . $subject . / . $assign ./  
. $username;

// Perform any requested actions by the user either delete, retreive or view 
individual file

if(isset($action))
{
// how to warn a user about deleting a file ?   
// simply dont at the moment and delete file

if($action == delete)
{
$stud_file_start = $student_dir . / .$filename;
$stud_file_end = $student_dir . / . old  . / . $filename; 
@rename($stud_file_start,$stud_file_end);
}
elseif($action == retreive)
{

// Send the file to the user
$stud_file = $student_dir . / . $filename;
header(Content-disposition: filename=$filename);
header(Content-type: application/force-download);
readfile($stud_file);
die();
}
elseif($action == view)
{
// Now need to output the file using the 
// file hi-lighter


}
else
{
$message = $username tried to do $action on  . time();
log_msg($message);
}

}


if(is_uploaded_file($userfile))
{
move_uploaded_file($userfile,/tmp);
}
else
{
echo No file Uploaded;

}

// Firstly to process any user instructions on the page

$message = $subject .   . $assign .  Submission;

start_page($message);

// Then dispaly the current directory state.

print H3Currently Submitted Files/H3\n;

$submit_dir = $current_assignment_directory . $subject . / . $assign ./  . 
$username;

$param = 
submit_assign.php?username=$usernamesubject=$subjectassign=$assign;

if(file_exists($submit_dir) == false)
{
print No Currently Submitted FilesP\n;
}
else
{
$pwd = fetch_current_files($submit_dir);

// Now to draw the table from the array.

sort($pwd); 

print TABLE\n;

while(($file = array_pop($pwd))!=NULL)
{
// Print each line of the available file table
print TRTD$file/TD\n;
print TDA 
HREF=\$paramupload=falsefilename=$fileaction=delete\Delete/A/TD\n;
print TDA 
HREF=\$paramupload=falsefilename=$fileaction=retreive\Retreive/A/TD\n;
print TDA 
HREF=\$paramupload=falsefilename=$fileaction=view\View/A/TD/TR\n;

}

print /TABLE\n;
}

// now to provide an assignment submission box
print P;
print FORM ENC_TYPE=\multipart/form-data\ ACTION=\$paramupload=true\ 
METHOD=\post\ \n;
print INPUT TYPE=\hidden\ NAME=\MAX_FILE_SIZE\ VALUE=\1048576\\n;
print H4Submit A File/H4P ;
print INPUT TYPE=\file\ NAME=\userfile\ \nP;
print INPUT TYPE=\submit\ VALUE=\Upload\\n;
print /FORM; 


end_page();

?


-- 
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] Re: More upload Problems

2001-07-19 Thread Jason Rennie

   Check your php.ini file to see if file_uploads = on - it is often
 turned
   off for security.
 
  Yep it is turned on.
 
  And php.ini is in /usr/local/php/lib/php.ini
 
  Any other ideas ?
 
  Jason
 
 
 need to see some code...

Here is the total chunk of code to date.

It does currently work, except for the file submission complaining about
the no file uploaded.

the current fragment of code to do with file submission is simply my
efforts to get the script to say that a file is being successfulyl
uploaded.

Jason


?php

//  submit_assign.php contains the 
//  dynamically genertaed pages for
//  the assignments.



include_once(function.php);
include_once(config.php);

// Check validity of the user
session_start();
check_session(session_id(),$username);
$priv = check_privledges($username,$subject);

if($priv == U)
{
login_bounce();
}


$student_dir = $current_assignment_directory . $subject . / . $assign ./  
. $username;

// Perform any requested actions by the user either delete, retreive or view 
individual file

if(isset($action))
{
// how to warn a user about deleting a file ?   
// simply dont at the moment and delete file

if($action == delete)
{
$stud_file_start = $student_dir . / .$filename;
$stud_file_end = $student_dir . / . old  . / . $filename; 
@rename($stud_file_start,$stud_file_end);
}
elseif($action == retreive)
{

// Send the file to the user
$stud_file = $student_dir . / . $filename;
header(Content-disposition: filename=$filename);
header(Content-type: application/force-download);
readfile($stud_file);
die();
}
elseif($action == view)
{
// Now need to output the file using the 
// file hi-lighter


}
else
{
$message = $username tried to do $action on  . time();
log_msg($message);
}

}


if(is_uploaded_file($userfile))
{
move_uploaded_file($userfile,/tmp);
}
else
{
echo No file Uploaded;

}

// Firstly to process any user instructions on the page

$message = $subject .   . $assign .  Submission;

start_page($message);

// Then dispaly the current directory state.

print H3Currently Submitted Files/H3\n;

$submit_dir = $current_assignment_directory . $subject . / . $assign ./  . 
$username;

$param = 
submit_assign.php?username=$usernamesubject=$subjectassign=$assign;

if(file_exists($submit_dir) == false)
{
print No Currently Submitted FilesP\n;
}
else
{
$pwd = fetch_current_files($submit_dir);

// Now to draw the table from the array.

sort($pwd); 

print TABLE\n;

while(($file = array_pop($pwd))!=NULL)
{
// Print each line of the available file table
print TRTD$file/TD\n;
print TDA 
HREF=\$paramupload=falsefilename=$fileaction=delete\Delete/A/TD\n;
print TDA 
HREF=\$paramupload=falsefilename=$fileaction=retreive\Retreive/A/TD\n;
print TDA 
HREF=\$paramupload=falsefilename=$fileaction=view\View/A/TD/TR\n;

}

print /TABLE\n;
}

// now to provide an assignment submission box
print P;
print FORM ENC_TYPE=\multipart/form-data\ ACTION=\$paramupload=true\ 
METHOD=\post\ \n;
print INPUT TYPE=\hidden\ NAME=\MAX_FILE_SIZE\ VALUE=\1048576\\n;
print H4Submit A File/H4P ;
print INPUT TYPE=\file\ NAME=\userfile\ \nP;
print INPUT TYPE=\submit\ VALUE=\Upload\\n;
print /FORM; 


end_page();

?



-- 
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] File Upload Headaches

2001-07-18 Thread Jason Rennie

Hi all,

Can anybody see what is wrong with this code ??


echo \$userfile = $userfile;
echo $HTTP_POST_FILES['userfile']['tmp_name'];


// now to provide an assignment submission box
print P;
print FORM ENC_TYPE=\multipart/form-data\ ACTION=\$paramupload=true\ 
METHOD=\post\ \n;
print INPUT TYPE=\hidden\ NAME=\MAX_FILE_SIZE\ VALUE=\1048576\\n;
print H4Submit A File/H4P ;
print INPUT TYPE=\file\ NAME=\userfile\ \nP;
print INPUT TYPE=\submit\ VALUE=\Upload\\n;
print /FORM; 


this is just a code fragment but, essentially the form submits back to
itself.

When i try to output the $HTTP_POST_FILE['userfile']['any thing']
variables they are not set, and $userfile is simply set to the filename on
the other computer.

Any ideas about what an earth i'm doing wrong 

Jason


-- 
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] Output (Urgent!)

2001-07-17 Thread Jason Rennie

   $resolution = SCRIPT
 LANGUAGE=\JavaScript\document.write(screen.width)/SCRIPT;
 
   if ($resolution = '1024') {
 $resolution = 1024;
   } else {
 $resolution = 800;
   }
 echo $resolution;
 
 It always output 1024


At a guess becasue your mixing and matching languages.

If you got the input from a hidden field in a form (perhaps an entry
page?) then it would be possible to get the data you want.

Jason


-- 
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] learning PHP from scratch

2001-07-16 Thread Jason Rennie

  This approach worked pretty well with previous people i teached 
  PHP, but they already had some sort of programming background. 
  This guy hasn't. I find that he has some difficulties picking 
  it up. And I have some difficulties to further help him. 
 
 Is he having problems with PHP, or database interaction with PHP?

It sounds like he might be having problems with the basic programming
concepts.

Are you teaching him and then getting the guy to actaully try some for
himself ?

Start with something really basic, (hello world) and get him to do a
couple of dynamic things that dont use the database, then introduce the db
slowly. 

Give him some hands on programming task to get started with, and rpovide
him with a good book on PHP and encourage him to experiment a bit.

Jason


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

2001-07-15 Thread Jason Rennie

Hi all,

This might be a dumb question but can anybody tell me why on earth this
doesn't work ?

session_start()
$logged_in = session_is_registered(auth);

if($logged_in != true)
{

if(!(pam_auth($usernamelogin,$pass,$error)))
{
// send an error if it doens't login in
}
else
{
session_register($username);
session_register($auth);
$HTTP_SESSION_VARS[username] = $usernamelogin;
$HTTP_SESSION_VARS[auth] = 1;


}

$user = $HTTP_SESSION_VARS[username];
start_page($user's home page);

}

Now the problem is, that although it auth's ok, and username and auth seem
to be set, anytime i try to access $HTTP_SESSION_VARS[username] it is
blank.

Also if i try to use $HTTP_SESSION_VARS[username] directly in a string i
get and error about expecting one of a variety of string types.

Sorry if this is a really dumb question.

Jason


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

2001-07-15 Thread Jason Rennie

Hi all,

This might be a dumb question but can anybody tell me why on earth this
doesn't work ?

session_start()
$logged_in = session_is_registered(auth);

if($logged_in != true)
{

if(!(pam_auth($usernamelogin,$pass,$error)))
{
// send an error if it doens't login in
}
else
{
session_register($username);
session_register($auth);
$HTTP_SESSION_VARS[username] = $usernamelogin;
$HTTP_SESSION_VARS[auth] = 1;


}

$user = $HTTP_SESSION_VARS[username];
start_page($user's home page);

}

Now the problem is, that although it auth's ok, and username and auth seem
to be set, anytime i try to access $HTTP_SESSION_VARS[username] it is
blank.

Also if i try to use $HTTP_SESSION_VARS[username] directly in a string i
get and error about expecting one of a variety of string types.

Sorry if this is a really dumb question.

Jason



-- 
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] User Authentication

2001-07-03 Thread Jason Rennie

Hi all,

Is there a way in php4 to authenticate a user against the system
passwords?

I have to write a php program to handle student assignment submissions.

These users need to authenticated against an winnt PDC.

Samba has a package called winbind that will let me map the pdc's
usernames and groups onto the unix ones, with the help of pam.

Now i then need to access those throught (i assume) the unix getpwent and
getgrent commands, so that winbind will be used as the service to lookup
the names and passwords.

Is this functionality available in php ?

If not, anybody got any pointers on how to go about writing a wrapper for
php for this ??

Jason



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