Error 404 with php game, but the page is there (ezRPG)

  • (2 Pages)
  • +
  • 1
  • 2

27 Replies - 1797 Views - Last Post: 15 October 2012 - 06:45 PM Rate Topic: -----

#1 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 05:15 PM

I understand that Error 404 refers to that a page is missing or not available, but the fact of the matter is that it is there as I put it there. Now let me just say this; the original files were all taken from ezRPG which is an open-source project available to anyone, both editing and just uploading. Now I have uploaded them all to my server, which does support PHP and mysql, so I do not understand why it is not allowing me to even access the index page.

I don't know how to explain my problem anymore than that, but if you ask I can certainly answer to the best of my abilities.

Stages I went through-
-Downloaded the ezRPG code from the following link; ezRPG DL(link)
-Uploaded it to my host that does support PHP and mysql; uploaded every single file and in the correct directories.
-Tried fixing the problem myself and failed.
-Googled solutions, but only ran into the same thing. "Error 404 implies that a page does not exist or incorrect address". Which both are incorrect, as I know the exact directory for it, both public and hidden through my domain.

Is This A Good Question/Topic? 0
  • +

Replies To: Error 404 with php game, but the page is there (ezRPG)

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9220
  • View blog
  • Posts: 34,624
  • Joined: 12-June 08

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 05:22 PM

There could be a multitude of errors - which will be damn hard for anyone to cut through that's not right there (especially with statements like "Tried fixing the problem myself and failed").

Are you supporting the right version of php for this setup? Do you need to crack open a new virtual directory to it? Is there a DB component you are missing? Login credentials? The issue is most likely your server isn't making the connection and not the install.. though that would be a second guess.
Was This Post Helpful? 0
  • +
  • -

#3 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 05:40 PM

First off, Thank you for your speedy reply. Well to be honest, I do not know the issue as this is my first attempt at making a web-browser persistent browser-based game. That is why I used the codes provided by ezRPG. Unfortunately, they no longer have a support forum or else I would asked there.

As far as I can tell the PHP is acceptable by the host/server, as the server clearly states it supports PHP and Mysql. I have also opened a 'Support Ticket' through the host itself, but I don't see them being of to much aid. I successfully set up my own homepage for the site, but as for the game itself; there is so damn many indexs and directories that I have dried my eyes out looking through all of them. Each and every time I went to open and edit them, I just seemed to run into indexs that were just connecting one to another. Such as log-in forms and such as that. Which they should be, but as for PHP is concerned I am confused.

I guess I could post some of the code here, but I wouldn't know where to begin. Giving someone access to the site is a bit risky, but if need be; need be.
Was This Post Helpful? 0
  • +
  • -

#4 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 07:29 PM

Seeing as the 'Edit' button is eluding me, sorry for the double-post. Here is the code to the config.php and the install.php. I can't even access the install.php page to actually install the game or whathaveyou, without going to edit it. Also you may notice a 'secret key' within the config.php, but that is not mine just a default value. It's used to connect to 'their' servers; which is not a requirement or anything. The game shall be ran by my own server.

install.php
<?php
error_reporting(0);
define('IN_EZRPG', true);
include './lib/func.rand.php';

function displayHeader()
{
    echo <<<HEAD
<html>
<head>
<title>ezRPG Installation</title>
<link rel="stylesheet" href="static/default/style.css" type="text/css" />
<style>
#content
{
  width: 50%;
  margin: auto;
  font: 1.0em Verdana, Arial, Sans-serif;
  color: #444;
  padding: 10px;
  border: 1px solid #3182C0;
}
</style>
</head>

<body>
<div id="content">
<h1>ezRPG Installation</h1>

HEAD;
}

function displayFooter()
{
    echo <<<FOOT
</div>
</body>
</html>
FOOT;
}

if (!isset($_GET['act']))
{
    if (!is_writable('config.php') || !is_writable('smarty/templates_c'))
    {
        displayHeader();
        echo '<h2>Step 1</h2>';
        echo '<p>Please make sure the following files and folders are writable:';
        echo '<strong>config.php</strong><br />';
        echo '<strong>smarty/templates_c</strong><br />';
        echo '<\p>';
        echo '<p>';
        echo 'The below folders are optional to make writable:<br />';
        echo '<strong>lib/ext/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer</strong>';
        echo '<strong>lib/ext/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer/HTML</strong>';
        echo '<strong>lib/ext/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer/URI</strong>';
        echo '</p>';
        echo '<p>';
        echo '<br />Chmod those files and folders to 0755 or 0777.</p>';
        echo '<p><a href="install.php">Click here to check again</a></p>';
        displayFooter();
        exit;
    }
    else
    {
        displayHeader();
        echo '<h2>Step 1</h2>';
        echo '<p>You have given the files/folders the correct file permissions.</p>';
        echo '<p><a href="install.php?act=2">Continue to next step</a></p>';
        displayFooter();
        exit;
    }
}
else if ($_GET['act'] == '2')
{
    displayHeader();
    echo '<h2>Step 2</h2>';
    
    if (!isset($_POST['submit']))
    {
        $dbhost = 'localhost';
        $dbname = 'ezrpg';
        $dbuser = '';
        $dbpass = '';
        $dbprefix = '';
    }
    else
    {
        $errors = 0;
        $msg = '';
        
        if (isset($_POST['dbhost']) && empty($_POST['dbhost']))
        {
            $errors = 1;
            $msg .= 'You need to enter a host name!<br />';
        }
        if (isset($_POST['dbname']) && empty($_POST['dbname']))
        {
            $errors = 1;
            $msg .= 'You need to enter a database name!<br />';
        }
        if (isset($_POST['dbuser']) && empty($_POST['dbuser']))
        {
            $errors = 1;
            $msg .= 'You need to enter a database user!<br />';
        }
        
        //so far so good...
        if ($errors == 0)
        {
            //let's test the connection
            $db = mysql_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass']);
            if (!$db)
            {
                $errors = 1;
                $msg .= 'ezRPG could not connect to the database with the details you entered!<br />';
            }
            else
            {
                $db_selected = mysql_select_db($_POST['dbname']);
                if (!$db_selected)
                {
                    $errors = 1;
                    $msg .= 'ezRPG could not select the database with the database name you entered!<br />';
                }
            }
        }
        
        if ($errors == 0)
        {
            //No problesm connecting and selecting the database
            //Save details to the config file and fill the database
            $dbhost = $_POST['dbhost'];
            $dbname = $_POST['dbname'];
            $dbuser = $_POST['dbuser'];
            $dbpass = $_POST['dbpass'];
            $dbprefix = $_POST['dbprefix'];
            //fill the database first
            $query1 = <<<QUERY
CREATE TABLE IF NOT EXISTS `{$dbprefix}players` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `username` varchar(30) default NULL,
  `password` varchar(40) default NULL,
  `email` varchar(255) default NULL,
  `secret_key` text,
  `rank` smallint(5) unsigned NOT NULL default '1',
  `registered` int(11) unsigned default NULL,
  `last_active` int(11) unsigned default '0',
  `last_login` int(11) unsigned default '0',
  `money` int(11) unsigned default '100',
  `level` int(11) unsigned default '1',
  `stat_points` int(11) unsigned default '10',
  `exp` int(11) unsigned default '0',
  `max_exp` int(11) unsigned default '10',
  `hp` int(11) unsigned default '20',
  `max_hp` int(11) unsigned default '20',
  `energy` int(11) unsigned NOT NULL default '10',
  `max_energy` int(11) unsigned NOT NULL default '10',
  `strength` int(11) unsigned default '5',
  `vitality` int(11) unsigned default '5',
  `agility` int(11) unsigned default '5',
  `dexterity` int(11) unsigned default '5',
  `damage` int(11) unsigned default '0',
  `kills` int(11) unsigned NOT NULL default '0',
  `deaths` int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;
QUERY;
            mysql_query($query1) or die('Something went wrong.');
            
            $query2 = <<<QUERY
CREATE TABLE IF NOT EXISTS `{$dbprefix}player_log` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `player` int(11) unsigned NOT NULL,
  `time` int(11) unsigned NOT NULL,
  `message` text NOT NULL,
  `status` tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (`id`),
  KEY `player_log` (`player`,`time`),
  KEY `new_logs` (`player`,`status`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
QUERY;
            mysql_query($query2) or die('Something went wrong.');
            
            echo '<p>Tables installed.</p>';
            
            //Save data to config file
            $secret_key = createKey(24);
            $config = <<<CONF
<?php
//This file cannot be viewed, it must be included
defined('IN_EZRPG') or exit;

/*
  Title: Config
  The most important settings for the game are set here.
*/

/*
  Variables: Database Connection
  Connection settings for the database.
  
  \$config_server - Database server
  \$config_dbname - Database name
  \$config_username - Username to login to server with
  \$config_password - Password to login to server with
  \$config_driver - Contains the database driver to use to connect to the database.
*/
\$config_server = '{$dbhost}';
\$config_dbname = '{$dbname}';
\$config_username = '{$dbuser}';
\$config_password = '{$dbpass}';
\$config_driver = 'mysql';

/*
  Constant:
  This secret key is used in the hashing of player passwords and other important data.
  Secret keys can be of any length, however longer keys are more effective.
  
  This should only ever be set ONCE! Any changes to it will cause your game to break!
  You should save a copy of the key on your computer, just in case the secret key is lost or accidentally changed,.
  
  SECRET_KEY - A long string of random characters.
*/
define('SECRET_KEY', '{$secret_key}');


/*
  Constants: Settings
  Various settings used in ezRPG.
  
  DB_PREFIX - Prefix to the table names
  VERSION - Version of ezRPG
  SHOW_ERRORS - Turn on to show PHP errors.
  DEBUG_MODE - Turn on to show database errors and debug information.
*/
define('DB_PREFIX', '{$dbprefix}');
define('VERSION', '1.0');
define('SHOW_ERRORS', 0);
define('DEBUG_MODE', 0);
?>
CONF;
            file_put_contents('config.php', $config);
            echo '<p>Config file written.</p>';
            echo '<p><a href="install.php?act=3">Continue to next step</a></p>';
            displayFooter();
            exit;
        }
        else
        {
            echo '<p><strong>Sorry, there were some problems:</strong><br />', $msg, '</p>';
            
            $dbhost = $_POST['dbhost'];
            $dbname = $_POST['dbname'];
            $dbuser = $_POST['dbuser'];
            $dbpass = $_POST['dbpass'];
            $dbprefix = $_POST['dbprefix'];
        }
    }
    
    echo '<p>Please fill in the database access details here.</p>';
    echo '<form method="post" action="install.php?act=2">';
    echo '<label>Host</label>';
    echo '<input type="text" name="dbhost" value="', $dbhost, '" />';
    echo '<label>Database Name</label>';
    echo '<input type="text" name="dbname" value="', $dbname, '" />';
    echo '<label>User</label>';
    echo '<input type="text" name="dbuser" value="', $dbuser, '" />';
    echo '<label>Password</label>';
    echo '<input type="password" name="dbpass" value="', $dbpass, '" />';
    echo '<label>Table Prefix (Optional)</label>';
    echo '<input type="text" name="dbprefix" value="', $dbprefix, '" />';
    echo '<p>You can enter a prefix for your table names if you like.<br />This can be useful if you will be sharing the database with other applications, or if you are running more than one ezRPG instance in a single database.</p>';
    echo '<input type="submit" name="submit" value="Submit"  class="button" />';
    echo '</form>';
    displayFooter();
    exit;
}

else if ($_GET['act'] == '3')
{
    displayHeader();
    echo '<h1>Step 3</h1>';
    
    if (isset($_POST['submit']))
    {
        $errors = 0;
        $msg = '';
        if (empty($_POST['username']) || empty($_POST['email']) || empty($_POST['password']) || empty($_POST['password']))
        {
            $errors = 1;
            $msg .= 'You forgot to fill in something!';
        }
        if ($_POST['password'] != $_POST['password2'])
        {
            $errors = 1;
            $msg .= 'You didn\'t verify your password correctly.';
        }
        
        if ($errors == 0)
        {
            include 'config.php';
            mysql_connect($config_server, $config_username, $config_password);
            mysql_select_db($config_dbname);
            
            $secret_key = createKey(16);
            $query = 'INSERT INTO `' . DB_PREFIX . 'players` (`username`, `password`, `email`, `secret_key`, `registered`, `rank`) VALUES(\'' . mysql_real_escape_string($_POST['username']) . '\', \'' . mysql_real_escape_string(sha1($secret_key . $_POST['password'] . SECRET_KEY)) . '\', \'' . mysql_real_escape_string($_POST['email']) . '\', \'' . mysql_real_escape_string($secret_key) . '\', ' . time() . ', 10)';
            mysql_query($query);
            
            echo '<p>Your admin account has been created! You may now login to the game. You can access the admin panel at <em>/admin</em>.</p>';
            echo '<p><strong>Please delete install.php immediately!</strong></p>';
            echo '<p><a href="index.php">Visit your ezRPG!</a></p>';
            displayFooter();
            exit;
        }
        else
        {
            echo '<p><strong>Sorry, there were some problems:</strong><br />', $msg, '</p>';
        }
    }
    
    echo '<p>Create your admin account for ezRPG.</p>';
    echo '<form method="post" action="install.php?act=3">';
    echo '<label>Username</label>';
    echo '<input type="text" name="username" value="', $_POST['username'], '" />';
    echo '<label>Email</label>';
    echo '<input type="text" name="email" value="', $_POST['email'], '" />';
    echo '<label>Password</label>';
    echo '<input type="password" name="password" />';
    echo '<label>Verify Password</label>';
    echo '<input type="password" name="password2" />';
    echo '<br />';
    echo '<input type="submit" value="Create" name="submit" class="button" />';
    echo '</form>';
    displayFooter();
    exit;
}
?>




config.php(Of course I removed the password, because I'm posting it here)
<?php
//This file cannot be viewed, it must be included
defined('IN_EZRPG') or exit;

/*
  Title: Config
  The most important settings for the game are set here.
*/

/*
  Variables: Database Connection
  Connection settings for the database.
  
  $config_server - http://legendofthesamurai.netau.net/
  $config_dbname - a7875695_legend
  $config_username - a7875695_admin
  $config_password - youwishblahblahblah
  $config_driver - mysql7.000webhost.com
*/
$config_server = 'mysql7.000webhost.com';
$config_dbname = 'a7875695_legend';
$config_username = 'a7875695_admin';
$config_password = 'youwishblahblahblah';
$config_driver = 'mysql7.000webhost.com';

/*
  Constant:
  This secret key is used in the hashing of player passwords and other important data.
  Secret keys can be of any length, however longer keys are more effective.
  
  This should only ever be set ONCE! Any changes to it will cause your game to break!
  You should save a copy of the key on your computer, just in case the secret key is lost or accidentally changed,.
  
  SECRET_KEY - A long string of random characters.
*/
define('SECRET_KEY', '692SdIZ3wVm?xzCod9r:zK]#');


/*
  Constants: Settings
  Various settings used in ezRPG.
  
  DB_PREFIX - Prefix to the table names
  VERSION - Version of ezRPG
  SHOW_ERRORS - Turn on to show PHP errors.
  DEBUG_MODE - Turn on to show database errors and debug information.
*/
define('DB_PREFIX', 'LegendofSamurai');
define('VERSION', '1.0');
define('SHOW_ERRORS', 0);
define('DEBUG_MODE', 0);
?>


Was This Post Helpful? 0
  • +
  • -

#5 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9220
  • View blog
  • Posts: 34,624
  • Joined: 12-June 08

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 07:44 PM

What's the server's software? IIS? Apache? I am still thinking it's there (if you can't navigate to the even the folder).
Was This Post Helpful? 0
  • +
  • -

#6 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 07:54 PM

I can access the files, but only in 'File Management', in my Admin Control Panel. I can not access the pages like a guest would. The Server software is as followed;
Note- I could list everything, but I will just list the jist of everything.

Quote

PHP Version 5.2.17
System- Linux srv27.000webhost.com 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:10:13 EDT 2011 x86_64

apache2handler
Apache API Version 20051115

mysql
Client API version 5.1.57

Here is the link to the complete list the server uses, not sure if you can access it.
http://server27.000w...com/phpinfo.php

Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9220
  • View blog
  • Posts: 34,624
  • Joined: 12-June 08

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 08:03 PM

Look.. their main site's non existent and you can't seem to configure your webserver to use it. It might be high time to move on to something that's not going to blow up.
Was This Post Helpful? 0
  • +
  • -

#8 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 08:10 PM

View Postmodi123_1, on 05 October 2012 - 08:03 PM, said:

Look.. their main site's non existent and you can't seem to configure your webserver to use it. It might be high time to move on to something that's not going to blow up.


The host site works just fine, unless you are referring to the ezRPG website; then you would be correct. As for the code I don't know why it doesn't work and it seems you can't figure it out either. Perhaps you could point me into the right direction? As I would very much enjoy crafting my own persistent browser-based RPG game. Though I would prefer a template of some sort, I do not really want to draft up every single bit of code.
Was This Post Helpful? 0
  • +
  • -

#9 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9220
  • View blog
  • Posts: 34,624
  • Joined: 12-June 08

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 10:04 PM

Quote

As for the code I don't know why it doesn't work and it seems you can't figure it out either

Yes.. because of the lack of information presented and not having the 'hands on'-ness of working with the server directly. How about you talk to the people that made the software. I would wager they might know a bit more about how to install it right than folk who never have heard of it.
Was This Post Helpful? 0
  • +
  • -

#10 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 05 October 2012 - 10:24 PM

I provided the parts of the code that were not working to the best of my knowledge. I don't know what else more I can provide for you...I'm especially not fond of allowing others access to my Admin Control Panel, for obvious reasons. There also seems to be no way to contact the original writers of said code, especially since their support forums and their website has been closed.

So as for your comment about lack of information provided is a bit rash, I'd have to say. I came here looking for help, not a hand out. I am more than willing to put forth the effort; I just need a leg-up.
Was This Post Helpful? 0
  • +
  • -

#11 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9220
  • View blog
  • Posts: 34,624
  • Joined: 12-June 08

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 06 October 2012 - 01:24 AM

That's the problem - low impact chunk of code, a multitude of variable issues with the environment, and no support.

You are fixated on a chunk of code that isn't working and is not being supported.

This is the time you need to take an earnest look and reevaluate what you are using. I don't have the time, nor inclination, to try and install this on a VM tonight. What I do suggest is going back to the well and finding an alternative and keep moving forward.
Was This Post Helpful? 0
  • +
  • -

#12 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: 0
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 06 October 2012 - 05:34 AM

I think it's fair to say that this code is dead. You either need to rewrite or find an alternative, as suggested.
Was This Post Helpful? 0
  • +
  • -

#13 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 06 October 2012 - 09:11 AM

View PostShibataTim, on 05 October 2012 - 08:10 PM, said:

Perhaps you could point me into the right direction? As I would very much enjoy crafting my own persistent browser-based RPG game. Though I would prefer a template of some sort, I do not really want to draft up every single bit of code.


View PostShibataTim, on 05 October 2012 - 10:24 PM, said:

I came here looking for help, not a hand out. I am more than willing to put forth the effort; I just need a leg-up.

Was This Post Helpful? 0
  • +
  • -

#14 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9220
  • View blog
  • Posts: 34,624
  • Joined: 12-June 08

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 06 October 2012 - 01:00 PM

I am not sure how that post was even responsive to anything said, but for the record, regardless of your tone, I dumped this on my local dev server and it ran fine. Again - it's an environment problem you have with your setup not an issue with the app. As for diagnosing it - who knows. Either learn more about permissions, server maintenance, and so forth by running a local server setup (I suggest XAMPP) or find something that works better for you.
Was This Post Helpful? 0
  • +
  • -

#15 ShibataTim  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 15
  • Joined: 05-October 12

Re: Error 404 with php game, but the page is there (ezRPG)

Posted 06 October 2012 - 03:42 PM

I don't know what the server could have to do with it, but I guess everything. I followed the very limited provided instructions to the tee and still no success. I sent the files through an FTP and so the files are exactly the same and in the exact directories. Maybe that is an issue?
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2