Re: [PHP] Looping from A to Z

2006-02-20 Thread Jason Motes

Richard K Miller wrote:
Good afternoon.  I'm having trouble getting PHP to loop from A  through 
Z.  Here is what I tried, coming from a C background:


for ($l = "A"; $l <= "Z"; $l++)
 echo $l;



I use this:

for($i='a'; $i != 'aa'; $i++){
  print $i;
|

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



Re: [PHP] Using PHP for accsess control, preventing access to static files

2005-10-27 Thread Jason Motes


I'm designing a controlled access system in PHP, and it's coming along
quite well.  It's very simple, and just sets a session varibale, such as
$_SESSION['authenticated'] = 1, not a whole lot.

Now I run a small sniplet of code on the top of each HTML and PHP file,
which checks for this variable, and either allows or denys access to the
page.

However, how do people protect against the downloading of real files,
ones which are not parsed by PHP?  .WMV, .MOV, .ZIP, .EXE and so on?  I
want to protect access to these as well, and if a visitor just types in
a URL and is able to access the file because my access control mechanism
simply doesn't work on those types of files, what should be the solution
here?

It's been suggested to use readfile() to accomplish this, by forwarding
content from outside of the document root - but this just sounds odd.
On top of being (what I think would be) incredibly slow, it just doesn't
sound "right".



I had a similar issue.  I ended up using a .htaccess so that you could 
not open the file directly.  If checked for the referrer.  This is not 
the most secure way to do it.  I know it can be spoofed.


IndexIgnore *
SetEnvIfNoCase Referer "^http://example.com/viewer.php"; local_ref=1
Order Allow,Deny
Allow from env=local_ref

Jason Motes
php at imotes.com

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



Re: [PHP] Sessions Issue

2005-08-02 Thread Jason Motes




We built a box about 7 months or so ago using the SuSE 9.1 cd's,
straight install from the CDs. While I've read that sessions are turned
on by default, when we try to call on the sessions functions (like with
phpOpenChat or start_session()) we get calls to undefined function
errors. This is leading me to belive that sessions are disabled for some
reason. I need to enable the sessions so I have a few questions

1) Can I do this without recompiling?



Don't know - Don't have SuSE




In YaST, goto install/remove software and do a search on php.
Is php4-session installed??

I am running SuSE 9.1 and sessions work fine for me.

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



Re: [PHP] SSL ldap bind

2005-06-16 Thread Jason Motes



I am trying to do an ssl ldap bind to novell's edir 8.7.

I have followed the examples from 
http://us4.php.net/manual/en/function.ldap-connect.php I know these 
examples are for AD, but they should be close to the same.


I have exported the server cert and made the changes to ldap.conf.  and 
restarted the ldap service





I guess it helps if you restart apache after you make the above changes.

Everthing is working now!

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



Re: [PHP] SSL ldap bind

2005-06-16 Thread Jason Motes




$ldapserver="ldapserver";  //this works
$ldapserver="ldaps://ldapserver";  //this fails
$ldapserver="ldapserver:636";  //this fails

if (!($ldap = ldap_connect($ldapserver)))
{
  die ("Could not connect to LDAP Server: $server\n");
}
else {
  print "Connected\n";
}
if (!(ldap_bind($ldap, $bindUser,$bindPass)))
{
  die ("Unable to Bind");
}
else {
  print "Bound\n";
}




Oh yeah, My connects don't fail.  It fails on the bind, even if it is 
anomynous.


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



[PHP] SSL ldap bind

2005-06-16 Thread Jason Motes

Hello list

I am trying to do an ssl ldap bind to novell's edir 8.7.

I have followed the examples from 
http://us4.php.net/manual/en/function.ldap-connect.php I know these 
examples are for AD, but they should be close to the same.


I have exported the server cert and made the changes to ldap.conf.  and 
restarted the ldap service


from the command line on a linux box this works:
ldapsearch -H "ldaps://ldapserver" -x

but this does not
ldapsearch -H "ldaps://ldapserver"

and returns the error:
ldap_ssl_interactive_bind_s: Unknown authentication method (86)
additional info: SASL(-4): no mechanism available: No worthy mechs 
found
if i run the above command with the debug option -d 16 it says something 
about supportedSASLMechanisms1...NMAS_LOGIN


notice that on the one that does not work i am not using the -x option. 
 This option allows you todo simple authentication.


In php i can do a bind on the normal port of 389, but anything on 636 fails.


$ldapserver="ldapserver";  //this works
$ldapserver="ldaps://ldapserver";  //this fails
$ldapserver="ldapserver:636";  //this fails

if (!($ldap = ldap_connect($ldapserver)))
{
  die ("Could not connect to LDAP Server: $server\n");
}
else {
  print "Connected\n";
}
if (!(ldap_bind($ldap, $bindUser,$bindPass)))
{
  die ("Unable to Bind");
}
else {
  print "Bound\n";
}

I am assuming the reason that it is failing is that i am getting that 
same SASL error.


Is there anyway to make ldap_bind() use simple authentication??

I looked at ldap_set_option() and could not find anything about simple 
authentication. http://us4.php.net/manual/en/function.ldap-set-option.php
This page has a link to: 
http://www.openldap.org/devel/cvsweb.cgi/~checkout~/doc/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt
This page says something about a constant value LDAP_SASL_SIMPLE.  Is 
there anyway to configure this?


I am using:
 PHP 4.3.3 --with-openssl --with-ldap=yes
 Apache 2.0
 Openldap
 OpenSSL 0.9.7b 10 Apr 2003


I have googled all over for this, any help would be appreciated.

Thanks,
Jason Motes

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



[PHP] Re: hey dip shit

2005-05-17 Thread Jason Motes
Sorry for this post.  A coworker was messing around with my computer and 
sent it.

Please direct all flames to [EMAIL PROTECTED]
Sorry!!
Jason Motes wrote:
HAH
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] hey dip shit

2005-05-17 Thread Jason Motes
HAH
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] SOLVEDphp Full Page Calendar not date picker

2005-04-29 Thread Jason Motes
Here is cal from a scheduling app i have working on.
http://www.imotes.com/cal2.php
http://www.imotes.com/cal2.phps
Richard Lynch wrote:
Here's source code to one I wrote ages and ages ago...
http://chatmusic.com/calendar.phps
http://chatmusic.com/calendar.php
Here's a similar one with PDF output:
http://uncommonground.com/events.phps
http://uncommonground.com/events.pdf
Help yourself to whatever bits and pieces you want.
YMMV
On Fri, April 29, 2005 2:25 am, Angelo Zanetti said:
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: PHP config issues when moving from Fedora to SuSe

2005-04-05 Thread Jason Motes
Whil Hentzen wrote:
Hi folks,
I've done a bit of work with PHP/MySQL on a Fedora Core server over the 
past few months and just about the time I got comfortable, it was time 
to change the server to SuSE. What a delight! Installed Apache 2, PHP 
and MySQL and I was processing pages within minutes.

So now I switched my development box to SuSE, then, later, installed 
Apache 2 and PHP via YaST, and it's burping on me. Apache processes 
static pages fine, but the PHP function calls aren't being processed. 
I'm guessing that there are missing directives somewhere in the Apache 
innards.

I'm confused about Apache's multiple config files. FC just had one big 
ol' config file and I was comfortable adding the PHP lines, setting up 
multiple virtual hosts, and all that. But this SuSE thing is more 
complicated.

There's /etc/apache2/httpd.conf that basically just has a bunch of 
includes. Don't wanna touch that. There's 
/etc/apache2/default-server.conf that looks like it's where the action 
is. And there's a /etc/apache2/conf.d/php4.conf file that has specific 
php commands, such as


   AddType application/x-httpd-php .php
   AddType application/x-httpd-php .php4
   DirectoryIndex index.php
   DirectoryIndex index.php4

But I can't find where any of the Apache config files point to the php4 
config file. Do I need to add an include in default-server.conf? 
(Shouldn't the install have done that? Silly install!)

Where else might I look?
Thanks,
Whil
in my /etc/apache2/default-server.conf their is a directive to load all 
conf files.

Include /etc/apache2/conf.d/*.conf
mod_php4.conf is located in the conf.d directory
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] pdf properties

2005-02-10 Thread Jason Motes
snip
Maybe if you send it 5 more times, someone will answer you.
/snip
Be kind, i tried sending this yesterday  and my post would not show up 
and they were not bounced back to me.  Then i figured out what i did 
wrong and they all went through.

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


[PHP] pdf properties

2005-02-10 Thread Jason Motes
Hello,
Is there anyway to retrieve the properties from a pdf file using php?
When you right click on a pdf file in windows you can see the title of 
the file and you can change this property there also.

I wrote a php page that lists all files in a certain directory.  I want 
to be able show the actual title of the document instead of just the 
file name.

I have searched the manual and google, everything that comes up refers 
to generating pdfs on the fly, not working with an already made pdf.

Thanks in Advance,
Jason Motes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] pdf properties

2005-02-10 Thread Jason Motes
Hello,
Is there anyway to retrieve the properties from a pdf file using php?
When you right click on a pdf file in windows you can see the title of 
the file and you can change this property there also.

I wrote a php page that lists all files in a certain directory.  I want 
to be able show the actual title of the document instead of just the 
file name.

I have searched the manual and google, everything that comes up refers 
to generating pdfs on the fly, not working with a already made pdf.

Thanks in Adance,
Jason Motes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] pdf properties

2005-02-10 Thread Jason Motes
Hello,
Is there anyway to retrieve the properties from a pdf file using php?
When you right click on a pdf file in windows you can see the title of 
the file and you can change this property there also.

I wrote a php page that lists all files in a certain directory.  I want 
to be able show the actual title of the document instead of just the 
file name.

I have searched the manual and google, everything that comes up refers 
to generating pdfs on the fly, not working with an already made pdf.

Thanks in Advance,
Jason Motes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] pdf properties

2005-02-10 Thread Jason Motes
Hello,
Is there anyway to retrieve the properties from a pdf file using php?
When you right click on a pdf file in windows you can see the title of 
the file and you can change this property there also.

I wrote a php page that lists all files in a certain directory.  I want 
to be able show the actual title of the document instead of just the 
file name.

I have searched the manual and google, everything that comes up refers 
to generating pdfs on the fly, not working with an already made pdf.

Thanks in Advance,
Jason Motes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Hostname

2004-12-15 Thread Jason Motes
Chris Boget wrote:
In earlier versions of PHP, you could use the $HOSTNAME
global variable to get the server/machine name that is running
Apache/PHP.  However, that variable is no longer working
and I can't seem to find a replacement in any of the super global
variables.  Is there one?  How can you get the server/machine
name?
thnx,
Chris
$_SERVER['HTTP_HOST']
$_SERVER['SERVER_NAME']
http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.server
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: alternating table entry colors

2004-12-10 Thread Jason Motes
Brad Ciszewski wrote:
i need some assistance making my table (rows) change color for every other
data. here is what i have so far, but i get a "unexpected T_STRING error".
this error's line is: if($thisRow mode 2 == 0){
I beleive you want
if($thisRow % 2 == 0)
not
if($thisRow mode 2 == 0)
http://us2.php.net/operators.arithmetic
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Pure PHP menu tree

2004-10-25 Thread Jason Motes

Basically i am looking for a PHP "menu tree", looking on google I have found
many but most of them use Javascript with php, or are pure JS or DHTML, I
want one that is pure php so it will work accross all browsers.

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