Jump to content

ober

Staff Alumni
  • Posts

    5,327
  • Joined

  • Last visited

Posts posted by ober

  1. Yeah, like if you needed to reuse the recordset for another control or something.

    I think that's just there so that if something was set in another part of the code, that it will be the first selection... although I don't see any "selected" attribute in the option. I'm assuming at this point without seeing more of the code.
  2. Yes, ASP is very inefficient.

    Wend is "While End"... it's like closing a bracket on a while loop in PHP.... and yes, you must include it for one liners.

    The if statement basically says "if the cursor (which is nothing more than a pointer in the recordset array) can use the MoveFirst call, do it.... otherwise run the query again to reset it at record 0".

    Hope that helps.
  3. You cannot include an entire set of forums in another page. It's impossible. If you want a specific URL to go to your forums, just use the header() call on the forums.php page to redirect the user to the main page of the forums.
  4. As far as I know, there is no way to get a snapshot of a website, and if you can, you could probably sell it.

    You'll have to actually capture an image of the site (screenshot) and manually create the thumbnail. There is no way to create what you're asking programatically through PHP.
  5. You can do this both ways.

    1) You can have them enter a part number and give them a button. The button submits the form and either takes them to a second form where they fill in additional information about the part to be submitted for insertion, or it takes them to a page that says the part already exists.

    2) Same as above, but you use AJAX to return the results. If you don't understand what AJAX is, check out www.ajaxfreaks.com (a sister site of phpfreaks). It's a javascript call that can run a PHP script that will return data to a specified area of your page without reloading the page.

    I'd personally go with AJAX, but it requires the user to have Javascript enabled to use the functionality of the site.
  6. Better:

    Store their IP in a database table along with the number of downloads and the date/time they downloaded the files. When a download is attempted, check the table and the number of downloads before passing them along to the actual download page. If they've surpassed their limit, send them to a different page.

    I'd also have another script that runs on that page that reduces their download count after a certain period of time, or provide some way to earn points towards more downloads or something.
  7. Why can't you just set the keys normally?
    [code]
    for($i = 0; $i < $con_count; $i++)
          $con_arr[$this->_data_contact[$i]->person_id] = $this->_data_contact[$i]->first_name." ".$this->_data_contact[$i]->last_name;
    [/code]

    By the way, it may be force of habit for some, but you don't need braces around a single-line for/if/while.
  8. You're going to want to use preg_match() with regular expressions to grab that out. You basically want to look for "action=" and grab everything from there until you find a space, and then do a str_replace on the quotes.
  9. I'm going to assume a few things:

    1) That you're storing the Category ID in the Articles Table with each article.
    2) You're already using SELECT SQL statements to grab the data.

    If those 2 things are correct, all you need to do is know how to use a WHERE clause in your SQL statement:
    [code]$query = "SELECT * FROM Articles WHERE Category_ID = '" . $_REQUEST['catid'] . "'";[/code]

    Then you just run the query and display the results as you normally would.

    Hope that helps.
  10. Well, the question would be how are you passing the value to the page to decide which file you want to read?

    Gaia is mostly right, but we have to know the above before we proceed. If this is hardcoded, and you put them in an array:
    [code]
    <?php
    $myarray = array('10', '11', '12');

    foreach($myarray as $key => $val)
    {
        $page = file($url . $myarray[$val]); // you can do this with the $_POST/$_REQUEST array too

         // process as normal
    }
    ?>
    [/code]

    The only other problem you'll have to deal with is what you do with the variables at the end. You'll have to make your $out array a little more dynamic or you'll have to store everything in records in a database or some other storage medium.
  11. Are you storing that information in a database or in a text file? Your display page would need to open one or the other to view that information.

    Can you be a little more specific about the problem you're having?
  12. Security: Looks better with the Paypal logo.

    Home page: The first thing I would do is change the banner image. It looks like a mid-90ish type banner with just some text and a funky background. Put a nice car image up in there. I'd also lose the full-width style of the site, as that can cause problems stretching your content. Using a fixed-width site not only let's you know exactly where things will fall, but it also makes you look like you have more content.... and as an added bonus, it allows you to have a defined-width banner image. I'd love to see a tricked out car in the banner or a picture of the buildiing where they do business.... or even a car being worked on. In terms of actual content, you could list testimonials or provide some kind of company motto or even throw up a few more pics. People expect sites like this one to take a little longer to load because they want to see your products. Just don't take advantage of that too much... know when to reduce the images.

    Navigation: On the home page, your nav items are only about 8 pixels high (if I had to guess). When you go to the other pages, they're at least 15, plus they still have the gradient. Not only does it look bad, but it means your coding sucks. You should have 1 menu page that you include everywhere so that you only have to update it in one place. You're using PHP, so take advantage of it.

    Contact Page: Looks better... but you could use a space between the "Required" and the box you're putting it next to. It also wouldn't hurt to redirect the user back to the homepage after a short delay... maybe 10 seconds of displaying the "thank you" (use the PHP header() call). You might also mention that "someone will contact you shortly".

    Select Box: I'm 99% sure you can use both count and length on an array in Javascript.

    Enlarged Pics: Just changing the width of a picture doesn't really help the user. You should really look into resizing the pic to a specific height and width using the GD library (I hope your host has that installed).

    List: Yeah, that's what I meant.


    Something else to pick on: when you hit the "view shopping cart" link, the banner turns red. Consistency would be nice.
  13. I don't have many blank lines, and I think it'd be hard to differentiate between blank lines and comment lines.

    And I'd guess that if you took both of those out, I'd still be above 40,000.

    Alright... I had to know:

    [code]$lines = 0;
    foreach (glob("*.php") as $filename) {
        $thefile = file($filename);
        foreach($thefile as $key => $val){
            if(trim($val) != '')
                $lines++;
        }
    }
    echo "Lines of code: ". $lines;[/code]

    That takes one of my biggest applications from 9474 lines of code to 8630, about an 8.5% drop, which as I guessed, still leaves me about 40000 lines if the ratio is similar in the other apps. Keep in mind that this doesn't remove comment lines.
  14. A few complaints:

    1) as moberemk mentioned, the nav looks awful and changes size depending on what page you're on. Lose the gradient and go with a more pleasent roll-over effect (changing background color, changing border color... something).
    2) Contact page... when there is an error, you should explain what it is and show the form again, refilling non-vital information. It needs work, at best.
    3) If there is only one option in the dropdown, have it pre-selected.
    4) If the "enlarged" picture is the same size as the current picture, don't provide a link to an "enlarged" version.
    5) If you don't have any of a specific item, don't show it to me. Only list parts that you have. Listing a part when you have none of them is only teasing the customer.
    6) Half of your links go to the same page with a different internal link in them. Is it that hard to create seperate pages for each of those items? I don't think your privacy policy belongs on the same page as the shipping info.
    7) You claim it's a secure site, but other than the little lock, which switches between being centered and not in the right column, I don't see any evidence of it. There's no security certificate, you're not using https, and the browser has no indication that it's a secure site..... you don't give me any reason to think that it's secure other than your little logo.

    It's a good start, but it needs a lot of work.
  15. Apparently I underestimated myself. Using Andy's code, I'm showing 44,167 lines of code. And that's only the top level of each application, but it also includes a little over 2000 lines that I didn't write. So if it all balances out, I'd say I've written at least 43000 lines of PHP/JS/HTML in the past year and a half.

    Crazy.
  16. Does anyone know of a tool that could count the number of lines of code in a project or just in a bunch of files on a server?

    I've been working on a number of applications for work that are all web-based and I'm just curious. For example, one of my backend ajax files is almost 900 lines of code by itself. If I had to guess, I'd say I have close to 20,000 - 30,000 lines of code in all the various applications. And I've written 99% of it myself (I'd say .2% is javascript I've found elsewhere and another .8% is PHP that I picked up on here or other places.
×
×
  • 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.