Jump to content

roopurt18

Staff Alumni
  • Posts

    3,746
  • Joined

  • Last visited

    Never

Everything posted by roopurt18

  1. I thought Google Ads took care of banners and targeted the audience for you...
  2. Have content that people are interested in. Whatever ads software you install should target the correct audience itself.
  3. How is the field Timestamp declared?
  4. I want to add that it is possible for people to view the content of your scripts if you program carelessly. As long as your server is configured correctly, it will be impossible for someone to see your PHP source with a request like: http://www.yoursite.com/file.php However, let's say you had files in the directory: /home/usr/downloads/ And you had a script downloads.php located at: /home/usr/public_html/downloads.php downloads.php <?php $fp = fopen("/home/usr/downloads/" . $_GET['file'], "r"); if($fp){ // Change headers to reflect the type of file about to be sent fpassthru($fp); fclose($fp); $fp = null; exit(); }else{ echo "Error opening file"; } ?> So if you had a file: /home/usr/downloads/cool_song.mp3 Someone may download it with: http://www.yoursite.com/downloads.php?file=cool_song.mp3 However, since your downloads.php fails to properly authenticate requests and determine if a user actually has access to the file, someone could do this: http://www.yoursite.com/downloads.php?file=../public_html/database_credentials.php Now the file being sent to the person making the request is the PHP file containing your database user name and password. Since the file is being opened and dumped by the PHP script and not by the web server, the visitor will see the actual file contents. Always authenticate, validate, and filter user input.
  5. I'll take a guess that it's because you didn't enclose $customerinvoice in single quotes.
  6. I made a thread about reporting some time ago and the issue has come back to haunt me. Doing some research I came across the BIRT, which is part of the eclipse project / foundation (not sure on the proper terminology). I only have shell access to my VPS (hosted by serverpowered) so I can't really design the reports on the machine where I'm intending to run them. The scenario I'm shooting for is to be able to design the reports on my local PC and then upload the report to the server. I found a portion of the BIRT documentation that talks about generating a report from PHP as long as the report XML file is hosted on the same server. This leaves me with the task of installing BIRT on the VPS and that's the part that is totally over my head. Here is the BIRT installation page: http://www.eclipse.org/birt/phoenix/build/ Here is a list of their download options: http://europa-mirror1.eclipse.org/birt/downloads/build.php?build=R-R1-2_2_0-200706261010 I'm wondering if someone patient can help me as this requires a bit more knowledge than I have!
  7. I think as a contract programmer your responsibilities lie in making sure that the files aren't freely available to anyone via URL manipulation and that whatever payment method you go with is secure. I think it's really up to the site operators to dictate in what fashion of serving the files is legal and optimal. Of course, sometimes things are suggested that are technically impossible or require a "clumsy" implementation so they get ruled out. I'm personally curious to the development of this as I've not ever dealt with handling payment transactions via the web but I foresee myself having to tackle this sort of problem in the next year or so.
  8. I just wanted to add that I love music. I listen to it all the time while programming. I also spend hundreds of dollars every year online. To date, the amount of money I've spent online buying music: $0.00 (No I don't download illegal music; the last song I downloaded was when Napster was still free.) I don't spend any money on online music because of the hassles and restrictions the RIAA has inflicted on consumers. It's ridiculous that I should buy a song and not be able to play it in any device that I own due to encoding / protection crap. If I bought it, I own it, so let me use it.
  9. I understand this. What I meant was if the site you are making is for a specific band or artist and it's that person's music you're distributing, they can dictate the rules. If it's a general online store then you just have more rules to follow. My suggesting was to figure out which legal rules you had to follow before you did any programming. I agree. I think distributed software is a bad example to bring into this discussion. True, if I lose my Windows key I have to buy another. But if my computer gets wiped out and I still have my CD stored away, I can still re-install and be on my way. A hassle but I know before hand that it won't cost me additional money. This is not true of music that you are allowed to download once and only once. You are placing an extra burden on the consumer to make it their responsibility to have a physical copy; people spending money don't want burden, they want an enjoyable experience. If I go to your music shop and am told up front that I can download music I purchase only once; I'm not going to buy anything. First, if I wanted hard copies of my music lying around all over the place I'd go to the music store, but instead I went to your online shop. Second, I know that if I purchase $100 in music over the course of a year, get a virus, and have to re-install my OS that I now have to spend $100 again just to get the music that I own. From my perspective I've given you a lot of my money, been a good customer, and am now being told to "Bugger off." Also, there's the point that if people can only download a file once that it just opens up the opportunity for more support calls. "Hello, I was in the middle of downloading a file and my [connection dropped | browser crashed | 3 year old hit the power button | etc]. Now it says I have to pay for it again?"
  10. You can't stop people from sharing the music with their friends, period. Even protected music can be shared easily. Say you download some songs on iTunes, they're protected, they only work on your PC and iPod. Right up until you burn them on CD, give them to your buddy, and he rips them back to MP3. Blammo! Unprotected music. I think you'd be better off looking into what the law states are your responsibilities in terms of serving music. If the music you're selling is owned by the people that own the site, then I'm pretty sure they can dictate the rules. If you can get away with it, I'd just keep track of who purchased what and provide them with a page where they can return to download it any time they want. One PC game that I played allowed you to purchase small add-ons for cheap from the companies online store. When you purchased the add-on, they sent you an e-mail with a link that was valid for 48 hours. That might also be an option worth exploring. If you're hell-bent on determing when the download completes, you might look into some sort of Java applet.
  11. Believe me, I didn't know what to expect when I majored in CS. I didn't know anyone that had done it before me who could tell me what to expect. Entering college, I thought I was already a good programmer but the truth is I didn't know crap. Computer science is exactly what the name says, the science behind computers, not just programming. If you're good at what you do you won't have to worry. With a few exceptions, I think most business majors are retarded; probably 50% of students that enter college expecting a degree in computer science graduate with business. Remember that the degree is really just for landing your first job. After that its what you know, who you know, your attitude, and your own personal talent that carry you through life.
  12. You can prevent 90% of all security problems if you distrust your users. That is to say filter everything you accept from them and be wary of any user input you later redisplay to the same (or other) users. You can read the PHP manual entries and the following user posts for the following functions to gain a head start: mysql_real_escape_string addslashes stripslashes striptags htmlentities Also, follow common sense rules. i.e. if you allow users to upload files and later delete them, make sure that when a user requests to delete the file that they are in fact the one who uploaded it! Stuff like that! I'd say more but laziness is getting the best of me.
  13. Aureole: You have just incurred the wrath of several people that browse these forums. Luckily for you, I have cemented your statement within my own post lest you decide to edit yours! Buahahah
  14. Let's say you don't want the file db_details.php to execute unless entry.php has been included or ran. The typical solution most people use is some thing like: entry.php <?php define( 'ENTRY_POINT', true ); // Rest of file follows... db_details.php <?php if(!defined('ENTRY_POINT')){ exit(); } // Rest of file follows... ?> This prevents someone from trying to access db_details.php directly through something like: http://www.yourdomain.com/hidden/path/db_details.php This method has the drawback that you have to add code at the top of every single file to prevent it from being accessed. The path hidden/path would have to exist somewhere inside of your public_html or www directory for this to work though. If instead you have a directory structure like the following: /home/usr/hidden/path/db_details.php /home/usr/public_html/index.php Now that the path to db_details.php is no longer web accessible, you prevent direct access to it without having to add extra code at the top of all your files. index.php can still access the file though: <?php // index.php include(dirname(dirname(__FILE__)) . "hidden/path/db_details.php"); ?>
  15. You're young so I'll give you the same best advice I got when I was young. It's important to do what you love. Whatever career you pick, you have to be happy with the potential possibility that you'll have to get up 5 days a week, commute in traffic, and do whatever it is for 8 hours before you commute home in more traffic. While this scenario is becoming less common due to technology, it would be rare for you to land a high-paying telecommuting job either directly out of college or without any formal education. Here are some criteria you can use to determine if you'll be a good programmer: * You like to solve problems * You think logically * You can break complicated tasks into simple steps * You have good communication skills * You pay attention to detail * You are constantly striving for improved efficiency Notice that nowhere in that list do I say you have to be a math whiz or know 10 programming languages. A freelancer with a good reputation can get by without any formal education or training. If you want to work at a company, it is only becoming more common for companies to require a degree and experience, although some will still accept upwards of 4 to 5 years of experience in place of a degree. Your best bet is to get at least a Bachelor's as suggested frost110. If you want to have your bases covered in terms of programming jobs, you should major in Computer Science. You do not need to be a computer science major to be a web developer, but if you want to be a programmer but are no longer interested in web development you'll need that degree. For example, 5 years of web development experience typically doesn't mean crap if you decide you want to program video games or embedded systems at Boeing. I work at a company that designs software for home builders in the United States. It's a small company, I handle our web product that interfaces with another server product that we sell. My primary job functions are to expand and support a site written primarily in PHP and MySQL, although I've been introducing more and more Javascript (AJAX) into it. I'm also responsible for communicating with our clients that use the site and I do a bit of server configuration, although the hosting company handles most of it. The nature of my work means I'm always working on the same website and there is really no end to it until we release a new product and abandon this one. Frost: I'll agree that most of what you have to endure in school is bullshit but learning to deal with it is invaluable. I say this because I don't know about you guys, but I work in a small office environment and I still have to withstand colossal amounts of it. Dealing with college bullshit is good practice for dealing with it in the corporate world; I think that's why so much of it is introduced into college curriculum. Frost: This statement is only partially true. Classes that teach you how to program in a specific language suck and are a waste of time. Basically, you can tell if you'll be a good programmer if you can learn as much from a good book on PHP as you could by taking a course on PHP. However, most colleges only introduce a single language to their starting CS majors and then introduce larger programming concepts through that language. For example, when I want to college we learned C in the first programming class; already being familiar with C++ I coasted through it. However, the next class was all about abstract data types; we created linked lists, queues, priority queues, binary search trees, hash tables, performed some simple algorithm analysis, etc. All of that stuff is pretty easy to implement but that was just the second class, an undergraduate class mind you. Here's what it all boils down to. I can learn any programming language on my own through a book or tutorials; I could do this before I ever went to college. It wasn't until I went to college that I learned about higher level programming concepts and it's that part of it that sets you apart from the crowd.
  16. Most likely they're using mod_rewrite. You could accomplish the same thing with sessions and redirects but it'd just be messy.
  17. The above poster is correct, I just wanted to ask what was wrong with the built in string-reversal function? http://www.php.net/manual/en/function.strrev.php
  18. function my_round(num, dec){ dec = dec === undefined ? 2 : dec; if(typeof num == "number" && typeof dec == "number"){ return num.toFixed(dec); } return Number.NaN; } function calculate_a() { var elems = document.forms['work_order'].elements; var total_a = 0; for (var i = 0; i < elems.length; i++) { if (elems[i].name.indexOf('number_a') !=-1) { total_a += +(elems[i].value); } } elems['totals_a'].value = my_round(new Number(total_a)); }
  19. <?php // Following is a single item array as it has a single item. $singleItemArr = Array( 5 ); $arr1 = Array(); $arr1[] = 1; $arr1[] = 2; $arr1[] = "Three"; $arr2 = Array(); $arr2[] = Array("hi", "bye"); $arr2[] = Array("there", "here"); $arr2[] = Array("us", "them"); // $arr1 and $arr2 are both arrays and neither of them is a "single element array" // There is NO REASON you can't do the following: echo "<pre>" . print_r(shuffle($arr1), true) . "</pre>"; echo "<pre>" . print_r(shuffle($arr2), true) . "</pre>"; ?> I'm making a point out of this because you seem to think there is a difference between an array where each element is a single string, integer, etc. and an array in which each element is another array. Even though an array can and usually does represent multiple values collected together, an array as a whole represents a single value just like any other string, integer, floating point value, etc. Anyways, I think the problem is narrowed down to you want display the elements of an array of size N in random order but you are getting confused by your template engine. Like I originally stated, I don't have much experience with templating engines and you are also using one developed in-house, so it's even harder to get support for it. Here is what I do know. Most templating engines provide a way of performing logical tests and looping. Most of them do not provide any mechanism to call PHP functions because it is easier to do that from outside the templating engine to begin with. So trying to put the logic of randomizing your array of arbitrary length into the templating engine is a no-no. Before you go on, you should find out if your template engine supports looping within the template.
  20. Definitely clear as mud. Given your syntax of [var.$Top.idx.dealer] in the template, where idx represents one of the possible array indexes (0 through 8 ), are you saying you want the index chosen by the template engine to be random? You do have a clear understanding of the differences between associative and numeric arrays and why the [] operator behaves as it does?
  21. $Top[] = BuyNow(85, 'dealersite.com'); Are you saying that you want the 85 to be a random value?
  22. ...but for now we'll need a warehouse. http://money.cnn.com/news/newsfeeds/articles/prnewswire/AQM07923072007-1.htm
  23. PHP scripts executed through your web server (aka Apache) are executed on every request, which is to say they are executed every time someone visits the page. Also, different people will see a different order, even if they somehow managed to make the requests at the same exact instant. If you want something to run on a schedule you have to look into cron on linux servers and windows scheduler on windows servers. If you're building a ranking system, which it appears you might be, you can do this in one of two approaches. In terms of computational power and complexity, if it's "easy" to calculate the page rankings, you can do it in real-time on every page request. For example, let's say your site manages a league for 100 users. You have a page that displays users' rankings in comparison to each other. If your chosen algorithm to calculate rankings finishes in less than (picking an arbitrary value) 2 seconds on average, then you can probably do your calculation on every page request. This means every time someone visits the ranking page, they have to wait an extra two seconds but the rankings are always up to date. On the opposite end of the spectrum, let's say your site grows to 10,000 users. In this scenario, you discover that your ranking algorithm now takes an average of 3 minutes to execute; this is far too long to be done on every visit to the page for every user. You now have two choices: 1) You can try and optimize your ranking algorithm. Perhaps by refactoring code or changing some of the database mechanics, you can get your algorithm to finish in that acceptable two second time span. 2) You can use cron to schedule the ranking algorithm to execute on a timetable, like every hour, every half hour, every 8 hours, etc. The cron job (as we call them) saves the computed rankings elsewhere in the database. Now you modify your regular rankings page on the site to pull from the computed rankings table, which should be almost instantaneous. The downside is now users don't have up to date rankings, but are viewing data that was calculated some time ago. It is always better to try option 1 first. I say this because in some scenarios you can get a 3 minute process down to less than a second by being clever. However, let's pretend the best you could accomplish is to get the script from 3 minutes of execution time down to 45 seconds. Well, 45 seconds is still too long to serve in a web browser, so you will have to set up a cron job anyways. The difference is your cron job will execute in 45s as opposed to the original 3 minutes, and it's always a good idea to cut down on computation time (especially in busy sites). I'm not sure what you mean by this. It is only meaningful to shuffle an array that has contents so you would naturally shuffle the array after you have loaded data into it.
  24. We have two of the Professional VPS packages for my work, one managed and the other unmanaged. The managed one is for our live server; I use the unmanaged one as a development server. Both of them have CentOS. I'm able to have root access to the unmanaged server so I can test out different PHP and apache settings; I have to request for those changes to be made on the managed server. My employer was getting reamed on the previous hosting plan we had; he was paying almost $1500 / month in hosting fees for unlimited disk storage and bandwidth but the site itself, when I was hired, used less than a GB of disk space and rarely over a couple of GB of bandwidth per month. We now have significantly more clients, still use barely any disk space / bandwidth, and have cut our hosting fees from $1500 / month down to $170 / month for two servers and better service. The only minor gripe I have is that the unmanaged server occasionally runs out of memory. I'm not sure if it's because of something I've mis-configured or what, but usually logging in as root and restarting apache helps. Also, while 512MB may seem like a lot of memory, both of our servers tend to coast around 100 to 120MB of free memory. I'm not really sure where the other 400MB is going to, but since we don't experience any downtime that I can attribute to running out of memory I've never looked further into it. I could be wrong, but I have a gut feeling that the managed server may also experience memory problems that are resolved automatically because it's a managed server, thus I'm never aware of them. Overall, I'm a happy customer.
  25. http://www.w3schools.com/tags/tag_input.asp http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_checkbox http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_radio
×
×
  • 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.