plasmagames Posted October 10, 2008 Share Posted October 10, 2008 ok i am makign this php theme system for a user system that my friends made and guess what it's not working. heres the error i get PHP Error Message Warning: rename(../theme/psg,../theme/psg) [function.rename]: No such file or directory in /home/a5880517/public_html/isus/theme.php on line 29 Free Web Hosting Error, the theme directory wasn't changed. and heres my code <?php /* iSuS User System Theme Mod Developed by: plasmagames(http://plasmasteelgames.net) member of iScripting(http://iscripting.net/smf) DO NOT REMOVE THIS */ //If the form hasn't been submitted, show it! if (!$_POST['submit']) { echo "<div class=\"reg\"><div class=\"point\"><img src=\"i/to.png\" alt=\"arrow\"><STRONG>Themes<STRONG></div><form action='index.php?action=theme' method='POST'> <p><strong>Theme:</strong><input class=\"field\" type='text' style width='300' height='500' name='theme' /></p> <input class='submit' type='submit' name='submit' value='Change Themes' /> </form></div> "; } else { //Or else it has.. Secure all the inputs $theme = secure($_POST['theme']); //find the old theme: $select = mysql_query("SELECT * FROM theme WHERE id=1"); //u need a WHERE clause or it won't work and it has to be valid. $row = mysql_fetch_array($select) or die(mysql_error()); //call it $oldtheme $oldtheme = $row['theme']; //Insert the user information into the database $update = "UPDATE theme SET theme = '$theme' WHERE id = 1"; //u need a WHERE clause or it won't work and it has to be valid. $rename = rename("../theme/$oldtheme", "../theme/$theme"); //If the update and rename went ok... if (mysql_query($update) && $rename==true) { //Tell them the good news echo "The theme directory was changed to <br /> <strong>$theme</strong><br />"; } else { echo "Error, the theme directory wasn't changed."; }} ?> now can someone tell me whats going on and how to fix it Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 10, 2008 Share Posted October 10, 2008 Try using an absolute path instead. <?php /* iSuS User System Theme Mod Developed by: plasmagames(http://plasmasteelgames.net) member of iScripting(http://iscripting.net/smf) DO NOT REMOVE THIS */ //If the form hasn't been submitted, show it! if (!$_POST['submit']) { echo "<div class=\"reg\"><div class=\"point\"><img src=\"i/to.png\" alt=\"arrow\"><STRONG>Themes<STRONG></div><form action='index.php?action=theme' method='POST'> <p><strong>Theme:</strong><input class=\"field\" type='text' style width='300' height='500' name='theme' /></p> <input class='submit' type='submit' name='submit' value='Change Themes' /> </form></div> "; } else { //Or else it has.. Secure all the inputs $theme = secure($_POST['theme']); //find the old theme: $select = mysql_query("SELECT * FROM theme WHERE id=1"); //u need a WHERE clause or it won't work and it has to be valid. $row = mysql_fetch_array($select) or die(mysql_error()); //call it $oldtheme $oldtheme = $row['theme']; $theme_dir = $_SERVER['DOCUMENT_ROOT'] . '/theme'; if(file_exists($theme_dir . "/$oldtheme")) { //Insert the user information into the database $update = "UPDATE theme SET theme = '$theme' WHERE id = 1"; //u need a WHERE clause or it won't work and it has to be valid. $rename = rename("$theme_dir/$oldtheme", "$theme_dir/$theme"); //If the update and rename went ok... if (mysql_query($update) && $rename==true) { //Tell them the good news echo "The theme directory was changed to <br /> <strong>$theme</strong><br />"; } else { echo "Error, the theme directory wasn't changed."; } } else { echo "The '$oldtheme' does not exist in $theme_dir"; } } ?> Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 10, 2008 Author Share Posted October 10, 2008 k now i get this error Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/theme/psg) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a5880517/public_html/isus/admin/theme.php on line 32 ok i have the theme.php file in a folder called admin and all my file have to be in a folder that came on the server called public_html Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 10, 2008 Share Posted October 10, 2008 Change $theme_dir = $_SERVER['DOCUMENT_ROOT'] . '/theme'; to $theme_dir = '/home/a5880517/public_html/isus/theme'; $_SERVER['DOCUMENT_ROOT'] should return the path to where you should upload files to. Seems your host has screwed something up. You'll have to hard code the full path instead. Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 10, 2008 Author Share Posted October 10, 2008 ok it chnaging the theme but the images aren't coming up heres one of the pages that has images in it i think i'm doing it right <?php echo ' <img src="$theme_dir/$theme/i/start.png" alt="start" /><a href="index.php"><img src="theme/ $theme_dir/$theme/i/home.png" alt="home" border="0" /></a><img src="theme/ $theme_dir/$theme/i/spacer.png" alt="spacer" /><a href="index.php?action=download"><img src="theme/ $theme_dir/$theme/i/download.png" alt="downloads" border="0" /></a><img src="theme/ $theme_dir/$theme/i/spacer.png" alt="spacer" /><a href="index.php?action=game"><img src="theme/ $theme_dir/$theme/i/game.png" alt="game" border="0" /></a><img src="theme/ $theme_dir/$theme/i/spacer.png" alt="spacer" /><a href="index.php?action=tutorial"><img src="theme/ $theme_dir/$theme/i/tutorial.png" alt="tutorials" border="0" /></a><img src="theme/ $theme_dir/$theme/i/spacer.png" alt="spacer" /><a href="http://forum.plasmasteelgames.net"><img src="theme/ $theme_dir/$theme/i/forum.png" alt="forum" border="0" /></a><img src="theme/ $theme_dir/$theme/i/spacer.png" alt="spacer" /><a href="index.php?action=contact"><img src="theme/ $theme_dir/$theme/i/contact.png" alt="contact" border="0" /></a><img src="t$theme_dir/$theme/i/end.png" alt="send" />'; ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 10, 2008 Share Posted October 10, 2008 Variables do not get parsed within strings which start with single quotes. You should do echo ' <img src="'.$theme_dir.'/'.$theme.'/i/start.png" alt="start" /> <a href="index.php"><img src="'.$theme_dir.'/'.$theme.'/i/home.png" alt="home" border="0" /></a> <img src="'.$theme_dir.'/'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=download"><img src="'.$theme_dir.'/'.$theme.'/i/download.png" alt="downloads" border="0" /></a> <img src="'.$theme_dir.'/'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=game"><img src="'.$theme_dir.'/'.$theme.'/i/game.png" alt="game" border="0" /></a> <img src="'.$theme_dir.'/'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=tutorial"><img src="'.$theme_dir.'/'.$theme.'/i/tutorial.png" alt="tutorials" border="0" /></a> <img src="'.$theme_dir.'/'.$theme.'/i/spacer.png" alt="spacer" /> <a href="http://forum.plasmasteelgames.net"><img src="'.$theme_dir.'/'.$theme.'/i/forum.png" alt="forum" border="0" /></a> <img src="'.$theme_dir.'/'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=contact"><img src="'.$theme_dir.'/'.$theme.'/i/contact.png" alt="contact" border="0" /></a> <img src="'.$theme_dir.'/'.$theme.'/i/end.png" alt="send" />'; Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 10, 2008 Author Share Posted October 10, 2008 ok i just tired to change the theme again and it didn't work i get this error Warning: rename(/home/a5880517/public_html/isus/theme/psg,/home/a5880517/public_html/isus/theme/default) [function.rename]: Permission denied in /home/a5880517/public_html/isus/admin/theme.php on line 36 so i copied the code that was provided before and it still doesn't work heres line 36 $update = "UPDATE theme SET theme = '$theme' WHERE id = 1"; //u need a WHERE clause or it won't work and it has to be valid. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 11, 2008 Share Posted October 11, 2008 You may need to set the appropriate write permissions for the theme/ directory, eg CHMOD 755 should do the trick. Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 11, 2008 Author Share Posted October 11, 2008 it's already CHMOD 755 I'll try 777 Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 11, 2008 Author Share Posted October 11, 2008 tried it and it still doesn't work Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 11, 2008 Author Share Posted October 11, 2008 what else can i try Quote Link to comment Share on other sites More sharing options...
Lamez Posted October 11, 2008 Share Posted October 11, 2008 make a new file and type this in: <?php echo phpinfo(); ?> then post a link to the newly made file, so we can see your configuration settings. Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 11, 2008 Author Share Posted October 11, 2008 ok it's changing the theme now but there this error with pages.php Parse error: parse error, unexpected T_VARIABLE, expecting ',' or ';' in pages.php on line 3 heres the code pages.php <?php echo ' <img src="'$theme'/i/start.png" alt="start" /> <a href="index.php"><img src="'$theme'/i/home.png" alt="home" border="0" /></a> <img src="'$theme'/i/spacer.png" alt="spacer" /> <a href="index.php?action=download"><img src="'$theme'/i/download.png" alt="downloads" border="0" /></a> <img src="'$theme'/i/spacer.png" alt="spacer" /> <a href="index.php?action=game"><img src="'$theme'/i/game.png" alt="game" border="0" /></a> <img src="'$theme'/i/spacer.png" alt="spacer" /> <a href="index.php?action=tutorial"><img src="'$theme'/i/tutorial.png" alt="tutorials" border="0" /></a> <img src="'$theme'/i/spacer.png" alt="spacer" /> <a href="http://forum.plasmasteelgames.net"><img src="'$theme'/i/forum.png" alt="forum" border="0" /></a> <img src="'$theme'/i/spacer.png" alt="spacer" /> <a href="index.php?action=contact"><img src="'$theme'/i/contact.png" alt="contact" border="0" /></a> <img src="'$theme'/i/end.png" alt="send" />'; ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 11, 2008 Share Posted October 11, 2008 You're not concatenating your string properly. change $theme to .$theme. (including the dots) The period is the concatenation operator. Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 11, 2008 Author Share Posted October 11, 2008 ok then how i tried it in the link the .css file and i get this error Parse error: syntax error, unexpected '.' in /home/a5880517/public_html/isus/index.php on line 35 Line 35 <link rel="stylesheet" type="text/css" href="theme/<?php echo .$theme.;?>/visus.css"> Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 11, 2008 Share Posted October 11, 2008 <link rel="stylesheet" type="text/css" href="theme/<?php echo $theme;?>/visus.css"> Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 11, 2008 Author Share Posted October 11, 2008 It's still not loading any images look for urself http://plasmasteelgames.net/isus/ Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 11, 2008 Share Posted October 11, 2008 It's still not loading any images look for urself http://plasmasteelgames.net/isus/ If you check the generated code, you'll see: <link rel="stylesheet" type="text/css" href="theme//visus.css"> That shows clearly that the value of $theme is not present and so is being interpreted as nothing. The problem (still) lies with how you're getting $theme Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 11, 2008 Author Share Posted October 11, 2008 fine then here ll the pages that have something to do with the theme system admin/theme.php <?php /* iSuS User System Theme Mod Developed by: plasmagames(http://plasmasteelgames.net) member of iScripting(http://iscripting.net/smf) DO NOT REMOVE THIS */ //If the form hasn't been submitted, show it! if (!$_POST['submit']) { echo "<div class=\"reg\"><div class=\"point\"><img src=\"i/to.png\" alt=\"arrow\"><STRONG>Themes<STRONG></div><form action='index.php?action=theme' method='POST'> <p><strong>Theme:</strong><input class=\"field\" type='text' style width='300' height='500' name='theme' /></p> <input class='submit' type='submit' name='submit' value='Change Themes' /> </form></div> "; } else { //Or else it has.. Secure all the inputs $theme = secure($_POST['theme']); //find the old theme: $select = mysql_query("SELECT * FROM theme WHERE id=1"); //u need a WHERE clause or it won't work and it has to be valid. $row = mysql_fetch_array($select) or die(mysql_error()); //call it $oldtheme $oldtheme = $row['theme']; $theme_dir = '/home/a5880517/public_html/isus/theme'; if(file_exists($theme_dir . "/$oldtheme")) { //Insert the user information into the database $update = "UPDATE theme SET theme = '$theme' WHERE id = 1"; //u need a WHERE clause or it won't work and it has to be valid. $rename = rename("$theme_dir/$oldtheme", "$theme_dir/$theme"); //If the update and rename went ok... if (mysql_query($update) && $rename==true) { //Tell them the good news echo "The theme directory was changed to <br /> <strong>$theme</strong><br />"; } else { echo "Error, the theme directory wasn't changed."; } } else { echo "The '$oldtheme' does not exist in $theme_dir"; } } ?> Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 12, 2008 Share Posted October 12, 2008 The code from admin/theme.php is irrelevant. We need to see the code from index.php Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 12, 2008 Author Share Posted October 12, 2008 ok index.php has a lot of includes so i will post those to. index.php <?php /* iSuS - iScripting.net User System v1.0 made by Panzer http://www.iScripting.net Copyright must stay intact */ // Get the configuration file $filename = 'defs.php'; $setup = 'install/index.php'; if (!file_exists($filename)) { die("Please install Isus beafore usage! <a href=\"install/\">Click here</A>"); } if (file_exists($setup)) { die("Please remove the install folder beafore usage. It can be harmful to your site if it exists and someone uses it!"); } include ('config.php'); //Set the navigation up, secure it's input. $nav = $_GET['action']; secure($nav); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="generator" content="HTML Tidy for Linux (vers 1 September 2005), see www.w3.org"> <title><?php echo SITE_NAME; ?></title> <link rel="stylesheet" type="text/css" href="theme/<?php echo $theme;?>/visus.css"> <style type="text/css"> div.c1 {text-align: center} </style> </head> <body bgcolor="#FFFFFF"> <p> <div class="c1"> <div class="logo"> <img src="theme/<?php echo $theme;?>/i/logo.png"> </div> <div class="pages"> <?php include ("pages.php"); ?> </div> <div class="Container"> <div class="content" style="width:580"> <?php //Use a switch statement to go through the URLS. switch ($nav) { case "login": include ('login.php'); break; case "logout": include ('logout.php'); break; case "editprofile": include ('editprofile.php'); break; case "memberlist": include ('memberlist.php'); break; case "register": include ('register.php'); break; case "viewterms"; include ('terms.php'); break; case "forgot"; include ('reset_pw.php'); break; case "profile"; include ('profile.php'); break; case "admin"; include ('admin/index.php'); break; case "theme"; include ('admin/theme.php'); break; case "news"; include ('admin/news.php'); break; case "general"; include ('admin/general.php'); break; case "download"; include ('download.php'); break; case "game"; include ('game.php'); break; case "tutorial"; include ('tutorial.php'); break; case "contact"; include ('contact.php'); break; default: include ('default.php'); break; } ?> </div> <div class="sidebar" align="right"> <?php include ('sidebar.php'); ?> </div> </div> <div align="center" class="footer"> <?php include ('footer.php'); ?> </div> </div> </p> </body> </html> pages.php <?php echo ' <img src="'.$theme.'/i/start.png" alt="start" /> <a href="index.php"><img src="'.$theme.'/i/home.png" alt="home" border="0" /></a> <img src="'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=download"><img src="'.$theme.'/i/download.png" alt="downloads" border="0" /></a> <img src="'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=game"><img src="'.$theme.'/i/game.png" alt="game" border="0" /></a> <img src="'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=tutorial"><img src="'.$theme.'/i/tutorial.png" alt="tutorials" border="0" /></a> <img src="'.$theme.'/i/spacer.png" alt="spacer" /> <a href="http://forum.plasmasteelgames.net"><img src="'.$theme.'/i/forum.png" alt="forum" border="0" /></a> <img src="'.$theme.'/i/spacer.png" alt="spacer" /> <a href="index.php?action=contact"><img src="'.$theme.'/i/contact.png" alt="contact" border="0" /></a> <img src="'.$theme.'/i/end.png" alt="send" />'; ?> sidebar.php <?php // Isus 1.1b Copyright must stay in tack // coded by klatz //http://iscripting.net if ($uId) { if ($uCan) echo "Hey! <STRONG>$uName</STRONG>"; // helo member! echo '<p>'; echo '<strong>User Menu</strong>'; echo '<br>'; echo '<br>'; echo "<a href=\"index.php?action=editprofile\">Edit Profile</a> <br>"; echo "<a href=\"index.php?action=memberlist\">View Members</a> <br>"; echo "<a href=\"index.php?action=logout\">Logout</a> <br>"; echo '</p>'; echo "<BR>"; if ($admin = 'admin') echo '<strong>Admin</strong>'; echo '<br />'; echo '<br />'; echo '<a href="index.php?action=theme">Change Theme</a> <br>'; echo '<a href="index.php?action=news">Edit News</a> <br>'; echo '<a href="index.php?action=general">General Settings</a> <br>'; } else { // if this isn't a member then echo "<br>"; include ('login.php'); echo "Welcome, <STRONG>$uName</STRONG>!"; echo '<p>'; echo "<br>"; echo "<a href=\"index.php?action=login\">Login</a>"; echo "<br>"; echo "<a href=\"index.php?action=register\">Sign up</a>"; echo '</p>'; } echo "<BR>"; //break echo "<BR>"; // break echo '<img src="theme/'.$theme.'/i/blah.png" alt=\"Bubble\"><STRONG>Partners</STRONG>'; // to enable please remvoe the comments // include('partners.php'); ?> and then there an include in sidebar.php partners.php <br /> <br /> <a href="http://iscripting.net">iScripting</a><br /> <a href="http://iscripting.net/beta/">iScripting Beta</a><br /> <a href="http://recondev.net">Recon Development</a><br /> <a href="http://gamerdistrict.net">Gamer District</a><br /> <a href="http://iptbb.org">IPTBB</a><br /> <a href="http://http://www.mozilla.com/en-US/firefox/"><img src="theme/<?php echo $theme;?>/i/firefox3.png" border="0" alt="FireFox 3"/></a><br /> Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 12, 2008 Share Posted October 12, 2008 And how does index.php acquire the value of $theme? Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 12, 2008 Share Posted October 12, 2008 Seems the top of index.php should be: <?php /* iSuS - iScripting.net User System v1.0 made by Panzer http://www.iScripting.net Copyright must stay intact */ // Get the configuration file $filename = 'defs.php'; $setup = 'install/index.php'; if (!file_exists($filename)) { die("Please install Isus beafore usage! <a href=\"install/\">Click here</A>"); } if (file_exists($setup)) { die("Please remove the install folder beafore usage. It can be harmful to your site if it exists and someone uses it!"); } include ('config.php'); // get the theme $result = mysql_query("SELECT theme FROM theme WHERE id=1"); $theme = mysql_result($result, 0); //Set the navigation up, secure it's input. $nav = $_GET['action']; secure($nav); ?> rest of your code here Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 12, 2008 Author Share Posted October 12, 2008 that work! but there's one problem the navbar(pages.php) isn't loading Quote Link to comment Share on other sites More sharing options...
plasmagames Posted October 12, 2008 Author Share Posted October 12, 2008 ok nvm i got it fixed Problem solved 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.