Jump to content

Aureole

Members
  • Posts

    788
  • Joined

  • Last visited

    Never

Everything posted by Aureole

  1. Does Javascript have such functions and do they work similarly to PHP's?
  2. Nope, I'm creating a User Script for Grease Monkey. A Website I visit has all their times in PST. I am going to make it so, someone can set a var in the User Script then it will convert all the times for them.
  3. But surely Javascript can turn something like "02.04.2008 11:10 AM PST" into a time-stamp, then that time-stamp can be manipulated? I only need to turn the above into a time-stamp, then I will be able to achieve what I want to do; despite what you say. The script I'm writing only needs to convert to one time-zone, it could be a simple var... with the time-zone... then all it has to do is add ( subtract) a certain amount of seconds to (or from) the time-stamp. It's hard to explain, but if I can turn "02.04.2008 11:10 AM PST" into a time-stamp then the rest I can figure out myself. Any ideas?
  4. I'm creating a little Grease Monkey add-on for Firefox, for a Website that shows all times in PST. I want to search for all instances of: <li class="date">*</li> Then replace the date/time there-in with a new date, depending on the user's time-zone. An example of what the date looks like is "02.04.2008 11:10 AM PST" i.e.: <li class="date">02.04.2008 11:10 AM PST</li> I REALLY don't know where to start. Is this even possible? If someone can help me out then it'd be much appreciated. Normal Javascript is fine, however if you feel it'll make your life easier and you are familiar with it, then jQuery would be great.
  5. Well I started using $_SESSION['something'] = $var, instead of session_register() a while ago to be honest, I'm assuming that's the (now) correct way? As far as session_set_save_handler() goes, there isn't really that much information there to be honest. The Paramaters open, close, destroy and gc don't even have any information on them. Or are you telling me to look in the User Contributed Notes? Thanks for your reply anyhow, does anyone else have any input?
  6. I'm wanting to create my own Session Class but I'm stuck as to how to go about it. I don't want to download some pre-existing Class and I can't find any tutorials. Normally I just use session_start(), session_register() and session_destroy(). Those are the only 3 Functions I've ever needed. When a user enters their login information, if it's all correct the basically I just do: <?php // Query here... $_SESSION['logged_in'] = 1; $_SESSION['mem_id'] = $result['id']; $_SESSION['mem_name'] = $result['name']; ?> Anyway, let me outline a few points... #1: I want to store Sessions in a MYSQL Database. #2: If the user has Cookies disabled, then I still want the Session to work via the ?sid=... thing, but I've never dealt with that before. #3: I would like Sessions for Guests. The way I do it now, if you ain't logged in then you don't have a Session; that's something I want to change. #4: I want to be able to control when Sessions expire. #5: It'd be nice if Search Engine Bots/Spiders could have separate Sessions to Guests and Members, but it's not really a priority. That's about all I can think of... When it comes to OOP related stuff, I usually go through the source of Invision Power Board. I don't copy their code, I just use it to try and help me learn. I had a look at their Session Class and I have determined that at the bare minimum I need... Anyway, if anyone has any pointers or can give any advise then it'd be most appreciated.
  7. Whenever I open a file with a .php extension, PHP Designer 2008 decides to set the syntax colouring mode to Ruby. I never used to have this problem, it just started happening recently. Any ideas?
  8. I seriously recommend PHP Designer 2008, it's not free - but it's not expensive and it's worth the price.
  9. Is the shopping cart on a different domain? If so then, you're screwed... to be crude.
  10. Try something like: <?php str_replace( '<p>', '', $v ); str_replace( "</p>", "\n", $v ); ?> ...where $v is the content you want to show in the textarea. I'm not sure if "\n" will work, if not just change the second parameter of the second str_replace to ""... but I added the "\n" there so that... well if you didn't then I think it'd be all crumpled up.
  11. If you're wanting to show "<" and ">" etc. inside a textarea, I believe you need to convert them into their HTML entity counterparts. Hope that helps.
  12. Thanks a lot, I'll leave this unsolved until I actually try what you suggested, just in case.
  13. It was a while since I posted this and there have been no replies. *Insert sneaky bump* Bumping is allowed after 24 Hours with no replies, as far as I know. Feel free to correct me however if I'm wrong.
  14. How would one approach something like this? The only (extremely bad) way I can think, is running a cron job/task every... x minutes and do a query to count how many members in the members table are currently online. If it's higher than in the past then update a table, otherwise leave it. I don't want to do it like that, if there's another way. Any ideas?
  15. There is nothing wrong with the line you speak of. ???
  16. I'm not going to post all the code from the files, just the code which is relevant, I'll remove the rest.. dump_vars() should only dump all the vars that don't begin with "db", but it's showing all of them, any ideas? Here is conf.php: <?php $vars['db_host'] = 'localhost'; $vars['db_database'] = '***'; $vars['db_user'] = '***'; $vars['db_pass'] = '***'; $vars['start_timestamp'] = ''; $vars['installed'] = '1'; $vars['php_ext'] = 'php'; $vars['board_url'] = 'http://www.mywebsite.com/folder/index.' . $vars['php_ext']; $vars['root_group'] = '1'; $vars['admin_group'] = '2'; $vars['member_group'] = '3'; $vars['banned_group'] = '4'; ?> Here's class_equinox.php: <?php /** /----------------------------------- / Equinox /=================================== / @author: .KX / @date: 03 February 2008, 22:42 GMT / @revision: 1 /=================================== / @file: Equinox Class / @started: 03 February 2008 / @updated: /----------------------------------- */ class equinox { /** * Variables from conf.php * @var [array] */ var $vars; //----------------------------------------- // Dump vars from conf.php for debugging // purposes. //----------------------------------------- function dump_vars() { foreach($this->vars as $key => $val) { // Exclude database stuff from dump, we don't want anyone accidentally giving away their database details... if( $key !== 'db_host' || 'db_user' || 'db_pass' || 'db_database' ) { echo( "<strong>$key:</strong> $val<br>\n" ); } } } } ?> ...and here's index.php <?php /** /----------------------------------- / Equinox /=================================== / @author: .KX / @date: 04 February 2008, 12:26 GMT / @revision: 1 /=================================== / @file: Equinox Wrapper / @started: 04 February 2008 / @updated: /----------------------------------- */ //-------------------------------- // Load Classes etc. //-------------------------------- require_once( 'init.php' ); $vars = array(); require_once( ROOT_PATH . 'conf.php' ); require_once( ROOT_PATH . 'classes/class_equinox.php' ); //-------------------------------- // Instantiation for the nation //-------------------------------- $equinox = new equinox; $equinox->vars = $vars; $equinox->initialize(); $equinox->initialize_db_connection(); $equinox->dump_vars(); ?>
  17. PHP Designer 2008 is a BIG improvement over 2007, I couldn't live without it.
  18. You should use str_replace(), it's a lot faster.
  19. That's why when I did the thing where I looped (with while()) and incremented $i each time, it was 9 (for me) like it should have been.
  20. I just did a little test on my site. <?php $table_items = mysql_query( "SELECT `mem_id` FROM `members`" ); echo mysql_num_rows( $table_items ); // Outputs 9 $items = mysql_fetch_array($table_items); var_dump( $items ); // Outputs array(2) { [0]=> string(1) "1" ["mem_id"]=> string(1) "1" } echo count( $items ); // Outputs 2 $i = 1; while( $test = mysql_fetch_array( $table_items ) ) { $i++; } echo $i; // Outputs 9 ?> I think it's because you're counting the array $items... which has two parts within... for me anyway.
  21. PHP Designer 2008 is by far the best PHP Editor as far as I'm concerned. You have to pay for it, but it's worth it. If you don't want to pay, there's always PHP Designer 2007 which I believe is free.
  22. Meh, well I don't know hex codes off by heart. But I know in certain instances they can be shortened.
×
×
  • 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.