Search
Left Quote    I start where the last man left off.
- Thomas A. Edison    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Undefined index: page
  This user is offline  nightwhisper09
  Subject: " Undefined index: page" Posted: @ 12:47 pm on Oct 31 2009   
Member #: 1076
Rank: User - (2)
Since: 10/30/09
Posts: 2

Hello all
I am working on cms to understand how it work but when i install it i got this msg !!!
the cms on wamp server on my PC

Notice: Undefined index: page in C:\wamp\www\eli teCMS\includes\ functions.php on line 92

Notice: Undefined index: page in C:\wamp\www\eli teCMS\includes\ functions.php on line 66
>Home

The functions code is

<?php
function mysql_prep($val ue)
{
$magic_quotes_a ctive = get_magic_quote s_gpc();
$new_enough_php = function_exists ("mysql_re al_escape_strin g"; // i.e. PHP >= v4.3.0
if ($new_enough_ph p) { // PHP v4.3.0 or higher
// undo any magic quote effects so mysql_real_esca pe_string can do the work
if ($magic_quotes_ active) {
$value = stripslashes($v alue);
}
$value = mysql_real_esca pe_string($valu e);
} else { // before PHP v4.3.0
// if magic quotes aren't already on then add slashes manually
if (!$magic_quotes _active) {
$value = addslashes($val ue);
}
// if magic quotes are active, then the slashes already exist
}
return $value;
}


function redirect_to($lo cation = null)
{
if ($location != null) {
header("Lo cation: $location"< img src=http://www. allsyntax.com/f orums/images/sm ilies/wink.gif border=0>;
exit;

}

}
function confirm_query($ query)
{
if (!$query) {
die("Datab ase Query failed !. Check Database Settings." . mysql_error());

}

}
function get_page_for_ed iting($page_id)
{
$query = " SELECT * FROM pages ";
$query .= " WHERE id =" . $page_id . " ";
$result = mysql_query($qu ery);
confirm_query($ result);
$page = mysql_fetch_arr ay($result);
return $page;

}

function get_post_for_ed iting($post_id)
{
$query = " SELECT * FROM posts ";
$query .= " WHERE id =" . $post_id . " ";
$result = mysql_query($qu ery);
confirm_query($ result);
$post = mysql_fetch_arr ay($result);
return $post;

}
function get_sidebar_for _editing($sideb ar_id)
{
$query = " SELECT * FROM sidebar ";
$query .= " WHERE id =" . $sidebar_id . " ";
$result = mysql_query($qu ery);
confirm_query($ result);
$sidebar = mysql_fetch_arr ay($result);
return $sidebar;

}
function selected_page()
{
global $selected_page;
global $selected_post;
global $selected_sideb ar;
if (isset($_GET['p age'])) {
$selected_page = get_page_for_ed iting($_GET['pa ge']);

}
if (isset($_GET['p ost'])) {
$selected_post = get_post_for_ed iting($_GET['po st']);

}
if (isset($_GET['s idebar'])) {
$selected_sideb ar = get_sidebar_for _editing($_GET[ 'sidebar']);

}
}

function display_acquire d_pages()
{
$query = "SELECT * FROM pages ORDER BY position";
$result = mysql_query($qu ery);
confirm_query($ result);
$check = mysql_num_rows( $result);
if ($check != 0) {
echo "<div id=\"aPosi tions\"> ;Already acquired positions." ;;
echo "<ul> ;";
while ($pageList = mysql_fetch_arr ay($result)) {
echo "<li> ;Page : {$pageList['men u_name']} -- Position : {$pageList['pos ition']}</li >\n"; }
echo "</ul&g t;</div>& quot;;

}
}
function display_acquire d_posts()
{
global $selected_page;
global $selected_post;
global $postList;
$query = "SELECT * FROM posts WHERE page_id = '{$selected_pag e['id']}' ORDER BY position";
$result = mysql_query($qu ery);
confirm_query($ result);
$query1 = "SELECT page_id FROM posts WHERE page_id = '{$selected_pag e['id']}' ORDER BY position";
$result1 = mysql_query($qu ery1);
confirm_query($ result1);
$check = mysql_num_rows( $result1);
echo "<div id=\"aPosi tions\"> ;Already acquired positions." ;;
echo "<ul> ;";
if ($check == "" {
echo "<span style=\"co lor: #900; font-weight: normal;\"& gt;No post found under this page. All positions are free to use.</span&g t;";

} else {
while ($postList = mysql_fetch_arr ay($result)) {
echo "<li> ;Post : {$postList['tit le']} -- Position : {$postList['pos ition']}</li >\n"; }
}
echo "</ul&g t;</div>& quot;;

}
function display_msg() {
global $successMSG, $errorMSG, $displayError;< br />
if (!empty($succes sMSG)) {
echo "<div class=\"su ccessMSG\" >" . $successMSG . "</div& gt;";

}
if (!empty($errorM SG)) {
echo "<div class=\"er rorMSG\"&g t;" . $errorMSG . "</div& gt;";

}
echo $displayError;< br />
}

function get_posts_for_s elected_page()< br /> {
global $selected_page;
global $posts;
$query = "SELECT * FROM posts WHERE page_id = '{$selected_pag e['id']}' ORDER BY position";
$result = mysql_query($qu ery);
confirm_query($ result);
$check = mysql_num_rows( $result);
echo "<div id=\"posts Under\"> ;\n";
echo "<h2> ;Posts under this page.</h2> ;\n";
echo "<ul> ;\n";
if ($check != 0) {

while ($posts = mysql_fetch_arr ay($result)) {
echo "<li> ;<a href = \"edit_pos t.php?page=&quo t; . urlencode($sele cted_page['id'] ) .
"&post =" . urlencode($post s['id']) . "\"&g t;<span>& lt;/span>{$p osts['title']}& lt;/a></l i>\n";< br />
}


} else {
echo "No posts posts found under this page.<br/> ;<br/>&qu ot;;
echo "<a href=\"add _post.php?page= " . urlencode($sele cted_page['id'] ) . "\" title=\Add New Post\" target=\"_ self\" class=\"ad dPageButton\&qu ot;>Add New Post</a>& quot;;
}
echo "</ul&g t;\n</div> ;";
}

function get_sidebar_pos ts_for_editing( )
{
global $selected_page;
global $selected_sideb ar;
global $sidebar_post;< br /> $query = "SELECT * FROM sidebar WHERE page_id = '{$selected_pag e['id']}' ORDER BY position";
$result = mysql_query($qu ery);
confirm_query($ result);
$query1 = "SELECT page_id FROM sidebar WHERE page_id = '{$selected_pag e['id']}' ORDER BY position";
$result1 = mysql_query($qu ery1);
confirm_query($ result1);
$check = mysql_num_rows( $result1);
echo "<div id=\"aPosi tions1\"&g t;Posts under this sidebar.";
echo "<ul> ;";
if ($check == "" {
echo "<span style=\"co lor: #900; font-weight: normal;\"& gt;No post found under this page. All positions are free to use.</span&g t;";
} else {
while ($sidebar_post = mysql_fetch_arr ay($result)) {
echo "<li> ;Post Position : {$sidebar_post[ 'position']}< ;a href=\"del ete_sbPost.php? sidebar={$sideb ar_post['id']}\ " class=\"im gLink\"> ;<img src=\"imag es/sidebar_dele te.png\" width=\"16 \" height=\"1 6\" border=\"0 \" onClick=\" return confirm('Are you sure you wann delete this sidebar post. This action can not be undone!.');\&qu ot;/></a& gt;
<a href=\"edi t_sidebar.php?p age=" . urlencode($sele cted_page['id'] ) .
"&side bar=" . urlencode($side bar_post['id']) . "\" class=\"ed Link\"> {$sidebar_post[ 'title']}</a ></li> \n";
}
}


echo "</ul&g t;</div>& quot;;
}

function get_settings()< br /> {
global $settings;
$query = "SELECT * FROM settings";
$result = mysql_query($qu ery);
confirm_query($ result);
$settings = mysql_fetch_arr ay($result);
return $settings;

}

?>
Bold Text Here

Can any one help ???


    Viewed: 6,000 Times | Reply to This | To top
  This user is offline  nightwhisper09
  Subject: " Undefined index: page" Posted: @ 12:54 pm on Oct 31 2009    
Member #: 1076
Rank: User - (2)
Since: 10/30/09
Posts: 2

So Sorry This is the code again


Code:


<?php
function mysql_prep($val ue)
{
$magic_quotes_a ctive = get_magic_quote s_gpc();
$new_enough_php = function_exists ("mysql_r eal_escape_stri ng"; // i.e. PHP >= v4.3.0
if ($new_enough_ph p) { // PHP v4.3.0 or higher
// undo any magic quote effects so mysql_real_esca pe_string can do the work
if ($magic_quotes_ active) {
$value = stripslashes($v alue);
}
$value = mysql_real_esca pe_string($valu e);
} else { // before PHP v4.3.0
// if magic quotes aren't already on then add slashes manually
if (!$magic_quotes _active) {
$value = addslashes($val ue);
}
// if magic quotes are active, then the slashes already exist
}
return $value;
}


function redirect_to($lo cation = null)
{
if ($location != null) {
header("L ocation: $location" ;
exit;

}

}
function confirm_query($ query)
{
if (!$query) {
die("Data base Query failed !. Check Database Settings." ; . mysql_error());

}

}
function get_page_for_ed iting($page_id)
{
$query = " SELECT * FROM pages ";
$query .= " WHERE id =" . $page_id . " ";
$result = mysql_query($qu ery);
confirm_query($ result);
$page = mysql_fetch_arr ay($result);
return $page;

}

function get_post_for_ed iting($post_id)
{
$query = " SELECT * FROM posts ";
$query .= " WHERE id =" . $post_id . " ";
$result = mysql_query($qu ery);
confirm_query($ result);
$post = mysql_fetch_arr ay($result);
return $post;

}
function get_sidebar_for _editing($sideb ar_id)
{
$query = " SELECT * FROM sidebar ";
$query .= " WHERE id =" . $sidebar_id . " ";
$result = mysql_query($qu ery);
confirm_query($ result);
$sidebar = mysql_fetch_arr ay($result);
return $sidebar;

}
function selected_page()
{
global $selected_page;
global $selected_post;
global $selected_sideb ar;
if (isset($_GET[' page'])) {
$selected_page = get_page_for_ed iting($_GET['p age']);

}
if (isset($_GET[' post'])) {
$selected_post = get_post_for_ed iting($_GET['p ost']);

}
if (isset($_GET[' sidebar'])) {
$selected_sideb ar = get_sidebar_for _editing($_GET[ 'sidebar']);

}
}

function display_acquire d_pages()
{
$query = "SELECT * FROM pages ORDER BY position" ;
$result = mysql_query($qu ery);
confirm_query($ result);
$check = mysql_num_rows( $result);
if ($check != 0) {
echo "<div id=\"aPo sitions\" ;>Already acquired positions.&quo t;;
echo "<ul&g t;";
while ($pageList = mysql_fetch_arr ay($result)) {
echo "<li&g t;Page : {$pageList['me nu_name']} -- Position : {$pageList['po sition']}</ li>\n" ;;
}
echo "</ul& gt;</div> ";

}
}
function display_acquire d_posts()
{
global $selected_page;
global $selected_post;
global $postList;
$query = "SELECT * FROM posts WHERE page_id = '{$selected_pa ge['id']}' ORDER BY position" ;
$result = mysql_query($qu ery);
confirm_query($ result);
$query1 = "SELECT page_id FROM posts WHERE page_id = '{$selected_pa ge['id']}' ORDER BY position" ;
$result1 = mysql_query($qu ery1);
confirm_query($ result1);
$check = mysql_num_rows( $result1);
echo "<div id=\"aPo sitions\" ;>Already acquired positions.&quo t;;
echo "<ul&g t;";
if ($check == "" {
echo "<span style=\" color: #900; font-weight: normal;\" ;>No post found under this page. All positions are free to use.</span&g t;";

} else {
while ($postList = mysql_fetch_arr ay($result)) {
echo "<li&g t;Post : {$postList['ti tle']} -- Position : {$postList['po sition']}</ li>\n" ;;
}
}
echo "</ul& gt;</div> ";

}
function display_msg()
{
global $successMSG, $errorMSG, $displayError;

if (!empty($succes sMSG)) {
echo "<div class=\" successMSG\&q uot;>" . $successMSG . "</div >";

}
if (!empty($errorM SG)) {
echo "<div class=\" errorMSG\&quo t;>" . $errorMSG . "</div >";

}
echo $displayError;

}

function get_posts_for_s elected_page()
{
global $selected_page;
global $posts;
$query = "SELECT * FROM posts WHERE page_id = '{$selected_pa ge['id']}' ORDER BY position" ;
$result = mysql_query($qu ery);
confirm_query($ result);
$check = mysql_num_rows( $result);
echo "<div id=\"pos tsUnder\" ;>\n" ;
echo "<h2&g t;Posts under this page.</h2> ;\n";
echo "<ul&g t;\n";
if ($check != 0) {

while ($posts = mysql_fetch_arr ay($result)) {
echo "<li&g t;<a href = \"edit_p ost.php?page=& quot; . urlencode($sele cted_page['id ']) .
"&pos t=" . urlencode($post s['id']) . "\" ;><span&g t;</span> {$posts['title ']}</a>& lt;/li>\n& quot;;

}


} else {
echo "No posts posts found under this page.<br/> ;<br/>&q uot;;
echo "<a href=\"a dd_post.php?pag e=" . urlencode($sele cted_page['id ']) . "\" ; title=\Add New Post\" target=\" ;_self\" class=\" addPageButton\ ">Add New Post</a> ";
}
echo "</ul& gt;\n</div& gt;";
}

function get_sidebar_pos ts_for_editing( )
{
global $selected_page;
global $selected_sideb ar;
global $sidebar_post;
$query = "SELECT * FROM sidebar WHERE page_id = '{$selected_pa ge['id']}' ORDER BY position" ;
$result = mysql_query($qu ery);
confirm_query($ result);
$query1 = "SELECT page_id FROM sidebar WHERE page_id = '{$selected_pa ge['id']}' ORDER BY position" ;
$result1 = mysql_query($qu ery1);
confirm_query($ result1);
$check = mysql_num_rows( $result1);
echo "<div id=\"aPo sitions1\&quo t;>Posts under this sidebar." ;
echo "<ul&g t;";
if ($check == "" {
echo "<span style=\" color: #900; font-weight: normal;\" ;>No post found under this page. All positions are free to use.</span&g t;";
} else {
while ($sidebar_post = mysql_fetch_arr ay($result)) {
echo "<li&g t;Post Position : {$sidebar_post[ 'position']}& lt;a href=\"d elete_sbPost.ph p?sidebar={$sid ebar_post['id ']}\" class=\" imgLink\" ;><img src=\"im ages/sidebar_de lete.png\&quo t; width=\" 16\" height=\" ;16\" border=\" ;0\" onClick=\&quo t;return confirm('Are you sure you wann delete this sidebar post. This action can not be undone!.');\ "/>< /a>
<a href=\"e dit_sidebar.php ?page=" . urlencode($sele cted_page['id ']) .
"&sid ebar=" . urlencode($side bar_post['id' ]) . "\" ; class=\" edLink\" >{$sidebar_p ost['title']} </a></ li>\n" ;;
}
}


echo "</ul& gt;</div> ";
}

function get_settings()
{
global $settings;
$query = "SELECT * FROM settings" ;
$result = mysql_query($qu ery);
confirm_query($ result);
$settings = mysql_fetch_arr ay($result);
return $settings;

}

?>



Edited at 07:56:38 pm on 10/31/09

    Viewed: 5,993 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: Undefined index: page" Posted: @ 8:02 pm on Oct 31 2009    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

I found this link: Undefined index which may help. One thing you might also look into is to ensure the version of PHP installed on your server is compatible with the version of PHP this script is designed for. If the script uses some syntax from a new version of PHP and you're running an old version, you may get weird errors like this. But I have not dealt with this error before so anyone else feel free to provide some input. Thanks




-bs0d | AllSyntax.com

    Viewed: 5,979 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank