Htaccess To Read XML As PHP
I'm trying to write a RSS feed which will pull info from a mySQL DB. In order
for the server to read the XML file as PHP, I've uploaded a .htaccess file to my server with this code in it:
AddType application/x-httpd-php .php .xml
Then, my feed looks like this:
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Email With Attachment - Annot Be Accessed. The File May Be Read-only, Or You May Be Trying To Access A Read-only Location.
It is a basic email with an attachment. The email and attachment are getting sent and received ok. When the recipient tries to open the attachment, the right application opens (eg. Excel) but then throws up an error. I am using base64 encoding. For example: .xls file with base64 encoding: 'testing.xls' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding. .pdf file with base64 encoding: There was an error opening this document. The file is damaged and could not be repaired. so the file isn't being decoded right. I have tested on Yahoo and Outlook. PHP Code:
View Replies !
View Related
Fgetcsv Returns False In Dynamic Read Vs. Hard-coded Read ??
I am working with directories in PHP for the first time. I have code that I've changed multiple times to try different things. I would think this is pretty standard fare so I'm not sure why I can't seem to get it right. What I would like to see happen: The code opens the directory and loops through the files, opening them and processing them. What is happening: If I hard code the name of one particular file (it is always the same file) in my test setting, fgetcsv does not return false and the code runs fine. The file is parsed and all is well. However, if I let the code open a directory and then loop through the files, this one particular txt file does not work. For debug purposes, I have it displaying each file name and it can display the name, it just won't process it. I've even tried setting a for loop and hard coding each file name (since right now I know the names - I won't in the future) and the file is processed. It is only when it is set to my $file var dynamically rather than being hard coded. Here is the code: $handle_dir = opendir('../directory_name'); /* loop over the directory. */ $countfile=0; while (false !== ($file = readdir($handle_dir))) { $countfile++; $filevalues = ""; //Skip the first two files that where found because they are "." and ".." if ($countfile 2) { //echo $file; //begin loop through each file name $handle = fopen($file, "r"); echo "Filename is: $file<BR>";//at this point the code can print the file name if (false == ($filevalues = fgetcsv($handle,6021,','))){ echo 'problems<br>'//for one particular file, this always displays }
View Replies !
View Related
How To Read Up To A Point And Assign The Read Value To An Array.
Open a text file which will look something like this: QuoteLink 1 http://www.blahblah.com/1651561 Link 2 http://www.etc.com/34324 Link 3 http://www.sdfkjsdf.com/12343423 basically its a "Link n" text followed by a URL text in the format of "http://www.page.com/random numbers" What I would like the php script to do is to read "Link n" text and output it with the a http link to the URL which follows it. That is it should look something like this in the output: Link 1 Link 2 Link 3 I have learned how to read a text file with php so far but I have no idea how to make it read up to a point and assign the read value to an array.
View Replies !
View Related
How To Use Php In .htaccess?
hi, does anyone knows how to write php in a .htaccess file? coz all i want to do is to have every member his own database with his own username and password, so that only hisself can access his own directory. but my membership creation is a web-based, so that i can't create the user's own password database by hand, so it must be done when a new user is created automatically. are there any ways to do that? Also, I tried to use php to call htpasswd but it seemed didn't work by the script: exec("htpasswd -b -c /usr/local/apache/passwd/perry perry perry");
View Replies !
View Related
Htaccess And PHP
I have set up .htaccess for one of my pages... and one of the protected files is a PHP script. Now, my question is, I want to use the username from htaccess in my PHP script, how do I get it? Eg. you log in to my htaccess protected page and then you come to a page that say this "Hello, you are logged in as <username>"
View Replies !
View Related
SEO URL Htaccess
I want to convert my smarty urls to seo friendlly.For example index.php?mod=member&pg=user&a ct=list should be converted to mod/ member/pg/user/act/list Url can have N number of querystrings. All of those should be converted to seo friendly.Please suggest an htaccess code for this problem
View Replies !
View Related
PHP-.htaccess-CGI
I created a set of pages with PHP for login using a database. Now, I need to link to a lot of CGI programs in a folder with protected-access (.htaccess). The username and password are the same as the ones people use to login with. Is there a way to use the session usrname/password for the HTTP authentication to that folder ?? If I remove the .htaccess for that particular folder, then all those files will have access without any kind of authentication. I tried username:password@www.example.com . But this doesnt work with IE 6. So I need something else.
View Replies !
View Related
Htaccess Help
right now im testing the generated permalinks of my cms. i'm kind of learning htaccess rewrite.. but i dont get one thing. what does this exactly mean? RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
View Replies !
View Related
Php - Htaccess
On my webhosting I don't have access to a root directory, so I am stuck in the public folder. I should secure the downloads folder, this is why I wanted to use a ..htaccess file. Only, PHP should have access to this folder..because users login using a username and password from the database. How can I make an htaccess file which allows the "php-user" to access the files in the folder on a Linux webserver?
View Replies !
View Related
.htaccess/PHP
Just wondering if this is possible: I want to use htaccess to authenticate different users. What I would then like to do is use the username from the htaccess box to set the session id of the pages. Furthermore, I would like to use this to keep a check on whether a user is logged in when they hit a page. This is so that I can deliver content appropriate for each user. This is an existing project where htaccess is being used. I'm just writing a backend for my customer so that their clients can log fault calls. Is this possible?
View Replies !
View Related
URL And .htaccess
I've protected a directory with an .htaccess file. I'd like some of the files in this directory to be accessible by a scheduler that runs an "URL". The problem is that the scheduler runs scripts in this directory, so the server asks a username and password. How to avoid this ??? Should I set the .htaccess file to allow GET, but how ??? and what would be the URL ??? directory tree: admin .htaccess admin.htm //frame adminmnu.htm //menu in frame script1.php script2.php script3.php
View Replies !
View Related
Using Php Instead Of Htaccess
I'm finding out that htaccess, while a decent way to secure a directory and its contents is not very programmer flexible. I was wondering how you could go about securing the contents of a directory by using php and mysql.
View Replies !
View Related
Php And Htaccess
i would like to know that ,how to get user name if i am using like that www.example.com/sijo i was used an htaccess file in it i have written RewriteEngine on RewriteRule P/(.*)$ index1.php?referer=$1 like that but in running site i did not the name.
View Replies !
View Related
Using .htaccess
i have set up a cookie using php. <?php setcookie("user", "student", 3600); ?> . is it possible to read that cookie using .htaccess? otherwise please inform me how to set and read cookies using .htaccess. please give me a link to such tutorial if there is one.
View Replies !
View Related
Htaccess Log Out
I set an htaccess on an admin folder for a news script through the folder permissions section in cpanel. Everytime I go to the admin folder it logs in automatically for somereason. Not sure if its just for me or for others aswell but can I make a log out link so it logs me out?
View Replies !
View Related
Php And .htaccess
I have written the .htaccess file and is in my doc root. the rule is something like this. RewriteRule ^test/?$ /view/os.php and so on, there are some 100 rules I have written. now I do not know , how to change the conf file so my php will read the link http://192.168.149.44/test/ and pass it directly to http://192.168.149.44/view/os.php can any idea, what are change and where so my PHP/apache will read the .htaccess file and do the stuff.
View Replies !
View Related
What's Htaccess ?
what's htaccess ? i don't know anything bout this thing and please someone to give me a brief explanation...bout what it is and it's function.. i read on http://httpd.apache.org/docs/2.0/howto/htaccess.html but is too hard to digest (i'm already confused) since i really don't know much bout apache (beside just using it as web server ^_^)
View Replies !
View Related
And .htaccess
I am building a website, part of which reuires user authentication. In the past I have used PHP and MYSQL to do this, but I was wondering if there is an easy wasy to use .htaccess. On the face of it this looks simple but each page the site returns is user specific, so I need a way of finding out which user logged in. For example if John logged in he would see page A If Suzy logged in she would see page B. I am thinking that there might be something in the page headers that I can get hold of, I'm just not sure what.
View Replies !
View Related
In .htm Without .htaccess
i have a large site and need the content pages to be .htm but i want to use 1 header and footer file (php includes)...tried useing the .htaccess files to run htm as php but cant on my windows server....is there any other way to do this?
View Replies !
View Related
.htaccess &
I have protected a directory with the help of .htaccess & htpasswd. I also read that I can get the login value in a php variable. Like this: $user = $_SERVER['PHP_AUTH_USER']; echo "User : "; echo $user;
View Replies !
View Related
Htaccess
When I try to go to a directory with mi Internet browser in order to display the files it contains, I get the following mention: Forbidden, you dont have permission to access /mydir/ on this server. Is there a way to acces to this directoy by puttinge an .htaccess file in it, and in that case what should I write into the .htaccess file.
View Replies !
View Related
.htaccess
Currently, I am using .htaccess rewrite to change some of the names of my URLs. However, I want to take it to another level. Currently, here is what I have: RewriteEngine On RewriteRule ^newsarticle/page/([0-9]+)/?$ newsarticle.php?id=$1 So if my news article was located at: http://www.mydomain.com/newsarticles.php?id=3, it will now be http://www.mydomain.com/newsarticles/page/3 However, I want it a little different. Rather than ending in with the ID number, I want the URL to have the title. If the news article title is Cool News Article, then I want the URL to be http://www.mydomain.com/newsarticles/Cool-News-Article Does anyone know what I would have to do to accomplish this task? p.s. All news articles are pulled from a database and the title is stored in the field called `title`.
View Replies !
View Related
Htaccess Auth Vs. Php Auth, Is Htaccess Better?
I have searched the forum and not really found an answer to my questions. I am debating forms of authentication, and I already have .htaccess apache authentication running. My question is, is htaccess a reliable enough form of authentication to not need anyother forms? I am just not sure which is the better method, php, or htaccess.
View Replies !
View Related
Writing To .htaccess
I read "Blocking Badly Behaved Bots" and its predecessor, and I'd like to ask a relatively simple question: Assuming I already have the bad IP to ban (let's call it $ip), how would I write the IP to the appropriate line in .htaccess, and safely? I'd like to use a relatively simple script like this one: <?php $file = $_SERVER['DOCUMENT_ROOT'] .'/.htaccess' $fp = fopen($file, 'a'); fwrite($fp, "Deny from".$ip.""); fclose($fp); ?> But again, I'm not sure how safe this is, and it doesn't write the IP to the correct line. Any suggestions? I know the other anti-bot scripts do this, but it is very (needlessly?) complicated and I have not been able to block the IP in the right line. Please help out a newbie trying to defend his sites vulnerable forms!
View Replies !
View Related
.htaccess Validation In URL
I'm building my website and i wanted to put a htaccess in a protected dir... and place a login form somewhere to access my protected directory so my login collect username and pass and try to go at my dir specific url like this: user:pass@mysite.com but it works on some computer and doesn't for others. Is there any reason?
View Replies !
View Related
Php_value In .htaccess
I am trying to change some php settings via .htaccess. For example, these work: php_value upload_max_filesize 1000M php_value include_path .:/path/to/dir/: ...however, these don't: php_value post_max_size 1000M php_value upload_tmp_dir .:/path/to/dir/:
View Replies !
View Related
Htaccess Variables
When a user enters their name and password dose htaccess return the username as a veriable that can be used to identify the user and be passed to php. If so where can I get more info on htaccess.
View Replies !
View Related
Htaccess Manager?
I'm looking for a script that could administer htaccess scripts for several folders. Our website has over a hundred folders which need protection, and it would just fabulous if there was a script that could make it all happen from the same front-end. The server is a Windows-server, running php5. I've searched hotscripts.com, but all there was were either for a single folder or just didn't work.
View Replies !
View Related
Htaccess Problem
I have the htaccess code that is below to redirect everything to index.php exept for the mentioned folders. (img, swf, js and css) Now when i try to access domain.com/testfolder/img in Firefox i get redirected to domain.com/testfolder/img/?img How can i prevent this? And i was wondering if i could 'tell' the htaccess to use the folder it's in as root automatically. And somehow my values don't get passed to index.php. That doesn't make sense to me either ... RewriteEngine On RewriteBase /testfolder/ RewriteRule ^((img|swf|js|css)(/.*)?){1}?$ - [PT] RewriteRule ^(.*)$ index.php?$1 [L]
View Replies !
View Related
URL Rewrite + Htaccess
I have a domain, and i want every query string redirected to index.php? so domain.com/foo/bar would actually be domain.com/index.php?/foo/bar Then i want to be able to say in index.php, if QUERY_STRING == foo, do this etc. (How) can i do this with htaccess?
View Replies !
View Related
URL With .htaccess Or PHP Redirect?
I have a URL on my website that is currently under the directory mysite.com/something/ But I'd like to change the URL to mysite.com/anotherthing/ This is peasy to do, of course, but I have a really big Google ranking under the /something URL, and I'm afraid that if I transfer to the new URL, I'd lose all that. Is there a way to put all my content under /anotherthing, but make anyone typing in the URL /something still get all the same content in /anotherthing? ..htaccess maybe? Or PHP headers? Am I making no sense?
View Replies !
View Related
.htaccess Settings
I read in a PHP and MySql book that you can set auto_prepend_file into a .htaccess file in a directory on an Apache server and set up headers and footers for all files in that diretory. I gave this a try. Code for .htaccess: line 1- php_value auto_prepend_file "/footer.inc" Code in footer.inc: <center><a HREF= "javascript:window.close();">Close Window</a></center> I am getting an Internal Server error whenever I try and open a file in the directory. I remove the .htaccess file and refresh and the page opens just fine.
View Replies !
View Related
Authentication With .htaccess
When using authentication on Apache server with .htaccess and .htgroup, is it possible to use PHP to provide customised content depending on whether a visitor to a website is in a specific group or not? If so, does anyone know of a good tutorial?
View Replies !
View Related
Another Htaccess Question
I am developing a personalized cms for my fathers business, and ive been reading a lot about SEO, so, as you must be guessing, i need to implement the so called "permalinks" to the site. for example, the website has 9 sections (some of them might be subsections of the other)......
View Replies !
View Related
Htaccess Must Be Empty
I am moving some php scripts to a new host. While getting to know the server, I ran into a strange problem. If I add a .htaccess file, or more specifically: a .htaccess with content, to a folder, requesting (html and php) files from that folder results in internal server error messages. If I upload an empty .htaccess file, all is fine. Then phpinfo() tells me I am using Apache/1.3.27.
View Replies !
View Related
Writing Into .htaccess
How do I write a new line into an .htaccess file? $fh = fopen($database."/.htaccess","w"); fwrite($fh,"Order Deny,Allow Deny from all"); fclose($fh); I used that, but it doesn't make a new line at.
View Replies !
View Related
PHP - MySQL - HTACCESS Is There A Way?
I was wondering, does anyone know if theres a way (and has a link to some kind of tutorial or something) that allows a database login (so a custom built log in basically) and then append it to an existing htaccess file (it as in the username and password)? Anyone have any ideas?
View Replies !
View Related
.htaccess And Mod_rewrite
I need to know what I should use to redirect any file with the extension .jpg to redirect to a php with the name of the file requested as a string. For example, if someone went to: http://example.com/pics/test.jpg I want it to redirect to: http://example.com/pics/view.php?img=test.jpg
View Replies !
View Related
.htaccess And Vista
I am using windows Vista and I tried to make my .htaccess and i get this error stating that I did not choose a filename! (Arg!! Vista) Anyways can I have a .htaccess file and name it something else like 1.htaccess or how can I fix this.
View Replies !
View Related
|