Hello Guys,
I've been trying out to use CentOS 5 instead of Windows XP, I created my own cp however it cannot connect (Unable to connect to server: 192.168.1.107). I'm just asking where should I place my hamachi and web-server? I already placed my hamachi to CentOS and it's greatly working but my control panel can't connect to the windows virtual machine via mssql_connect function.
Regards
EDIT:
By the way here's the control panel I made, i took out some functions from sir chumpy.
index.php
PHP Code:
<?php
//DB CONNECT
include 'config.php';
if (isset($_GET['submit'])) {
mssql_connect($IP, $user, $pass)or die('Could not connect to the database server : ' . $IP);
mssql_select_db ($DB) or die ('Database "'.$DB.'" not found');
//
//POST VARIABLES
$user = $_GET['user'];
$pass = $_GET['pass'];
$rpass = $_GET['rpass'];
//
//CHECKING
$result = mssql_query("SELECT ID FROM dbo.cabal_auth_table WHERE ID = '.$user.' ");
//$result = mssql_query('select count (*) from '.$DB.'.dbo.cabal_auth_table where ID="'.$user.'"');
$rows=mssql_num_rows($result);
$error=0;
if ($rows>0) {
echo 'User already exists<br />';
$error=1;
}
if (empty($_GET['user'])) {
echo 'Please enter your desired Username<br />';
$error=1;
}
if (empty($_GET['pass'])) {
echo 'Please enter your desired Password<br />';
$error=1;
}
if (!ctype_alnum($_GET['user'])) {
echo 'Invalid password letters and numbers only.<br /> ';
$error=1;
}
if (!ctype_alnum($_GET['pass'])) {
echo 'Invalid password letters and numbers only.<br />';
$error=1;
}
if (!ctype_alnum($_GET['rpass'])) {
echo 'Invalid Re-typed password!<br />';
$error=1;
}
if ($_GET['rpass']!=$_GET['pass']) {
echo 'Both password fields do not match<br />';
$error=1;
}
//
//Insert Account
if ($error!=1) {
mssql_query('exec '.$DB.'.dbo.cabal_tool_registerAccount "'.$user.'","'.$pass.'"');
echo 'Account Successfully Created'; }
}
else if($error!=0) {
echo 'Account cannot be created due to the following errors above';
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<title>
Cabal Register v.01
</title>
<body>
<form method="GET" action="index.php" name="submit">
<div class="reg" align="center">
<table border="0" class="table" width="500">
<tr><td align="right">
Username:
</td>
<td>
<input type="textbox" name="user" length="15" style="color: gray; background-color: black; border-color: gray;">
</td></tr><br/>
<tr><td align="right">
Password:
</td>
<td>
<input type="password" name="pass" length="15" style="color: gray; background-color: black; border-color: gray;"><br/>
</td></tr>
<tr><td align="right">
Re-type Password:
</td>
<td>
<input type="password" name="rpass" length="15" style="color: gray; background-color: black; border-color: gray;"><br/>
</td></tr>
<tr>
<td>
</td>
<td>
<input type="submit" name="submit" value="Submit" class="button">
<input type="reset" value="Reset" class="button"></td></tr>
</table>
</div>
</body>
</html>
config.php
PHP Code:
<?php
//Database settings!
$IP = "[IP]"; //Put your Windows IP Here
$user = "[ACCOUNT]"; //Put your sa account
$pass = "[PASS]"; //Put your sa account's password
$DB = "[DB]"; //Put your DB account
//
//ANTI INJECT
function xw_sanitycheck($str){
if(strpos(str_replace("''",""," $str"),"'")!=false)
return str_replace("'", "''", $str);
else
return $str;
}
function secure($str){
// Case of an array
if (is_array($str)) {
foreach($str AS $id => $value) {
$str[$id] = secure($value);
}
}
else
$str = xw_sanitycheck($str);
return $str;
}
// Get Filter
$xweb_AI = array_keys($_GET);
$i=0;
while($i<count($xweb_AI)) {
$_GET[$xweb_AI[$i]]=secure($_GET[$xweb_AI[$i]]);
$i++;
}
unset($xweb_AI);
// Request Filter
$xweb_AI = array_keys($_REQUEST);
$i=0;
while($i<count($xweb_AI)) {
$_REQUEST[$xweb_AI[$i]]=secure($_REQUEST[$xweb_AI[$i]]);
$i++;
}
unset($xweb_AI);
// Post Filter
$xweb_AI = array_keys($_POST);
$i=0;
while($i<count($xweb_AI)) {
$_POST[$xweb_AI[$i]]=secure($_POST[$xweb_AI[$i]]);
$i++;
}
// Cookie Filter (do we have a login system?)
$xweb_AI = array_keys($_COOKIE);
$i=0;
while($i<count($xweb_AI)) {
$_COOKIE[$xweb_AI[$i]]=secure($_COOKIE[$xweb_AI[$i]]);
$i++;
}
//
?>