Results 1 to 9 of 9

Thread: sending array to next page

  1. #1

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090

    sending array to next page

    I need to send an array from one page to another. I don't use any forms, but I could if I need to and I don't want to use MySQL.

    Should I use cookies? I want something that the user can't edit (obviously 'll encrypt the data)

    It's not extremely important data, it's sorta like a quiz.
    Have I helped you? Please Rate my posts.

  2. #2
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Use a form with the POST method. All your data will get passed to the next page and the user won't see it in the URL.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  3. #3

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    But Then I have to use a hidden form. If they are clever enough, they can edit this.

    If this is by far the easiest method I'll do it anyway, I'll just come up with a nifty encryption for it.
    Have I helped you? Please Rate my posts.

  4. #4
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Depending on the data, you can use sessions. If I was doing it, I'd probably use a database, but you said no to that.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  5. #5
    Lively Member Misspell's Avatar
    Join Date
    Mar 2002
    Location
    Located
    Posts
    69
    How about working off a txt file kept on the server ?

    Ony thing is if the user finds out the name of the file, they will have access to the info. I guess you could even name the file with the session ID to make it alittle harder. I dont really see how they could find the txt files name unless they scan your sites dirs with an exturnal app, but who knows

    Just some thouhgts.

    ~ What was once an opinion, became a fact, to be later proven wrong... ~

  6. #6

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    How do you create, read, delete and rename files?
    Have I helped you? Please Rate my posts.

  7. #7
    Lively Member Misspell's Avatar
    Join Date
    Mar 2002
    Location
    Located
    Posts
    69
    Heres acouple functions that you can play with... you'll have to edit them to fit your needs.

    PHP Code:

    function create_file($the_file){
    global 
    $bla;
     
        
    $file fopen ($the_file"w");
        
    fclose($file);
        
    return 
    $the_file " Created" ;
    }




    function 
    create_file_with_info($the_file$the_txt){
    global 
    $bla;
     
        
    $file fopen ($the_file"w");
        
    $fw fwrite($file$the_txt);
        
    fclose($file);
        
    return 
    $the_file " Created with info:<br>" $the_txt ;
    }



    function 
    read_file($the_file){
    global 
    $bla;
     
        @
    chmod($the_file0777);
        
        
    $lines file($the_file);
        foreach (
    $lines as $line_num => $line) {
           
    $edited_txt $edited_txt $line ;
        }
        
    return 
    $edited_txt ;
    }




    function 
    save_file($the_file$the_txt){
    global 
    $bla;

        
    $fp fopen($the_file"w");
         
    fwrite($fp$the_txt);
         
    fclose($fp);
         
         @
    chmod($the_file0755);
         
    return 
    $the_file " Saved with info:<br>" $the_txt ;
    }




    function 
    rename_file($the_file$new_name){
    global 
    $bla;
     
        
    rename($the_file$new_name);
        
    return 
    "<b>Old Name</b> " $the_file "<br><b>New Name</b>" $new_name ;
    }




    function 
    delete_file($the_file){
    global 
    $bla;
     
        
    unlink($the_file);
        
    return 
    "Gone, <b>R.I.P</b> " $the_file ;

    For more info:
    http://us2.php.net/manual/en/function.file.php

    Never used it but you might want to look into this too:
    http://us2.php.net/manual/en/functio...e-ini-file.php

    ~ What was once an opinion, became a fact, to be later proven wrong... ~

  8. #8
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    What's up with all the:

    PHP Code:
    global $bla
    In there? That doesn't make sense to me. It's not used.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  9. #9
    Lively Member Misspell's Avatar
    Join Date
    Mar 2002
    Location
    Located
    Posts
    69
    Originally posted by The Hobo
    That doesn't make sense to me. It's not used.
    Most of the code i posted was from a script of mine.. I had some more code in there where i was using them to hold an array... i just did a copy/paste with alitte editing.. I should have left out the gloables in what i posted here

    ~ What was once an opinion, became a fact, to be later proven wrong... ~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width