SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wondering,
    I am creating an Ebay manager script and after I created everything in seperate files, I was thinking that I'd convert it all to one big funcs.php file and use a command script such as:-

    if ($action == "NewBid") {
    newbid();
    } elseif ($action == "DeleteBid") {
    deletebid($auctnum);
    }

    etc.

    Is this the best way to do it? Looking at the code, the funcs.php file would be about 30k as there are quite a lot of functions. Is there anything wrong with using normal flat files?

    Also, if I have function showbids() defined, can I use it inside another function that is defined after showbids()?

    IE.

    function showbids()
    {
    defined here
    }

    function deletebids()
    {
    delete bid code
    showbids()
    }

    Any input appreciated!

  2. #2
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds good I don't think a 30K file is anything to worry about. Also, there is nothing wrong with calling a function from within a function. In many programming langauges, the program begins by execution entering a special function main(); so in these languages all code is called from within functions technically speaking. After all - its turtles all the way down!

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just a suggestion, but for this part

    if ($action == "NewBid") {
    newbid();
    } elseif ($action == "DeleteBid") {
    deletebid($auctnum);
    }

    I would use a switch statement like

    switch ($action) {

    case "NewBid";
    newbid();
    break;

    case "DeleteBid";
    deletebid($auctnum);
    break;

    default;
    whatever;
    break;

    }
    Marty H.

  4. #4
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks All!

    I'll certainly try out that switch idea Marty, would be a lot easier and should save a few more bytes.

    Just wondering, is there any way that I could pull auction data from Ebay itself? I assume that that wouldn't strictly be legal, am I right?

    Also, if I was to create a website that just ran the auction manager, what would be the best security to run multiple logins? Sessions? (I can do sessions )

    Finally, if I HAD multiple logins, do you think that having one big table of bids (with a seperate sellers table) using a user number to define who owns which bid would be the best way to manage a lot of data?

    ie.
    Bid Data ------ User
    lalalalalal ------ 3
    lalalblah-------- 2

    Thanks all again!

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check this script out for ebay stuff

    http://www.hotscripts.com/Detailed/6671.html
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Warning: Failed opening '/home/jtlnetc/public_html/auction/index.php3' for inclusion (include_path='.:/usr/local/lib/php') in Unknown on line 0

    He must be upgrading

    When that script was up freddy, it wasn't working. I tried searching several times for different UK and US sellers but to no avail. Just "Seller Unavailable" messages.

    Thanks anyway man

  7. #7
    SitePoint Member
    Join Date
    Mar 2001
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Globals

    A little thing to mention about Functions:

    When your using functions and you want the $var; to be used outside it then you must call global $var; however, if you do global $var; in both the inner and outer functions, the outer functions WILL override the inner functions.

    Just a note

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm...

    I used it and it worked fine for me, it would take like 30 min. to write one from scratch though. In fact I might have one at home, I can check when I get off work and if I have it, I will email it to you.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    Feel my RewiredMind KMxRetro's Avatar
    Join Date
    Jan 2001
    Location
    Exeter, Devon, UK
    Posts
    477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks freddy, that would be ace!


Bookmarks

Posting Permissions

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