Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. You could just use a CMS system, simple or complex your choice. Since you are not selling the product, that should workout just fine. CMS ( Content Management System). Look into those.
  2. Reminds me of the movie hackers.... GOD is the number 1 password used, how dumb is that. lol
  3. LIMBO!!!! AHHHHHHHH!!!
  4. The key here is that, <?php will always work (unless something changes). Where as <? will not always work. Go with the sure thing and save yourself future headaches.
  5. You want to look into AJAX.
  6. Was it an XSS exploit or a server hack? Just out of curiosity, was it a flaw in the new SMF code?
  7. I am not sure of this in PHP5, but I had that setup in my scripts in PHP4 and it was amazing at how much slower the script ran by passing in the objects. I actually had a "Main" method where I would instantiate an object/return it if called, so only one instance of the object was created, but for whatever reason it slowed it down a ton. Since, this was for PHP4, I created functions, it would still only instantiate the class on a first call, but allowed for that to be used throughout any class, and it worked well. As far as this on PHP5, I have no clue of the side-effects. Just thought I would share my PHP4 experience with that scenario of including the class with the constructor or parameter.
  8. Assuming that this is using MySQL, not unless you want to add a huge overload to your server. My suggestion is do not display the id, instead put a counter in the loop to show them as "1-5" and you do not have to worry about this problem. To do it with MySQL, you would have to dump the current data, delete the table, recreate the table then re-input the data to the table, which as stated, too much of a load on the database server.
  9. Most likely the issue is the Charset. I am not sure what charset you are displaying your page in, maybe try using the charset from that page or UTF8.
  10. 24 now, so 5 years ago. As for COL, I did not have that issue. I lived with my parents until I was 20, so COL did not matter (free rent), at which I got a job that paid $40k/year and moved on with my life. But I was wise with money and saved it up, so when I moved out I had first and last months rent paid, plus $4g in savings, which helped for when I bought my house a couple years later.
  11. As iterated above the teacher is always right, whether it is inefficient or not. I started out in College coding properly, but I was getting marked down for it. I improved my relationship with the teacher, and I just learned to follow the directions, do not go overboard and try and be fancy by adding extras. Do what it says, nothing more nothing less. Eventually on my 3rd semester my teachers realized I had the skill and stopped marking me down for doing a bit extra and actually omitted me from going to class, instead they would email me the assignments and I just had to show up for test days. Of course that was a small community college, so they knew who I was. I do not think that would work at a university as you probably get different teachers each go round. I actually think they stopped checking my assignments and just gave me an A, my last 3 semesters of college I had a 4.0 lol. But initially, I had to obey their strict rules until I built up the relationship
  12. Yep in this economy in the states, be grateful for what you have right now! It could always be worse. As far as the $10, thats about what I started out at (actually $15) but the owner really liked that I could keep up with him when he was doing stuff and decided after 1 month to go from $10 to $15, plus unlimited overtime. I was working about 70hours/week which was good money at 19 (which was when I got my first programming job full-time). Since then he taught me a ton about coding and efficiency, I actually would be a bum coder today without that job. When I left him he offered to make me a partner, but I needed the security that he could not provide me, unfortunately.
  13. Your best one is reading the PHP Manual anytime you say, "I wonder if I can do this?" or "Is this possible". Search the manual, chances are there is already a function for it and examples of usage. Like just there you learned implode with usage of $_POST and how to properly display MySQL data. If you notice at the mysql_query and the mysql_fetch_assoc man pages, you can see that there are examples of proper usage for that, which might have helped you. If all else fails try googling for a tutorial of what you would like done. As a final resort, after trying to code it, ask here for help. We will surely point you in the right direction as long as you have at least put effort into trying to make it work. EDIT: I would however read up on MySQL and 3NF (3rd normalized form), as it will teach you proper database structure and usage.
  14. PERL will always be there. It is an awesome and powerful language. It is worth while to learn PERL, at least in my opinion. It depends on how you are trying to get a job/what state you live in. When I started out as a junior developer I was making $15/hour, but that was in Wyoming, which $15/hour is quite a bit of money for there. Right now my DB services I charge $50/hour to design a DB. $40/hour to code PHP/HTML/JS but I also do this as a "side" job. If I was doing this full time I would try and get in with a company on a salary basis. Starting salary I would say is probably an average around $50k per year for coding. If you up to a project manager/dba you get quite a bit more than that. But you have to have the proper degrees and or have worked with the company long enough for them to promote you. But it all depends on the developer. Most of my clients know I am worth that money for extensive tasks cause I will deliver and I have a great reputation with them. But I started out charging them a bit less than that just to get my foot in the door. Once I was in, they want to keep me happy when I code for them to keep on staff as a contractor. They pay their code monkeys the lower wages to code the easy stuff That is my take anyhow from my own experiences. It all depends on the company, if they make enough money to fund you and how you have represented yourself to that company in the past. EDIT: I should note, I do code for smaller business websites that do not make much money and only have 1 part time coder on staff. For them I generally go down to $20-30 cause I know they cannot afford it and I am thankful for their business, so yea. If I did not need a "guaranteed" job and medical benefits I would so go private and make a ton more money. But a last I need the security and benefits, so IT Tech Help is the job for me. I am just glad I am allowed to do side work, really helps out
  15. Well I am a complete moron: <?php $con = mysql_connect("*******","*********","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("metropo_artrequest", $con); // test if the form was submitted if (isset($_POST['Submit'])) { // it was, see if any checkboxes were checked if (isset($_POST['idval']) && is_array($_POST['idval'])) { // there was, let's implode the array to format it for SQL insertion using the "IN" keyword. $ids = implode(", ", $_POST['idval']); // fixed here. $sql = "UPDATE artrequests SET `invis` = 'true' WHERE id IN({$ids})"; mysql_query($sql) or die("ERROR IN SQL: {$sql}\n Mysql Returned: " . mysql_error()); echo mysql_rows_affected() . ' rows have been made invisible!'; } } ?> Try that and see if it works. Basically I was not calling the post array like I should have been, which was the issue.
  16. Already being discussed, it was asked earlier: question about the future of php As far as my take, yes, unless something better comes along. EDIT: The rage from the .NET is that .NET is closed source, Microsoft owned, so you have to pay for the OS to run it, and the .NET software to code it. Also, as far as XP is concerned, Home cannot run IIS as it does not come installed, so you would have to pay more for "Pro" to run IIS. PHP is open sourced, can run on multiple environments, Linux, Mac and Windows. It is free, with Apache to run it. This is ideal for small businesses, and even corporations who do not want to have to pay extra for a CD-KEY or even just the .NET studio to have a developer code their site. That is the major difference between the two. .NET studio can be nice, and it can be helpful with the debugging engine etc it has, but it is Microsoft, and you do have to pay to use it.
  17. Typo on my part: mysql_query($sql) or die("ERROR IN SQL: {$sql} \n Mysql Returned: " . mysql_error()); Replace that in the dbenter file, I did $sq, instead of $sql. The form looks good.
  18. Let's try this out and tell us the error: <?php $con = mysql_connect("*******","*********","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("metropo_artrequest", $con); // test if the form was submitted if (isset($_POST['Submit'])) { // it was, see if any checkboxes were checked if (isset($_POST['idval']) && is_array($_POST['idval'])) { // there was, let's implode the array to format it for SQL insertion using the "IN" keyword. $ids = implode(", ", $ids); $sql = "UPDATE artrequests SET `invis` = 'true' WHERE id IN({$ids})"; mysql_query($sql) or die("ERROR IN SQL: {$sq} \n Mysql Returned: " . mysql_error()); echo mysql_rows_affected() . ' rows have been made invisible!'; } } ?> Replace that then run it again and report back the error. I have a feeling it has to do with an element of the id array being empty. While you are doing that, view the source on the created page and make sure the value of the checkbox contains something, if not we may have to revisit that portion too.
  19. One, queries use single quotes, not double: $sql ="SELECT * FROM tiny WHERE TinyUrl=\"$t\""; Should be $sql ="SELECT * FROM tiny WHERE TinyUrl='$t'"; That will cause an error. Two, it seems as though you expect more than 1 item returned, but you are only using the last item, try this: $sql ="SELECT `FullUrl` FROM tiny WHERE TinyUrl='$t'"; $query=mysql_query($sql, $link) or die("ERROR IN SQL {$sql} \n Mysql Reutrned: " . mysql_error()); $uri = mysql_result($query, 0); Change those items and see if it works.
  20. Are you using the latest jQuery? I know Javascript and ajax are a pain in the butt to code/debug. It could be 1 minor thing that does it, and that is all it takes. Such as making your button post twice on accident, I have done that before. Well hope for the best.
  21. Show the portion where you insert data, and I would be glad to help you fix that issue.
  22. Yea, I have a habit of saying stuff in the wrong way. I guess it all depends on the person, I started out that way, and I feel that it made me a better coder because of it. When I started coding PHP, I never had the "register_global" security issues, cause I already had a habit of defining my variables before I used them. Etc and so on. It is not the language that promotes bad coding practices, it is the learning material/lack of knowledge. I do have to say, since I only worked with Oracle as a standalone before I coded PHP/MySQL that I had no clue about the mysql_real_escape_string issues, and thus I left it off most of my first PHP programs, until I learned about it. Well yea, that is just my opinion on the subject, it did help me thwart certain bad habits, which I see every day, with people trying to write PHP code, but since it was a completely different language it did not help with everything other than the basic logic and concepts. So really it depends on their needs and where they want to go Sorry, I do that all the time, my wife hates that about how I talk with her lol. It all makes sense in my head! As far as personal experiences go, I was glad I started out with C++ and Java as appose to just jumping into PHP.
  23. It should not break the ability to connect to mysql, it should just add on to that feature. Are you removing the mysql portion when you recompile it? EDIT: Thinking about it, does oracle use the same port as mysql? If so, try changing your local mysql port to something different and see if that works.
  24. You want to alter the table, add "id" as a primary key INT auto_increment value and it should fill it in. This will allow for you to modify certain rows, without that you really cannot tell which row to modify. This will automatically fill itself in when inserting any data. In the original code you just had $invis, which was not being set anywhere. Anyhow a few alterations to my code above: <?php $con = mysql_connect("*******","*********","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("metropo_artrequest", $con); // test if the form was submitted if (isset($_POST['Submit'])) { // it was, see if any checkboxes were checked if (isset($_POST['idval']) && is_array($_POST['idval'])) { // there was, let's implode the array to format it for SQL insertion using the "IN" keyword. $ids = implode(", ", $ids); mysql_query("UPDATE artrequests SET `invis` = 'true' WHERE id IN({$ids})") or die(mysql_error()); echo mysql_rows_affected() . ' rows have been made invisible!'; } } ?> And: <?php $con = mysql_connect("*******","*********","******") or die('Could not connect: ' . mysql_error()); mysql_select_db("metropo_artrequest", $con); $result = mysql_query("SELECT * FROM artrequests WHERE invis = 'false'"); // modified this to be the literal false, not sure if this is correct or not. echo "<form method=post action=dbeditor.php> <table border='1'> <tr> <th>Design Number</th> <th>Color</th> <th>Quantity</th> <th>Due Date</th> <th>Description</th> <th>First Name</th> <th>Email</th> <th>phone</th> <th>Greek</th> <th>School</th> <th>State</th> <th>Timestamp</th> <th>Post to Filemaker</th> </tr>"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>" . $row['designnum'] . "</td>"; echo "<td>" . $row['color'] . "</td>"; echo "<td>" . $row['quant'] . "</td>"; echo "<td>" . $row['duedate'] . "</td>"; echo "<td>" . $row['desc'] . "</td>"; echo "<td>" . $row['fname'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['phone'] . "</td>"; echo "<td>" . $row['greek'] . "</td>"; echo "<td>" . $row['school'] . "</td>"; echo "<td>" . $row['state'] . "</td>"; echo "<td>" . $row['timestamp'] . "</td>"; echo "<td><input name=\"idval[]\" id=\"invis2\" type=\"checkbox\" value={$row['id']}></td>"; // this assumes that you do have a unique identifier column called "id" echo "</tr>"; } echo "</table> <input name=Submit type=submit value=POSTED></form>"; // the ending to the form so it can be submitted. ?> Hopefully that helps you out a bit more, as CV said (And I iterated above) only select the data you want in the query, this saves coding time and processing time.
  25. <?php if($_POST['Submit']){ $open = fopen("test.txt","a+"); $text = "Left\n"; fwrite($open, $text); fclose($open); header("Location: {$_SERVER['PHP_SELF']}"); } echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">"; echo "<input name=\"Submit\" type=\"submit\" value=\"Left\" />\n </form>"; ?> That should fix it. Given your code, it seems as though you have register_globals turned on. I would suggest turning them off. For more information see http://www.php.net/register_globals
×
×
  • 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.