Log in

View Full Version : What would i have to include?


Killgore
03-01-2009, 11:01 PM
http://sylonia.freehostingwave.com/adoptables/guide.html (http://sylonia.freehostingwave.com/adoptables/guide.html)

What pages(s) of the script would i have to include to get the featured adoptable do display in the correct table? (the one with ":FEATURED:" in it)

EDIT: Scratch that, what would i have to include to make it have the same template as the res of the site? Obviously I'd have to rename it to a .php file. If it had the same template, that would save me a lot of time ;)

aroymart
03-02-2009, 08:52 AM
wow were do you advertise by the way you have a lot of adopted adoptables and you started after me >.< please tell me where you put your ads


wait you lied to me you only have a few adopts you havent even hit 90 yet

Killgore
03-02-2009, 11:02 AM
I switched hosts since the last time i told you about it ;)

In the box on the left-hand side of the screen. The one that says "Featured Adoptable"?

BMR777
03-02-2009, 04:29 PM
The easiest way to do this is take from the download the file extrapage.php and make a copy and rename it. Then inside find and delete:

//Loop out code
$i=0;
while ($i < 1) {

$article_title=mysql_result($result,$i,"title");
$article_date=mysql_result($result,$i,"date");
$article_content=mysql_result($result,$i,"content");

$i++;
}

$article_title = stripslashes($article_title);
$article_content = stripslashes($article_content);

Then, for your content, use the $article_title and $article_content variables to show your content. So, for instance:

$article_title = "Page Title Here";
$article_content = "Your page content goes here. <a href='link.php'>This is a link.</a> I can put content here.

Basically, paste your content or HTML inside of $article_content to display it on the page. Be sure and replace double guotes " with single ' ones. :)

Killgore
03-02-2009, 06:21 PM
So i would take out what's in the first box, and replace it with what's in the second?

BMR777
03-02-2009, 06:22 PM
Yep. :)

Killgore
03-02-2009, 06:37 PM
Hm...here's what happened:

http://sylonia.freehostingwave.com/adoptables/guide.php (http://sylonia.freehostingwave.com/adoptables/guide.php)

BMR777
03-02-2009, 06:42 PM
Please paste your code here. :)

Killgore
03-02-2009, 06:44 PM
I haven't pasted what i want to go in there yet, i wanted to get everything okay before i did something to it ;)

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php"); // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username = "";
$password = "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];

$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);

//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

if($username == $luser and $password == $lpass){
$isloggedin = "yes";
}
else{
if (isset($_COOKIE['adoptu'])){
$past = time() - 10;
setcookie("adoptu",$username,$past);
}

if (isset($_COOKIE['adoptp'])){
$past = time() - 10;
setcookie("adoptp",$password,$past);
}
$isloggedin = "no";
}

}
else
{
//User is not logged in
$isloggedin = "no";

}


// Define our Template File

$file = $current_theme;



// Get our content for the index page

$query = "SELECT * FROM article_content WHERE page = 'extra'";
$result = mysql_query($query);
$num = mysql_numrows($result);

$article_title = 'Sylonia';
$article_content = "Your page content goes here. <a href='link.php'>This is a link.</a> I can put content here.

$article_content = $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

$link1 = "" ;
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

// Do the template changes and echo the ready template

$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);

$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);


//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$template = replace(':WELCOMEORREGISTER:','<u>Welcome Back:</u>',$template);
$template = replace(':LOGINORACCT:', 'Welcome back '.$username.'. <br><br><a href="account.php">Click here to view or edit your account.</a><br><br><a href="logout.php">Log Out</a>' ,$template);
}
else{

//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
<p>Username:
<input name='username' type='text' id='username'>
</p>
<p>Password:
<input name='password' type='password' id='password'>
</p>
<p>
<input type='submit' name='Submit' value='Submit'>
</p>
<p>Don't have an account?<br>
<a href='register.php'>Register Free</a> </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}

echo $template;
?>

BMR777
03-02-2009, 06:48 PM
Ok, remove:

$query = "SELECT * FROM article_content WHERE page = 'extra'";
$result = mysql_query($query);
$num = mysql_numrows($result);

and...

$article_content = $bbcode->Parse($article_content);

// Run the BBCODE parser on the content

// Should we show the extra pages in the nav bar?

Also, this:

$article_title = 'Sylonia';

Should be:

$article_title = "Sylonia";

You need that one set of quotes that is there already, but the content you have goes inside the quotes and there shouldn't be any other quotes inside the main quotes. :)

Also, this:

$article_content = "Your page content goes here. <a href='link.php'>This is a link.</a> I can put content here.

Should be:

$article_content = "Your page content goes here. <a href='link.php'>This is a link.</a> I can put content here.";

That should solve things. :)

Killgore
03-02-2009, 06:53 PM
EDIT: Wait a sec, something went wrong again.

Parse error: syntax error, unexpected T_STRING in /home/killgore/domains/sylonia.freehostingwave.com/public_html/adoptables/guide.php on line 81

BMR777
03-02-2009, 07:04 PM
What's the new code. Just what you changed this time please. :)

Killgore
03-02-2009, 07:08 PM
$article_content = "<p align="left"><font color="#ffffff" face="Verdana" size="1">To see past and present adoptables, please choose a category to look in.
<br><br>
<center>
<a href="http://sylonia.freehostingwave.com/adoptables/guide/monthlies.html">Monthly Adoptables</a>
<br>
<a href="http://sylonia.freehostingwave.com/adoptables/guide/promo.html">Promotional Adoptables</a>
<br>
<a href="http://sylonia.freehostingwave.com/adoptables/guide/shop.html">Shop Adoptables</a>
</center>";

BMR777
03-02-2009, 07:10 PM
It should be:

$article_content = "<p align='left'><font color='#ffffff' face='Verdana' size='1'>To see past and present adoptables, please choose a category to look in.
<br><br>
<center>
<a href='http://sylonia.freehostingwave.com/adoptables/guide/monthlies.html'>Monthly Adoptables</a>
<br>
<a href='http://sylonia.freehostingwave.com/adoptables/guide/promo.html'>Promotional Adoptables</a>
<br>
<a href='http://sylonia.freehostingwave.com/adoptables/guide/shop.html'>Shop Adoptables</a>
</center>";

Killgore
03-02-2009, 07:20 PM
Ah, so just make the " into ' i got it. Thanks! :D:D:D[hr]
Wow, major issues. I tried adding THIS (http://sylonia.freehostingwave.com/adoptables/guide/monthlies.php) to the guide. I'm assuming you want to see the code, so here it is.

<?php

// Easy Adoptables Script by Brandon Rusnak
// Get our includes out of the way

include("inc/functions.php");
include("inc/config.php");
include("inc/settings.php");
include("inc/nbbc.php"); // BBCODE Parser
$bbcode = new BBCode;

// Connect to our database

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql database!');
mysql_select_db($dbname);


//Set up our login info...
$username = "";
$password = "";

//Check for cookie

if (isset($_COOKIE['adoptu']) and isset($_COOKIE['adoptp'])){

$username = $_COOKIE['adoptu'];
$password = $_COOKIE['adoptp'];

$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$password = preg_replace("/[^a-zA-Z0-9s]/", "", $password);

//Run login operation
$query = "SELECT * FROM users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");

$i++;
}

if($username == $luser and $password == $lpass){
$isloggedin = "yes";
}
else{
if (isset($_COOKIE['adoptu'])){
$past = time() - 10;
setcookie("adoptu",$username,$past);
}

if (isset($_COOKIE['adoptp'])){
$past = time() - 10;
setcookie("adoptp",$password,$past);
}
$isloggedin = "no";
}

}
else
{
//User is not logged in
$isloggedin = "no";

}


// Define our Template File

$file = $current_theme;



// Get our content for the index page

$article_title = "Sylonia";
$article_content = "<p align='left'>
<table border='2' bordercolor='#575757' cellpadding='5' cellspacing='1'>
<tr>
<td colspan='4'><center><font color='#ffffff' face='Verdana' size='1'>Below are all the monthly adoptables that once were (or still are) available.</font><br></td>
</tr>
<tr>
<td colspan='4'><font color='#ffffff' face='Verdana' size='1'><center><a href='http://sylonia.freehostingwave.com/adoptables/guide.php'>Back to guide index</a></center></font></td>
</tr>
<tr>
<td><font color='#ffffff' face='Verdana' size='1'><center>Hatched From</center></font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>Hatched Into</center></font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>Date Released</center></font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>Date Retired</center><font></td>
</tr>
<tr>
<td><center><img src='http://sylonia.freehostingwave.com/adoptables/images/bases/amber_1.png'><br><font color='#ffffff' face='Verdana' size='1'>Honey Amber</font></td>
<td><center><img src='http://sylonia.freehostingwave.com/adoptables/images/adults/bugzel_1.png'><br><font color='#ffffff' face='Verdana' size='1'>Bugzel</font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center><center>February 15<sup>th</sup>, 2009</center></font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>March 15<sup>th</sup>, 2009</center></font></td>
</tr>
<tr>
<td><center><img src='http://sylonia.freehostingwave.com/adoptables/images/bases/egg_1.png'><br><font color='#ffffff' face='Verdana' size='1'>Cool Egg</font></td>
<td><center><img src='http://sylonia.freehostingwave.com/adoptables/images/adults/yetti_1.png'><br><font color='#ffffff' face='Verdana' size='1'>Yetti</font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>February 15<sup>th</sup>, 2009</center></font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>March 15<sup>th</sup>, 2009</center></font></td>
</tr>
<tr>
<td><center><img src='http://sylonia.freehostingwave.com/adoptables/images/bases/bone_2.png'><br><font color='#ffffff' face='Verdana' size='1'>Purple Bone</font></td>
<td><center><img src='http://sylonia.freehostingwave.com/adoptables/images/adults/snakecro_1.png'><br><font color='#ffffff' face='Verdana' size='1'>Snakecro</font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>February 15<sup>th</sup>, 2009</center></font></td>
<td><font color='#ffffff' face='Verdana' size='1'><center>March 15<sup>th</sup>, 2009</center></font></td>
</tr>
<tr>
<td colspan='4'><font color='#ffffff' face='Verdana' size='1'><center><a href='http://sylonia.freehostingwave.com/adoptables/guide.php'>Back to guide index</a></center></font></td>
</tr>
</table>";

$link1 = "" ;
if($show_extra_page1 == "yes"){
$link1 = "<li><a href='$extra_page1_link'>$extra_page1_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<li><a href='$extra_page2_link'>$extra_page2_name<span class='tab-l'></span><span class='tab-r'></span></a></li>";
}

// Do the template changes and echo the ready template

$template = file_get_contents($file);
$template = replace(':SITETITLE:',$site_title,$template);
$template = replace(':SITENAME:',$site_name,$template);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':LINK1:',$link1,$template);
$template = replace(':LINK2:',$link2,$template);
$template = replace(':LINK3:',$link3,$template);

//Get the featured adoptable...
$featured = getfeatured();
$template = replace(':FEATURED:',$featured,$template);

//Ad Management
$header = @file_get_contents("ads/header.txt");
$footer = @file_get_contents("ads/footer.txt");
$tower = @file_get_contents("ads/tower.txt");

$header = stripslashes($header);
$footer = stripslashes($footer);
$tower = stripslashes($tower);

$template = replace(':HEADERAD:',$header,$template);
$template = replace(':FOOTERAD:',$footer,$template);
$template = replace(':TOWERAD:',$tower,$template);


//Is the user logged in?
//$isloggedin = "no";
if ($isloggedin == "yes"){
$template = replace(':WELCOMEORREGISTER:','<u>Welcome Back:</u>',$template);
$template = replace(':LOGINORACCT:', 'Welcome back '.$username.'. <br><br><a href="account.php">Click here to view or edit your account.</a><br><br><a href="logout.php">Log Out</a>' ,$template);
}
else{

//User is not logged in
$template = replace(':WELCOMEORREGISTER:','<u>Member Login:</u>',$template);
$loginform = "<form name='form1' method='post' action='login.php'>
<p>Username:
<input name='username' type='text' id='username'>
</p>
<p>Password:
<input name='password' type='password' id='password'>
</p>
<p>
<input type='submit' name='Submit' value='Submit'>
</p>
<p>Don't have an account?<br>
<a href='register.php'>Register Free</a> </p>
</form>
";
$template = replace(':LOGINORACCT:', $loginform ,$template);
}

echo $template;
?>