[PHP] char function

2002-06-25 Thread Leo

i want a logical function (true or false) that search a character into a
string.(like indexOf() in javascript)
example: i want to find char '@ ' in the string [EMAIL PROTECTED]

leo



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




[PHP] checking

2002-06-27 Thread Leo

I have a form and I don't want to insert recording with blank value.
I put:
if ($lastname="") {
$insert="no"
}
if ($insert="no"){
do not insert;
else
insert;
}
my probleme is in some case $lastname="" is true and other case is false.
I tried with $lastname=" " but no change. how can I check if a varible is
empty or not?

leo



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




[PHP] sharing variables

2001-03-09 Thread Leo


hi

i'm currently programming a php web application and i have the following 
problem: i need a login scheme; programmed a simple one. Whichever page the 
user reaches, in some i need their userid, for extra validation. so 
basically, i'm looking for a mechanism to share a variable between multiple 
pages, but as i don't always use forms, i think i can't use url-encoding 
with the a-tag to make the userid available for all scripts.
maybe there is support for logging users in, i don't know
anyone an idea?

tx
 
 



-- 
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.1.2 and gdbm

2002-03-05 Thread Leo

Hello, all!

I have one problem i can't bild php --with-gdbm support.

I have it on my Linux: gdbm-1.8.0-10
and during install there are no errors, but when i try use function in
my program (dbmopen(), dblist().) PHP write that it is undefined
function.

Thanks!


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




[PHP] Static functions

2003-02-09 Thread Leo Spalteholz
Hi, I'm a bit of a newbie to PHP, I've done some stuff in Java/VB/C++ 
but I'm having a few problems finding info on this issue.

Does PHP support something like static functions in Java?

for example in Java I can write:

public class someClass {
public static void someMethod() {}
}

and then in another file:

import someClass;

public class anotherClass {
someClass.someMethod()
}

Is there some way to access methods of a class without creating an 
object in PHP?
Right now I just include the file (not using a class) and then call 
the function but I would like to have it more seperate.

Thanks,
Leo

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




Re: [PHP] Re: Static functions

2003-02-09 Thread Leo Spalteholz
ah!  thank you very much.  Thats exactly what I was looking for.

Leo

On February 9, 2003 01:49 pm, David Eisenhart wrote:
> yes, you can call a static method on a class by specifying the
> class name, then 2 colons and finally the function name:
>
> classname :: functionname([arg,.])
>
> (of course properties can not be accessed by such methods)
>
> David Eisenhart
>
>
>
> "Leo Spalteholz" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> > Hi, I'm a bit of a newbie to PHP, I've done some stuff in
> > Java/VB/C++ but I'm having a few problems finding info on this
> > issue.
> >
> > Does PHP support something like static functions in Java?
> >
> > for example in Java I can write:
> >
> > public class someClass {
> > public static void someMethod() {}
> > }
> >
> > and then in another file:
> >
> > import someClass;
> >
> > public class anotherClass {
> > someClass.someMethod()
> > }
> >
> > Is there some way to access methods of a class without creating
> > an object in PHP?
> > Right now I just include the file (not using a class) and then
> > call the function but I would like to have it more seperate.
> >
> > Thanks,
> > Leo


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




Re: [PHP] Re: Static functions

2003-02-09 Thread Leo Spalteholz
very interesting link.  While some of the cases where he takes java to 
be the winner are simply personal preference, I do agree with most of 
his conclusions.
Best points are the one about declaring variables(3), declaring 
constants(6), using libraries(7), class member scope(17), and 
exception handling(20).  Ok thats my (very unrealistic) wishlist for 
PHP :)

leo

On February 9, 2003 02:09 pm, David Eisenhart wrote:
> you may find the following link interesting
> http://www.tek271.com/articles/JavaOrPhp.html
>
> David Eisenhart


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




[PHP] Include() problems

2003-02-13 Thread Leo Spalteholz
I just ran into a somewhat strange problem with an include failing.
I have the following in my script:
include(dirname(__FILE__)."/LNScreens/LNScrMain.php");
include(dirname(__FILE__)."/LNDataBase/LNDataBase.php");

The first file is included just fine, but the LNDataBase file fails 
(Failed opening for inclusion).  My directory structure is:

/LNDataBase
LNDataBase.php
/LNScreens
LNScrMain.php
index.php

The file exists and it seems to be the exact same syntax as what I 
used to include the other file.  What else could possibly be wrong?

Thanks for any help,
Leo

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




Re: [PHP] Include() problems IGNORE PARENT

2003-02-14 Thread Leo Spalteholz
Never mind.  Apparently I can't tell the difference between a capital 
and a lowercase B.  time to crash methinks.

leo

On February 13, 2003 11:59 pm, Leo Spalteholz wrote:
> I just ran into a somewhat strange problem with an include failing.
> I have the following in my script:
> include(dirname(__FILE__)."/LNScreens/LNScrMain.php");
> include(dirname(__FILE__)."/LNDataBase/LNDataBase.php");
>
> The first file is included just fine, but the LNDataBase file fails
> (Failed opening for inclusion).  My directory structure is:
>
> /LNDataBase
>   LNDataBase.php
> /LNScreens
>   LNScrMain.php
> index.php
>
> The file exists and it seems to be the exact same syntax as what I
> used to include the other file.  What else could possibly be wrong?
>
> Thanks for any help,
> Leo


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




[PHP] MAC address user recognition?

2003-02-20 Thread Leo Spalteholz
I've been thinking about how to do authentication and user recognition 
for my site without cookies.  I had this idea but I don't really know 
if its possible at all.
If I got the IP address from the request could I use ARP to get the 
MAC address for that IP?  If so I could compare that MAC address with 
a (previously obtained) database of addresses and if it matches they 
would automatically be logged in.  So I could preauthorize my friends 
and remember other users once they have signed up.

It seemed like a cool idea but is this at all possible or am I just 
insane?

Thanks,
Leo

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




Re: [PHP] MAC address user recognition?

2003-02-20 Thread Leo Spalteholz
On February 20, 2003 08:13 pm, Jason Sheets wrote:
> MAC addresses are used for on a LAN and not the Internet.  Using a
> MAC address might work for identification on a LAN BUT in most
> operating systems you can easily change the effective MAC address
> on the card.

Good call.  I thought there was some fundemental problem I just 
couldn't remember enough from my networking class to put my finger on 
it. 

> It would probably be better to look for some other form of
> identification like SSL certificates or a cookie with the secure
> bit on so it will only be sent over an SSL connection.

Yeah I'm not super concerned about security and such, this is only a 
personal page so something simple will do the job.  I think I'll just 
end up hacking together my own encryption algorithm and then storing 
encrypted passwords in a cookie.  
Hehe.  Security through obscurity, everyones favorite way :)

Thanks,
Leo

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




[PHP] MSSQL Stored procedure return values

2003-02-22 Thread Leo Spalteholz
Hi,
I'm doing a small project at work with php, ms sql server on w2k IIS5.  
All the data access is done through stored procedures.  This seems to 
be working fine, the record sets are returned and the stored 
procedures execute without error however I can't get any return 
values from them.  
For example I have the following php code:

// setup stored procedure
$sp = mssql_init("spGetReseller", $conObj);
mssql_bind($sp, "@ResellerID", $loginID, SQLINT4, FALSE);
mssql_bind($sp, "@ReturnCode", &$retVal, SQLINT4, TRUE);

$rs = mssql_execute($sp);

So the @ReturnCode variable is defined as OUTPUT in the SP and I am 
passing in $retVal by reference.  This is my stored procedure.

ALTER PROCEDURE spGetReseller
@ResellerID int
, @ReturnCode int OUTPUT
AS

SELECT Something
FROM SomeTable
WHERE SomeField = 1

-- set return code
IF @@ROWCOUNT > 0
  SET @ReturnCode = 0
ELSE
  SET @ReturnCode = 1

This should set the returncode to be 1 if there are no rows returned.  
However no matter what, it will never get this returncode from the 
stored procedure.  (ie $retVal will not be changed by the mssql_bind 
function)  I ran the stored procedure and the @returnCode variable is 
set correctly there so that isn't the problem.  

Does anyone know what could be the problem there?  I guess I could 
return @ReturnCode in the recordset but that would be kinda hokey.

Thanks,
Leo

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



Re: [PHP] PHP running on Win 2000 and IIS

2003-02-22 Thread Leo Spalteholz
For help with getting MSSQL to work with php, check the comments for 
the mssql_execute and mssql_bind functions in the online php manual. 
You need some extra dlls.

Leo

On February 21, 2003 09:43 pm, John W. Holmes wrote:
> > I wish to run PHP on a Win 2000 server, MS SQL and IIS. Can
> > someone
>
> please
>
> > guide me to some place where there are some tutorials on how to
>
> install
>
> > and run the above?
>
> The PHP manual has an installation channel the works.
>
> > Also are there any problems by running PHp on Win 2000, MS SQL
> > and
>
> IIS?
>
> Not that I've noticed. I use all that except for MSSQL, thankfully.
>
> ---John Holmes...


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



Re: [PHP] flashing text possible on PDA?

2003-02-22 Thread Leo Spalteholz
On February 22, 2003 04:38 pm, Denis L. Menezes wrote:
> Hello friends.
>
> I am developing some light pages on the web basically for access by
> PDAs. I need to put and alert for some members so that as soon as
> they log in, the next page will show a flashing alert on the page.
>
> Can anyone suggest how I can make text flash on a PDA considering
> that the PDA browsers do not support many Javascript commands?

No!  Just when I thought the  tag was finally dead and gone 
someone wants to bring it to PDAs... :)

Leo

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



Re: [PHP] include

2003-02-24 Thread Leo Spalteholz
On February 23, 2003 11:08 pm, John Taylor-Johnston wrote:
> Which variable should I use?
>
> _SERVER["HTTP_HOST"]
> _SERVER["SERVER_NAME"]
> HTTP_HOST
> Server_NAME
> Host

Docs are your friend.  or JUST TRY IT.

leo

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



Re: [PHP] PHP Script

2003-02-24 Thread Leo Spalteholz
Hm.  Looks pretty nice.  Cool page and the demos are pretty slick.  
But I can't really see what it would be useful for.  Maybe I missed 
something but it seems to be a sort of InstallShield for php scripts.  
While this sounds like a good idea, its actually quite useless.  What 
is normally involved in "installing" a php script?  If its simple you 
just upload it to the server and if its complex you upload it and 
then do some script specific configuration.
So what exactly does this installer of yours do?  Apparently it just 
runs through a few screens, yet does nothing constructive, and then 
starts the main script.  So you set some variables but where are 
these used?  The only configuration a php script may need will be so 
specific that a general interface cannot handle it.

Leo

PS: Microsoft copyrighted images. Commercial app. Bad idea. Seriously.

On February 24, 2003 12:05 pm, Stephen Craton wrote:
> It may do some good to give you the URL to the website, won't it?
> Sorry...
>
> http://piw.melchior.us
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
>
> - Original Message -
> From: "Stephen Craton" <[EMAIL PROTECTED]>
> To: "PHP List" <[EMAIL PROTECTED]>
> Sent: Monday, February 24, 2003 3:04 PM
> Subject: PHP Script
>
>
> Hello all,
>
> Very sorry if this is spam, but we all need some meat now and then,
> right? ;-)
>
> Anyway, some of you may recognize me as being the horrible PHP
> coder that has so many errors he can't get past the echo command.
> Others may know me as the math maniac for asking so many math
> related PHP functions it looked like I was trying to get you to do
> my homework. Never the less, I have created a, I hope, very useful
> PHP script for you other PHP programmers. It's called
> phpInstallWorks. It's a wizard based and webbased program that
> automatically creates a webbased installation script for your PHP
> script. You may remember me asking if it had been done before, and
> now it has! ^_^
>
> Normally, my scripts are free, but since it's a relativly new idea
> and new type of script, I thought I might charge a little bit to
> help myself get a new computer customized to my needs. The cost is
> a flat fee of $25 for the basic version (the pro has some more
> features but isn't out yet) and will probably have free upgrades or
> like a year or something. Email me or visit the script's website
> for more information. Hope you like it and it does you good and
> that you buy it! =)
>
> Sorry, again, if this is spam but I did want to inform you about
> this script...
>
> Thanks,
> Stephen Craton
> http://www.melchior.us


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



Re: [PHP] testing for < 0

2003-02-28 Thread Leo Spalteholz
On February 28, 2003 10:41 am, Leif K-Brooks wrote:
> Try $timeb <> ''.
>

Well whatta ya know I learn something new every day..  I thought the 
only valid not equal operator was !=...  I'm used to using <> only 
for SQL server stored procedures or VB..

leo

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



Re: [PHP] Arrays and MySQL

2003-03-02 Thread Leo Spalteholz
On March 2, 2003 01:53 pm, Jason Wong wrote:
> On Sunday 02 March 2003 23:34, Beauford.2002 wrote:
> > Hi,
> >
> > I have an array which I am trying to total but having some
> > problems. Any help is appreciated.
> >
> > Example:  This is a hockey team and there are 20 players - I am
> > selecting the goals, assists, and points from each player and
> > then want to have a grand total of all goals, assists, and
> > points.
> >
> > $query = "select goals, assists, points from roster";
> >
> > while ($line = mysql_fetch_row($result)) {
> >
> > $totals[] = $line;
> >
> > }
> >
> > I want to total $totals[0][4] through $totals[19][4],
> > $totals[0][5] through $totals[19][5], etc. for each stat. I
> > thought of putting them in a for loop and just adding them, but
> > this seemed kind of messy and the long way around
>
> You can use array_sum().

What about "SELECT SUM(Goals), SUM(assists)"?

Leo

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



Re: Re[2]: [PHP] ICQ # validation

2003-03-03 Thread Leo Spalteholz
On March 3, 2003 06:31 pm, Tom Rogers wrote:
> Hi,
>
> Tuesday, March 4, 2003, 12:06:14 PM, you wrote:
> JF> Does it actually NEED a regexp?
>
> JF> UNTESTED code:
> JF>  JF> $icq = 2264532680;
> JF> if( (is_int($icq)) && (strlen($icq) > 7) && (strlen($icq) < 9)
> ) { JF> echo "yah";
> JF> } else {
> JF> echo "nah";
> JF> }
> ?>>
>
> JF> FWIW, Are you SURE that all valid ICQ #'s are between 7 and 9
> chars? JF> Surely at some point they'll reach 10 chars, and *may*
> have started at 6?
>
>
> JF> Justin
>
> JF> on 04/03/03 6:00 AM, Liam Gibbs ([EMAIL PROTECTED]) wrote:
> >> Maybe I'm off my rocker, but I don't see how this can't work.
> >> I'm trying to validate an ICQ number, and assuming a valid one
> >> is between 7 and 9 numbers. My line of code is this:
> >>
> >> if(ereg("^[0-9]{7,9}$", $_REQUEST["icqnumber"])) {
> >> print("a-okay!");
> >> } else {
> >> print("error msg");
> >> }
> >>
> >> I've submitted the ICQ # 2264532680, but it validates. Any
> >> ideas?
>
> My icq is 6 digits

Would be kinda cool if your scirpt did a search on icq.com and if it 
found a result then the ICQ # is valid..  of course that means you're 
relying on the icq server to be up and the search page to stay 
consistant..

leo

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



[PHP] Executing PHP code in a database

2003-03-07 Thread Leo Spalteholz
Hi,
I have a table that stores all the "boxes" that my website will 
display on the sides.  So far the content is simply stored in a text 
field and then substituted for the box body.  However this way I 
can't have any php code in the boxes...  What I thought I could do is 
have another field that will contain any php code that I want for 
that box and then execute that after I read it from the database.

So I have two questions basically.
1. How would I go about executing php code in a string?
Say I have $code = "md5('blah');"  how would I execute the code in  
the string?
2. If I instead include a file would it have access tio the local 
variables?

Ie.  In a class I have this:
$strContent = "blah, this is the content I got from the database";
include("includefilefromdatabase.php");

Is the $strContent variable then available from the include file?

Thanks,
Leo

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



Re: [PHP] Executing PHP code in a database

2003-03-07 Thread Leo Spalteholz
On March 7, 2003 09:15 pm, Leo Spalteholz wrote:
> Hi,
> I have a table that stores all the "boxes" that my website will
> display on the sides.  So far the content is simply stored in a
> text field and then substituted for the box body.  However this way
> I can't have any php code in the boxes...  What I thought I could
> do is have another field that will contain any php code that I want
> for that box and then execute that after I read it from the
> database.
>
> So I have two questions basically.
> 1. How would I go about executing php code in a string?
> Say I have $code = "md5('blah');"  how would I execute the code in
> the string?
> 2. If I instead include a file would it have access tio the local
> variables?
>
> Ie.  In a class I have this:
> $strContent = "blah, this is the content I got from the database";
> include("includefilefromdatabase.php");
>
> Is the $strContent variable then available from the include file?
>
> Thanks,
> Leo

Sorry about that.  A simple search in the manual would have answered 
the first question  But I'm still not sure about the second...

Thx,
Leo


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



php-general@lists.php.net

2003-03-07 Thread Leo Spalteholz
On March 7, 2003 08:54 pm, James Taylor wrote:
> Ok, this may have already been posted to the list already, but the
> archives don't seem to like the & and && characters.
>
> I'm running into some code that looks like this:
>
> 
> Define('INPUT', 2);
> 
> if($search->level & INPUT) $tmp.= $search->input();
>
>
> Ok, what's the & mean?
>
> As far as I could tell from the very little documentation I was
> able to scrape up on google, & is a bit-by-bit operator.  Thus, if
> either INPUT or $search->level, we get TRUE... If that's the case,
> what's the point of using it instead of || ?
>
> Or, do I just totally not understand the point of this.  Thanks

Ok shoot me if I'm wrong here I just vaguely recall this from some 
Java course I took.   I think && and & are identical except that if 
you use &, PHP will not short circuit the expression.
like:

$x = 0;
if(false && $x++)
print "impossible";
print $x;   // should print 0


$x = 0;
if(false & $x++)
print "impossible";
print $x;   // should print 1

Warning: This may only work for Java or maybe I just can't remember it 
properly..

leo

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



Re: [PHP] strange behaviour with login page

2003-03-09 Thread Leo Spalteholz
On March 9, 2003 12:49 pm, Steve Pollard wrote:
> If anyone has come across a similar problem to the one described
> below, and has a solution I'd be really grateful if you can help me
> out.
>
> I'm trying to implement a user authentication process where users
> can click on an external link to my site. If they're not logged in
> they get presented with a login dialog. Once they log in they're
> redirected onwards to the page they initially wanted to visit.
>
> The system I have in place at the moment handles authentication
> using sessions. The bizarre thing is, while everything seems to
> work on my home pc (windows & iis web server, php 4.2.1), on the
> host server (linux, apache, php 4.1.2) I get the login screen twice
> before I get redirected. My hunch is that it's something to do with
> when session variable become available after registering them. (I'm
> using the sesssion management functions built in to php 4).
>
> TIA
>
> Steve

Hm.  I had a similar problem.  In my login verification script I would 
run through a bunch of checks, verify the login/pass in the database 
and if it was correct I would start a session, register the variables 
and redirect the user.  This wouldn't work most of the time in IE.  
For some reason it always took a few tries to login.  Then I moved 
the call to session_start() to the beginning of the script and it 
worked fine.  Not sure if this applies to your problem though...

Leo


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



Re: [PHP] Can someone explain this? include problem.....?

2003-03-09 Thread Leo Spalteholz
On March 9, 2003 04:30 pm, Beauford.2002 wrote:
> Sorry, the line I was actually referring to is the one below. I
> forgot the hidden one was even there and serves no purpose and does
> not resolve the problem by removing it.
>
> This works:  
> It also works if I just hardcode a value (value="Bob")
>
> This doesn't:   
>
> They are both exactly the same other than the way they get their
> values, so I don't see a reason why I'm losing part of the second
> input line. Just to be clear, when I view the souce code I see
> this:
>
>   The value= has been
> stripped from the code

Look really hard at that second line..  Notice anything missing?  I 
dont know why its stripped from your browser source but theres an 
obvious mistake.

leo

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



Re: [PHP] Subtracting two dates

2003-03-11 Thread Leo Spalteholz
On March 11, 2003 09:35 pm, Justin French wrote:
> READ THE F***ING MANUAL!!!
>
> http://php.net/round clearly shows you how to round to a whole
> number.
>
> if you want to round ALL decimals up, then you might have to create
> something from scratch, but

ceiling and floor functions are part of nearly every modern 
programming language

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



Re: [PHP] PHP and IIS

2003-03-22 Thread Leo Spalteholz
On March 22, 2003 04:03 pm, Beauford.2002 wrote:
> I just installed Win2k server and IIS (need it for a project I am
> doing) and get the following error after installing PHP. All
> permissions are set correctly. This appears to be a common problem
> as a search comes up with hundreds of the same problem - funny
> though - no answers.
>
> Any help is appreciated.

Are you absolutely sure the permissions are all set correctly?  I 
can't see how this problem could be coming from anything else.  
Remember to give the IUSR_YOURMACHINENAME account execute access to 
php.exe as well as access to uploadtemp and sessionsdata directories.  
Also in IIS enable script execution for your website or virtual 
folder.

Leo

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



Re: [PHP] reloading a page..

2003-03-23 Thread Leo Spalteholz
On March 23, 2003 10:22 am, Beauford.2002 wrote:
> One other problem is that I need to know the page the came from in
> order to reload it. i.e.  if they try to access a restricted page
> from six.html I want to reload six.html - if they try from
> eight.html then eight.html needs to be reloaded.

Firstly, as David mentioned, if the user is not allowed to access the 
page then the link shouldn't be there in the first place.  If there 
is no link then there is no need to refresh the page or generate an 
error or anything.  If you really want to you can have the link but 
instead of an href to the page you would replace it with a Javascript 
alert saying "access denied".
But thats beside the point because if they enter the restricted page 
into the address bar directly it also has to deny them access.  You 
should write a script that checks the users credentials and then 
include it at the top of EVERY page.  If the user can no be validated 
then an access denied message is displayed.  Even better, if a user 
cannot be validated then you can redirect them back to where they 
came from (referrer).  That would effectively achive your goal by 
refreshing the original page no matter where they;re coming from.

Leo


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



Re: [PHP] reloading a page..

2003-03-23 Thread Leo Spalteholz
On March 23, 2003 02:34 pm, Beauford.2002 wrote:
> The link in question is there by design and should be there, but
> below is what I am talking about.
>
> > Even better, if a user cannot be validated then you can redirect
> > them back
>
> to where they
>
> > came from (referrer).  That would effectively achive your goal by
> > refreshing the original page no matter where they;re coming from.
>
> This is what I have, but no matter what I do I can not get a
> message to appear on the referring page saying you have no access
> to the other page, and  I have also read that 'HTTP_REFERER' is not
> very reliable

No you shouldn't rely on it to do anything important but in your case 
its just where the user will be redirected to.  Even if someone fakes 
the referrer to point to the restricted page it will just go into an 
infinite loop.

> if($userlevel != $neededlevel) {
> include ($_SERVER['HTTP_REFERER']);
> $message = $no_permission;
> $exit;
> }
>
> ...on referring page
>
> 

Code seems fine.  You probably are never entering into that if 
statement or the referrer is outputting something unexpected.
Use some print statements to debug this..  

print("{$userlevel} and {$neededlevel}");
print($_SERVER['HTTP_REFERER']);

Of course make sure $no_permission actually contains a string...

Leo

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



Re: [PHP] reloading a page..

2003-03-23 Thread Leo Spalteholz
On March 23, 1998 08:53 pm, Beauford.2002 wrote:
> It's definitely going through the if statement as it does "reload"
> the page - print($_SERVER['HTTP_REFERER']); shows
> http://www.myserver.com/oldpage.html - which is correct.
> print("{$userlevel} and {$neededlevel}"); also shows the correct
> info.   $no_permission does have a string, but even if I hard code
> the message it still doesn't work.
>
> Note thoughif I take out  include ($_SERVER['HTTP_REFERER']);
> from the if statement and put in print($_SERVER['HTTP_REFERER']);
> and print $message - they both display.
>
> So I am at a loss

OH I think I've got it.  the problem is that you're including the 
page before you set the message.  So of course in the include the 
$message will still be an empty string and therefor not display it. 

so rearange the two lines like this:
$message = $no_permission;
include ($_SERVER['HTTP_REFERER']);

and it should work.

HTH,
Leo


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



Re: [PHP] date math question

2003-03-27 Thread Leo Spalteholz
On March 27, 2003 09:15 pm, Charles Kline wrote:
> I am storing my dates as unix timestamp (epoch). Am I right in
> assuming that if I need to add or subtract days from this it is
> done in seconds?

yes


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



[PHP] Problems when trying to use ibm_db2 extension

2007-04-16 Thread Leo Jokinen

Hi all,

I've been banging my head into the wall cause I can't get ibm_db2 
extension working with Apache 2.0.59 and PHP 5.2.1 (as apache module).

(Operating system is winxp pro SP2)

For some reason, this code is working on command line but not when 
placed to htdocs folder:






Command line output:

C:\>php c:\db2_test.php
Function db2_connect() exists
Trying to connect DB2 database..
OK: Connection established


Web output:

Unknown function db2_connect()


Some extra output:

Fatal error: Call to undefined function db2_connect() in 
F:\www\services.itella.net\app\webroot\index.php on line 57


Also, phpinfo() won't say nothing that module ibm_db2 is in use

More info:

php_ibm_db2.dll file is in folder C:/php-5.2.1/ext

php.ini:
extension_dir = "C:/php-5.2.1/ext"
extension=php_ibm_db2.dll

httpd.conf:
AddType application/x-httpd-php .php
LoadModule php5_module "C:/php-5.2.1/php5apache2.dll"
PHPIniDir "C:/php-5.2.1/"


Can someone point out the right direction for me?

Regards

Leo Jokinen

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



[PHP] Re: Problems when trying to use ibm_db2 extension

2007-04-16 Thread Leo Jokinen

Problem solved:
I restarted my computer and after that apache loaded ibm_db2 extension.

My conclusion:
1. When you add some extensions to php.ini, you need to restart windows 
in order to get those extensions available through apache
2. However, those extensions are instantly available if you use php 
command line interface


Anyone disagree?

-Leo-

Leo Jokinen wrote:

Hi all,

I've been banging my head into the wall cause I can't get ibm_db2 
extension working with Apache 2.0.59 and PHP 5.2.1 (as apache module).

(Operating system is winxp pro SP2)

For some reason, this code is working on command line but not when 
placed to htdocs folder:



  
"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";

$conn = db2_connect($conn_string, '', '');

if ($conn) {
  echo "OK: Connection established\n";
  db2_close($conn);
} else {
  echo "ERROR: Connection failed\n";
}
?>


Command line output:

C:\>php c:\db2_test.php
Function db2_connect() exists
Trying to connect DB2 database..
OK: Connection established


Web output:

Unknown function db2_connect()


Some extra output:
Fatal error: Call to undefined function db2_connect() in 
F:\www\services.itella.net\app\webroot\index.php on line 57


Also, phpinfo() won't say nothing that module ibm_db2 is in use

More info:

php_ibm_db2.dll file is in folder C:/php-5.2.1/ext

php.ini:
extension_dir = "C:/php-5.2.1/ext"
extension=php_ibm_db2.dll

httpd.conf:
AddType application/x-httpd-php .php
LoadModule php5_module "C:/php-5.2.1/php5apache2.dll"
PHPIniDir "C:/php-5.2.1/"


Can someone point out the right direction for me?

Regards

Leo Jokinen


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



[PHP] Poping array which has the matching value

2006-12-20 Thread Leo Liu
Hi,

I wanted to search through the array and pop out the value which match my 
search criteria. For example

If array has {a,b,c,d,e,f}

I wanna search for "c" and once I found it, took it out from the array.

So the result of the array after operation will be

{a,b,d,e,f}

If I do array_pop(); function it will only pop the last element inside the 
array and the array will become

{a,b,c,d,e}

Anyway to search the desire element inside the array and took it out from the 
array?

Regards,
Leo
 
Reality starts with Dream

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[PHP] array_intersect problem

2006-12-25 Thread Leo Liu
Hi,
   
  I try to intersect associative array and it seems to fail to do so. Can 
anyone show me a walk around?
   
  For example I have
   
  array1
   
  Array
(
[0] => Array
(
[imageID] => 1
)

[1] => Array
(
[imageID] => 2
)

[2] => Array
(
[imageID] => 3
)

[3] => Array
(
[imageID] => 4
)
)
   
  And array 2
   
  Array
(
[0] => Array
(
[imageID] => 6
)

[1] => Array
(
[imageID] => 3
)
)
   
  After intersection instead of me getting 3 as a result, I got the array 1 
unchanged. Seems like intersection doesn't take place at all. Anyway to solve 
this problem?
   
  Regards,
   
  Leo
   



Reality starts with Dream 

 __
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: [PHP] Comment management

2006-10-23 Thread Rocco Di Leo

Hi Tedd,

you may want to check out a Blog-Software like Wordpress if it fulfills your
requirements and relaunch your website using it. From what i see on your
page, it could pretty much replace the functionality and add the benefits of
comments, nice urls, etc

Greets
Rocco

--
New Identity AG



On 10/23/06, tedd <[EMAIL PROTECTED]> wrote:


Hi:

I posted this on the web-design list, but didn't receive any leads.

I want to continue what I've been doing, which is to offer various
code solutions for people via my web site, but I would like to add a
feature where people can comment on the code. Such as if they found
it useful, or found an error, or general comment -- you know, you've
seen this before. Also, I want the code to be secure and allow me to
edit users comments.

Does anyone have any recommendations or can point me to a simple
content manager for such a purpose?

I know I could write it myself, but I would rather not reinvent the
wheel, if possible.

Thanks.

tedd

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

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




[PHP] Re: [PHP-WIN] can I use Apache v 2 with PHP?

2005-08-03 Thread Leo G. Divinagracia III

Taksam wrote:




Now, my question is: can I use Apache version 2 with PHP? And, even if I can 
use it in my development environment... is it safe to use Apache 2+PHP in a 
production environment?



running apache 2 with php 4, not 5...

--
Leo G. Divinagracia III
[EMAIL PROTECTED]

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