Php Help

04/19/2013 16:28 Godricc#1
So I downloaded janvier123's php EX: top pvp/etc.
But how should I go about adding them to my website?

I understand how my register pages works, seeing that I do have it up and running. But for that it has to files. Php/HTML.

The files I downloaded from janvier does not. I feel lost in this area a little.

If anything someone skype me and let me know how shit works. xD

Skype: Ansem774
04/19/2013 20:02 janvier123#2
PHP Code:
<?php include ('<filename.php>'?>
04/20/2013 00:37 Godricc#3
add that into my webpage and its just showing
') ?>
Then I moved the < > and its showing blank...
04/20/2013 01:14 .Genome.#4
Just do

Code:
<?php
//other script stuff here if needed

include 'blah.php';

//other script stuff here if needed
?>
Also look into require, require_once, and include_once.

Depending on what you're doing with the website those may be better to use.
04/20/2013 01:30 Godricc#5
Kk so I have the php scripts that included that extra file. {odbc.config.php}
so I have two scrpits.

Code:
include("config/odbc.conf.php");
$odbc_char_con = odbc_connect($odbc['data_cha'],$odbc['user'],$odbc['pass']) or die("Verbinndung zum ODBC Server fehlgeschlagen,bitte zu einem späteren zeitpunkt erneut probieren.");
$odbc_acc_con = odbc_connect($odbc['data_acc'],$odbc['user'],$odbc['pass']) or die("Verbinndung zum ODBC Server fehlgeschlagen,bitte zu einem späteren zeitpunkt erneut probieren.");


echo "<center>Player Online List<br>";

echo "<table border='1'>
	<tr>
		<td align='center'>Char.Name</td>
		<td align='center'>Level</td>
		<td align='center'>Class</td>
	</tr>";

$result1 = odbc_exec($odbc_acc_con,"SELECT user_no FROM account.dbo.USER_PROFILE WHERE login_flag = '1100'");

$classes = array('0' => "Azure Knight", '1' => "Segita Hunter", '2' => "Incar Magician", '3' => "Vicious Summoner", '4' => "Segnale", '5' => "Bagi Warrior");  

while(odbc_fetch_row($result1)) {
	
	$user_no = odbc_result($result1,1);

	$result2 = odbc_exec($odbc_char_con,"SELECT character_name,wLevel,byPCClass FROM character.dbo.user_character WHERE user_no = '".$user_no."' ORDER by login_time DESC");
	$name = odbc_result($result2,1);
	$level = odbc_result($result2,2);
	$class = odbc_result($result2,3);

	if(!preg_match("/[[GM]]/i",$name)) {

		echo "<tr>
			<td align='center'>".$name."</td>
			<td align='center'>".$level."</td>
			<td align='center'>".$classes[$class]."</td>
		</tr>";

	}

}
odbc_close($odbc_char_con);
odbc_close($odbc_acc_con);

echo "</table></center>";
04/20/2013 03:57 .Genome.#6
Change

Code:
include("config/odbc.conf.php");
to

Code:
include 'odbc.conf.php';
As long as it's in the same directory it will work.
04/20/2013 05:18 Godricc#7
Wouldn't it be like this tho?

include 'http://{EXTERNALIP}/odbc.conf.php';

Im not hosting my website from my htdocs...
04/20/2013 10:21 .Genome.#8
Quote:
Originally Posted by Godricc View Post
Wouldn't it be like this tho?

include 'http://{EXTERNALIP}/odbc.conf.php';

Im not hosting my website from my htdocs...
*From the PHP include manual*
include 'http://www.example.com/file.php';

So yea putting the IP would work as long as it isnt in a protected directory.

But I don't see much of a purpose in storing your scripts in different locations. What I mean is having the included script in a different spot than the one calling it.
04/20/2013 14:06 janvier123#9
Quote:
Originally Posted by .Genome. View Post
*From the PHP include manual*
include 'http://www.example.com/file.php';
will NOT work,

PHP Code:
Warning: include() [function.include]: 
URL file-access is disabled in the server configuration in ... <file
unless this is enabled, what NO server will do, unless they are retarded !
04/20/2013 15:21 .Genome.#10
Quote:
Originally Posted by janvier123 View Post
will NOT work,
PHP Code:
Warning: include() [function.include]: 
URL file-access is disabled in the server configuration in ... <file
unless this is enabled, what NO server will do, unless they are retarded !
I was close saying this:
Quote:
Originally Posted by .Genome. View Post
as long as it isnt in a protected directory.
But ty for the info :D I've never done an include from a url/ip.
04/21/2013 06:16 Godricc#11
This is how it's showing up on my index...
[Only registered and activated users can see links. Click Here To Register...]

Heres my code.
PHP Code:
<?php

include("odbc.conf.php");
$odbc_char_con odbc_connect($odbc['data_cha'],$odbc['user'],$odbc['pass']) or die("Verbinndung zum ODBC Server fehlgeschlagen,bitte zu einem späteren zeitpunkt erneut probieren.");
$odbc_acc_con odbc_connect($odbc['data_acc'],$odbc['user'],$odbc['pass']) or die("Verbinndung zum ODBC Server fehlgeschlagen,bitte zu einem späteren zeitpunkt erneut probieren.");


echo 
"<center>Player Online List<br>";

echo 
"<table border='1'>
    <tr>
        <td align='center'>Char.Name</td>
        <td align='center'>Level</td>
        <td align='center'>Class</td>
    </tr>"
;

$result1 odbc_exec($odbc_acc_con,"SELECT user_no FROM account.dbo.USER_PROFILE WHERE login_flag = '1100'");

$classes = array('0' => "Azure Knight"'1' => "Segita Hunter"'2' => "Incar Magician"'3' => "Vicious Summoner"'4' => "Segnale"'5' => "Bagi Warrior");  

while(
odbc_fetch_row($result1)) {
    
    
$user_no odbc_result($result1,1);

    
$result2 odbc_exec($odbc_char_con,"SELECT character_name,wLevel,byPCClass FROM character.dbo.user_character WHERE user_no = '".$user_no."' ORDER by login_time DESC");
    
$name odbc_result($result2,1);
    
$level odbc_result($result2,2);
    
$class odbc_result($result2,3);

    if(!
preg_match("/[[GM]]/i",$name)) {

        echo 
"<tr>
            <td align='center'>"
.$name."</td>
            <td align='center'>"
.$level."</td>
            <td align='center'>"
.$classes[$class]."</td>
        </tr>"
;

    }

}
odbc_close($odbc_char_con);
odbc_close($odbc_acc_con);

echo 
"</table></center>";

?>
EDIT: Messed with my config. Also now I get this on the page.
Verbinndung zum ODBC Server fehlgeschlagen,bitte zu einem späteren zeitpunkt erneut probieren
04/21/2013 11:09 janvier123#12
my guess? you dont even have PHP installed or wrong extension

what is your FILENAME ?
04/21/2013 11:49 Godricc#13
1. How do I install php? I thought it came with everything when I installed xampp!
2. The file names are... obdc.config.php / obdc.player_names.php
Both from dkunderground.
04/22/2013 12:46 janvier123#14
added you on skype
04/22/2013 13:29 Godricc#15
yeah, I saw that now xD. Im on there now, ganna wait for ya, because I rather talk to a php king! :))