Welcome Guest, Not a member yet? Register   Sign In
tell a friend project
#1

[eluser]kierownik[/eluser]
Hi all,

I started a project with codeigniter to get familiar with it so I choose to make a tell a friend controller and view.

Now I do not want to use a database and keep it flatfile based.

Now I know how to write the time to my log-file but it seems it does not get updated.

Could someone tell me what I am doing wrong!

If you have any remarks on the coding side I love to hear it, I am here to learn to program correctly.

The Code:

Controller: tell_a_friend.php
http://www.pastebin.com/f718db868

View: tell_a_friend_view.php
http://www.pastebin.com/f2f6af688

I Could not post the code here, it was to long I think.

Thanks,
#2

[eluser]kierownik[/eluser]
Nobody :long:

Now I was thinking in using just one file and make an array in that file.
Code:
$tellafriend = array(
    '2010-02-20' => array(
        '127.0.0.1' => array(
            'your name'             => 'cvcxv',
            'your email'            => '[email protected]',
            'first friend email'    => '[email protected]'
            ),
        'another ip here' => array(
            'your name'             => 'cvcxv',
            'your email'            => '[email protected]',
            'first friend email'    => '[email protected]'
            ),
        ),
    '2010-02-19' => array(
        '127.0.0.1' => array(
            'your name'             => 'test',
            'your email'            => '[email protected]',
            'first friend email'    => '[email protected]'
            ),
        '127.0.0.1' => array(
            'your name'             => 'cvcxv',
            'your email'            => '[email protected]',
            'first friend email'    => '[email protected]'
            ),
        ),
    );

What would the best approach be to get the best result.

I hope someone can help me.
#3

[eluser]SpooF[/eluser]
I would use a single file, store each record on its own line in the format: {name|email|friendemail|ip}, you dont even need to place them on there own lines.

Then to get your results you can simple read the file and use a preg match to find the information you need.

Or do it via XML, which would probably be the better solution.
#4

[eluser]kierownik[/eluser]
I will look into that thank you.
I do not have any clue how to do it but I am going to try it.
#5

[eluser]slowgary[/eluser]
The easiest way might be to create a multidimensional array just as you have, and use PHP's serialize() function to turn the array into a string, then store it to file. To retrieve it, just read in the string and unserialize() it. Easy.
#6

[eluser]kierownik[/eluser]
I now made one that uses a database.

I will now try to make one that is flatfile based.
I will try to use the suggestions that you all made.
#7

[eluser]kierownik[/eluser]
I have submitted my script to the wiki.

The page can be found here: http://codeigniter.com/wiki/tellafriend/
#8

[eluser]kierownik[/eluser]
Updated the script to include jquery and using ajax to send calls to the database and validation.

Get the script here: Wiki Page
#9

[eluser]kierownik[/eluser]
Updated the script to fix an // Fixed an Undefined variable: data on line 77

Get the script here: Wiki Page
#10

[eluser]zibstefan[/eluser]
add $this->output->enable_profiler(FALSE); to the method ajax_index()




Theme © iAndrew 2016 - Forum software by © MyBB