Jump to content

creata.physics

Members
  • Posts

    261
  • Joined

  • Last visited

    Never

Everything posted by creata.physics

  1. I don't know if it's just me being illiterate, but this part: Generally it doesn't change, but not necessarily. confuses me. I'm now just confused about the points trying to be made. I'm saying the first part of the code is better, because config.php is in the root directory of his script. So if he did include "config.php"; inside a file in, /root/folder/, and config.php is in /root/ it would fail. if the root path passed onto /root/folder/file.php and it was included within that file, it would work. You are saying if he did include "config.php" in any file in any directory, it would try to include config.php from whatever directory you were in( the current working directory ). So if you're in /root/ and have an include there it'll check /root/, as to where if you were in /root/folder/ it would search there for the file. So I don't see how it's not relative to the files path with the file that is doing the include. If index.php is in /root/ and has include "config.php" it will search /root/ for that file, which would mean it is relative. Anyway, I'm not trying to start an argument or be a douche, I am just obviously confused by what you meant.
  2. I think it looks awesome. I'm not a fan of the black bar at the top considering you have the exact same links somewhere down the page. I also think the links in the footer look ugly. It may be the padding or margin, I don't know what's throwing me off from liking it. Maybe add a hover effect to the links changing the background, that would look really good. Oh yeah, there is a random search bar in the middle of the page handing off the right of the layout, half in the main wrapper and the other half is hanging out into the background. Besides that everything looks great, good job.
  3. I like the banner and navigation, but when a menu item (home, chat, web design, etc..) isn't selected, the borders on the left and right look out of place and ugly. When a link is selected or hovered over, it looks great. The side area on the right needs actual content, that looks messy and incomplete. The links in the footer need to be changed, the dotted underlining of text looks ugly. Everything else is great, good job.
  4. http://php.net/manual/en/function.mysql-real-escape-string.php http://php.net/manual/en/function.htmlspecialchars.php Will be some of your best options to safely protect your site against xss attacks. You'll eventually want to sanitize all $_REQUEST data to prevent from xss and sql injection.
  5. The first code is better as the full path to the document is included, so it'll include /home/user/public_html/config.php instead of just config.php in the same directory as the code requiring it is in.
  6. If your going to use object oriented programming I'd take a look at the singleton pattern. http://www.oodesign.com/singleton-pattern.html Just because you have a class with functions and call the class and use your functions doesn't mean your code is object oriented. It means you use objects, the singleton pattern is object oriented and is a great method and learning experience. I agree with what Thorpe stated, definitely keep your php code separate from html and css. Also, the link I provided you with is a great resoure for learning oop designs and oop in general. Spend some time reading there. Didn't know php had a Patterns page, take a look here for the php side of the singleton pattern http://php.net/manual/en/language.oop5.patterns.php
  7. This may be an issue with sendmail's configuration or php.ini configuration issue. I know in linux sendmails config settings are in /usr/sbin/sendmail.conf normally. Are you running xampp on windows or linux?
  8. On your home server the file is loaded successfully which populates $db, and on the live server $db is undefined and your thrown an error saying prepare fails because it's called off a non-object (undefined $db var). This is obviously a file path issue. Just make sure you correct all links and path settings before you upload to your live server.
  9. What is the code you are using to try to accomplish this?
  10. You are already on the right track with htmlentitties, you can also use htmlspecialchars(). This is the best way from having html code inserted through $_POST data.
  11. I don't see the while loop begin but it certainly looks like you have on started somewhere because of this at the very end of your code: <?php endwhile; ?> So you have a foreach loop inside of a while loop which is why you are getting your results twice.
  12. what code are you currently using to accomplish this? what methods have you tried on your own so far?
  13. your error is with $searching variable, it is not set. change: if ($searching =="yes") to if ( $_POST['searching'] == 'yes' )
  14. Using a cron job to handle user sessions seems a bit too extreme, i'd never do it. Is the logged_in field inside the same table that registered users info is stored in? Or do you have your own separate mysql table to handle user sessions? Storing "Logging In"/"logged Out" in the database, what does that even mean? There is a way to log users out automatically depending on how your script is set up. I'd want to know how you're keeping track of a users session, I've already gathered that it's from a database, but I'm not sure what table contains what data. If a user is logged in, and you have some information to check and validate they are logged in if( $user['logged_in'] == 1 ) then have the script check and see how long ago their session was active if ( time() - $user['last_page_refresh'] > 3600 ) What to execute within the arguments depends on how you store users sessions. So if you have a field called logged_in being the only thing that determines a users online status, you'd want an update query to change that value to false, indicating that they are no longer offline.
  15. You'd want a mysql table to store data into a database. When a users session is created you would store that information into a database. You'd have your script check and see if that users session is active, if that session hasn't been active for X amount of time, you'd have a script clearing that record from the database. That would cover a user leaving your site or timing out. You won't need any extra session code other than what you currently have.
  16. Well, can you at least try to build a join query and post it here? You've shown me what you need but you haven't shown me what you've done to try to accomplish your goal. So far it only seems like you just want somebody to build your code for you.
  17. If that exact code you posted is what you are using then you aren't even calling the function since it's commented out. Also, you may not need to do all that, this should work: $teams = new SimpleXMLElement('C:\\teams.xml',NULL,true); $abs = array(); foreach ( $teams as $team ) { arsort( $team ); $abs[] = $team; } echo '<pre>'; print_r( $abs ); echo '</pre>';
  18. print str_replace( '-', '', 'yyyy-mm-dd'); Of course you'll need to replace 'yyyy-mm-dd' with the appropriate key for the post data, e.g. $_POST['date']
  19. Um, you may want to rethink the way you are doing this. I see your styles are put into the script manually, so an admin couldn't add/edit/delete these specific styles unless they modified the code, that is fine, but I'd eventually change that. I would make $user['color2'] capable of handling a good amount of text. I would make an array to store the users colors that s/he has purchased. // 0 means not purchased, 1 means purchased - also you will need to finish the array on your own $userColors = array ('Purple Orb' => 0, 'Ms Beautiful' => 0, 'Blue Essence' => 0 ...... ); Then I would serialize the array and keep it stored in $user['color2'] $default_purchases = serialize( $userColors ); I'd set that code up upon registration Now when a user goes to purchase, let's say, Purple Orb, we will unserialize the array, update that users Purple Orb value to 1, serialize it once again and update the field in the database. $userColors = unserialize($user['colors2']); $userColors['Purple Orb'] = 1; $_userColors = serialize($userColors); mysql_query('UPDATE QUERY'); Hope that helps
  20. Are you even echoing the code? It works just fine for me. print "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
  21. Um, if the cookie is set than the cookie is set, that is all. Only if the script is built to log the user in IF a cookie is set, will it log a user in automatically. You need to make an if statement to produce the appropriate html to render what you need. <?php if ( isset ( $_COOKIE['username'] ) ) { $preparedUsername = ' value=' . $_COOKIE['username'] . ''; $rememberMe = ' checked'; } print '<input type="text" name="username"'.$preparedUsername.'><br />'; print '<input type="checkbox"'.$rememberMe.'>'; I'm assuming if a user does not check remember me than a cookie is not set and sessions are used instead and vice versa. That is why I only checked to make sure that there is a cookie set to know if we should keep the box checked. I personally feel doing it this way is a drag, if you are to check a box that says remember me you would it expect it to automatically log you in on the next visit. I'd only do it your way if this was a bank or other type of business that handles money, credit cards, etc.
  22. Well, considering that mysql's DATE format is, YYYY-MM-DD, and if your url is http://example.com/?day=01&m=03&year=2012 Then you shouldn't have any issues. You would combine your required get values into one variable: $date_to_enter_into_database = $_GET['year'] . '-' . $_GET['month'] . '-' . $_GET['day']; And add it into your database. That way it is formatted for mysql's DATE function.
  23. I'm sorry but I have no idea how to understand what you just wrote.
  24. Please use print_r($colorarray) so we can see what is returned.
  25. I won't creata the code for you, but I'll help you wrap your head around things. There's something I need to understand from you first. You said you can grab the values from the url, that I'm assuming looks like this: http://example.com/?day=1&month=3&year=2012 So using $_GET you can grab these values which you said you already know how to do. $month = $_GET['month']; $day = $_GET['day']; $year = $_GET['year']; // Now you need to combine into one value, easy $date = $month . $day . $year; So what exactly do you need after that? Do you want to convert the date into a timestamp? I need some clarity.
×
×
  • 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.