Jump to content

White_Lily

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by White_Lily

  1. Sorry for all the problems im having im not entirly sure why of all them are occuring since the majority are things i have done in the past. Anyway - to the point of this new problem, i have created a user profile where the user can have a profile banner and an avatar, however the banner shows the default image even if there is an image in the database. here's the profile php code: <?php if(!$loggedUser && !$loggedPass){ echo '<div class="navigation">'; $nav = select("*", "pages", NULL, "pageType ASC"); $num = mysql_num_rows($nav); if($num != 0){ echo "<ul>"; while($get = mysql_fetch_assoc($nav)){ $filename = file_exists($_SERVER['DOCUMENT_ROOT'].$get["pageFileName"]); if($get["pageType"] <= 2 && $get["active"] == 1){ if($filename){ echo "<li><a href='".$GLOBALS["siteUrl"]."/".$get["pageFileName"]."'>".$get["pageName"]."</a></li>"; } } } echo "</ul>"; }else{ echo "No menu found."; } echo '</div>'; echo '<div class="content">'; echo '<h1>Welcome</h1>'; echo '<h3>Login</h3>'; include "inc/loginCheck.php"; echo '<form action="" method="POST">'; echo '<label>Username:</label><input type="text" name="username" />'; echo '<label>Password:</label><input type="password" name="password" />'; echo '<input type="submit" name="submit" value="Login" />'; echo '</form>'; echo '</div>'; }else{ echo '<div class="navigation">'; $nav = select("*", "pages", NULL, "pageType ASC"); $num = mysql_num_rows($nav); if($num != 0){ echo "<ul>"; while($get = mysql_fetch_assoc($nav)){ $filename = file_exists($_SERVER['DOCUMENT_ROOT'].$get["pageFileName"]); if($get["pageType"] > 0 && $get["active"] == 1){ if($filename){ $convertLink = str_replace("Home", "Profile", $get["pageName"]); echo "<li><a href='".$GLOBALS["siteUrl"]."/".$get["pageFileName"]."'>".$convertLink."</a></li>"; } }else{ echo "<li>No active navigation.</li>"; } } echo "<li><a href='logout.php'>Logout</a></li>"; echo "</ul>"; }else{ echo "No menu found."; } echo '</div>'; echo "<div class='banner'>"; echo "<div class='bannerImage'>"; $banner = getbanner("lightbox"); echo $banner; echo "</div>"; echo "</div>"; echo '<div class="content">'; echo "<div class='userDetails'>"; echo "<div class='avatarUser'>"; echo "</div>"; echo "<div class='accountDetails'>"; echo '<h1>'.$loggedUser."'s ".$page.'</h1>'; echo "</div>"; echo "</div>"; include "inc/profile.php"; echo '</div>'; } ?> and here is the funtion that the banner calls once the user has logged in: <?php //Banner Image(s) function getBanner($rel){ $query = select("*", "users", "username = '$loggedUser'"); $fetch = mysql_fetch_assoc($query); $bannerImg = $fetch["bannerImage"]; $link = "<a href='".$GLOBALS["siteUrl"]."/images/banners/".$bannerImg."' rel='".$rel."'>"; $Img = "<img src='".$GLOBALS["siteUrl"]."/images/banners/".$bannerImg."' />"; $close = "</a>"; $default = "<img src='".$GLOBALS["defaultImage"]."' />"; $acutalImg = $link.$Img.$close; if($actualImg){ return $actualImg; }else{ return $default; } } ?>
  2. O_O Didn't know that sort of if statment was possible. However it did work Barand, thank you. *Notes that one down*
  3. print_r($newVar); outputs: Resource id #7
  4. No difference. Im not sure where the problem is :/
  5. <?php /*************************** *Select data from database ***************************/ function select($amount = "*", $table, $where = NULL, $order = NULL, $limit = NULL){ $query = "SELECT ".$amount." FROM ".$table; if($where != NULL){ $query .= " WHERE ".$where; } if($order != NULL){ $query .= " ORDER BY ".$order; } if($limit != NULL){ $query .= " LIMIT ".$limit; } $result = mysql_query($query); if($result){ return $result; }else{ return false; } } ?> Not sure the error is in this function as all the other pages using this function are working properly.
  6. i changed one of the pages to type 11, and it was still being displayed
  7. Nothing changes... it then displaying all types, same as "1 or 4" displays 2 and 3 as well. "2 or 3" displays 1 and 4 as well as 2 and 3
  8. What christian said is what my old CMS was, i had two tables, one for pages/products and another for related pages/products, i do suggest this option as it has worked for me for a very ong time and no-one has complained of it yet
  9. Hi, I am currently developing a cms where people can edit their site however they please. I have just a small problem, within the database the table "pages" has a column named "pageType" the types range from 1-4. in my CMS i have a while that is supposed to check if the pageType is equal to 1 or 4, however my problem is, is its displaying pages that have a type that equals 2, which isnt supposed to happen. <?php echo "<h2>Default Pages</h2>"; $newVar = select("*", "pages", "pageType = 1 OR 4"); $num = mysql_num_rows($newVar); if($num != 0){ while($fetch = mysql_fetch_assoc($newVar)){ if($fetch["pageType"] == 1 OR 4){ if($fetch["active"] == 1){ echo "<div class='active'><img src='images/tick.png' /><a href='edit/edit-default-pages.php?name=".$fetch["name"]."'>".$fetch["name"]."</a></div>"; }else{ echo "<div class='non-active'><img src='images/cross.png' /><a href='edit/edit-default-pages.php?name=".$fetch["name"]."'>".$fetch["name"]."</a></div>"; } } } }else{ echo "<p>No Default Pages found.</p>"; } ?> The page can be seen at: http://www.janedealsart.co.uk/template/cms/
  10. So basically you want something more or less along the lines of a related products/pages box?
  11. just curious, why do you have page.title, etc outside of the php tags?
  12. If you decide to go with the cookie suggestion, read up on cookie laws - you will have to include somewhere on your page that you use cookies, also specify what the cookie(s) is and are doing.
  13. An example loop that im using on a cms im developing at the moment would be: <?php echo "<ul>"; $mainNav = select("*", "pages"); $Nav = $mainNav; while($fetch = mysql_fetch_assoc($Nav)){ $path = $GLOBALS["siteUrl"]."/template/".$fetch["pageLink"]; if($fetch["active"] == 1 && $fetch["pageType"] == 1){ echo "<li><a href='".$path."'>".$fetch["name"]."</a></li>"; } if($fetch["active"] == 1 && $fetch["pageType"] == 2){ echo "<li><a href='".$GLOBALS["siteUrl"]."/template/page.php?name=".$fetch["name"]."'>".$fetch["name"]."</a></li>"; } if($fetch["active"] == 1 && $fetch["pageType"] == 4){ echo "<li><a href='".$path."'>".$fetch["name"]."</a></li>"; } } echo "</ul>"; ?>
  14. What he is saying is, rather than comparing them through ',' try using a while loop to grab all the domains from the database, and loop them through a table row or a div.
  15. then in such case where you want their name/username to appear you need something along the lines of this: echo "<p>".$_SESSION["username"]."</p>";
  16. simple, go into your MySQL database, add a column at the beggining of your requested table, name it "UserID" or whatever. Then all you have to do is add this to your sessions: $id = $_SESSION["UserID"]; Create the column with an index of "PRIMARY" and A-I to "Yes" (or in my case just click the small box).
  17. Try changing $target = "path"; to $target = $_SERVER["DOCUMENT_ROOT"]."path";
  18. Okay, so ive just tried using $_SERVER["DOCUMENT_ROOT"]; and it works! thanks guys for all the help
  19. Okay so getting anything from the URL you should have right at the very top of your page (before <doctype>) you need: $Url = $_GET["id"]; /*or whatever you getting from url*/
  20. Hey, sorry for not replying, fell asleep after staying up half the night with my kid lol. I will give these suggestions a go later and will post the results :-)
  21. the file_exists() code: $filename = $GLOBALS["siteUrl"]."template/".$fetch["pageLink"]; if(file_exists($filename)){ echo "<option value='1' selected='selected'>Yes</option>"; }else{ echo "<option value='0' selected='selected'>No</option>"; } echo "</select>"; echo $filename; the echo $filename:: http://localhost/template/index.php the $GLOBALS["siteUrl"]; code: $GLOBALS["siteUrl"] = "http://".$_SERVER['HTTP_HOST']."/";
  22. My reason for putting !file_exists() on the success message was to prove that it says the doesn't exist, even though the file i want to prove exists is staring me in the face.
  23. $GLOBALS["siteUrl"]; is: http://localhost/ and according to php.net, that type of file path IS supported by file_exists() and yes, the file path is correct.
  24. Okay, so i need my CMS to determine whether a page exists or not without the user guessing, I looked up file_exists() on php.net, read what it does, and copied the code into mine and just changed the echos and $filename variable to what i needed them to be, the problem is it says completely the opposite of what its supposed to be. if i say: $filename = $GLOBALS["siteUrl"].$fetch["pageLink"]; if(file_exists($filename)){ echo "file exists"; }else{ echo "file not found"; } It says the file does NOT exist whereas if you go into the directory im pointing to, right there in front of you is the file. However, If i say: $filename = $GLOBALS["siteUrl"].$fetch["pageLink"]; if(!file_exists($filename)){ echo "file exists"; }else{ echo "file not found"; } It then says the DOES exist... Any ideas why its confusing the two? P.S: Ive echoed $filename and it shows the CORRECT file path, even including the file name.
×
×
  • 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.