Solved

Breaking line in .htaccess

Posted on 2007-03-29
4
248 Views
Last Modified: 2008-03-06
Hello,

how can I break the link with this code? I tried to include \n but it doesn't work. The code will write to .htaccess file.

<?
$ip = "deny from $REMOTE_ADDR\n" ;
$banip = '.htaccess';
$fp = fopen($banip, "a");
$write = fputs($fp, $ip);
fclose($fp)
?>

.htaccess file output, it cannot break the line in between "deny from 123.122.8.10"

<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 123.122.8.10deny from 456.122.8.10deny from 696.122.8.10

thank you
0
Comment
Question by:simoa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 18816287
use
$ip = "\ndeny from $REMOTE_ADDR";
in this case
0
 
LVL 29

Accepted Solution

by:
TeRReF earned 50 total points
ID: 18816352
If that doesn't work, try:
$ip = "\r\ndeny from $REMOTE_ADDR";
0
 

Author Comment

by:simoa
ID: 18816467
hernst42: sorry your couldn't work thanks for helping.

TeRReF: thanks it works.
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18817173
You're welcome.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question