CentOS as main computer (WEB CP PROB)

Results 1 to 6 of 6
  1. #1
    Account Upgraded | Title Enabled! GunKill is offline
    MemberRank
    Apr 2009 Join Date
    Why do you care?Location
    230Posts

    CentOS as main computer (WEB CP PROB)

    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:&nbsp;

    </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:&nbsp;

    </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:&nbsp;

    </td>

    <td>

    <input type="password" name="rpass" length="15" style="color: gray; background-color: black; border-color: gray;"><br/>

    </td></tr>

    <tr>

    <td>

    &nbsp;

    </td>

    <td>

    <input type="submit" name="submit" value="Submit" class="button">&nbsp;

    <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++;



    //

    ?>
    Last edited by cypher; 03-06-09 at 12:40 PM.


  2. #2
    The Cat in the Hat cypher is offline
    MemberRank
    Oct 2005 Join Date
    IrelandLocation
    5,073Posts

    Re: CentOS as main computer (WEB CP PROB)

    what error are you getting?

  3. #3
    Account Upgraded | Title Enabled! GunKill is offline
    MemberRank
    Apr 2009 Join Date
    Why do you care?Location
    230Posts

    Re: CentOS as main computer (WEB CP PROB)

    Unable to connect to server: [IP]

  4. #4
    Banned Yamachi is offline
    BannedRank
    Oct 2006 Join Date
    Jolly EnglandLocation
    3,517Posts

    Re: CentOS as main computer (WEB CP PROB)

    Quote Originally Posted by GunKill View Post
    ... if you will tell me to use windows just fuck off ...
    Watch the language, please. Children visit this forum.

  5. #5
    The Cat in the Hat cypher is offline
    MemberRank
    Oct 2005 Join Date
    IrelandLocation
    5,073Posts

    Re: CentOS as main computer (WEB CP PROB)

    Quote Originally Posted by Yamachi View Post
    Watch the language, please. Children visit this forum.
    Fixed. Thanks, i didn`t see that ^^

    Quote Originally Posted by GunKill View Post
    Unable to connect to server: [IP]
    Try using your sql named instance instead of ip.

  6. #6
    The Dinosaur chumpywumpy is offline
    MemberRank
    Jun 2008 Join Date
    /f451/Location
    5,127Posts

    Re: CentOS as main computer (WEB CP PROB)

    Can you ping windows from centos? If so then i would guess it is a php config problem so check it over. I recommend using freetds rather than the native php mssql libs as they can cause problems with sql 2005.



Advertisement