Jump to content

Gayner

Members
  • Posts

    549
  • Joined

  • Last visited

    Never

Posts posted by Gayner

  1. Adjust time in my box? you mean buttom corner of my desktop ?

     

    Yea, when I refer to "box" it generally means your computer. A lot of IT people call them boxes because...well most of them are as a big as a box and store a ton of junk inside :) (at least that is how I define the term).

     

     

    Adjust time to be 6 hours?

     

    I dont get it, so make add 6 Hours to it?

     

     

    but isn't that script for 60days? im lost

     

     

    in any event.. 6hours wont help if it's 60days

  2. Does it do it on other browsers/computers? It could just be a setting on your computer wiping the cookie data...

     

    No cause all my other sites i use like phpfreaks/other forums im still loggedin

     

    Is there something wrong with my code? is it setting it to unlimited time with all those **?

  3. setcookie("user_id", $_SESSION['user_id'], time()+60*60*24*60, "/");
    			  setcookie("user_name", $_SESSION['user_name'], time()+60*60*24*60, "/");

     

    i use that for my login.php when somone logs in..

     

    But if i login and go to school and come back and hit refresh usally around 5-8hours im logged off...

     

    but if i hit refresh after 3-4hours im still logged in why?

  4. try this and see how it goes for time... you don't have any triggers etc set up in your mysql database?

     

    function getmicrotime(){
    list($usec, $sec) = explode(" ",microtime());
    return ((float)$usec + (float)$sec);
    }
    
    $time_start = getmicrotime();
    
    mysql_query("INSERT INTO forum_replies(tid,uid,message,date,time) VALUES('1','2','3','4','5')");
    
    $time_end = getmicrotime();
    $time = $time_end - $time_start;
    
    echo "Query took $time seconds";
    

     

    here:

     

    Query took 6.25345611572 seconds and in database looks like this:

     

    It insert data fine but took 7seconds lawl..

     

     

    wat the hell is this mean?

     

     

    Indexes: Documentation Keyname Type Cardinality Action Field

    PRIMARY PRIMARY 102  Edit Drop id

     

    Im looking at Structure and I see Cardinality is 102?

     

     

     

    Even tho that wont make a difference but what the hell is wrong with my table, lol

     

     

     

     

    If this make any difference this was the query i oringally used to make the table

     

    CREATE TABLE `forum_replies` (

      `id` int(11) NOT NULL auto_increment,

      `tid` int(11) NOT NULL,

      `uid` int(11) NOT NULL,

      `message` text NOT NULL,

      `date` varchar(64) NOT NULL,

      `time` int(25) NOT NULL,

      `edit_time` int(24) NOT NULL,

      PRIMARY KEY  (`id`)

    ) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

     

    ENGINE=InnoDB is this why? Charset=Latin1 is this problem too ? lol

     

     

    I think InnoDB Is the proble, how do i change it back tonormal mysql in phpmyadmin ?

  5. The table looks fine. It could be the amount of data in the table but I doubt it. One thing I did notice is that you are storing the date as a varchar. I am not sure why you are doing that because you can use either mysql's date or datetime or even php's time(); functions to store the time. I usually use php's time() function with an int as the field type. Its really easy to work with timestamps and you can even get dates from them.

     

    Hmm... true..

     

    But I dont think any of this is worth 8seconds of insert query timeout? Can u please help me catch this problem bro.. thanks

     

     

    Sorry it wont let me edit.

     

    but this is the query not the update function one.

     

    mysql_query("INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('".$tid."','".$_SESSION['user_id']."','".$msg."','".$date."','".$time."')");

  6. The table looks fine. It could be the amount of data in the table but I doubt it. One thing I did notice is that you are storing the date as a varchar. I am not sure why you are doing that because you can use either mysql's date or datetime or even php's time(); functions to store the time. I usually use php's time() function with an int as the field type. Its really easy to work with timestamps and you can even get dates from them.

     

    Hmm... true..

     

    But I dont think any of this is worth 8seconds of insert query timeout? Can u please help me catch this problem bro.. thx

  7. Query took 8.80006599426 seconds

     

     

    LOL but if i switch back to:

     

     mysql_query("INSERT INTO `prays` (`title`,`prayer`,`private`,`level`,`time`,`nameid`) VALUES (
    '". mysql_real_escape_string('1') ."',
    '". mysql_real_escape_string('2') ."',
      '". mysql_real_escape_string('3') ."',
        '". mysql_real_escape_string('4') ."',
      '". mysql_real_escape_string('5') ."',
    '". mysql_real_escape_string('6') ."');") or die(mysql_error()) ;

     

    It only takes:

    Query took 0.000324964523315 seconds

     

     

     

    WTH??

     

    It has to be something to do with my table forum_replies..

     

    iuno wth omg

     

  8. By just glancing at the query it seems to be fine to me but there could be something else causing the query to be slow. It may be something else on the page, its hard to say without know what is going on. You can try this cleaner looking query and see if it helps any:

     

    mysql_query("INSERT INTO forum_replies(tid,uid,message,date,time) VALUES('$tid','".$_SESSION['user_id']."','$msg','$date','$time')");
    

     

    Not going to say it will be any faster but it at least looks nicer lol.

     

     

    I Replaced it with a random one

     

     mysql_query("INSERT INTO `prays` (`title`,`prayer`,`private`,`level`,`time`,`nameid`) VALUES (
    '". mysql_real_escape_string('1') ."',
    '". mysql_real_escape_string('2') ."',
      '". mysql_real_escape_string('3') ."',
        '". mysql_real_escape_string('4') ."',
      '". mysql_real_escape_string('5') ."',
    '". mysql_real_escape_string('6') ."');") or die(mysql_error()) ;

     

    and it works perfect, but this is on a different table, is there something wrong my forum_replies table I posted a screenshot... hmm ???

  9. mysql_query("INSERT INTO `forum_replies` (`tid`,`uid`,`message`,`date`,`time`) VALUES('".$tid."','".$_SESSION['user_id']."','".$msg."','".$date."','".$time."')");
    					mysql_query("UPDATE forum_topics   SET `time`='".time()."', ".
                                                "lastposttime='"         .time()          ."' ". 
    										"WHERE id='"        .$tid               ."'") or die(mysql_error());
    
    mysql_close();
    					header("Location: ./index.php?act=topic&id=".$tid);

     

    Iuno that's best code I can think off. whenever i run that on a form like

     

    The queries work it's jsut it takes like 5-10 seconds to freakin submit the dam thing? normal ?? Should be instant? my other forum if u submit it it's instant.. why this all slow??

  10. Hi everyone!

     

    Well here is my code that displays this:

     

    It works wonderful.

     

     

    2v8g5yc.jpg

     

    The code is:

     

    function time_elapsed_string($ptime) {
        $etime = time() - $ptime;
        
        if ($etime < 1) {
            return '0 seconds';
        }
        
        $a = array( 12 * 30 * 24 * 60 * 60  =>  'year',
                    30 * 24 * 60 * 60       =>  'month',
                    24 * 60 * 60            =>  'day',
                    60 * 60                 =>  'hour',
                    60                     =>  'minute ago',
                    1                       =>  'second'
                    );
        
        foreach ($a as $secs => $str) {
            $d = $etime / $secs;
            if ($d >= 1) {
                $r = round($d);
                return $r . ' ' . $str . ($r > 1 ? 's ago' : '');
            }
        }
    }

     

    But I would like it to say, instead of just 1 Minute ago, make it say "1 Minute 25 Seconds ago"

     

    I would want to add seconds into there on the minutes.

     

    Can somone revamp this and post again the correct way, Thanks for your patience, ( Sorry for my other topic I was too excited) I'm trying to be nice and professional for u.

  11. function time_elapsed_string($ptime) {
        $etime = time() - $ptime;
        
        if ($etime < 1) {
            return '0 seconds';
        }
        
        $a = array( 12 * 30 * 24 * 60 * 60  =>  'year',
                    30 * 24 * 60 * 60       =>  'month',
                    24 * 60 * 60            =>  'day',
                    60 * 60                 =>  'hour',
                    60                     =>  'minute',
                    1                       =>  'second'
                    );
        
        foreach ($a as $secs => $str) {
            $d = $etime / $secs;
            if ($d >= 1) {
                $r = round($d);
                return $r . ' ' . $str . ($r > 1 ? 's ago' : '');
            }
        }
    }

     

     

     

    Everything works fine.. I get 25, seconds ago bla bla.

     

     

    But when It get's into minutes.. it only does 4 Minutes ago.

     

    I want it to be, 4Minutes 28Seconds ago.

     

    Or whatever.

     

    Sorry but this is the farthest i gotten in php code now i need ur help thanks.

  12. $sql1 = "SELECT count(*) AS num_replies FROM `forum_topics` WHERE `cid`='".$row3['cid']."'";
    

     

    I want to beable to have num_replies and num_posts, posts are in forum_replies table tho.. ? but how?

     

    Thanks.

  13. Gayner.. you have some cheek on you.

    I understand how you think thaty if you using money in the buisness to have security.

     

    Though if you had a login, which tracked IP, location, etc.. upon registration, would you like hackers to find out that information and find you? I would think not. Not only is security about protecting the website, its about protecting yourself.

     

    If you wanted to use Session to create a very secure login, use IP detectors, so that if your IP isn't the same as the one on registration, then do not login.

     

    Though in terms of general security, it depends how it is used, as to whether it can be hacked into.

     

    it's just a simple login registration form to let users have a big ego if there account is created , username and md5 with sha hash and a text for users to describe about them selves, lol nothing fancy

  14. Why would anyone give you money?  Why should anyone give you anything?

     

    This forum is meant for PHP web developing..not for little kids to bum money off of like some kind of "Starving Needs Foundation".  Why don't you ask mommy and daddy for a dollar or borrow your bestest friends' parents' credit card and get what money you need.  Seeing as how you don't seem to care where your money comes from.... or who.

     

    Better yet, you could start stealing change out of random people's cars.  Soon enough you would have more than what you're asking for.

     

    Lil kids? lol come to my house .

  15. but no1 needs protection unless u gonna be having a huge site that is very needy on money like gaia online or what not

     

    Remind me not to sign up on any web site you created.

     

    You wouldn't anyway, and with that attitudei wouldn't want u, lol

     

     

    In any event i could tell u i used allprotection and u woulda've signed up I coulda tell u anything.

     

    How do u know .

×
×
  • 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.