
cberube09
Members-
Posts
37 -
Joined
-
Last visited
Never
Everything posted by cberube09
-
Never mind, I finally got it. Thanks for the tip.
-
Thanks, that helps a lot. Didn't know that existed, I was trying to do it with some sort of PHP script. Now, I can get the latest articles that were commented on by using this code $query='SELECT DISTINCT title FROM comments ORDER BY commentid DESC LIMIT 0,5'; However, I also want to select the category that each article is in, and this category is NOT distinct. It doesn't seem like I can blend the two into one statement, so how to I find the correct category that matches up to each of the articles?
-
Seems to be coming along pretty good. For the new site, my suggestions so far would be to remove the video unless it is absolutely necessary, and move away from the bright red text on the white background. It isn't very readable and just doesn't seem to match very well with the overall color scheme of the site. Just some personal opinions, but I hope to see how it evolves. Good luck with it.
-
Hi, I am trying to select recently commented articles out of a database. I want to display the last 5 commented articles, so I originally just set a LIMIT to the mysql query to 5. However, if the title of the article is the same as one already being shown in the newest 5, I do not want it to show up again. To clarify, I want the 5 most recently commented UNIQUE articles to show up. So if Jim and Sue both commented on an article called Dogs, than that article would show up once in the top 5 list, and 4 other articles would show up as well. How can I do this?
-
Alright, thanks for the feedback! I'm glad you guys like the new look better. I will continue work on it tommorow.
-
Thanks for the link. I actually just completed a new layout before seeing that, but are there any opinions?
-
Now that's embarrassing! I shouldn't be editing the website on the live server! Sorry! Its all set now though.
-
Thanks, that's good to know, because I could not get it to work.
-
I have certainly taken your comments into consideration, thanks. I have moved the home link to the first section in the unordered list, changed the top tabs, and validated the entire site. I feel that they layout works for what I'm trying to do, however I am sure up for any further suggestions, I just didn't think that the container div style is what I'm looking for. I added some padding, but to the text and not the container boxes. I left the search at the top of the navigation box because I feel it is important and needs to be accessible right away without scrolling. I have tried to think of a color other than the green, but nothing is seeming to work for me. Are there any further opinions? Thanks!
-
Something like this... index.php?content=main&id=Government_Policy&title=Hypocritical_Politicians I want to encode the ampersands because that this is required by W3 specification. Since the ampersand does not mean AND but is an operator in the link, it must be encoded.
-
Didn't know about the full address, but I'm trying to encode the &s between main and id and between categoryout and title, not the variables i am including
-
Hmm maybe I shouldn't be getting myself into this right now but if there is a bunch of different checks that you want to run and you use if(something) { $errors[] = "Some error message."; } then wouldn't that only check one condition? You don't want multiple messages for one condition, but different error messages for different conditions, so you would use multiple arrays. Am I thinking about this correctly?
-
Right, sorry, that what I meant, I just wrote the wrong thing. This is the code with the url unencoded header("Location:index.php?content=main&id=$categoryout&title=$titleout"); When I use anything like & or %26, that is what shows up in the URL when it redirects, not the regular &, so in turn, the page is not found.
-
Well my arrays do something useful, its just that I don't know what css elements he is using. And I am a bit overtired but I believe that what you wrote doesn't work for some reason or another...not quite sure about that though.
-
The only problem is that the browser url shows the &26 and not the & so the page is not found.
-
First of all, you want to be using $user, $email, and $pass in your insert statement. Secondly, here is how I would write the code. I would say... $user = $_POST['username']; $email = $_POST['email']; $pass = $_POST['password']; if((empty($user))) { error1 = array('username'=>'<b>Error:</b> The username field is empty!<br>'); } if((empty($email))) { error2 = array('email'=>'<b>Error:</b> The email field is empty!<br>'); } if((empty($pass))) { error3 = array('password'=>'<b>Error:</b> The password field is empty!<br>'); } if(!isset($error1) && !isset($error2) && !isset($error3)) { $sql="INSERT INTO user (`username`, `email`, `password`) VALUES ('%s', '%s', '%s')", mysql_real_escape_string($user, $con), mysql_real_escape_string($email, $con), mysql_real_escape_string($pass, $con)); $result=mysql_query($query) or die('Sorry, could not query the database'." Error: ".mysql_error()); if ($result) { echo "<div>Successful submit</div>"; }else { echo "<div>Unsuccessful submit</div>"; } } else { echo'<div>'; if(isset($error1['username'])){echo $error1['username'];} if(isset($error2['email'])){echo $error2['email'];} if(isset($error3['password'])){echo $error2['password'];} }
-
I am trying to encode an ampersand as & within the php header("Location: "); . This method works fine in normal links in php but in the header it passes to the browser as the encoded form & in the url. How do I encode an ampersand in the url of a header redirect?
-
Hi, I have just completed a website for users to write and rate editorials. It's not feature complete by any means, but I am looking for some feedback. If you'd like to check it out, you can find it at http://www.udeclare.com **To those on this site who have helped make this possible, thank you.**
-
Okay, thanks! Would it be beneficial to add session_regenerate_id(true) after the session is started?
-
I feel like such an idiot...So I make a row in the database for the identifying id. I could then generate a random number and assign it to a variable that places it into both a cookie and the database under the correct user. Then I can check if the cookie id matches what is in the database, and if it does, I can assign session privileges, and if not (or if the cookie is expired) I delete the id from the database. Is that right?
-
This is very interesting. I understand the concept, but I still am relatively new to PHP. Could you elaborate on the process of doing this a little? I can't tell you how much I would appreciate it.
-
Thanks, I'm going to do a little more research and coding on the issue now and we'll see what happens.
-
Thanks, that is quite interesting. Should I also be implementing some king of session regeneration? What if I wanted to have a "Remember Me" feature, how could I use a cookie but keep the application secure?
-
I have a general question that I would like to ask... On the site that I am working on, I set a cookie to determine if a user has logged in, or if a user is an administrator, it sets another cookie. Privileges in the site are determined by using a simple isset() function to check for the cookie. I'm wondering about the security of this. My form inputs do not allow html or javascript, but my web host is a shared host on godaddy and I'm wondering if I should be worried about stolen cookies? What would you do? Thanks!
-
Wow, thanks so much! I can't tell you how stupid I feel right now... Sometimes you miss the most obvious things!