[PHP] Re: Mail() not working

2004-07-31 Thread Tularis
Robin Wilson wrote:
Hi
I get the following error message:
Fatal error: Call to undefined function: mail() in
/srv/www/htdocs/blog/serendipity_functions.inc.php on line 1394
I have changed my php.ini file to find the correct path to sendmail and to
put an option on the end (-f [EMAIL PROTECTED]) to make the
mail come from me, not from my linux system (otherwise my ISPs smtp server
doesn't accept it).
Sending mail works fine with the command line mail command.
What should I do to make this work?
Thanks
Robin
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 29/07/04
enable the function in php.ini :)
There's this small setting somewhere around there that prevents the use 
of certain functions, and you probably configured it to prevent the use 
of mail().

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


Re: [PHP] db transactions across multiple pages...

2004-07-31 Thread Tularis
you could write such a thing, in php, yourself aswell... wouldn't be 
that hard :)

- Tul
Bruce wrote:
yeah...
i saw that write up. i've also inquired with bugs.mysql as to if/whether
this might be reinserted.. we'll see.
that said, it appears that there would need to be an approach similar to the
apache::dbi mod for perl, where you have an app that essentially does
connection pooling. in this model, an intermediate app becomes the app that
has the connection with the mysql server, and never shuts down. the web app
would 'talk' to the intermediate app to get the connection id/handle,
ensuring that the web app could get the same handle for all subsequent mysql
interaction on the pages of the web app
ie
  +<--->app1+
  | v
mysql<--- pool app
  | ^
  +<--->app2+
in this case app1/app2 are both web apps running on apache
app1/app2 would talk to the 'pool app' to get the initial mysql db 'handle'.
the handle is stored/maintained for the life of the client web app.
once the pool app gets the handle, the web app fetches the handle at the
start of every page that has to perform db functions with mysql. subsequent
db functions for the page are then performed between the web app and mysql,
using the handle provided by the pool app
that's the theory, not sure how it would work, or what other issues would
be. but if it did work, it could be extended to support any given web
app/server that needed to be able to maintain the connection with the db
over multiple pages...
-bruce
-Original Message-
From: Jim Grill [mailto:[EMAIL PROTECTED]
Sent: Friday, July 30, 2004 10:48 PM
To: [EMAIL PROTECTED]; 'John Nichel'; [EMAIL PROTECTED]
Subject: Re: [PHP] db transactions across multiple pages...
It's my understanding that persistent connections via the old ext/mysql was
a  flawed misfeature to begin with. This was one of several misfeatrures
corrected by the new mysqli extension. There is some information on the
subject here: http://www.zend.com/php5/articles/php5-mysqli.php
It would be my guess that pconnect will be a thing of the past. It's sort of
a drag, but running out of connections - as pconnect can cause - is a real
drag too. ;)
Jim Grill
Web-1 Hosting
http://www.web-1hosting.net
- Original Message -
From: "bruce" <[EMAIL PROTECTED]>
To: "'John Nichel'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, July 31, 2004 12:10 AM
Subject: RE: [PHP] db transactions across multiple pages...

you also won't see the mysqli pconnect function... which tells me that at
least for now, it's not there...
-bruce
-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED]
Sent: Friday, July 30, 2004 8:44 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] db transactions across multiple pages...
bruce wrote:
not sure if it's php/mysqli... but if you check the php.net for the
"mysqli"
not "mysql" functions... you won't see the persistent attribute listed
for
the php.ini attributes...
I wouldn't worry too much about that though.  I mean if persistant
connections are required for transactions, I'm sure it will be there.
The only reason we may not be seeing it now is because the PHP5
documentation is full of holes (with it not being a production release
yet).  I know of a few items that are available in PHP5 that aren't
documented on php.net yet.
--
By-Tor.com
It's all about the Rush
http://www.by-tor.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


Re: [PHP] PHP5 exception handling

2004-07-30 Thread Tularis
Matthew Weier O'Phinney wrote:
* Curt Zirzow <[EMAIL PROTECTED]>:
* Thus wrote Matthew Weier O'Phinney:
The problem I'm running into: what do I pass as arguments to catch()?
The articles on ZE2 use something like: catch (Exception $e) {}, or
something like catch(MyException $e) (where MyException is a class they
defined in their examples). Is the 'Exception' class a base
class/handler with PHP5? Do I need to create my own exception handler
classes? Do I even need to catch objects of a specific type, or can I
simply do:
   catch ($error) {
   do something with $error
   }
At minimum you should always at least catch the Exception class:
 catch (Exception $e) { }

So, the Exception class is in the PHP5 distribution, then? Do I need to
include/require it, or is it implicit in simply running PHP5?

class foo {
 function myException() {
   throw new MyException('Exception thrown');
 }
 function standardException() {
   throw new Exception();
 }
}
$f = new foo();
try {
 $f->myException();
}
catch (MyException $e) {
 echo "Caught my exception\n", $e;
 $e->customFunction();
}
catch (Exception $e) {
 echo "Default Exception caught\n", $e;
}
try {
 $f->standardException();
}
catch (MyException $e) {
 echo "Caught my exception\n", $e;
 $e->customFunction();
}
catch (Exception $e) {
 echo "Default Exception caught\n", $e;
}

Next question: do I have to 'throw' an error for it to be caught? Again,
coming from perl, if I try to eval something and it fails, I don't have
to throw in error -- if one occurs, I catch it with the 'if ($@)'
construct. Is 'catch (Exception $e)' equivalent? i.e., if an error
occurs in a try block that isn't specifically thrown, will that
construct catch it?
evals don't throw errors as far as I know, unless you throw it yourself 
from within the eval. The few internal functions that do throw 
exceptions can be caught using the catch(Exception $e) method, if you 
want to MAKE something throw an exception, then you need to explicitly 
tell it to THROW. Remember though, this is not an error-mechanism! It's 
exceptions... Errors are returned the standard way, and can be handled 
using error_handlers (http://www.php.net/manual/en/ref.errorfunc.php)

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


[PHP] Re: HTML Table display based upon field contents

2004-07-24 Thread Tularis
Robb Kerr wrote:
On Sat, 24 Jul 2004 23:23:49 +0200, Tularis wrote:

Robb Kerr wrote:

I have a complicated table that needs to be altered depending upon the
contents of a field in one of my recordsets. I've tried several approaches
and need to know what you recommend.
I've created three totally different tables and put the HTML code for each
into a database. Then I used PHP to insert the relevant code into the page
depending upon the contents of a field in a different database. Result -
the appropriate code is inserted properly into the HTML. Problem - the HTML
table I'm trying to insert contains PHP code which is not executed after
being inserted.
Because sometimes the HTML table needs 4 rows and other times only 2, I
tried enclosing the appropriate s in a PHP IF statement (see below).
Problem - PHP IF wasn't executed, both s embedded appeared on page
anyway. And, sometimes, the relevant s will include PHP code so this
embedding technique won't work.

 
    
    
    
    
    
    
 
 
    
    
    
    
    
    
 

Should I simply describe the entire relevant s on one line,
appropriately escape them, assign the to a variable and then use an ECHO to
put them on the page? Or does someone have a simpler more elegant solution?
Thanx
just use eval() on that string, it's not elegant, nor is it really 
secure, but it'll work fine.

This sounds like exactly what I need. But, can you help me with the synatx?
I've read the entry in the PHP documentation and I don't completely
understand. Let's assume all of the code to define the HTML table
(including appropriate PHP) is stored in a database table called
FooterTable. The field containing the code is called FooterField.
Do I first need to assign the field to a variable via the eval()...
$vFooterText = eval(FooterTable['FooterField']);
echo $vFooterText;
or does the eval statement automatically include the ECHO...
eval(FooterTable['FooterField']);
or do I have to read the contents into a variable first, then eval(), then
echo...
$vFooterText = FooterTable['FooterField'];
eval($vFooterText);
echo $vFooterText;
once you get the code you posted a few lines up out of the database it 
usually already resides in a variable. eg. $footertable['FooterField']. 
What eval() does is take a string and just "imagine" it is actually an 
included piece of PHP. If this helps you, you could imagine the eval 
string as follows:
-
// write the string contents to a new php file
$stream = fopen('tmpfile.php', 'w+');
fwrite($stream, $string, strlen($string));
fclose($stream)
include 'tmpfile.php';	// include it, seems obvious...
unlink('tmpfile.php');	// remove the file again


This means that if you pass a string like eg:
A is B!A is not B!
it would parse that as-if it were a piece of php-code, which it is in 
this case. Remember though that everything you tell php to do in that 
string is done at the time the eval() is called. That means that if you 
use that string, eg. called $string (how obvious :P) in such an expression:


$string = '...'; // that php code but then as a string, or gotten from 
the database
$a = 1;
$b = 2;
echo 'starting...';
eval($string);
echo 'stopping';
?>

it would output:
starting...
A is not B!
stopping
Hope that helps :)
- Tul
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: HTML Table display based upon field contents

2004-07-24 Thread Tularis
Robb Kerr wrote:
I have a complicated table that needs to be altered depending upon the
contents of a field in one of my recordsets. I've tried several approaches
and need to know what you recommend.
I've created three totally different tables and put the HTML code for each
into a database. Then I used PHP to insert the relevant code into the page
depending upon the contents of a field in a different database. Result -
the appropriate code is inserted properly into the HTML. Problem - the HTML
table I'm trying to insert contains PHP code which is not executed after
being inserted.
Because sometimes the HTML table needs 4 rows and other times only 2, I
tried enclosing the appropriate s in a PHP IF statement (see below).
Problem - PHP IF wasn't executed, both s embedded appeared on page
anyway. And, sometimes, the relevant s will include PHP code so this
embedding technique won't work.

  
 
 
 
 
 
 
  
  
 
 
 
 
 
 
  

Should I simply describe the entire relevant s on one line,
appropriately escape them, assign the to a variable and then use an ECHO to
put them on the page? Or does someone have a simpler more elegant solution?
Thanx
just use eval() on that string, it's not elegant, nor is it really 
secure, but it'll work fine.

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


[PHP] Re: If...Or...Else

2004-07-24 Thread Tularis
if(a OR b) {
 do something
} else {
 do something else
}
or
if(a || b) {
 do something
} else {
 do something else
}
is enough :)
Robb Kerr wrote:
From time to time I need an If statement that includes an Or condition...

What's the correct syntax for the If line?
Thanx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Using and Echoing Session Variables

2004-07-18 Thread Tularis
you need to call session_start() on every page, yes.
Also, if you're bored with assigning values like that, and you're sure 
you're not overwriting anything, you could try:
$_SESSION = array('UserId'=>'userid', 'Authorised'=>'yes','etc'=>'blah');

However, remember that you don't need to REassign values to $_SESSION to 
keep them stored over multiple visits! :)

hope that helps,
- Tul
Harlequin wrote:
Hi everyone. A few quick pointers if you have time...
I've created a session, easy enough:

I've created variables:
$_SESSION['UserID'] = UserID;
$_SESSION['Authorised']="yes";
$_SESSION['logname'] = $logname;
When a user clicks a link to a test page I created the following doesn't
work though:
echo $_SESSION["UserID"];
Do I need to use the (again):

??? Confused...!
Also - rather than list the session variables the way I am new line session,
new line session etc. is there a better way...?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Book Required

2004-07-17 Thread Tularis
Programming PHP by O`Reilly :)
Lester Caine wrote:
Harlequin wrote:
There's loads and loads of books available on the subject of PHP & MySQL.

It would be nice to find one's that DON'T rely on MySQL ;)
Does anyone have any recommendations...?

Anybody seen a good NON MySQL one.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: How can I tell if a path is absolute?

2004-07-17 Thread Tularis
Trejkaz Xaoza wrote:
Michael Ochs wrote:
Hi,
maybe you could try it with regular expressions! "[A-Z]:\\" or better
"[C-Z]:\\" because A and B is used just for floppy drives...
Take a look at www.php.net/preg_match/

I'm not sure if you noticed, but I said I wanted it to be portable.
Sure, "([A-Za-z]:)?[/\\]" would work to some extent, but would it work
perfectly?  As far as I can tell, the path "C:/" is _relative_ on Linux and
BSD.  Am I wrong?
TX
c:/ wouldn't even work as a path on unix systems. I don't know how paths 
look on MacOS systems, so can't help you with that. However, after 
removing the [a-z]: part of the path, you're stuck with an abosulute 
path that is of the same type as in Unix. In Unix systems absolute paths 
start with a forward-slash (eg. /usr/local or /home/me/, etc). After 
removing the c: from eg. c:/this/and/that, you're left with 
/this/and/that which looks pretty much the same :)

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


[PHP] Re: convert degrees to heading

2004-07-16 Thread Tularis
Here's a quick script I wrote for it:

$deg = $_GET['deg']; // get from URL, for testing atm
$deg %= 360; // make sure it doesn't break on eg 560 degrees
$deg = ((ceil(($deg-22.5)/45))*45+22.5); // break it up into parts we 
know, there might be an easier way though, just too tired to see it.

switch($deg) {
case 22.5:
echo 'W';
break;
case 67.5:
echo 'NW';
break;
case 112.5:
echo 'N';
break;
case 157.5:
echo 'NE';
break;
case 202.5:
echo 'E';
break;
case 247.5:
echo 'SE';
break;
case 292.5:
echo 'S';
break;
case 337.5:
echo 'SW';
break;
default:
echo 'W';
break;
}
?>
René fournier wrote:
I have to write a little function to convert a direction from degrees to 
a compass -type heading. 0 = West. 90 = North. E.g.:

from:
135 degrees
to:
NW
Now, I was planning to write a series of if statements to evaluate e.g.,
if ($heading_degrees < 112.5 && $heading_degrees > 67.5) {
$heading_compass = "N";
}
The works, but it will require
N, NNW, NNE, NE, NW, ENE, NWW... many IF statements.
Can anyone think of a programatically more elegant and efficient way of 
converting this type of data? (I suppose this is not really a problem, 
just a curiosity.)

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


Re: [PHP] custom tags

2004-07-13 Thread Tularis
Eric Emminger wrote:
Hi George,
How about this?
parse the html as xml and replace the component tags with whatever php/html code
output that result to a file
include the file from previous step
Eric
On Tue, 6 Jul 2004 15:56:26 -0500, George Lantz
<[EMAIL PROTECTED]> wrote:
I am looking for a way to parse custom html tags. I would like to then
replace those tags with php/html code. Here is an example of the html
file to be parsed. Notice the "component", they are the custom tags I
wish to replace with code. I only need help in parsing the tags and
storing in a variable or array so I can work with the attributes. The
component tag will be the only tag I will need to work with.


test






This is what I was thinking, although if someone has better idea that is
fine. I was thinking of storing these in a multi-dimensional array. An
example might be $components[0][name][layout]. Is there code out there
already that does this?
Or you could simply use a regexp to extract those from the code, and 
then later on using the 'e' flag, replace them with PHP code.

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


[PHP] Re: Else If/Elseif

2003-06-30 Thread Tularis
Stevie Peele wrote:
What is the difference between "else if" and "elseif"?

Thanks

_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail

else if shouldn't be used, use elseif, and the difference is non-existant

--
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 Tularis
I would also advise to check for register_globals, since I have the 
faint feeling it was OFF on your old version and ON in your new (though 
most logcial would be viceversa :P)

Bobby Patel wrote:
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: session handling works on local server, but not when uploadedto ISP

2003-06-28 Thread Tularis
... and line 5 of reporter_view.php reads what? =/
Anders Thoresson wrote:
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?



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


Re: [PHP] parsing problem

2003-06-28 Thread Tularis
David Otton wrote:

On Sat, 28 Jun 2003 12:33:27 +0200, you wrote:


I have problem in including this text in my PHP parsed file for XHTML
definition:


It works if I remove the first line:




So, I am assuming PHP has problems with the  symbols, as they are
recognised to be PHP code delimiters.


Yup.

try

' . "\r\n"); ?>

or turning short tags off.

use 

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


[PHP] pspell

2003-06-28 Thread Tularis
does anyone know how to check what Dictionaries for pspell/aspell are 
present on the system? since I will need to do that dynamically ;)

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


Re: [PHP] __FILE__ plus variables?

2003-06-28 Thread Tularis
David Nicholson wrote:
Hello,

This is a reply to an e-mail that you wrote on Sat, 28 Jun 2003 at 13:16,
lines prefixed by '>' were originally written by you.
I have a password protected site. If you go to an inside page before 
logging in, it redirects you to the log in page. I would like to grab 
the URL that a user tries to access and send them back there after
they 
log in. I'm using __FILE__ to get the file name (secondary.php
for 

example) but that doesn't return the variables 
(secondary.php?cat_id=267). Is there a way for me to get the full
URL 

not just the filename?
Sam


Using my Apache installation it is in $_SERVER['REQUEST_URI'].

At a guess I would say most other web servers will put it there too.

David.

on IIS you can access it using $_SERVER['query']

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


[PHP] mod_rewrite rules for the php.net rewritten urls

2003-06-07 Thread Tularis
I was wondering where I could get the rewrite urls for the rewriting of 
urls like here on php.net.

- Tularis

P.S. I don't think they're in the phpweb on CVS, I checked that already

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


Re: [PHP] memory exhausted... memory leak?

2003-01-25 Thread Tularis
It worked fine till I changed database (just the database-name). Here is 
the script that is executed untill the line 61:

- - - GLOBAL.PHP- - -

// Pre-load vars
   $settings= array();
   $database= array();
  
   define('XE_VERSION', '0.03a');
   define('XE_BUILD', '2003012319');
  
// Require important Files
   require './config.inc.php';
   require './libs/error.lib.php';
-
- - - CONFIG.INC.PHP - - -

$database['host'] = 'localhost';
$database['port']= '3306';
$database['name'] = 'XEngine';
$database['user'] = '';
$database['pass'] = '';
$database['type']= 'mysql3x';
$database['persistent'] = (bool) false;
$database['status']= 'off';

$settings['template_type']= 'file';// Takes only 'file' or 'db'
$settings['pre']= 'xe_';
?>
--
- - - ERROR.LIB.PHP - - -

class error{
   var $cache;
   var $last;
   var $show;
   var $die;
  
   function error(){
   $this->cache = array();
   $this->last = '';
   $this->show= 4;
   $this->die= 1;
  
   define('XE_FATAL', 0);
   define('XE_ERROR', 1);
   define('XE_WARNING', 2);
   define('XE_MINOR', 3);
   define('XE_NOTICE', 4);
   }
  
   function set($show=4, $die=1){
   $this->show= $show;
   $this->die= $die;
   return true;
   }
  
   function report($msg, $type){
   global $output;

   if($type <= $this->show){
   $this->cache[]= $type.'-|-'.$msg;
   $this->last= $type.'-|-'.$msg;
  
   if($this->die >= $type){
   $output->finish();
   }
   }
   return true;
   }
  
   function show($which='all'){
   $array= array(
   0=> 'FATAL ERROR',
   1=> 'ERROR',
   2=> 'WARNING',
   3 => 'MINOR ERROR',
   4=> 'NOTICE'
   );
  
   if($which=='all'){
   foreach($this->cache as $cache){
   $errors = explode('-|-', $cache);
   $type= $errors[0];
   $msg= $errors[1];
// line 61  
   $return[]= array($array[$type], $msg);
--

I hope you can help me with this, because (on the same server), just 2 
dirs away, the same script is running smoothly... :S
- Tularis

John W. Holmes wrote:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 35 bytes) in
/home/virtual/site8/fst/var/www/html/staff/libs/error.lib.php on line
   

61
 

I suddenly got this error on one of my sites, and after rechecking the
script, it shouldn't be happenning :S

Anyway, I was wondering if this would be a memroy leak? or just some
standard notice that I'm taking up too much memory ;)
   


What were you doing when it happened?

---John W. Holmes...

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


 





[PHP] memory exhausted... memory leak?

2003-01-24 Thread Tularis
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to 
allocate 35 bytes) in 
/home/virtual/site8/fst/var/www/html/staff/libs/error.lib.php on line 61

I suddenly got this error on one of my sites, and after rechecking the 
script, it shouldn't be happenning :S

Anyway, I was wondering if this would be a memroy leak? or just some 
standard notice that I'm taking up too much memory ;)

Anyone?
- Tularis


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



Re: [PHP] No Global Code Fixing

2003-01-04 Thread Tularis
NOTE:
this basicly mimics the way register_globals works.

I use this code to fix register_globals aswell as the magic_quotes_gpc:

$global = @array($_SESSION, $_SERVER, $_COOKIE, $_POST, $_GET, $_FILES, 
$_ENV);
	$global_old = @array($HTTP_SESSION_VARS, $HTTP_SERVER_VARS, 
$HTTP_COOKIE_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_FILES_VARS, 
$HTTP_ENV_VARS);
	
	if(!$global[1]){
		$global = $global_old;
	}
	
	if(!@ini_get('magic_quotes_gpc')){
		foreach($global as $array){
			if(is_array($array)){
foreach($array as $key=>$val){
	$$key = addslashes($val);
}
			}
		}
	}else{
		foreach($global as $array){
			if(is_array($array)){
foreach($array as $key=>$val){
	$$key = $val;
}
			}
		}
	}


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



[PHP] Re: security in guest book and user forums

2003-01-04 Thread Tularis
most forums do this


Seraphim wrote:

Anders Thoresson wrote:


 I've seen both guest books and user forums "hacked" by users who
enter javascript or other code, and that way redirects vistors to
other sites or do other unwelcome things. What expressions should I
look for and not allow in my forms?



I use the htmlspecialchars() function to disable all html. This function
basically puts a '\' in front of eacht html character and thus disables all
html.
You may not want to do this if you want to allow, for example  or
other friendly html. If so you can use a regex to disable the 

Re: [PHP] Avoiding Repeat Posts

2003-01-04 Thread Tularis
Actually, there is a different solution to this aswell. One that is used 
by phpBB and XMB, and maybe some others aswell.

Basicly, it's an anti-flood system. It works like this:

- You are a member and logged in

You post, and the post gets inserted into the database, and with it, 
also the time of posting is kept.

When you post the next thing, the script checks if there was a message 
posted, by that user in the last X seconds (can be set manually). If so, 
it will return a message saying not to repost stuff. Otherwise, it just 
continues...

Hope this helps,

- Tularis
XMB Lead Developer

Orangehairedboy wrote:
I did searches on this one...I'm using NNTP so it's nice...unfortunatly, no
one had quite the same problem.

I had thought about the random value already (see paragraph about unique
visit id), but it just seems like so much to keep track of...

After asking on other board on the same topic, one theme seems to be the
same...just use redirects.

If anyone else is having the same issue, you can do a redirect using the PHP
header() function to send the user directly to the next page. If the user
goes back, they will get a new version of the form, and less browsers will
support resubmitting.

Also, on the same note, if anyone is using buttons as links, make sure you
are using an http://whatever'">
command instead of submitting a form with no fields. This will solve the
problem here.

Lewis


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


on 04/01/03 7:26 PM, OrangeHairedBoy ([EMAIL PROTECTED]) wrote:



Hi all,

It seems that there might be some basic solution on this that I never
received a memo on...


it's been mentioned MANY times on the list in the last week :)



Basically, I'm looking for a way to avoid repeat posts. If someone, for
example, adds something to a bulletin board, clicks submit, and then


presses


F5, they're just 1 click away from re-submitting the form and posting


the


same information for a second time. Is there an easy way to avoid this?


when "generating" the form, include a hidden field which has a unique,
random value.

then the script that recieves/validated the post should check that the


value


doesn't already exist in the database before inserting... the only way
someone can double-post is by actually refreshing the form (thus getting a
new hidden field.




I've thought about using a "unique visit id" or something which gets
triggered when a visitor posts, but that seems like a lot to do...

Also, do you think I should look into redirecting the user once they've
posted so they can't go back?


they can still go "back" after a redirect... it's just pages in the


browser


cache...


Justin French








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




[PHP] Re: email/time question

2003-01-03 Thread Tularis
Since PHP is a languaged that work with user-activation, it would only 
be possible with an infinitive loop, and a constant time check.

PHP needs some user interaction before it can start processing. That's 
the entire basis. As such, it IS techinally possible to do what you 
said, but is also something that is really NOT recommended to do with php.

The other possiblity is to set a cron job to fire up a script which will 
send the email.

- Tularis

Randy Johnson wrote:
Here is what i need to do.



I have a form where a user will submit, email address, email text and a time
 like 11:15pm  and at 11:15pm the email is supposed to be sent out.   any
ideas on how i can make this happen automatically???





Randy




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




[PHP] Re: Securing areas of a web site with PHP

2003-01-01 Thread Tularis
Jean-Christian Imbeault wrote:

1- user logs in
2- user goes to restricted area
3- user views pages, orders an item, changes his account settings, etc ...
4- user logs out
5- user is sent to log out page
6- user hits back button ...

And here my problems start ... even though the user has logged out, all 
the "restricted" pages he saw are still cached by his browser and 
accessible ...

I have tried using a script that checks a session variable that 
indicates if a user is logged in or not and take appropriate action at 
the start of all "restricted" pages, but that doesn't work since when 
the user hits the back button, the PHP script is not re-executed, the 
page is simply loaded from the browser cache.

What are some PHP techniques I could use so that a user can no longer 
access/use pages once he has logged out?


I adives to make sure the browser doesn't cache it *at all*.
This can be done using (one, or more) of the following headers:

// HTTP 1.1 compliant:
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP 1.0 compliant:
header("Pragma: no-cache");

Hope that helps,
- Tularis


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




[PHP] Re: loading a db table into a php array from mysql

2002-12-31 Thread Tularis
Usually,
using mysql to handle your tables is *way* faster than letting php 
handle it.

That's what it was made for, speed...!

In your case, you could just do a complex join I think. That would give 
all results in one table, and you could just order that on scheduletime, 
  and voila, you'd have a pretty nice outcome, namely the schedule you 
were making via a complex way ;)

David T-G wrote:
Hi, all --

I'm so far about knee-deep in my project where I'll be using php to talk
to the mysql database and spit out my web pages.  I wonder if I should be
making individual calls to the database or loading a table into an array
so that I can walk it without those calls.

For instance, I have an instructors table, a clients table, and a
schedule table that has an instructor number column, a client number
column, and a time slot column.

In order to print an instructor's schedule for the day, I have to query
the instructors table to get the id where the name matches, and then
query the schedule table to get the clients and times where the time slot
matches some time today, and then I have to repeatedly query the clients
table to get the names where the returned id matches.  Since the schedule
should be arranged in time order, I might even have client 1 and then
client 2 and then client 1 again -- but I've already switched to 2 so I
have to start over for 1.

It seems a bit silly to, say, load the entire clients table into an array
because there could be thousands or millions of clients, but it's an
awful pain to go and make all of those mysql_query calls to walk the
clients list.  Should I just build a huge query something like

  $query = "select fname,lname from clients where " ;
  foreach ($results_from_previous_query_somehow as $clinum)
{ $query .= "id = '$clinum' or "; }
  $query .= "id = ''" ;	# nice always-failing value; easier than pruning

and then query that way, to get all of what I need in one shot but not
the whole table (unless I need it all)?  Does sql like big OR clauses
like that?

I don't know if this is a PHP or a MySQL question, so this once I've
posted it to both lists.  I'll also summarize to both.


TIA & HAND & Happy New Year

:-D



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




[PHP] Re: Keeping script running, but returning control to user?

2002-12-31 Thread Tularis
What you could do is put your 'lengthy process' in a shutdow function 
(register_shutdown_function()), and just do the header.

There is actually even a simpler way to do this, but it's not advised:

-
first

@set_time_limit(0);	// Make sure there is no limit
ob_start();		// Start output buffering

if(array_key_exists('secondrun',$_GET)) {
	print "Processing complete!";
	exit();
}else{
header("Location:http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?secondrun=1");
ob_flush();		// This sends the output to your browser
ignore_user_abort(true);// Makes sure the script continues...
...			// Lengthy process here
}
?>
-

Basicly, what it does here, is force the engine to flush the output (the 
redirect) to your browser, next,
because the set_time_limit is set to 0 (unlimited), your script still 
goes on... While you can follow the other link.

The ignore_user_aboort(true), makes sure the server continues till the 
script finishes. Otherwise it would kill it as soon as you'd press stop 
on your browser :)

Hope that helps,
- Tularis

Leif K-Brooks wrote:
I need a way to keep the script running on the server, but control to 
the user.  I'm doing some lengthy processes on the server, and it seems 
stupid to keep the user waiting pointlessly.  I'm trying to do something 
like:


header("Location: 
http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?secondrun=1");
//Do long processing here
?>
but it waits till the long processing is done, and then redirects.  Is 
there another way to do this?



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




Re: [PHP] echo'ing array contents through reference variable

2002-11-23 Thread Tularis
echo ${$pdag[$n]}; // is also possible in case the [$n] is the index to 
pdag. Otherwise use this:
echo ${$pdag}[$n];

- Tularis

PS. This is basicly the same thing as Ernest said, but shorter...

Ernest E Vogelsinger wrote:

At 16:50 23.11.2002, -<[ Rene Brehmer ]>- said:
[snip]

>Shouldn't
> echo($$pdag[$n]);
>be able to pull the string contents of the array? Or is there some extra
>needed when using referenced variable?

[snip]

This is ambiguous: is it "$$pdag" indexed by "[$n]", or is it "$pdag[$n]"
dereferenced? If you're using an interim variable you'll get what you need
- either use (depends on your data layout which I don't know)
$temp = $pdag[$n];
echo $$temp;
or
$temp = $$pdag;
echo $temp[$n];





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




[PHP] Re: php programming style

2002-11-21 Thread Tularis
why wouldn't it be??

it's clean code as long as you can read it without having to do much 
trouble, and you have written it the shortest way possible with still 
enough extra stuff around to make other ppl understand it...

so, I would say -> yeah, it's clean :)
- Tularis


Beau Hartshorne wrote:

Hi,

I'm curious if it's bad coding style for a function to return a value on
success, or simply "false" on fail. Here's what I mean:





Is this ok?

Thank you,

Beau





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




Re: [PHP] show mysql- processing time

2002-11-21 Thread Tularis
ok, let me rephrase that... I ment I would like to use a php-function 
for it, OR a mysql command... just not such a function as I put down here...

Chris Shiflett wrote:

Well, you say you want to return the processing time of a MySQL query
via PHP, but then you go on to say that you do not want to do this in
PHP. :-)

I would recommend Jeremy Zawodny's mytop:

http://jeremy.zawodny.com/mysql/mytop/

Chris

--- Tularis  wrote:

>I was wondering if anyone knew of a way to return the processing
>time of a mysql query via php.
>
>And NOT using the
>
>$starttime = time();
>mysql_query($whatever);
>$endtime = time();
>$processingtime = $endtime - $starttime;



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




[PHP] Re: HTML page and php

2002-11-21 Thread Tularis
Martin Johansson wrote:


How do I get a html page into a string variable in php?
Isnt there any function working like this:
$homepage = getHtmlPage(http://www.myhomepage.com/index.html);

/Newbie



try this:
$file = file('http://www.myhomepage.com/index.html');
foreach($file as $key => $val){
	echo "$val\r\n";
}
/*
$file will be an array where each index corresponds with a line from the 
file.
so:

1 => 
2 => 
3 => blah

etc.


Hope that helps
- Tularis


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



[PHP] show mysql- processing time

2002-11-21 Thread Tularis
I was wondering if anyone knew of a way to return the processing time of 
a mysql query via php.

And NOT using the

$starttime = time();
mysql_query($whatever);
$endtime = time();
$processingtime = $endtime - $starttime;

Does anyone please?


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



[PHP] this oop-script still doesn't work

2002-11-19 Thread Tularis
ok, I have gotten great help here  already, but it still doesn't work, 
it returns a object not found error (on the $foo->bar() line). I want to 
change $overall->foo->bar() to $foo->bar... any tips? or help??

thanx!
- Tularis



class overall {
	var $loaded;
	
	function load($class){
		eval("global \$$class;"); // This didn't work either
		//$this->loaded[] = $class; // see the comments with the foreach()
		eval("\$this->$class = new $class;");
		return true;
	}
}

class foo {
	var $bar;

	// Constructor
	function bar(){
		if(!isset($this->bar)){
			$this->bar = 1;
		}else{
			$this->bar++;
		}
		echo $this->bar."";
	}
}

// Start actual loading
$overall = new overall;
$overall->load('foo');

/*
foreach($overall->loaded as $key=>$val){	// didn't work.. I commented 
this out, because I thought it MIGHT interfere with the other way
	$val =& $overall->$val;			// both don't work though :(
}
*/

$overall->foo->bar();
$overall->foo->bar();
$overall->foo->bar();
$overall->foo->bar();

// it doesn't understand this
$foo->bar();
?>


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



[PHP] Re: Display character 'x' times

2002-11-19 Thread Tularis
Tjoumaidis Tasos wrote:


Hello to everybody,

I just want to display a character like D x times like DDD where x is a
$variable i get from the database i cannot make it work like it is on
perl (i don't even know if it is working the same way) and i can't find
a reference in the manual on php.net, maybe it's a silly question but i
am stuck at this moment.

Thx in advance.


there propably is a faster way, but you can use this:
$max = the amount of times you want it to show :) //eg 6 would give dd
while($i <= $max){
	echo 'd'; //or any character you want
	$i++;
}


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




[PHP] Re: What is the best site for PHP news, articles, resources etc....

2002-11-19 Thread Tularis
Phil Schwarzmann wrote:


Let's say you had one site and one site only to get the latest PHP/MySQL
news, articles, reviews, resources, tutorials, advanced stuff etc.

What would it be?!?


zend.com :)


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




[PHP] Re: problem with code (almost fixed)

2002-11-19 Thread Tularis
Yan Grossman wrote:


Hi,
I fixed my code to handle forms using $_REQUEST. Just having problem with
the fields with multiple contents...
the one you have to call  like field[0], field[1],etc...

How do I use the brackets inside brackets?
my case is this:
Thanks.
I have fixed everything with $_REQUEST
but I am having problem with the multiple fields, like this:
$message .= ("hotel = " . $_REQUEST['pac_hot[0]'] . " - ".
$_REQUEST['pac_hot[1]']. " - " .$_REQUEST['pac_hot[2]'] . " -
".$_REQUEST['pac_hot[3]'] . "\n");

How am I going to use the brackets inside the brackets?
Thanks



first, change this: $_REQUEST['pac_hot[0]'] to: $_REQUEST["$pac_hot[0]"]
a single quote (  '  ) disallows variable-matching, meaning it won't 
replace $var by what it should be, it just leaves it as it where a real 
character it should show.

that should work on all your request array stuff hope this helps :)


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



[PHP] Re: OOP - transfering object-pointer

2002-11-19 Thread Tularis
actually, the foreach should read:
foreach($overall->loaded as $key=>$val){
	$val =& $overall->$val;
}

still doens't work though

Tularis wrote:


Currently, I have the following code:

loaded[] = $class;
eval("\$this->$class = new $class;");
return true;
}
}

class foo {
var $bar;

// Constructor
function bar(){
if(!isset($this->bar)){
$this->bar = 1;
}else{
$this->bar++;
}
echo $this->bar."
";
}
}

// Start actual loading
$overall = new overall;
$overall->load('foo');

foreach($overall->loaded as $key=>$val){
$key =& $overall->$key;
}

$overall->foo->bar();
$overall->foo->bar();
$overall->foo->bar();
$overall->foo->bar();

// it doesn't understand this
$foo->bar(); // line 42
?>

It all works, except for the $foo->bar(); thing... I am wondering how I
can turn $overall->foo->bar() to $foo->bar(); as all the things I've
tried, don't work, they don't give any errors, except for
Fatal error: Call to a member function on a non-object in
d:\apache\htdocs\classes.php on line 42...

Could anyone help me with this?
thanx

- Tularis




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




[PHP] OOP - transfering object-pointer

2002-11-19 Thread Tularis
Currently, I have the following code:



class overall {
	var $loaded;
	
	function load($class){
		//eval("global \$$class;"); // This didn't work either
		$this->loaded[] = $class;
		eval("\$this->$class = new $class;");
		return true;
	}
}

class foo {
	var $bar;

	// Constructor
	function bar(){
		if(!isset($this->bar)){
			$this->bar = 1;
		}else{
			$this->bar++;
		}
		echo $this->bar."";
	}
}

// Start actual loading
$overall = new overall;
$overall->load('foo');

foreach($overall->loaded as $key=>$val){
	$key =& $overall->$key;
}

$overall->foo->bar();
$overall->foo->bar();
$overall->foo->bar();
$overall->foo->bar();

// it doesn't understand this
$foo->bar(); // line 42
?>

It all works, except for the $foo->bar(); thing... I am wondering how I 
can turn $overall->foo->bar() to $foo->bar(); as all the things I've 
tried, don't work, they don't give any errors, except for
Fatal error: Call to a member function on a non-object in 
d:\apache\htdocs\classes.php on line 42...

Could anyone help me with this?
thanx

- Tularis


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



[PHP] OOP-classes in PHP

2002-11-17 Thread Tularis
currently I have the followig script:

everything works fine, except for the fact that it doesn't seem to 
understand $overall->foo->foo();. It returns this error:
"Fatal error: Call to a member function on a non-object in 
d:\apache\htdocs\classes.php on line 32"

Now, I know the object is loaded, because the constructor is run, and 
puts out a 1 onscreen... I wish to know how to make this work...
any help plz?

thanx
- Tularis


class overall {
	var $loaded;
	
	function load($class){
		eval("\$$class = new $class;");
		return true;
	}
}

class foo {
	var $bar;

	// Constructor
	function foo(){
		if(!isset($this->bar)){
			$this->bar = 1;
		}else{
			$this->bar++;
		}
		echo $this->bar."";
	}
}

// Start actual loading
$overall = new overall;
$overall->load('foo');

// As of here it won't work anymore... somehow $overall->foo-> doesn't 
work...

$overall->foo->foo();
?>

(and if possible, I would also like to change $overall->foo->foo() to 
$foo->foo(), but still keeping that class as a 'subclass' to the overall 
one.)


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



[PHP] Re: PROBLEMS

2002-11-14 Thread Tularis
all header-modifying functions should be BEFORE any echoing is done, so:

session_start();
if(!session_is_registered("camion"))
   DIE("error");

should be BEFORE:




Ysrael guzmán wrote:


THIS IS MY SCRIPT:
AND THE ERROR IS
Warning: Cannot send session cache limiter - headers already sent
(output started at
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php:4) in
c:\foxserv\www\t-demo1\pedidos\prod_mostrar_tipo.php on line 5


///  SCRIPT  ///








 ";		echo " "; echo "*", 
$filas['prod_descripcion'], "*"; echo ""; echo "
 "; echo "
\n"; echo "

"; echo " ";  			//echo "";  			echo ""; //		if 
(esta_en_array($camion, $cantidad))   //	   { // 
 echo "VALUE='$cantidad' size='15'>";   // 
  } //else   //  {  // 
  $cantidad = 0;   // echo 
"VALUE='$cantidad' size='15'>"; //} 
// echo ">"; echo "\n"; 
echo "\n";   echo "\n"; 
// echo "";  // echo "";echo " "; 
  echo "\n";   echo ""; 
   echo "
";   echo "
"; 	    		 		echo ""; echo " "; echo "

"; echo ""; echo "
";  		 		echo ""; echo " "; echo "*CODIGO: *", 
$filas['prod_cod'], "
\n"; echo ""; echo "
";  echo ""; echo " "; echo "*PRESENTACION: *", 
$filas['prod_presentacion'], "
\n"; echo ""; echo "
";  echo ""; echo " "; echo "*FABRICANTE: *", 
$filas['prod_fabricante'], "
\n";  echo "
"; echo " "; echo "*DESCRIPCION: *", $filas['prod_propiedades'], "
\n"; echo ""; echo "
";	 } 	 echo "

"; ?>









Ysrael Guzmán Meza


-Mensaje original-
De: BigDog [mailto:bigdog@;venticon.com]
Enviado el: Jueves, 14 de Noviembre de 2002 09:54 a.m.
Para: [EMAIL PROTECTED]
Asunto: RE: [PHP] PHP Auth with Apache


You are sending the header information to the browser before the session
stuff begins...


make sure that you call "session_start();" right after your I have a 
problem, i'm new in PHP
>
>It is the problem in my browsegive me the solution please
>
>Warning: Cannot send session cache limiter - headers already sent
>(output started at c:\foxserv\www\t-demo1\pedidos\prod_oficina.php:5)
>in c:\foxserv\www\t-demo1\pedidos\prod_oficina.php on line 6
>
>
>HELP MEEE!!1
>
>Sos
>
>ygm



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




Re: [PHP] OOP-related question

2002-11-14 Thread Tularis
Ok, I combined both, your tip and Brent's, now I have the following 
error, with the following code:

Fatal error: Cannot pass parameter 1 by reference in 
/home/shadowlight/public_html/test/libs/global.lib.php on line 296

code:
	function load(&$class){
		global $$class;

		$$class = new $class;
		$this->loaded[$class] = 1;

		$$class->setup(); // Run constructor

		if(!is_object($$class)){
			return false;
		}
		return true;
	}
}
Danny Shepherd wrote:

Hello,

Adding the following as the first line of overall->load() should solve 
your
problem.

global $$class;

HTH,

Danny.

- Original Message -----
From: "Tularis"
To:
Sent: Thursday, November 14, 2002 8:18 PM
Subject: [PHP] OOP-related question



>Hey,
>I have the following script:
>class overall {
>
>function overall(){
>$this->loaded['overall'] =1;
>
>function load($class){
>
>$$class = new $class;
>$this->loaded[$class] = 1;
>
>$$class->setup(); // Run constructor
>
>if(!is_object($$class)){
>return false;
>}
>return true;
>}
>}
>
>then I have a few classes, which hold a setup() function as thei
>'constructor'. Then, I do this:
>
>$overall = new overall;
>$overall->load('debug');
>
>this should load the debug class. I want it to load to $debug->, but it
>won't even load to $overall->debug
>
>It's not really a *need* to have this, it's just something that will
>help me in keeping control over all classes. I don't want to use new
>class, because this way it would be easier to 'instruct' the
>'constructor' of those new classes to change the values of the vars to a
>specific one, without calling for something weird...
>
>anyway, it doesn't work, and it doesn't spit out an error either.
>Any ideas?
>
>- Tularis
>
>
>--
>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] OOP-related question

2002-11-14 Thread Tularis
Hey,
I have the following script:
class overall {

	function overall(){
		$this->loaded['overall'] =1;

	function load($class){
		
		$$class = new $class;
		$this->loaded[$class] = 1;
		
		$$class->setup(); // Run constructor
		
		if(!is_object($$class)){
			return false;
		}
		return true;
	}
}

then I have a few classes, which hold a setup() function as thei 
'constructor'. Then, I do this:

$overall = new overall;
$overall->load('debug');

this should load the debug class. I want it to load to $debug->, but it 
won't even load to $overall->debug

It's not really a *need* to have this, it's just something that will 
help me in keeping control over all classes. I don't want to use new 
class, because this way it would be easier to 'instruct' the 
'constructor' of those new classes to change the values of the vars to a 
specific one, without calling for something weird...

anyway, it doesn't work, and it doesn't spit out an error either.
Any ideas?

- Tularis


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



[PHP] Re: passing multiple variables in a url

2002-11-14 Thread Tularis
If I understand correctly, you want to ahev links like:


To get the vars from the thread, if you don't know it's name, you can 
use soemthing like this:
foreach($_GET as $key => $name){
$get[] = htmlentites($name, 'ENT_QUOTES');
}

that way you'll get a $get array, with all the url parts in it, numbered 
from 0->n

the htmlentities() makes sure that all html compatible chars get 
transformed in to others, which look the same but don't work as html (eg 
» and such).

Hope this helps,
- Tularis
XMB Lead Developer
Cj wrote:

I have a "contact us" php script on my site that allows users to email
direct from the webiste.  I want to be able to pass the to address and
subject line to the script so I can call teh web page from elsewhere 
on the
site and have it automatically choose the correct email address and 
subject
line.

EG instad of using  which requires them
to have an email client set up on the machine I want to link to
 <mailto:joe@;bloggs.mail.com>
The script already handles the email=director by setting a default 
entry in
a drop down form but I can't get it to separate the first and second
variables in the URL.

Also is this a big security risk as I will be echoing the 2nd variable as
the contents of a form field.  Would it be possible for someone to type in
the URL with HTML/php in it that would make a mess of everything?  How 
can I
protect against this?  Would it be sufficient to just pase the 2nd 
variable
for non alphabetic characters and remove them?


 



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