Jump to content

error?


eaglelegend

Recommended Posts

Hi

 

There is no page called "page". Think the error is on the first script (and is maybe my fault).

 

There is a line saying:-

 

<input name='page' type='hidden' id='page' value='".$page."'>

 

Change that to

 

<input name='page' type='hidden' id='page' value='<?php echo $page; ?>'>

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777352
Share on other sites

Hi

 

Probably best to put it in the update statements (not that you could put these 3 update statements into just one statement if you want to tidy it up).

 

$query = "UPDATE article_content SET title='".htmlspecialchars_decode($title)."' WHERE page='".$page."'";
mysql_query($query);
$query = "UPDATE article_content SET content='".htmlspecialchars_decode($content)."' WHERE page='".$page."'";
mysql_query($query);
$date = date('Y m d');
$query = "UPDATE article_content SET date='".htmlspecialchars_decode($date)."' WHERE page='".$page."'";
mysql_query($query);

 

and in the original script (to avoid them upsetting the page layout of the edit page if you edit them in the future)

 

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

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777383
Share on other sites

index.php

<?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 = 'index'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//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);

$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 = "<a href='$extra_page1_link'>$extra_page1_name</a>"; 
}

$link2 = "";
if($show_extra_page2 == "yes"){
$link2 = "<a href='$extra_page2_link'>$extra_page2_name</a>"; 
}

// 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,$template);
$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 = "<h2>Advertisement</h2>";
$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;
?>

 

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777402
Share on other sites

Hi

 

Not really sure ??? .

 

I take it you have put the paragraph tabs in yourself (eg typed <p>) . If so then try [p] and [/p] instead, but not sure if te BB code parser you are using will understand them.

 

Also possible that you just do not need them.

 

Sorry, without looking through loads of the code for your site and what is used where I cannot really give you any extra help on this bit.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777421
Share on other sites

Hi

 

OK, I have no knowledge of the javascript text box. Presume it is there to make editing more pleasant, but I presume it is adding the <p> and </p> tags. However not sure if it has already tried to encode them.

 

What I would suggest is that  you put some echo statements back in just before the updates and put out the page. Hopefully we can then see what it has added (it could be that it has added < and when we have played with that with htmlspecialchars it has landed up as &lt; , essentially encoding the already encoded input).

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777437
Share on other sites

UPDATE article_content SET title='Welcome to Eagle Legend!' WHERE page='index'

UPDATE article_content SET content='

Welcome!

 

' WHERE page='index'

UPDATE article_content SET date='2009 03 05' WHERE page='index'

 

Please be aware I left your "htmlspecialchars_decode" in it

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777469
Share on other sites

Hi

 

Think it must be the bbcode parser that is doing it.

 

In index.php can you echo out the field $article_content, both before and after the call to the bbcode parser to confirm this.

 

echo "BEFORE PARSE $article_content <br />";
$article_content = $bbcode->Parse($article_content);
echo "AFTER PARSE $article_content <br />";

 

When you run it, do a "view source" and check what it has put out.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777480
Share on other sites

Hi

 

Just had a look. If you do a "view source" you can see it is <p> and </p> before the parse (which I think probably means it must be saved like that on the database - best to check) and hence is not actually displayed on the normal page while after the parse it has been converted to <p>Welcome!</p> , which the web page treats as <p> and</p> to display, rather than treating them as HTML paragraphs.

 

This is a bit strange as when you posted what was written to the database it did not have the tags.

 

Is there another stage in your process? For example, is there a script to mark the content as live so that it is displayed (which could add the tags).

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777499
Share on other sites

Hi

 

Mmm, strange. Those tags must have been added at some point. Unless they are added on the update and you didn't see them as you looked at the page rather than doing a view source. Could you double check? If that is the case then I suspect the javascript editor on pages.php. Unfortunatly I cannot really look through that.

 

All the best

 

Keith

Link to comment
https://forums.phpfreaks.com/topic/148066-error/page/2/#findComment-777519
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.