Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. You could always have a field in a database, that basically lets YOU know if the user has collected their gained money within the pass 24 hours. Then use time() and check the difference between the time last collected.

     

    So we can do something like this:

     

    <?php
    $sql = "SELECT * FROM `phpbb_dseusers` WHERE `user_id` = " . $user->date['user_id'];
    $res = mysql_query($sql) or die(mysql_error());
    
    while($row = mysql_fetch_assoc($res)){
    # do other things we'll do time
    $time = time();
    $last = $row['last_collected']; # you might have to add this into your database
    $day = 3600*24;
    $total = $time-$last;
    $collection = $row['collected'];
    
    if($collection == '0'){
    # give points for first time
    # update last_collected field with time();
    # update collected with the number 1
    }else {
    
    	if($total >= $day){
    	# give points
    	# update last_collected field with time();
    	}
    }
    }
    ?>
    

  2. Do:

     

    $title = mysql_real_escape_string($_POST['title']);
    $cust = mysql_real_escape_string($_POST['cust_id']);
    
    $query = "INSERT INTO `upload2` (`name`,`size`,`typr`,`path`,`title`,`cust_id`)
                 VALUES('$fileName','$fileSize','$fileType','$filePath','$title','$cust');";
    
    mysql_query($query) or die("Error, query failed: " . mysql_error());
    

     

    You had an extra comma after cust_id

  3. function randomPassword($length){
    $chars = "abcdefghijkmnopqrstuvwxyz023456789";
    srand((double)microtime()*1000000);
    $pass = "";
    $i = 0;
    
    while($i <= $length){
            $num = rand() % 33;
            $tmp = substr($chars, $num, 1);
            $pass = $pass . $tmp;
            $i++;
    }
    return $pass;
    }
    
    echo randomPassword(10); # 10 letters/numbers in length;
    

  4. I have:

     

    $post = preg_replace ("/\[user=(.*?)\]/is",uname2("$1"),$post);
    

     

    and the function

     

    function uname2($value){
    $sql = "SELECT * FROM `users` WHERE `username`='$value'";
    $res = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_assoc($res);
    
    return "<a href=\"/profiles.php?user={$row['username']}\" style=\"text-decoration:none;\"><img src=\"/images/users/ui_{$row['level']}.png\" alt=\"\" border=\"0\"> {$row['username']}</a>\n";
    }
    

     

    My result: �

     

    Basically I suppose the actually value inside the uname2 function isn't necessarily being passed.

  5. Heh.

     

    You could easily simplify that to a much smaller page, and easier to work with.

     

    /*
    create a page form.php which can hold just the form itselfs
      use an array based error system
    */
    
    if(!$_POST['submit']){
    include "./form.php";
    }else {
    # your variables
    $username = mysql_real_escape_string($_POST['username']);
    $password = mysql_real_escape_string($_POST['password']);
    //etc...
    
    $errors = array();
    
       if(!$username){ $errors[] = "You did not supply a username"; }
       if(!$password){ $errors[] = "You did not supply a password"; }
       #etc
    
       if(count($errors) > 0){
          foreach($errors AS $error){
          echo $error . "<br>\n";
          }
       include "./form.php";
       }else {
       # register
       }
    }
    

  6. $_SERVER['HTTP_REFERRER'];
    

     

    The address of the page (if any) which referred the user agent to the current page. This is set by the user agent. Not all user agents will set this, and some provide the ability to modify HTTP_REFERER as a feature. In short, it cannot really be trusted.

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