Mystical Posted May 6, 2011 Share Posted May 6, 2011 Something in preferences.php is not working. v2.03 I did a fresh install and when I try to change the user display pic I get this error. Forbidden You don't have permission to access /preferences.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Not an htaccess problem either. The same for forum display pic.... Any help would be appreciated. Been here all morning trying to figure it out with no luck. Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted May 6, 2011 Share Posted May 6, 2011 (edited) change your permission to the file to 644 your directory to your display pics should be 755 Edited May 6, 2011 by lucky3809 Quote Link to comment Share on other sites More sharing options...
Mystical Posted May 6, 2011 Author Share Posted May 6, 2011 (edited) change your permission to the file to 644 your directory to your display pics should be 755 Permission to file is set at 644 and there is no directory to display pics as they are externally hosted. File in question. <?php include_once "globals.php"; switch($_GET['action']) { case 'sexchange2': do_sex_change(); break; case 'sexchange': conf_sex_change(); break; case 'passchange2': do_pass_change(); break; case 'passchange': pass_change(); break; case 'namechange2': do_name_change(); break; case 'namechange': name_change(); break; case 'picchange2': do_pic_change(); break; case 'picchange': pic_change(); break; case 'forumchange2': do_forum_change(); break; case 'forumchange': forum_change(); break; default: prefs_home(); break; } function prefs_home() { global $db,$ir,$c,$userid,$h; echo " <h3>Preferences</h3> <a href='preferences.php?action=sexchange'>Sex Change</a><br /> <a href='preferences.php?action=passchange'>Password Change</a><br /> <a href='preferences.php?action=namechange'>Name Change</a><br /> <a href='preferences.php?action=picchange'>Display Pic Change</a><br /> <a href='preferences.php?action=forumchange'>Forum Info Change</a><br /> "; } function conf_sex_change() { global $ir,$c,$userid,$h; if($ir['gender'] == "Male") { $g="Female"; } else { $g="Male"; } echo " Are you sure you want to become a $g? <br /> <a href='preferences.php?action=sexchange2'>Yes</a> | <a href='preferences.php'>No</a> "; } function do_sex_change() { global $db,$ir,$c,$userid,$h; $g = ($ir['gender'] == "Female")?'Male':'Female'; $db->query("UPDATE `users` SET `gender` = '$g' WHERE `userid` = $userid"); echo " Success, you are now $g!<br /> <a href='preferences.php'>Back</a> "; } function pass_change() { global $ir,$c,$userid,$h; echo " <h3>Password Change</h3> <form action='preferences.php?action=passchange2' method='post'> Current Password: <input type='password' name='oldpw' /><br /> New Password: <input type='password' name='newpw' /><br /> Confirm: <input type='password' name='newpw2' /><br /> <input type='submit' value='Change PW' /> </form> "; } function do_pass_change() { global $db,$ir,$c,$userid,$h; if ( md5($_POST['oldpw']) != $ir['userpass'] ) { echo " The current password you entered was wrong.<br /> <a href='preferences.php?action=passchange'>> Back</a> "; } else if ( $_POST['newpw'] !== $_POST['newpw2'] ) { echo "The new passwords you entered did not match!<br /> <a href='preferences.php?action=passchange'>> Back</a>"; } else { $db->query('UPDATE `users` SET `userpass` = "'.md5($_POST['newpw']).'" WHERE `userid` = '.$userid); echo "Password changed!<br />> <a href='preferences.php'>Go Back</a>"; } } function name_change() { global $ir,$c,$userid,$h; echo " <h3>Name Change</h3> Please note that you still use the same name to login, this procedure simply changes the name that is displayed. <form action='preferences.php?action=namechange2' method='post'> New Name: <input type='text' name='newname' /> <br /> <input type='submit' value='Change Name' /> </form> "; } function do_name_change() { global $db,$ir,$c,$userid,$h; $_POST['newname'] = ( isset($_POST['newname']) && is_string($_POST['newname']) ) ? $_POST['newname'] : '' ; if ( empty($_POST['newname']) ) { echo ' You did not enter a new username.<br /> > <a href="preferences.php?action=namechange">Back</a> '; die($h->endpage()); } elseif ( ((strlen($_POST['newname'])>32)OR(strlen($_POST['newname'])<3)) ) { echo ' Usernames can only be a max of 32 characters or a min of 3 characters.<br /> > <a href="preferences.php?action=namechange">Back</a> '; die($h->endpage()); } if ( !preg_match("/^[a-z0-9_]+([\\s]{1}[a-z0-9_]|[a-z0-9_])+$/i", $_POST['newname']) ) { echo ' Your username can only consist of Numbers, Letters, underscores and spaces.<br /> > <a href="preferences.php?action=namechange">Back</a> '; die($h->endpage()); } if ( empty($_POST['newname']) ) { echo ' You did not enter a new name.<br /> > <a href="preferences.php?action=namechange">Back</a> '; } else { $check_ex = $db->query('SELECT `userid` FROM `users` WHERE `username` = "'.$_POST['newname'].'"'); if ( $db->num_rows($check_ex) > 0 ) { echo ' This username is already in use.<br /> > <a href="">Back</a> '; die($h->endpage()); } $_POST['newname'] = addslashes(htmlentities($_POST['newname'], ENT_QUOTES)); $db->query("UPDATE `users` SET `username`='{$_POST['newname']}' WHERE `userid` = $userid"); echo "Username changed!"; } } function pic_change() { global $ir,$c,$userid,$h; echo " <h3>Pic Change</h3> Please note that this must be externally hosted, <a href='http://www.photobucket.com'>Photobucket</a> is our recommendation. <br /> Any images that are not 150x150 will be automatically resized <form action='preferences.php?action=picchange2' method='post'> New Pic: <input type='text' name='newpic' value='{$ir['display_pic']}' /> <br /> <input type='submit' value='Change Picture' /> </form> "; } function do_pic_change() { global $db,$ir,$c,$userid,$h; $_POST['newpic'] = ( isset($_POST['newpic']) && is_string($_POST['newpic']) ) ? $_POST['newpic'] : '' ; if ( empty($_POST['newpic']) ) { echo ' You did not enter a new pic.<br /> > <a href="preferences.php?action=picchange">Back</a> '; } else { $image = (@getimagesize($_POST['newpic'])); if ( !is_array($image) ) { echo 'Invalid Image.<br />> <a href="preferences.php?action=picchange">Go Back</a>'; die($h->endpage()); } echo $_POST['newpic'].'<br />'; $db->query('UPDATE `users` SET `display_pic` = "'.$_POST['newpic'].'" WHERE `userid` = '.$userid); echo 'Pic changed!<br />> <a href="index.php">Go Home</a>'; } } function forum_change() { global $ir,$c,$userid,$h; echo " <h3>Forum Info Change</h3> Please note that the avatar must be externally hosted, <a href='http://www.photobucket.com'>Photobucket</a> is our recommendation. <br /> Any avatars that are not 150x150 will be automatically resized <form action='preferences.php?action=forumchange2' method='post'> Avatar: <input type='text' name='forums_avatar' value='{$ir['forums_avatar']}' /> <br /> Signature (you may use BBcode): <textarea rows=10 cols=50 name='forums_signature'>{$ir['forums_signature']}</textarea> <br /> <input type='submit' value='Change Info' /> </form> "; } function do_forum_change() { global $db,$ir,$c,$userid,$h; $_POST['forums_avatar'] = ( isset($_POST['forums_avatar']) && is_string($_POST['forums_avatar']) ) ? $_POST['forums_avatar'] : '' ; $image = (@getimagesize($_POST['forums_avatar'])); $_POST['forums_signature'] = strip_tags($db->escape($_POST['forums_signature'])); if ( !is_array($image) ) { echo 'Invalid Image.<br />> <a href="preferences.php?action=forumchange">Go Back</a>'; die($h->endpage()); } if ( strlen($_POST['forums_signature']) > 250 ) { echo 'You may only have a forums signature consisting of 250 characters or less.<br />> <a href="preferences.php?action=forumchange">Go Back</a>'; die($h->endpage()); } $db->query("UPDATE `users` SET `forums_avatar` = '{$_POST['forums_avatar']}', `forums_signature` = '{$_POST['forums_signature']}' WHERE `userid` = $userid"); echo 'Forum Info changed!<br />> <a href="index.php">Go Home</a>'; } $h->endpage(); ?> Edited May 6, 2011 by Dominion Code tags added. Quote Link to comment Share on other sites More sharing options...
sniko Posted May 6, 2011 Share Posted May 6, 2011 * Please use code tags for future reference The only things i can think of are; 1) file/links are spelt incorrectly 2) check this link I hope that helps. Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted May 6, 2011 Share Posted May 6, 2011 There is nothing wrong with the preferences.php tested it on my server and did not get the error... perhaps try checking your public_html directory and see what the permission is set to, else contact your web host of your problem, because it has NOTHING to do with your file, if you have it set to 644 already. and your directory is set to 755... Quote Link to comment Share on other sites More sharing options...
Mystical Posted May 7, 2011 Author Share Posted May 7, 2011 There is nothing wrong with the preferences.php tested it on my server and did not get the error... perhaps try checking your public_html directory and see what the permission is set to, else contact your web host of your problem, because it has NOTHING to do with your file, if you have it set to 644 already. and your directory is set to 755... Already contacted my webhost and they say it is not a problem with the server.... All permissions are correct also. I also have a test site on another server and it is the same way which leads me to believe it is a problem somewhere in the script itself. Anyone else have any ideas? Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted May 7, 2011 Share Posted May 7, 2011 Maybe it has something to do with your globals.php? it's not the preferences one...so got to be something that is included in header.. which is globals... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.