Serving A Website Based On Source Internet Address ?
Based on the source internet address a different version of the website
should be presented/served to the user/browser.
I would like to keep the script as simple as possible and it should
replace the index.php.
The script could look something like this in pseudo code:
if SourceAddress = â¸.3.5.1' then
begin
ShowBlueWebsite; // load/show BlueIndex.htm
end else
if SourceAddress = ït.5.15.7' then
begin
ShowRedWebsite; // load/show RedIndex.htm
end;
Is this possible with php ?
View Complete Forum Thread with Replies
Related Forum Messages:
PHP Based Email Address Obfuscator For Website Mailto: Tags
I found a PHP based email obfuscator for use in websites, where the source HTML (PHP, actually) file doesn't contain the actual email address in the Mailto tag, but generates it and that generated page (containing a full and conventional Mailto: tag) is what is ultimately presented to the user. The intent is to thwart Spam bots and spiders, by NOT having the email address in the original HTML Source, but ultimately presenting it to the person browsing the site. But here's my question.... Even though the program works exactly as advertised, isn't this a case of flawed logic on the part of this scripts author? PHP runs server-side, so won't the PHP be interpreted, whether it's requested by a bot, a spider, or a legit website visitor? (and thereby, presenting the bot with the full Mailto: tag and email address anyway)? Or is there something basic I'm missing here?
View Replies !
Php Process Website Source Code
I was wondering if PHP had the ability to look at source code <body> of a website, load it into a variable, detect a certain tag within the code, truncate everything before it (and after a separate tag) and run the code. i realize that i might have to write a page that applies this 'snatched' code to itself, and then i would use an <iframe> to display the generated page. as a bonus icing on the cake, i was wondering if there was a way to display this generated page (or even the code itself!) within a <div>. Practical use for the "<body>snatcher" script: 1) i like to read webcomics, and most of the pages they are displayed on are written in php. i would like to have all my webcomics show up on a single page all at once saving me just a little bit of time reading them all. 2) i have a professional blog, a personal blog, a myspace and a facebook, and a flickr account. needless to say, that's a lot of comments to be checking. i would like to have a page that displays all the latest comments of each of my accounts on one page.
View Replies !
Getting HTML Source Based On User Cookies
I am attempting to get the HTML source of a web page on a different domain, but the source is based on the client's cookies they have stored for that site. I've tried using javascript with iframe's and XMLHttpRequests and HTMLHttpRequests, but it's restricted to inside my domain. With php you can get the HTML source of any web page using the file functions, but since its server-sided i don't think I would be able to open the page and get the HTML source based on the users cookies. Is there someway using PHP I don't know about, or mayb combinding javascript and PHP in some sort of AJAX engine?
View Replies !
Banning An IP Address From Seeing My Website.
Someone is abusing the comments system I have in place on my website. I have their IP address, but is there a way to prevent them from seeing my website altogether? I was thinking that when someone visits my homepage (which I will turn into a PHP file), their IP address is cross-referenced with a database of banned IPs. If it is in there, then they are sent to a different website - like Google.
View Replies !
Member Based Website
I have a member based website, and when a user logs on it sets online = 1 in the database, and when they log off it sets it to = 0. When they close the window, they automatically log off. the session closes. How can I let the database know this? Is there a way I can have the online column automatically turn to 0 after 30 minutes of inactivity or something? Would I need to set up a cron job on the server (I pay for hosting, dont know if I can even do that).
View Replies !
Roll Your Own PHP Based Website?
I'm wanting to develop my own enterprise intranet web portal. I'm very new to PHP and I don't know it well yet, but does anyone have any suggestions on any docs or books that would be a good guide? I already know where the general PHP documentation is and the same goes for mysql. Any documentation or books with lots and lots of examples would be great. Code:
View Replies !
IP Address Redirect Based On Country
I'm looking for a solution to redirect a user based on his/her IP. I have servers in Asia and servers in the US. A few of my pages are on a US based server which is the primary or root domain name if you will. However when these pages are accessed from China for example, I would like to serve them pages from my China server (my subdomain). by having the page detect their IP and knowing whether it is based out of China or the US. Is this possible?
View Replies !
Creating An Article Based Website
i need to create an article based website, what words should i search for in yahoo to find a good strategy? or can someone just give me hints how to create it? the site should do the following-> 1-only administrator can add articles 2-public can only search 3-and of course the search should be optimized and fast.
View Replies !
Disadvantages And Advantages Of Database Based Website
I have created a website mostly dependent on MySQL database. What are the disadvantages? Will MySQL be able to serve about 100 to 500 users concurrently? I guess that is my main concern. Will a website based on database be slower or faster than a more traditional webesite where it is maily based on individual files?
View Replies !
CSV File-based Address Book Code Snippet?
Since I'm a PHP newbie and the only address book apps I found through Google require MySQL or PostgreSQL, I figured I'd ask if someone has come code handy. I'd just like to keep a list of addresses in a CSV file (ie. columns last name, first name, e-mail, office #, etc.) so as to ease backing up, and read/update this list from a PHP script. I guess it's pretty much just a loop to read + parse, and a form to update, but if someone has the code handy, I'm interested :-)
View Replies !
PHP Page That Displays Html Based On The Address Enterd
I would like to have a PHP page that displays html based on the address enterd. For example: index.php?example=a would show a page with <body>Example1234</body> whereas index.php?example=b would show a page with <body>Example5678</body>. I've done this before, but I can't remember the code I used.
View Replies !
Questions/Recommendations On Content/Membership Based Website
I've searched groups.google.com already to see if I can determine if using PHP/MySQL (if needed) for a web site I wish to develop. As the subject indicated, it will be a content based site with videos - NO, it's not a porn site though. I thought that I'd list the key requirements/specifications for my web site below and was wondering if some of you'd be so kind as to provide your thoughts on each and comment on them with respect to how PHP can accomplish them or how adept PHP is at accomplishing them? (FYI, I'm an Oracle developer and haven't had too much "real" programming/coding practice since I finished school, but I can still, given enough time to familiarize myself, C/C++/Java and some OOP. But I really haven't had any experience in setting up a website/webserver at all.) -- Strong authentication required since it will be membership based. Someone had suggested that I use a third party billing company, such as iBill, PayCom, CCBill and etc, to simplify the billing process and I'm looking into it. I know it's sounding more and more like an adult site, but it's not. However, if PHP/MySQL offers a better billing method/member info DB maintenance capability and membership authentication, please inform me. -- The instructional videos probably will not be updated/switched/added too often. The same goes for the accompanying pictures for the lessons. The pics though will need to have an accompanying explanation. -- There will be about 30 videos in all, all about 45 seconds to a minute in length. -- I wish to be able to create a member page which they will be greeted with once they log in, muck like "My eBay" over at eBay.com with the following showing, among other things: A) Each member will have a lesson plan according to their expertise or level of completed lessons and I wish to be able for members to maintain a record of which lessons they've completed in each of the plans and which lessons they still need to complete displayed in some chart form. B) I wish to, though it may sound impossible or wishful thinking, be able to prevent straight copying or lifting of my pages, including the videos and the pictures. I know I can disable "right click", but besides that is there anyway I can prevent it from happening? I have worked very hard and spent long hours in developing the content for this website and I'd hate for any copycat websites to just lift my pages somehow and use it as their own on their own website. -- If the site membership grows, I'd imagine that there'd be many simultaneous access to the membership content, including the videos.
View Replies !
Add A Private Messaging System To A Membership Based Website.
I'd like to add a private messaging system to a membership based website. Before I start re-inventing a bycicle perhaps someone can point me into a direction of a class or script that is available somewhere? This is not a Joomla, Mambo, PHP Nuke or similar modular site -- so add-on modules probably won't work.
View Replies !
Simple Way Of Implementing Bbcode Into A Php-based Website/database Design?
Can anyone recommend a simple way of implementing bbcode into a php-based website/database design? I'd like the user to be able to enter the data using bbcode's options (simple click and format options without having to know anything about code... like this site has) and have this display in pages when the results are pulled out of the database and displayed in HTML format.
View Replies !
Serving Files With PHP
I've used Apache with the automatic directory indexes ... works great ... just click on the file name and IE magically figures out how to display it .... if it is a .PDF then Adobe Acrobat runs, etc. However, I'd like to "serve" files in a more restrictive context where: a)The user has to have a valid session identifier in order to get a file. b)The files I'd be serving aren't in directories that Apache can get to directly, i.e. not in a "Document Root" or aliased directory (although it has the right permissions to get the files). Is it possible to do this with PHP? Can PHP just spit out the right MIME information and then somehow open and encode the file and the client will treat it properly? Are there any PHP functions that help with the encoding? Are there any good web references?
View Replies !
Serving Xhtml With Php
Is it possible to serve valid xhtml with php? xhtml requires the 1st line: <?xml version="1.0" encoding="iso-8859-1"?> But php interprets the opening <? as a php statement. If I try to echo this in PHP: <?php echo '<?xml version="1.0" encoding="iso-8859-1"?>' ?> The closing ?of the xhtml bit is interpreted as closing the php. Thus: ' ?> is displayed in the browser. Any way around this?
View Replies !
Serving An Image
I am in the preliminary design stage. client wants to serve one of several small gifs from a database depending on user selection. I can do all of that easily except serve the images. I imagine that I will have an img tag that will invoke a php script, but how do I serve the img so that the browser displays it as an image rather than (garbage) text ?
View Replies !
Serving ZIP Files To IE Using PHP
I've been wrestling for several months now with this issue in IE: http://support.microsoft.com/?kbid=308090 (IE thinks that ZIPs sent from a script are corrupt when they are not). IE now also seems to think that many other files are ActiveX controls and pops up the "Some files may damage your computer...Open Save Cancel" dialog. However, I am quite certain that others have managed to use a script serve ZIPs, PPTs or PDF files to clients using IE, as I saw download.com do just that a moment ago. I am currently using IIS and a Windows-ized version of mod_rewrite to do URL rewriting so that IE in theory should not know that it is receiving a ZIP file from script. Nonetheless, the error occurs even with rewriting invoked. The problem seems to be that after IE pops up its security dialog, it does not issue another HTTP request, but seems to expect to go get the file.
View Replies !
Serving PDF Problem
I'm still having a problem with the following code, but I can better describe the symptoms now. Code: <?php $uri = getenv('REQUEST_URI'); $pieces = explode('/',$uri); $file = $pieces[count($pieces)-1]; header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=".$file); readfile('/home/america2/pdfs/'.$file); ?> The code appears to work perfectly in NN7, but in IE6 it only works when the user chooses to "Save" the file to the hard drive. If the user chooses to open the file, Adobe Reader launches, but before a PDF is rendered, the following error is displayed. "There was an error opening this document. The file does not exist."
View Replies !
Securely Serving Files
People on my website register to be allowed access to certain downloads. I store these files above the document root so that they can't be accessed by Apache (Only from PHP). I wrote a file serving script which dumps the correct headers for the download and calls readfile(). I thought everything was going swimmingly until I realized that my webhost has Safe Mode turned on, and the script execution time is limited to 30 seconds. If your file takes longer than that to download, then too bad :). So how can I do this? The files that I am serving are no larger than about 2 megabytes. It seems that one option would be to make a copy of the file I want to serve, but below the document root so that it is available from the browser. I'd give the file a randomly generated name that couldn't just be guessed, and just write a regular link to the browser. Has anyone tried this, and did it work out okay for you? How did you go about cleaning up files after the client has downloaded them? Is there a better option?
View Replies !
Serving Fastest Pages
I am in the process of starting a very large content website. We are looking at about 20,000 uniques per day. Now we only have 1 server (2GB/day transfer), so I am trying to keep the load down as much as possible. I have two options in our custom built CMS. I can have the pages be purely dynamic and call the content from the MySQL database on every page or I can build the new pages and the affected pages (if the article link is listed on another page) every night or whenever I feel. What this will do is build static .html pages (parse .html as php) with a minimal amount of php in them just for cookies, log-in stuff, etc. Do I have to worry about load with only 20,000 (~70,000 page views) per day or should I use the building static pages method? I want my site to be as fast as possible, obviously.
View Replies !
Serving Different Style Sheets
I have two different style sheets, I would like all IE users to receive style1.css, while everyone else receives style2.css. I don't need a different one for each browser, just one for IE and one for everyone else.
View Replies !
Serving A Growing File
I init a download for a user via http before the file is finished growing. (if i wait till it's done growing it will take 2 minutes) problem is that the below method only serves the file up to the point when i opened it. say 2-10 megs but the file ends up being 400 megs. header('Content-Type: application/x-zip'); $fp = fopen("C:Apachehtdocs{$new_file}", "rb"); while(!feof($fp)){ $buf = fread($fp, 2048); print $buf; }
View Replies !
Transparenty Serving Media Stream
i have a problem - i need to hide address of broadcasting computer in internet, problem looks like this - i hava a computer with windows media encoder, this computer is broadcasting online stream video, now i need to share with this video on internet without windows media server, i have idea that i can open this stream with php and send it forward - but how to do it ?? it is posible to that ?? maybe some other solutions for broadcasting live video without costs?? -broadcasting server must be on windows ;-(
View Replies !
Serving Files And Redirecting Using Headers.
I have a page where form data is passed to a php page (just script) to process the input. This page calls a function to output a file: function sendFileViaHeader($path, $name) { $fp = fopen($path . $name, 'r'); header("Cache-Control: ");// leave blank to avoid IE errors header("Pragma: ");// leave blank to avoid IE errors header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename="" . $name . """); header("Content-length: ".(string)(filesize($path . $name))); fpassthru($fp); } The original script then calls a further header that will redirect the user page to a different (or updated original page): header('Location: http://www.new.com'); However, only the file is sent. The second header is never called. It is either one or the other. Never both. How do I get around this (I've tried buffering - ob_start(), ob_end_flush() to no avail)?
View Replies !
Blank Screen While Serving File
Our site allows clients to upload files to share with others. We have several clients who are sharing many files with many users. There is one client that inconsistently receives a blank white screen while viewing a file. She is the only client that has reported this as an issue, so I'm not sure how wide spread it is; I can not duplicate this problem myself but I can watch it happen to her using remote desktop software. She first reported it last week. I went into the function that serves the file, added two lines of code, removed those same two lines, saved the file, and the problem went away. She called again this morning reporting the same problem. This time I modified the code to pass along extra header information and that seemed to clear the problem up. She called again about 2 or 3 hours later and the problem had started yet again, without any changes to the code:
View Replies !
Cookie Based Script To Session Based
PMsys is a script that based on Cookies rather sessions(what are people thinking in 2003?) To intergrate this system to mine website, I got to change all the cookies to sessions. So, I think 1st replace all the: $_COOKIE into $_SESSION and then write a function that search and find a line that contains: setcookie('a', 'b', $whateverthetime); into session_start() $_SESSION['a'] = 'b' will that work? is there anymore things I have to think about? anyone can write a function to do that? I just can't get a hold on regular expressions.
View Replies !
Ftp Through Internet Explorer
I'm trying to do a ftp client through php. I have the client working but with one hicup. Say I upload a file in firefox it will just upload the file name but when I try it in internet explorer I get the file location as well.
View Replies !
PHP And Internet Explorer
I am trying to deploy a webftp application using Apache 2.0., MySQL 5.0 and PHP 5.2.0 In IE, when I attempt to perform actions such as uploading, deleting, downloading, whatever, it kicks me back to the login page. In Firefox, this works with no problem. This isn't just one webftp solution, either - I've tried about a dozen different products. Has anyone seen this behavior before?
View Replies !
Login To Use The Internet
I have internet at my house and im trying to make a script/website that the user has to login to access the internet and that tracks home much usage they have used but if they use like limewire it will not work without login i think this will be done using a proxy server maybe how will i go about starting this project?
View Replies !
Internet Connection
i have my application which is on development level. the thing is, i am using AJAX on almost all the pages. the application is going to run on web. the problem which may arise is if the internet connection is too slow or if the user is very quick on his actions, i feel the data may not be relevent or there may be incomplete inserts. the entire page works on AJAX. all related data gets loaded after some action. how can i avoid this or how can i see that the entire set of inserts are performed? Please advice me on this? is there anyother problem which may arise and i am not be able to fore see?
View Replies !
Calculating Internet
I would like to calculate a viewer's internet connection speed when coming to a site. I've done a bunch of searches and came up with a few scripts that weren't that accurate when I tried them.
View Replies !
Internet Radio Server
I run an internet radio server and I'd like to output the current song and whether the station is currently up or down to a table on my SMF forums. I've found some code: $open = fsockopen("123.123.123.123","1234"); if ($open) { fputs($open,"GET /7.html HTTP/1.1 User-Agent:Mozilla"); $read = fread($open,1000); $text = explode("content-type:text/html",$read); $text = explode(",",$text); } else { $er="Connection Refused!"; } if ($text[1]==1) { $state = "On Air"; } else { $state = "Off Air"; } if ($er) { echo $er; exit; } echo "<br><font face=verdana size=1> Server State: <b>$state</b><br> Playing Now: $text[6] </font>"; which is outputting things nicely but I'm trying to work out how to output insidea table 1024 across with a black background. I'm not having much luck.
View Replies !
Sessions In Internet Explorer 6?
I use session_start() and session_register() functions to handle sessions. They work fine in Netscape 6 and opera. But in IE session data seems to be lost from the session at diffrent points. It gets more strange because this problem doesn't occour when testing on localhost nor does it ocur on my friends copy of IE (both version 6). The Site also works fine here in netcaptor which uses IE so i'm guessing some sort of privacy management in IE 6 is blocking it, i know IE 6 is strict anything to do with p3p here?.
View Replies !
Swatch Internet Time
This question isn't really about PHP so much as it is about Swatch's Internet Time. I know it's measured at 1,000 beats per day, and is written as @225 (that being 225 beats into the day), but there are one or two things I'm confused about: Swatch time is supposed to eliminate time zones by making a universal time for the entire world. Does the PHP engine have something built into it to where it formulates the correct Swatch Time from whatever time zone the server is set to have? Or is the Swatch Time formulated only off of the timestamp that date() formats? And if it is the latter, wouldn't that defeat the purpose of a new time format all together?
View Replies !
Javascript For Internet Explorer
does anyone know how to make javascript for internet explorer in order that it can read the picture from my webcam or may be free code from website??. i'm using camserv to get streaming picture from my webcam. all browser can read the streaming picture from my webcam except Internet explorer. i'm using mandrake 9.2 as my operating system.
View Replies !
Cookie's In Internet Explorer
I am creating cookies in php, which works fine in Mozilla in the same session[window], for example I can create them and then go to another page and then come back to the page and see the results of the cookie take effect. But in Internet Explorer I create the cookies, but have to close the browser window/session and reopen the browser for the cookies to be read/take effect. Here is my code. if ((isset($_POST['cookieCollege'])) && (isset($_POST['cookieFolder']))) { setcookie("default_college", "$cookieCollege", time()+60*60*24*360, "/", ".mycollegepost.com"); setcookie("default_folder", "$cookieFolder", time()+60*60*24*360, "/", ".mycollegepost.com"); } Then I have: if(($_COOKIE['default_college']) && ($_COOKIE['default_folder'])) { $collegeName = $_COOKIE[default_college]; $folder = $_COOKIE[default_folder]; echo "<meta HTTP-EQUIV="refresh" CONTENT="0; URL=http://www.mycollegepost.com/{$folder}/">"; }
View Replies !
Integrating An Internet And Intranet
I developed a php inventory system on the public Internet. I have now been asked to create a customer information system that will run in an INTRAnet environment. What php and/or perl functions can I use to seamlessly integrate the intranet and internet applications.For example: We have all the product information online, but we want all the customer information offline(especially credit card stuff). When we make a sale, we would like to have the customer information displayed along with the product information. This will be used for invoicing and then for accounting purposes.
View Replies !
|