Jump to content

php5 problem


phpsycho

Recommended Posts

I am setting up php5 on ubuntu 10.10

I can visit pages but they come up with errors

 

Notice: Undefined index: id in /var/www/alphawebpro.com/htdocs/index.php on line 5 Notice: Undefined index: action in /var/www/alphawebpro.com/htdocs/index.php on line 9 Warning: include(/var/www/alphawebpro.com/htdocs/home.php): failed to open stream: Permission denied in /var/www/alphawebpro.com/htdocs/index.php on line 105 Warning: include(): Failed opening 'home.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/alphawebpro.com/htdocs/index.php on line 105 

 

Any idea as to how I fix this?

Link to comment
https://forums.phpfreaks.com/topic/233301-php5-problem/
Share on other sites

These are notices (that you should fix). Basically, you're trying to access an array element via an array index that hasn't been created yet.

 

For example, if the array index 'name' hasn't been set yet and I try to do this:

 

echo $myarray['name'];

 

... I'd also get a nasty notice message.

Link to comment
https://forums.phpfreaks.com/topic/233301-php5-problem/#findComment-1199789
Share on other sites

Well it does it on any file you open, but here is the index file that I gave you the error to..

 

<?php

include ('conn.php');

session_start();



if($_SESSION['id']){

mysql_query("UPDATE users SET status=unix_timestamp() WHERE id='{$_SESSION['suserid']}'");

}



switch($_GET['action']){



case 'tos':

include ('pages/tos.php');

break;



case 'forgotpass':

include ('pages/forgot_pass.php');

break;



case 'forum':

include ('pages/forum.php');

break;



case 'contact':

include ('pages/contact.php');

break;



case 'image':

include ('pages/image.php');

break;



case 'topic':

include ('pages/topic.php');

break;



case 'posttopic':

include ('pages/posttopic.php');

break;



case 'profile':

include ('pages/profile.php');

break;



case 'board':

include ('pages/board.php');

break;



case 'privacy':

include ('pages/privacy.php');

break;



case 'login':

include ('pages/login.php');

break;



case 'logout':

include ('pages/logout.php');

break;



case 'signup':

include ('pages/signup.php');

break;



case 'activate':

include ('pages/activate.php');

break;



case 'browsebooks':

include ('pages/browsebooks.php');

break;



case 'browseimages':

include ('pages/browseimages.php');

break;



case 'browsebbooks':

include ('pages/browsebbooks.php');

break;



case 'browsescripts':

include ('pages/browsescripts.php');

break;



case 'browsebtemplates':

include ('pages/browsebtemplates.php');

break;



case 'usertopics':

include ('pages/browseusertopics.php');

break;





case 'browsetemplates':

include ('pages/browsetemplates.php');

break;



case 'members':

include ('pages/members.php');

break;



case 'product':

include ('product.php');

break;



default: 

include ('home.php');

break;

}



?>

 

I have no idea what to change...

Link to comment
https://forums.phpfreaks.com/topic/233301-php5-problem/#findComment-1199792
Share on other sites

Here you have:

<?php
if($_SESSION['id']){
    mysql_query("UPDATE users SET status=unix_timestamp() WHERE id='{$_SESSION['suserid']}'");
}
?>

You should be checking whether $_SESSION['id'] exists before using it. You should also be checking whether $_SESSION['suserid'] exists.

<?php
if (isset($_SESSION['id']) && isset($_SESSION['suserid'])) {
    mysql_query("UPDATE users SET status=unix_timestamp() WHERE id='{$_SESSION['suserid']}'");
}
?>

 

Similar is other areas.

 

Ken

 

Link to comment
https://forums.phpfreaks.com/topic/233301-php5-problem/#findComment-1199799
Share on other sites

Aside from all the notices, there's this:

Warning: include(includes/rating_functions.php): failed to open stream: Permission denied in /var/www/alphawebpro.com/htdocs/header.php on line 19

Warning: include(): Failed opening 'includes/rating_functions.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/alphawebpro.com/htdocs/header.php on line 19

Check the permissions on your php files, specifically includes/rating_functions.php. There's also a lot more code to change than just the code Ken gave you. That was just an example of what needs to done throughout all your code.

Link to comment
https://forums.phpfreaks.com/topic/233301-php5-problem/#findComment-1199811
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.