Re: [PHP] Blank PHP pages...

2002-10-17 Thread René Moonen

I had the same thing just two days ago. This is what happend:

I have some code using include files in this way:

1 ?php
2
3 // some php code
4 include(xlib.inc);
5 // some php code
6
7 ?

The include file looks like

1 ?php
2 // some code
3 ?

The problem was in line 3 of the include file. If there is a line feed 
behind ? , the code does not work - gives a blank page just like yours.
Removing that linefeed solved my problem.

I did not yet figure out why this happend. It has someting to do with 
html headers being send. The line feed behind ? is considered HTML 
output, so headers are send at that point. Somehow the rest of the 
PHP-code gets lost.

Anyway... with a little luck this could be of any help to you.

Good luck

René





Angel Gabriel wrote:

... I've got PHP working, on my server, I know this because I used that
small PHP script that shows all the variables, and that worked fine. The
problem seems to be that every other script shows me a blank pages. I'm
using redhat 7.3,  and I installed PHP, MySQL and Apache from RPM's and they
are all up2date - I have no idea what I could have missed. Has anyone else
encountered a similar problem, and if so, how did you remedy it? I have
followed the install instructions to the letter, and I can't seem to find
what the problem is. Any suggestions, hints or tips, greatfully recieved!
Thanks in advance.

***
Not everyone is touched by an Angel..and those that are, never forget
the experience.
***
If you want guest list for bare club
nights.http://raw-talent.hopto.org/mailman/clubnights
***
Can you sing, dance, MC, DJ, do you have talent?Send an email to
[EMAIL PROTECTED]
***


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.404 / Virus Database: 228 - Release Date: 10/15/2002



  





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




Re: [PHP] conditional statement problems

2002-10-01 Thread René Moonen

Pablo Oliva wrote:

$title_err = ($adTitle == ) ? 1 : strlen($adTitle)  50 ? 2 : 0;

Can anyone tell me why this is not evaluating correctly (returning a
value of 1) when $adTitle is an empty string?


  

I have no idea... but if you change your code to this, it works:

$title_err = ($adTitle == ) ? 1 : (strlen($adTitle)  50 ? 2 : 0);

Does anyone know why ?



René




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




Re: [PHP] conditional statement problems

2002-10-01 Thread René Moonen

René Moonen wrote:

 Pablo Oliva wrote:

 $title_err = ($adTitle == ) ? 1 : strlen($adTitle)  50 ? 2 : 0;

 Can anyone tell me why this is not evaluating correctly (returning a
 value of 1) when $adTitle is an empty string?


  

 I have no idea... but if you change your code to this, it works:

 $title_err = ($adTitle == ) ? 1 : (strlen($adTitle)  50 ? 2 : 0);

 Does anyone know why ?



 René




Yes... that's it. Your statement is probably evaluated like this:

$title_err = ( ($adTitle == ) ? 1 : strlen($adTitle)  50 ) ? 2 : 0;

The first ?: returns 1 so the second ?: will return 2


Regards


René



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




Re: [PHP] This is weird, this script does/doesn't work

2002-09-04 Thread René Moonen

Øystein Håland wrote:

on my own machine, W2k+Apache+php4.2 this works without problem,
on the Internet-server though, (Linux), the following script produces a
blank page:

?php
 require ../utils.php;
 $link=openDB();
 $file = $target.form;

// Queries for student
if ($target == student) {
 // Add student Query to add

 // Change student info Query to change info

 // Delete student Query to delete
}

// Queries for result
if ($target == result) {
 // Delete result  Query to delete
}

if(!isset($administrate)  $goal) {
 if ($logga_in == ok ) {
  $adm_user = admin;
  $adm_pass = password;

  if ($operation == logon) {
   if ($password == $adm_pass  $admin == $adm_user) {
setcookie(administrate, OK, 0);

include(../recycle/head.php);
include ($file.php);
   } else {
include(../recycle/head.php);
echo CENTERFONT SIZE=\5\ COLOR=\#C9\Please try again. Check
your spelling./FONTCENTER;
include (loginform.php);
   }
  }
 } else {
  include(../recycle/head.php);
  include (loginform.php);
 }
} elseif ($target) {//When logged in this load the right form
 include(../recycle/head.php);
 include ($file.php);
}
if (!$target) {//This happens when first loaded. In the head.php there's a
menu and the different targets are set
 include(../recycle/head.php);
 echo 
H2Administration of  SUBIMG BORDER=0 SRC=\../pics/mypicmin.gif\
WIDTH=135 HEIGHT=30/SUB/H2
 ;
}
include(../recycle/bottom.php);
?

Explanation: utils.php with the two functions openDB() and queryDB() connect
to the database and do the query. loginform.php contains the html to the
loginform.
 $file = $target.form; so the right form will be loaded.
So, what is wrong, why does it 'behave' so different?





  

Does not look that there are any problems in your script. The real 
problem could be in the include files though!

You might start doing the following
1) check if your internet server allows access to the other directories 
(like ../recycle and ../). I suppose that you did not forget to copy 
these files too ;-)
2) compare the php.ini of your test system and the internet server. 
Differences might give a clue to the problem
3) view the source code of the 'blank page' . Is it realy blank? It 
might contain a bit of HTML output that can give a hint of were your 
script stops
4) include  error_reporting(E_ALL); as first line of code in your 
php-scripts. It might help debugging
5) does your internet server have access to the database? Is it the same 
database? Arre the access rights the same?
6) run this script on both machines and look for differences in the outputs:
?php php_info() ?


Good luck

René




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




Re: [PHP] Re: PHP OOP

2002-09-04 Thread René Moonen

Rodrigo Dominguez wrote:

I made a mistake while I was writting the example, in my original code I
wrote it as you did, with $this-b[0] = new one(); but it doesn't work.
Thank you.

Philip Hallstrom [EMAIL PROTECTED] escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  

Not tested, but what if you change

 $b[0] = new one();
 $b[1] = new one();

to:

 $this-b[0] = new one();
 $this-b[1] = new one();

On Tue, 3 Sep 2002, Rodrigo Dominguez wrote:



I have a problem, I can't create an array of classes into a class, for
example:

class one {
var $a;

function foo() {
echo foo;
}
}

class two {
var $b;

function initialize() {
$b[0] = new one();
$b[1] = new one();
}
}

$test = new two();
$test-initialize();

$test-b[0]-foo();  //It doesn't work
$test-b[1]-foo();  //It doesn't work

Any suggestion?




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

  




  


Eh.. unchecked code, but what about:

$this-b[0] = new one;
$this-b[1] = new one;

$test = new two;


Instead of
$this-b[0] = new one();
$this-b[1] = new one();

$test = new two();

If no luck try to include 
error_reporting(E_ALL);
as first line of your script.


Good luck


René



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




Re: [PHP] Please help with fresh fish.

2002-09-04 Thread René Moonen

Anh wrote:

Hello everyone,

I would like to study PHP but do not have any experience about PHP or
programming. Could you please give me some advice to begin such as books,
news, forum...

Many thanks in advance,
Anh



  

You already found the best PHP forum there is ;-)

René





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




Re: [PHP] How to Popup a Window Using PHP Code

2002-08-02 Thread René Moonen

Hakkan Lui wrote:

Dear all,

As the title state, is there any method to popup a window (like
window.open in Javascript), using PHP code?

Thanks for your help.


Regards,
Hakkan Lui



  

Yep there is:

?php
  echo SCRIPT LANGUAGE='JavaScript'window.open();/SCRIPT
?

But I suppose it is not what you had in mind. ;-)

set mode=serious

You can do anything in PHP as long as your actions are on the server. 
Javascript runs on the client and PHP is not in control than. So if you 
need to open a new window you will need PHP to produce HTML code that 
does just that. That HTML can include Javascripts.

René



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




Re: [PHP] Why won't this work?

2002-07-19 Thread René Moonen

You probably do not have a background of C / C++ programming ;-)

assignments:single equal sign
comparison:dual equal sign

The *assignments* in your if statements are always TRUE, so it will 
always execute the statements after the first *if*

So use
if ($mode == entrance) {
and
else if ($mode == collection) {

And all works well...


René



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




Re: [PHP] Why won't this work?

2002-07-19 Thread René Moonen

snip

   $mode = entrance;
   if ($mode == entrance) {

/snip
I suppose you added the first line ($mode = entrance; ) for testing 
purposes during debugging, but in order for the script to work you 
should now remove it, because now $mode will always have the value 
entrance

good luck


René



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




Re: [PHP] Why won't this work?

2002-07-19 Thread René Moonen

hmm... seems a MySQL topic.
I suppose that your table is filled with correct data at some other 
point. So what you need is a count query that returns
*one* result and not all records in that table. You do not want a 
*while* loop in your PHP script, because that would show a list of
unique ips. So my gues would be:

$result = mysql_query(SELECT COUNT(DISTINCT IP) AS ips FROM ma_counter);
$ips = mysql_fetch_row($result);
pintf(Visitors = %d,$ips);

Disclaimer: code not tested. You might want to check the MySQL manual 
for syntax details of the query.

Good luck

René


John Wulff wrote:

You're a savior, don't know how i missed that.  Thanks a bunch.  Now, one
more quick question if you don't mind.  I've got this query at the bottom
of my page for the purpose of a counter.  But naturally i don't want a
list of all the ips logged, i just want a count of how many unique ips
there are in the table.  How do i go about this??php
$result = mysql_query(SELECT distinct ip from ma_counter);
while(list($ip) = mysql_fetch_row($result))
{
print ($ip);
}
?


  

snip



 $mode = entrance;
 if ($mode == entrance) {

  

/snip
I suppose you added the first line ($mode = entrance; ) for testing
purposes during debugging, but in order for the script to work you
should now remove it, because now $mode will always have the value
entrance

good luck


René





  



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




Re: [PHP] Why won't this work?

2002-07-19 Thread René Moonen

Well if you *know* your query only returns one row or you are just 
interessed in the first row, just forget about the while construction

$result = mysql_query(SELECT id FROM ma_users WHERE user='$PHP_AUTH_USER');
$id=mysql_fetch_row($result)
print $id;

Good luck

René


John Wulff wrote:

Didn't work, but its a great place for me to start from.
As far as the difference between a looping query and a non looping query,
i understand the difference but not exactly how to go about writing a non
looping query.  This bit of code is looping, and i assume it dosen't need
to be, how do i fix this?
$result = mysql_query(SELECT id FROM ma_users where user='$PHP_AUTH_USER');
while(list($id) = mysql_fetch_row($result))
{
print($id);
}

  

hmm... seems a MySQL topic.
I suppose that your table is filled with correct data at some other
point. So what you need is a count query that returns
*one* result and not all records in that table. You do not want a
*while* loop in your PHP script, because that would show a list of
unique ips. So my gues would be:

$result = mysql_query(SELECT COUNT(DISTINCT IP) AS ips FROM
ma_counter); $ips = mysql_fetch_row($result);
pintf(Visitors = %d,$ips);

Disclaimer: code not tested. You might want to check the MySQL manual
for syntax details of the query.

Good luck

René


John Wulff wrote:



You're a savior, don't know how i missed that.  Thanks a bunch.  Now,
one more quick question if you don't mind.  I've got this query at the
bottom of my page for the purpose of a counter.  But naturally i don't
want a list of all the ips logged, i just want a count of how many
unique ips there are in the table.  How do i go about this??php
$result = mysql_query(SELECT distinct ip from ma_counter);
while(list($ip) = mysql_fetch_row($result))
{
print ($ip);
}
?




  

snip





   $mode = entrance;
   if ($mode == entrance) {



  

/snip
I suppose you added the first line ($mode = entrance; ) for testing
purposes during debugging, but in order for the script to work you
should now remove it, because now $mode will always have the value
entrance

good luck


René






  




  




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




Re: [PHP] Why won't this work?

2002-07-19 Thread René Moonen

Eh.. probably should be:

$result = mysql_query(SELECT id FROM ma_users WHERE 
user='$PHP_AUTH_USER');
$row=mysql_fetch_row($result)
print $row['id'];

René

René Moonen wrote:

 Well if you *know* your query only returns one row or you are just 
 interessed in the first row, just forget about the while construction

 $result = mysql_query(SELECT id FROM ma_users WHERE 
 user='$PHP_AUTH_USER');
 $id=mysql_fetch_row($result)
 print $id;

 Good luck

 René


 John Wulff wrote:

 Didn't work, but its a great place for me to start from.
 As far as the difference between a looping query and a non looping 
 query,
 i understand the difference but not exactly how to go about writing a 
 non
 looping query.  This bit of code is looping, and i assume it dosen't 
 need
 to be, how do i fix this?
 $result = mysql_query(SELECT id FROM ma_users where 
 user='$PHP_AUTH_USER');
 while(list($id) = mysql_fetch_row($result))
 {
 print($id);
 }

  

 hmm... seems a MySQL topic.
 I suppose that your table is filled with correct data at some other
 point. So what you need is a count query that returns
 *one* result and not all records in that table. You do not want a
 *while* loop in your PHP script, because that would show a list of
 unique ips. So my gues would be:

 $result = mysql_query(SELECT COUNT(DISTINCT IP) AS ips FROM
 ma_counter); $ips = mysql_fetch_row($result);
 pintf(Visitors = %d,$ips);

 Disclaimer: code not tested. You might want to check the MySQL manual
 for syntax details of the query.

 Good luck

 René


 John Wulff wrote:

   

 You're a savior, don't know how i missed that.  Thanks a bunch.  Now,
 one more quick question if you don't mind.  I've got this query at the
 bottom of my page for the purpose of a counter.  But naturally i don't
 want a list of all the ips logged, i just want a count of how many
 unique ips there are in the table.  How do i go about this??php
 $result = mysql_query(SELECT distinct ip from ma_counter);
 while(list($ip) = mysql_fetch_row($result))
 {
 print ($ip);
 }
 ?




 

 snip



   

 $mode = entrance;
 if ($mode == entrance) {



 

 /snip
 I suppose you added the first line ($mode = entrance; ) for testing
 purposes during debugging, but in order for the script to work you
 should now remove it, because now $mode will always have the value
 entrance

 good luck


 René


   



 




  







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




Re: [PHP] Sessions / logins / cookies / security

2002-07-17 Thread René Moonen

snip

What I'm looking to do is when a user logs in, I start up the session.. I
then have the registered session var to verify they are authenticated as
they move throughout the site.

/snip

This solution is no garantuee that the authenticated user is in control 
during that session. The only thing you realy *know* is that there was a 
succesful authentication at the beginning of the current session and you 
would *assume*  that the user is at the client screen during the 
complete session. (the authenticated user could leave the browser 
unattended).

snip

Now, when they close the browser and come back, I want them to still be
authenticated.  

/snip

The only thing you *know* for sure is that there was a valid 
authentication during some *previous* session. And that *some* user has 
still access to that client based on some client specific authentication 
(pressing ESC during Windows login dialog). So what's your definition of 
'authenticated'.

snip

What's the most secure way, that's not easily spoofed?  

/snip

My point is this. You will never know for sure if the authenticated user 
is still in control in whatever session (not even the first). If you 
realy need to be sure, you would use authentication more than once 
during a session. For example a first time login and then again just 
before the user wants to post or read important information.

If this is of no concern to your application, than it will be no problem 
to use cookies with some session identifier to allow continuing without 
authentication during the next session. But it might be wise to force 
authentication if a user where to enter some kind of admin area of your 
site during the second session.


Success


René




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




Re: [PHP] querying for one specific row number

2002-07-17 Thread René Moonen

Phil Schwarzmann wrote:

I want query my mysql table and get one particular row.
 
So let's say my table had 5 rows (entries) in it, and I want to pull
just row #2, how would I do this??
 
THANKS!!

  

It's OT but OK:

SELECT * FROM table LIMIT 1,1;

Have another look at the MySQL manual (6.4.1. Select Syntax)



René



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




Re: [PHP] Good Forum...

2002-07-15 Thread René Moonen

snip

What is a good php-based forum?

/snip

http://phpnuke.org/
http://phpwebsite.appstate.edu/

A bit more than just a forum, you could use them to build your complete 
site...


snip

What I would do is expand the table with more user info
for use with my whole site.

/snip
 I would consider building your complete site with one of the above 
tools. Much easier to maintain in one tool.
Makes it also easier if a tool updates to a newer version.




Success

René




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




Re: [PHP] Geting PHP Version

2002-07-10 Thread René Moonen

run this MySQL query

SELECT VERSION();

René


Skyhawk wrote:

Please,

How do I make to get version information of MySql in runtime ?
I would like to show the version of MySql in my website. For example:

Version PHP : ? echo phpversion(); ?
Version MySql : ??

Thanks

Skyhawk

  




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




Re: [PHP] Generating word documents based on fields in a browser

2002-07-10 Thread René Moonen

Is this what you mean?


?php
header(Content-type: application/rtf);
echo Hello World;
?

René


Craig wrote:

Is this possible
I want to create a form, similar to an invoicing system that generates a
word document that the user can print out

Any help would be gratefully appreciated.

craig



  




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




Re: [PHP] Browser Troubles...

2002-07-09 Thread René Moonen

snip

Now... on certain browser platforms the browser spuriously dies for no reason. 
(Primarily Oldish IE 5.0(but not all releases) and 5.5).

Has anyone came accross this kind of thing before?

/snip
  

What? M$ software crashing? Na... never seen that ;-)

sorry... coudn't help that!

What output do you produce with your PHP script? Is it plain HTML, does 
it include Javascripts or some our scripts? Did you check the HTML code 
of the output? Does it contain invalid tags or missing end tags?


René







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




Re: [PHP] Compiling PHP with XML????

2002-06-27 Thread René Moonen

snip

 Yes.  Since 4.1.x at least.  But for XSLT you need to get expat and 
 Sablotron and link them into the compile (with the appropriate 
 ./configure options).

/snip

Hum, I did spent some time yesterday on exactly that, but with no 
success (yet).

I'm using
Linux RedHat 7.1.
Expat 1.95.3
Sablotron 0.95-1
PHP 4.2.1

Compiling and installing Expat and Sablotron works fine (so it seems) 
but after that I get errors compiling PHP with XSLT options. Compiling 
without the XSLT options works just fine. These are the PHP options I use:

--prefix=/usr/local/php
--with-config-file-path=/usr/local/php
--with-apxs=/usr/sbin/apxs
--enable-track-vars
--enable-magic-quotes
--enable-debugger
--enable-xslt
--with-xslt-sablot

The last two are the ones that I have added to allow for XSLT


Am I missing something?


René


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




Re: [PHP] Compiling PHP with XML????

2002-06-27 Thread René Moonen

snip

I had the same problem yesterday afternoon, trying to compile PHP with
Sablotron 0.95. Last week, I did a compile with Sablotron 0.90 and everything
was good, so I downgraded 0.95 to 0.90 and was able to successfully build
PHP.
  

/snip

That did it for me also... thanks

René


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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread René Moonen

You might want to start by looking (download, instal, try) at available 
content managers like
PHPWebSite   http://phpwebsite.appstate.edu/ 
PHPNukehttp://phpnuke.org/

They do exactly that; seperate content from programming logic. As an 
admin you can assign certain users as beining authors. Authors can 
upload contents to the web-server without every having to know anything 
about PHP, webservers or databases. As an admin you can change the look 
and feel of the webpage without having to know much about PHP. It's 
designing a new 'skin' rather than desiging a complete new PHP project.
It might very well be that these content managers do not fit your needs, 
but if you start from scratch they are certainly worth looking into 
before you take off on a large PHP project.

good luck

René

Jean-Christian Imbeault wrote:

 I'm just about to start a large PHP project in which I get to work 
 with professional designers/layout people. I want to separate all the 
 programming logic from the presentation but I am not sure how to do this.

 Can anyone point me to resources (web tutorials/articles or books) 
 that would help me figure out how best to separate my programming work 
 from designer's work and how best to integrate them?

 Sorry for asking such a generic question but I don't know how to best 
 phrase it. I did look on the web but the best I could find were some 
 mentions of templates. While templates seems ok they don't address all 
 the issues of separation presentation from code (if I understand them 
 correctly).

 Thanks!

 Jc




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




Re: [PHP] function echo ' '

2002-06-25 Thread René Moonen

Use the escape character to output double quotes

echo 'a href=\$address\';

René

Martin Johansson wrote:

Is there a way to express php variables inside an echo ' '.

I want something like this to work:

echo 'a href=$address';

I know I can write it like this:
echo 'a href=';
echo $address;
echo '';

But Its to hard to read the code like this.
/Martin


  




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




Re: [PHP] Seperating presentation from logic

2002-06-25 Thread René Moonen

Well... I still think that these tools can help.

For example PHPWebSite (which I use for our Intranet) has a set of 
'themes'. A theme consists of a style sheet (.css), some image files 
(logo's, backgrounds etc.) and a small set of PHP scripts that define 
things like standard header, footers.

If you would like to change the look and feel, you 'just' have to change 
(or add) the theme plugin. Examples are also on the phpwebsite homepage.
You can even allow visitors to select a different theme when they visit 
the website.

Now it depends on how much your designers know about style sheets etc. 
Would you trust them changing a style sheet and some images? If not than 
your project could very well be that you have to write a 'theme editor'. 
A kind of user interface that designers can use to build the theme files.

But anyway 'content mangers'  (phpwebsite / phpnuke) do seperate the 
application from the contents, but also application from design. 
Allthough the later not as far as I suppose you would need for your project.

good luck

René


p.s. these tools require a database on the webserver as well, so if you 
download phpwebsite or phpnuke,  be prepared to also have a database 
installed on your webserver.


Jean-Christian Imbeault wrote:

 Thanks for the links. Hard to figure out what those things are just 
 from their web pages. They should work on making it easier to figure 
 what the projects are.

 I'll have a look but ...

 Maybe my message was too vague but what I meant is that my designers 
 will come up with the site layout, colours, graphics etc ... I want 
 them to be able to do all their work without thinking about any 
 programming.

 If they want to make a page that lists in a table all the documents we 
 have from 1999-2001, then they can can do this easily without worrying 
 about me.

 And just as importantly I can code the scripts that will generate the 
 table without worrying that maybe in the future the layout will change.

 So I how can I do this? i.e. if the designers want to change the 
 background colour on one page how can they do this without coming to 
 seem?

 Jc




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




Re: [PHP] Stopping multiple votes by IP

2002-06-05 Thread René Moonen


What then happens with users who are behind a firewall/proxy (probably 
have non-routable IP addresses on theire LAN) and share one internet 
connection. They all have the same remote IP address (routable IP 
address of the firewall).
This would mean that only one user of that group can vote.

I'm not sure if the solution below also works for non-routable 
IP-addresses behind a firewall. It works for proxies.

function clientIP()
{
  return (getenv(HTTP_X_FORWARDED_FOR))?
getenv(HTTP_X_FORWARDED_FOR):getenv(REMOTE_ADDR);
}


Other solution might be
- use cookies to store the vote on the client
- use login name / password to check votes



René


Nick Wilson wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi everyone.

I need to ensure that only one 'vote' per 'article' can be cast by each
visitor and was hoping you might share any opinions you have on my
solution:

IP's seem the way to go so I thought the simplest and most secure method
would be this:

Have a MySQL table with 2 fields: IP and ARTICLE_ID

Check the $REMOTE_ADDR against this table WHERE IP = $REMOTE_ADDR AND
$articl_id = $ARTICLE_ID

IF there is no match, record the vote and insert their IP and the
article id

IF /is/ a match, decline.


Anyone see any inherent problems with that?

Many thanks!
- -- 
Nick Wilson //  www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8/ejLHpvrrTa6L5oRAjf5AJ98ew6rICv4DUAqACXXu1Ru7TxYBQCfbKxn
yzTmfMgihXvX65sY/bCMMDA=
=zRNV
-END PGP SIGNATURE-



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




Re: [PHP] Question about grant user right to MySql

2001-08-13 Thread René Moonen

Try these links for MySQL news:

http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

Best Regards

René

Jack wrote:

 Sorry, all, but i couldn't fine any Mysql News group around, so i sent this
 message here, as i found php got a close relationship with mysql.

 could someone pls tell me how i can grant a user to logon to the database
 from any computer around the office?

 i had read a book and the book told me to type this command:

  Grant all on samp.* to username@% IDENTIFIED BY password

 The book said that the % is stand for the user can logon to the system at
 any computer!
 But i think mysql server take the % as a invaild character.

 Could somone pls tell me if there is another way to Grant the permission to
 a user which he can login to the system from any computer?

 Thx

 Jack
 [EMAIL PROTECTED]

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


--
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] IP security check

2001-08-08 Thread René Moonen

Try this code:

if(getenv(HTTP_X_FORWARDED_FOR))
{
  $ip=getenv(HTTP_X_FORWARDED_FOR);
}
else
{
  $ip=getenv(REMOTE_ADDR);
}
$host = gethostbyaddr($ip);

And check out   http://www.php.net/manual/en/function.getenv.php

However, I think it is very unsafe to base your payment transactions on these
features. If a criminal can get credit card data, he can sure get IP
addresses also.

Regards

René


matt wrote:

 For secure payment pages, I need for the code to determine the persons IP
 address, even if they have a spoofer running. Is this possible? Getting
 around the spoofer in order to catch criminals using illegal credit card
 #'s..

 thanks
 -matt (cs student)

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


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




[Re: [PHP] user's ip]

2001-08-07 Thread René Moonen

The problem is that REMOTE_ADDR returns the IP address of the proxy (if
the user
accesses the web-page via a proxy. This will allways return the IP
address of
the user's machine:

if(getenv(HTTP_X_FORWARDED_FOR))
{
  $ip=getenv(HTTP_X_FORWARDED_FOR);
}
else
{
  $ip=getenv(REMOTE_ADDR);
}
$host = gethostbyaddr($ip);


Renze Munnik wrote:

 On Tue, Aug 07, 2001 at 03:55:25PM +0530, Adrian D'Costa wrote:
  Hi,
 
  I am trying to get the ip address of any user browsing a particular page.
 
  I tried $REMOTE_ADDR but that give me only the remote address.  What would
  be the best way?
 
  Adrian

 Okay... Help me out here...
 You want to know someones IP-address and using $REMOTE_ADDR you get
 the IP-address of the user. What's the problem man?!?!?!

 --

 * RzE:

 -- 
 -- Renze Munnik
 -- DataLink BV
 --
 -- E: [EMAIL PROTECTED]
 -- W: +31 23 5326162
 -- F: +31 23 5322144
 -- M: +31 6 21811143
 -- H: +31 23 5516190
 --
 -- Stationsplein 82
 -- 2011 LM  HAARLEM
 --
 -- http://www.datalink.nl
 -- 

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

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




[PHP] declaring variables in PHP???

2001-07-24 Thread René Moonen

Hi,

I'm using PHP for a few weeks now, so you can imagine that I'm making a
lot of typing errors...

Often I make a typing error in one of the variable names ($helo instead
of $hello or worse still $Hello instead of $hello). Since PHP does not
care about declaring variables before using them, it is very easy to
overlook such  small typing error in a large PHP script.

In the old days of ANSI C, there where things like LINT that would help
you with these problems. Of course in ANSI C these things were easier,
because of the fact that variables need to be declared before they could
be used.

My questions:
1. can you configure PHP in such away that variables need to be
declared?
2. are there source code checking tools that could help me locate
problems like described above?


Thanks for your help

René



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