User Name
Password
AppleNova Forums » Programmer's Nook »

What file type would this be?


Register Members List Calendar Search FAQ Posting Guidelines
What file type would this be?
Thread Tools
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Tidewater Virginia
 
2007-12-13, 22:57

If I were to create and index file with this content, what would it be? (.html or .php or other)
[PHP]<?php
$ip = "$REMOTE_ADDR\n" ;
$banip = '/home/kellyint/public_html/ban-ip/ban-ip.txt';
$fp = fopen($banip, "a");
$write = fputs($fp, $ip);
fclose($fp);
?>[/PHP]
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2007-12-13, 23:33

index.php, if I understand your question correctly.
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Tidewater Virginia
 
2007-12-13, 23:44

Thanks. That's what I was asking.

I'm following a "how-to" and it said to create an index file with that content. It's to ban bad bot's who don't follow robots.txt.

Thanks!

Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.”
MineCraft? mc.applenova.com | Visit us! | Maybe someday I'll proof read, until then deal with it.
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2007-12-13, 23:45

To be completely clear however, the file simply needs to be parsed by the PHP parser... So it can be whatever filetypes you have PHP associated with in httpd.conf (Via the AddHandler directive), whether that be .php, .php5, .phtml, or even .html.

I really have nothing to put here, but I feel it's rather strange to not have one.
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Tidewater Virginia
 
2007-12-14, 00:00

My host doesn't have a httpd.conf in any of my directories, so I would need to create them on my own if I wanted to add .html to it? Or would it already be there?

In this case, the easiest thing for me to do was change the index.html to index.php and everything worked. I managed to bad my own IP address from my site though the .htaccess file. Of course I did remove my IP from the list too.

Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.”
MineCraft? mc.applenova.com | Visit us! | Maybe someday I'll proof read, until then deal with it.
  quote
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2007-12-14, 00:25

Where exactly are you hosting that has register globals on?

From that small snippet of code it looks like it is on, you shoul…turn it off with php.ini if you can make one. It's a security hazard if you are not careful.
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Tidewater Virginia
 
2007-12-14, 00:31

Quote:
Originally Posted by ast3r3x View Post
Where exactly are you hosting that has register globals on?

From that small snippet of code it looks like it is on, you shoul…turn it off with php.ini if you can make one. It's a security hazard if you are not careful.
My host is SurpassHosting.

And I don't know what "register globals" are. I'm pretty new to coding and learning more and more like I learned C++ in high school, editing code rather than writing it. Please give more detail for me on the security hazard.

Louis L'Amour, “To make democracy work, we must be a notion of participants, not simply observers. One who does not vote has no right to complain.”
MineCraft? mc.applenova.com | Visit us! | Maybe someday I'll proof read, until then deal with it.
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2007-12-14, 00:41

Quote:
Originally Posted by turtle2472 View Post
And I don't know what "register globals" are.
It's a PHP "feature" that creates variables out of the contents of the $_ globals. It's a security problem because it allows users to inject variables into your PHP scripts.

Since you're probably using a shared web service with Surpass Hosting, you likely don't have access to the httpd.conf or php.ini mentioned above. Don't worry about it, though. Short of this one concern, everything is probably set up just fine.

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2007-12-14, 00:52

Quote:
Originally Posted by Brad View Post
Don't worry about it, though. Short of this one concern, everything is probably set up just fine.
Yes, I didn't mean to imply it was a bad host, I just haven't seen a host lately that has it on, so I was surprised. Perhaps I picked the wrong smiley

Sorry, I should have explained, but Brad took care of it. You should still look into if you have access to create your own php.ini on your shared host, I've had the ability to do that on several hosts I've had.

The only real thing you should have to worry about is to initialize or verify the content of your variables. I'd suggest just not using them as register globals is off by default in PHP 5 which is starting to become the standard as PHP 6 is in the works and support for PHP 4 is going to be stopping in the near future I believe.

I'd check out php.net and google to check out some examples of how to properly code with register globals on.
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2007-12-14, 10:31

Quote:
Originally Posted by turtle2472 View Post
My host doesn't have a httpd.conf in any of my directories, so I would need to create them on my own if I wanted to add .html to it? Or would it already be there?
httpd.conf is Apache's global configuration. .htaccess is the substitute on a directory level.

And AFAIK, Surpass does not have register_globals on.
  quote
ast3r3x
25 chars of wasted space.
 
Join Date: May 2004
Send a message via AIM to ast3r3x  
2007-12-14, 10:54

They must or his code wouldn't work I don't think. Unless somewhere else it sets $REMORE_ADDR or does an extract().

roller coaster375 is correct, and often times you can set php settings in the .htacces. Maybe check out how to change configurations in PHP

Anyways, not that it really matters that much if it's working for you
  quote
PKIDelirium
Nobody bumps my lock
 
Join Date: Oct 2005
Location: Xenia, Ohio
 
2007-12-14, 12:55

Surpass has register_globals turned on according to phpinfo on my server, however I'm on an older one. The newer ones like turtle is on might not, but they're running on phpSuExec, which might make a difference, but I'm not sure.

Early '09 Mac mini (El Capitan), iPhone 7 (iOS 12.3), iPad Air 2 (iOS 12.3), Mid '10 MacBook Unibody (High Sierra), Mid '05 14" iBook G4 (Tiger)
Kings Island Site, Horribly Outdated Flickr
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Tidewater Virginia
 
2007-12-14, 13:14

Thanks for the links and information guys. I really appreciate it.

My hosting plan uses PHP5 BTW.
  quote
rollercoaster375
Senior Member
 
Join Date: Mar 2005
Location: UIllinois (Champaign, IL)
Send a message via AIM to rollercoaster375 Send a message via MSN to rollercoaster375 Send a message via Yahoo to rollercoaster375 Send a message via Skype™ to rollercoaster375 
2007-12-14, 13:20

Ah, see, I'm on WebDev, so I've got very different server settings from everybody else... (For example, I've got PHP4 and 5)
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
Any file compression significantly better than ZIP? Dorian Gray Genius Bar 11 2007-08-19 19:50
watching a .mov file in windows caraloca Genius Bar 5 2007-04-29 22:11
File names changed when clicked on alcimedes Genius Bar 11 2007-01-12 17:11
Darwine Requirements doublem9876 Third-Party Products 2 2006-02-26 10:58
File association to app was screwed.. what do you think? Koodari Genius Bar 0 2005-09-17 05:10


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 13:35.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2019, AppleNova