Simple PHP-script for virtual hosting

 
Post new topic   Reply to topic    Aprelium Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Wed Jun 07, 2006 4:11 pm    Post subject: Simple PHP-script for virtual hosting Reply with quote

I wrote this little script a while ago, and want to share it with whoever wants to use it. Unlike TRUSTpunks vhost-script, this one uses a flatfile database (vhost.txt).

I use it myself.

Here's an example:

This host does exists in my vhost.txt-file: http://2q4u.com
This host does not exists: http://cmxhost.no-ip.biz

Here's the script:
Code:
<?php
$this_host = $_SERVER['HTTP_HOST'];
foreach(explode("\n", implode("", file("vhost.txt"))) as $array => $currentrow) {
$array = explode("|", $currentrow);
$host = $array[0];
$url = $array[1];
if ($host != "" && $url != "" && $host == $this_host) {
header("location: $url");
exit;
}
}
?><html>
<head>
<title>UNDERCODe</title>
<script>
<!--
alert("Error: Cannot find the host '<?php echo $this_host ?>'.")
-->
</script>
</head>
<body>
<center>
<p>Insert your default page here.</p>
</center>
</body>
</html>


Here's an example of vhost.txt:
Quote:
www.microsoft.com|microsoft.html
www.mydomain.com|http://redirect.to.this.host/and/this/folder
aprelium.com|/aprelium


I use this script myself when I'm to lazy to create a new vhost in Abyss.
Back to top View user's profile Send private message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3714
Location: USA, GA

PostPosted: Wed Jun 07, 2006 4:29 pm    Post subject: Reply with quote

Interesting technique. I didn't write the Virtual Host script, I just made it easier
by providing a simple form to do the work for them. :-)

You should create a GUI to that.
_________________
Computer Programmer & Networking Specialist

Back to top View user's profile Send private message Visit poster's website MSN Messenger
cmxflash
-


Joined: 11 Dec 2004
Posts: 872

PostPosted: Wed Jun 07, 2006 4:39 pm    Post subject: Reply with quote

I already have a GUI (sort of, at least). Most stuff on my server can be controlled using my own control-panel Stream.


And yes, the window-design is stolen from Steam. So sue me. I made the logo and buttons myself though.

Stream can be used to;

Send spoofed emails
Edit pages on my server
Edit MySQL-databases
Allow and disallow usage of my own encrypted version of Counter-strike.

It's pretty fun to use it with encryption. Each CD has it's own encrypted image of the game. When the user wants to play the game, the computer sends its CD-ID (the uniqe ID of that CD) to my server, my server checks if the user is allowed to use the CD, and sends back the key used to decrypt the content and mount it within the RAM. When the user closes the game, the key is removed from the RAM and needs to be requested again.

The main reason I created this system isn't to get 100% control over my buddies. Even though I do log whenever they play, from where, and for how long, the system is mainly used to lock lost/stolen CDs. We're not allowed to use CS on our laptops. The system is pretty useful if a teacher bust you while playing and takes your CD and/or computer. Since they can't prove whatever is on the CD, the system has saved my ass a lot of times.

Stream can be used by many difference users, each with an individual username, password and STREAM_ID. Each account has it's own "flags", which gives you access to whatever the administrator wants you to have access to. If the account is flagged as an administrator, you'll automatically get all other flags.

At this moment, Stream has about 60 users on my server. Mostly people I know that have some site hosted on my server, or people who wants to send spoofed email from APB (The Swedish version of RIAA) to play a joke with their buddies.

Stream is written with a combination of C++ and PHP (for the server-side). There's also a webbased version.

Stream is probably my biggest project yet, it took about 35-40 hours to write and currently has about 5 000 lines of code. Of course, there's a lot of crap in the code.
Back to top View user's profile Send private message
canuckid
Guest





PostPosted: Wed Jun 14, 2006 8:20 pm    Post subject: Reply with quote

cmxflash wrote:
I already have a GUI (sort of, at least). Most stuff on my server can be controlled using my own control-panel Stream.


And yes, the window-design is stolen from Steam. So sue me. I made the logo and buttons myself though.

Stream can be used to;

Send spoofed emails
Edit pages on my server
Edit MySQL-databases
Allow and disallow usage of my own encrypted version of Counter-strike.

It's pretty fun to use it with encryption. Each CD has it's own encrypted image of the game. When the user wants to play the game, the computer sends its CD-ID (the uniqe ID of that CD) to my server, my server checks if the user is allowed to use the CD, and sends back the key used to decrypt the content and mount it within the RAM. When the user closes the game, the key is removed from the RAM and needs to be requested again.

The main reason I created this system isn't to get 100% control over my buddies. Even though I do log whenever they play, from where, and for how long, the system is mainly used to lock lost/stolen CDs. We're not allowed to use CS on our laptops. The system is pretty useful if a teacher bust you while playing and takes your CD and/or computer. Since they can't prove whatever is on the CD, the system has saved my ass a lot of times.

Stream can be used by many difference users, each with an individual username, password and STREAM_ID. Each account has it's own "flags", which gives you access to whatever the administrator wants you to have access to. If the account is flagged as an administrator, you'll automatically get all other flags.

At this moment, Stream has about 60 users on my server. Mostly people I know that have some site hosted on my server, or people who wants to send spoofed email from APB (The Swedish version of RIAA) to play a joke with their buddies.

Stream is written with a combination of C++ and PHP (for the server-side). There's also a webbased version.

Stream is probably my biggest project yet, it took about 35-40 hours to write and currently has about 5 000 lines of code. Of course, there's a lot of crap in the code.


i started a basic website control panel, but i think it would be really cool if someone like you made a simple website with snippets of code for different kinds of control panels. this might be a stupid idea but i personally think it would help...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Tutorials All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group