Jump to content

damion

Members
  • Posts

    47
  • Joined

  • Last visited

Everything posted by damion

  1. Thanks. Adding those lines do not do anything. It might be because the pages are flash and cannot display them, I'm not sure. But with or without those lines inside the files, I get an internal server error when I try to load them in my browser directly. Here is my error log, hopefully there are clues here? [Thu Feb 23 21:23:21 2012] [error] [client xxx.xxx.xxx.xxx] File does not exist: /home/me/public_html/500.shtml [Thu Feb 23 21:23:21 2012] [alert] [client xxx.xxx.xxx.xxx] /home/me/public_html/mysite/php/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
  2. I have 2 pages in my flash site that call some PHP files. The pages are a feedback page and a locator page. When my server went from PHP4 to PHP5 both pages stopped displaying the content. When I load the flash pages with Fiddler open, fiddler shows a 500 error on the PHP files that the flash is calling. I'm certain my database connections are good, file paths have not changed since the server maintenance, and I have .htaccess files except they are blank. Can anyone advise what I can do to find where the problem is? I have the PHP code below that showed the 500 errors. Any help would be really appreciated. This is the locator page: <?php include_once('db_connect.inc.php'); $query = "SELECT state FROM stores group BY state ORDER BY state"; $result = mysql_query($query); if(mysql_num_rows($result)==NULL){ $r_string = '&error=1&msg=No Records Found.'; }else{ $r_string = '&error=0&n='.mysql_num_rows($result) . '&r_states='; $i = 0; $r=''; while ($row = mysql_fetch_assoc($result)) { if($r!='') $r .= '||'; $r .= $row['state']; $i++; } $r_string .= $r; // add extra & to prevent returning extra chars at the end $r_string .='&'; } echo $r_string; ?> This is the feedback page: <?php include_once('inc/feedbackconn.inc.php'); echo '&rsult='; $query = "SELECT * FROM messages where active!=0"; $result = mysql_query($query); $num = @mysql_num_rows($result); $cfeed=$_POST['sFeed']; $cfeed--; $query = "SELECT * FROM messages where active='1' ORDER BY id LIMIT " . $cfeed . ',1'; $result = mysql_query($query); //$row = mysql_fetch_array($result); if($num==NULL){ echo "No Records."; exit(); } while($row = @mysql_fetch_array($result)){ $b_name = stripslashes($row[strName]); $b_loc = stripslashes($row[strLocation]); $b_mes = stripslashes($row[strMessage]); $b_id = $row[id]; $b_active = $row[active]; $feedArray[] = array("name"=>$b_name,"location"=>$b_loc,"feedback"=>$b_mes,"id"=>$b_id,"active"=>$b_active); } /* /////////////// DISPLAY THE RECORDS ///////////////// */ $numOfMessages = sizeOf($feedArray); for($i=0;$i<$numOfMessages;$i++){ //------------------------------------------------------------------ //echo $feedArray[$i]['id']."<br>\n"; echo '<b><i>' . $feedArray[$i]['feedback']."</i><br><br>"; echo $feedArray[$i]['name']."<br>"; echo $feedArray[$i]['location']."</b>"; //--------------------------------------------------------------------- } echo '&tFeeds=' . $num; echo '&cFeed=' . $_POST['sFeed']; ?>
  3. I'm trying to redirect a web site to a different domain. For some reason, the URL that I put inside the htaccess for the new domain is altered when I try to go to the old domain. It changes the new domain's URL when loaded in the browser from this: http://www.newdomain.com/gdProfile.php?clientID=23 To this which is incorrect: http://www.newdomain.com/index.php?clientID=noneOrNAN I've tried the hosts cpanel redirect feature, and manually edited the .htaccess file, and both give the same results. Here is what I used for the manual editing of the htaccess.. Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/gdProfile.php?clientID=23/$1 [R=301,L] There is nothing else in the .htaccess file. What on earth is causing this?? Thanks!
  4. Wow, I totally blew that one. I did not see the two $msg variables in the code where I could add the style rules to each case. Now I see why you guys were pushing the CSS Thank you for your help! Time to go back to sleep..
  5. Hi cssfreakie. Yes, I totally understood what Mikesta explained about the styling of the text. For me that's the easy part, and apologies if that was confused with what I really needed - the PHP code. Although I appreciate your help, my situation does not test for a static value. So I need to somehow test what already exists in the database. And sorry for all the superfluous code. I'm a little hesitant to assume that I know enough to trim down to the relevant code, but I will try here if it helps to get a solution. <?php //show page only if admin access level if($level=="admin"){ //request all neccessary variables for extensions action. $name = (!empty($_REQUEST["name"]))?strip_tags(str_replace("'","`",$_REQUEST["name"])):''; //"create new folder" action processing. if(!empty($_REQUEST["add_folder"]) && $_REQUEST["add_folder"]=="yes" && !empty($name)){ //check for existing user in DB. $name = strtolower(trim($name)); $sql="SELECT * FROM folders WHERE name='".$name."'"; $result=mysql_query($sql) or die("error selecting folder from database for comparison"); if(mysql_num_rows($result)>0){ $msg = "Folder already exists in database. Try another one."; } else { if(!empty($name)){ //also create mkdir folder in script base, and make it writable $thisdir = getcwd(); @mkdir($thisdir ."/".$name , 0777); //chmod($script_dir.$name, 777); $sql="INSERT INTO folders (dateCreated,name) VALUES (NOW(),'".$name."')"; $result=mysql_query($sql) or die("error occured when tryin to insert new folder."); $msg = "Folder was successfully added!"; addLog($_SESSION["idUser"],"Added new folder $name"); //} $name=""; } } ?> I hope that helps, thanks.
  6. Thanks mikesta707. Here is the code on the page that allows the admin to create folders. I hope this is enough and then I can hopefully understand what you did enough to apply it to my other forms. <?php session_start(); require_once("includes/dbconnect.php"); //Load the settings require_once("includes/functions.php"); //Load the functions $msg=""; if($_SESSION["logged_in"]!=true){ header("Location: index.php"); } else { //get access level if(isset($_SESSION["accesslevel"])){ $access = $_SESSION["accesslevel"]; //determin admin or not. if(stristr($access,"abcdef")){ $level="admin"; }else{ $level="user"; } } else { header("Location: index.php"); } //paging settings // how many rows to show per page $rowsPerPage = 14; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } $offset = ($pageNum - 1) * $rowsPerPage; //CREATE PAGING LINKS // how many rows we have in database $query = "SELECT COUNT(id) AS numrows FROM folders WHERE '1' "; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum){ $nav .= " $page "; // no need to create a link to current page } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1){ $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">Prev</a> "; $first = " <a href=\"$self?page=1\">1st Page</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = ' '; // nor the first page link } if ($pageNum < $maxPage){ $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">Next</a> "; $last = " <a href=\"$self?page=$maxPage\">Last</a> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' '; // nor the last page link } //show page only if admin access level if($level=="admin"){ //request all neccessary variables for extensions action. $name = (!empty($_REQUEST["name"]))?strip_tags(str_replace("'","`",$_REQUEST["name"])):''; //"create new folder" action processing. if(!empty($_REQUEST["add_folder"]) && $_REQUEST["add_folder"]=="yes" && !empty($name)){ //check for existing user in DB. $name = strtolower(trim($name)); $sql="SELECT * FROM folders WHERE name='".$name."'"; $result=mysql_query($sql) or die("error selecting folder from database for comparison"); if(mysql_num_rows($result)>0){ $msg = "Folder already exists in database. Try another one."; } else { if(!empty($name)){ //also create mkdir folder in script base, and make it writable $thisdir = getcwd(); @mkdir($thisdir ."/".$name , 0777); //chmod($script_dir.$name, 777); $sql="INSERT INTO folders (dateCreated,name) VALUES (NOW(),'".$name."')"; $result=mysql_query($sql) or die("error occured when tryin to insert new folder."); $msg = "Folder was successfully added!"; addLog($_SESSION["idUser"],"Added new folder $name"); //} $name=""; } } } //"delete selected folders" action processing. if(!empty($_REQUEST["folders_delete"]) && $_REQUEST["folders_delete"]=="yes"){ if(is_array($_POST['extToDel'])){ if(join(",", $_POST['extToDel'])!='') { //update all users who currently has folder which we are going to delete. for($i=0;$i<count($_POST["extToDel"]);$i++){ if($_POST["extToDel"][$i]!="uploads"){ $query="UPDATE users SET upload_dir='uploads' WHERE upload_dir='".$rr["name"]."' "; $result=mysql_query($query); //remove folder from server if it is empty if (!is_dir($script_dir.$_POST["extToDel"][$i])) { $thisdir = getcwd(); if(@rmdir($thisdir."/".$_POST["extToDel"][$i])){ $msg .= "Directory '".$script_dir.$_POST["extToDel"][$i]."' was successfully deleted.<br/>"; $sql="DELETE FROM folders WHERE name='".$_POST['extToDel'][$i]."'"; $result=mysql_query($sql) or die("error when tryin to delete folders"); addLog($_SESSION["idUser"],"Deleted ".$script_dir.$_POST['extToDel'][$i]." folder."); } else { $msg .= "Directory '".$script_dir.$_POST["extToDel"][$i]."' is not empty! Please delete files associated with this directory first.<br/>"; } } } } } } } //CREATE folders TABLE $folder_table=""; $bgClass="even"; $sql="SELECT * FROM folders ORDER BY name ASC LIMIT ".$offset.", ".$rowsPerPage; $result=mysql_query($sql) or die("error getting folders from db"); if(mysql_num_rows($result)>0){ while($rr=mysql_fetch_assoc($result)){ $bgClass=($bgClass=="even"?"odd":"even"); $folder_table.="<tr class=\"".$bgClass."\">"; if($rr["id"]!="1"){ $folder_table.="<td><input name=\"extToDel[]\" type=\"checkbox\" value=\"".$rr["name"]."\" /></td>"; } else { $folder_table.="<td> </td>"; } $folder_table.="<td height=\"24\">".$rr["name"]."</td>"; $folder_table.="<td>".date("d M Y, H:i",strtotime($rr["dateCreated"]))."</td>"; $folder_table.="<td> </td>"; $folder_table.="</tr>"; } $folder_table.="<tr>"; $folder_table.="<td height=\"32\" colspan=\"7\"><input name=\"delete_users\" type=\"submit\" value=\"Delete Selected\" /></td>"; $folder_table.="</tr>"; } else { $folder_table.="<tr><td colspan=\"7\">0 folders found in database</td></tr>"; } ?> The form: <div class="form_block"> <h2>Add New Folder</h2> <strong><?php echo $msg; ?></strong> <form action="folders.php" enctype="multipart/form-data" method="post" name="ff1"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="152" height="25" align="right">Folder Name:</td> <td width="632" height="23"><input name="name" type="text" id="name" size="10" /> </td> </tr> <tr> <td height="25" align="right"> </td> <td height="32"> <input type="submit" name="create" id="create" value="Add Folder" /> <input value="yes" name="add_folder" type="hidden" /> </td> </tr> </table> </form> </div>
  7. Is there a simple bit of code that I can use to show for example green font "Success" or red font "Fail" on a form? I have several forms in my application that has file uploads, create user, create folder, and so on. I'm hoping there is a simple few lines I can add to these forms without being too intrusive. I'm wondering maybe the easiest would be if the data is stored in the database show green, if not show red?
×
×
  • 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.