Jump to content

Caesar

Members
  • Posts

    1,025
  • Joined

  • Last visited

    Never

Posts posted by Caesar

  1. If you want to use those variables in a function in 'main.php', you have to make them available to the function by...

     

    <?php
    
      include'foo.php';
    
        function cancer() {
        global $foo_1; //Now we can use this variable in the cancer() function in 'main.php'
    
          $message = "Hello $foo_1";
    
        return $message;
        }
    
    ?>

  2. I agree...

     

    A simple timestamp will do.

     

    <?php
    
      function check_session($current) {
    
        session_start();
    
        $sess_limit = 1200;
        $sess_start = $_SESSION['sess_start'];
    
        $session_time = ($current - $sess_start);
    
          if($session_time > $sess_limit) {
            session_destroy();
    
            header("location: index.php?action=logout");
            exit;
          }
    
            else
            {
              //Update the your session...or whatever.
             }
    
      }
    
    ?>

  3. Using your existing code....

     

    <?php
    
    $sql = "SELECT * FROM siteusers";
    $query = @mysql_query($sql,$connection) or die(mysql_error());
    while ($row = mysql_fetch_array($query))
    {
    $emails[] = $row['email'];
    print $row['email'].'; ';
    }
    
    ?>

     

    This will create an $emails array that will store all the emails in that loop. If you want to store it in one long string instead of using an array...

     

    <?php
    
    $sql = "SELECT * FROM siteusers";
    $query = @mysql_query($sql,$connection) or die(mysql_error());
    while ($row = mysql_fetch_array($query))
    {
    $emails .= $row['email'].' ';
    print $row['email'].'; ';
    }
    
    ?>

  4. If you've already got the product to sell, and you're not a programmer, I suggest using an existing solution.

     

    Reasons why...

     

    1. They continuously update their software.

    2. They troubleshoot the code.

    3. Support for integrated payment processors..

     

    And on and on...etc.

     

    The solution I use for my clients is:

     

    http://www.turnkeywebtools.com/sunshop/

     

    Edit: Online Demo -> http://demos.turnkeywebtools.com/ss4/

  5. I only want to redirect if the URL is www.mydomain.com with no PID. So would the first code be sufficient?

     

    Yes, it will.

     

    Slight modification....

     

    <?php
    
      if((!isset($_GET['pid'])) || ($_GET['pid'] == '') || (!is_numeric($_GET['pid']))) {
        header("location: index.php?pid=0"); exit;
      }
    
    ?>

  6. thanks :)

    also what do you use to un md5 it?

     

    Technically, it isn't reversible. So to check the db for authentication, you need to see if the password they entered, equals the hash stored in the database.

  7. Your question isn't very specific.

     

    If you plan on developing a site for games...I suggest starting with some PHP tutorials and actually putting aside some time to learning it...instead of looking for code to work with. Otherwise, you'll annoy half the world by troubleshooting every problem that comes up because you never took the time to learn the basics.

     

    Good luck.

  8. I do something similar to this with other file types but I don't think I've tried it with images....possibly something like...

     

    <?php
    
      fopen('temp/'.$filename,"w");
    
      fclose($filehandle);
    
      header("Content-type: force-download");
      header("Content-type: jpeg");
      header("Content-transfer-encoding: binary\n");
      header("Content-disposition: attachment; filename=\"$filename\"");
    
      unlink('temp/'.$filename);
    
    ?>

     

    You'll have to fill in the blanks and edit it....but maybe something like that can be done using images as well. I don't see why not. (Note: Again, have only tried this with documents and other file types)

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