Jump to content

WebStyles

Members
  • Posts

    1,216
  • Joined

  • Last visited

Everything posted by WebStyles

  1. oh man... there's so much redundancy in that script... you're uploading into a structure like this: 'images/$companyname/$materialdir/$prefix$modelnumber.jpg' Are you sure the directories exist and are writeable? (if there was a migration or a server upgrade, sometimes the folders can get their attributes changed)
  2. the time() function will return the number of seconds passed since the 1st January 1970. You can take advantage of that to count the seconds in an easy way: // store the time they last checked for gold: $last_gold_check = time(); // get the time when they check again: $current_time = time(); // number of seconds will be final time - initial time: $seconds = $current_time - $last_gold_check; // update the gold count: $availableGold += $seconds; (or just skip the previous command and do it directly with $availableGold = $current_time - $last_gold_check) (dont forget to update the last time gold was checked after this) $last_gold_check = $current_time; This seems like you're creating an incentive for people to keep refreshing the page... if every time they check for new gold it just adds the seconds from last check, you'll get people hitting the refresh button constantly just to see their gold increase.
  3. I see no problem with that. It's a design decision, and simple approaches are almost always better than complicated ones. If you're confident that using that approach does not allow the user to bypass it in any way, then it's as good as any other solution. Maybe even better because it's nice and simple. It really depends on how everything else is built and if a simple include is enough to properly implement the extra modules.
  4. what mac_gyver is telling you is that you should change your first line (the <form> element) to include a sending method like this: <form action="contact.php" id='contContact' class='container' method="POST"> hope this helps
  5. assuming you want to allow the user to select several results, I would give all the checkboxes the same name (i.e an array) and put the ProductID in the value field. something like this: echo '<input id="selectviewingbutton" type="checkbox" name="selectedProductIDS[]" value=" . $row[ProductID] . " /></td></tr>'; when this get's POSTED to your script, you'll have an array of selected ids inside $_POST['selectedProductIDS'], you can loop through it and get the values with something like: foreach($_POST['selectedProductIDS'] as $pid){ echo $pid .'<br>'; }
  6. I'm guessing you're not a Macintosh user. Since forever Macs have had a different approach to software. In windows, typically, when you close the application's last window, the application will quit, on a Mac it wont. cmd+w closes windows, but to quit the application you need to use cmd+q. I don't own an iphone, but since it's Apple, I'm assuming it works the same way, so whatever js you're using is only good to close windows, not quit the actual application (although in windows it seems to work because the apps auto-quit after last window is closed) Hope this helps.
  7. There's nothing wrong with that. It should open a new window (unless you have javascript disabled or a popup blocker or something). What error are you getting? does it not open the window, or does it not display your file in the window?
  8. sounds like you're talking about photoshop, when you create slices on an image and then export to html...
  9. you can also just try something like addslashes() before inserting into database, and stripslashes() when pulling stuff out.
  10. Why not fetch that info (users name and id, etc...) when he logs in? Then just store in session and use when needed. Sessions can hold quite a lot of information, and it will keep you from having to make a lot of database requests.
  11. honestly, no Idea, as I have never used Amazon's API, but it looks like part of a regex expression, [^@] would return everything that is NOT an @ symbol. (just guessing here, but I hope it helps)
  12. isset($_POST['submit']) is your main condition to trigger the validation block.... I'm guessing there is nothing called 'submit' being sent over... Try changing isset($_POST['submit']) to !empty($_POST) and try again. If it works, you html is missing the 'submit' element.
  13. I would try a JOIN with a GROUP BY... just sayin'
  14. Why would you want to save the text into a word document? Or, here's another way to put it: why a word document? (the solution is just going to confuse you if you're not a developer). if the purpose is just getting the text from the form into a file, for heaven's sake just use a .txt file (word will open it up nicely too)... All you would need would be something like: $var = "Hello " . $_POST['name'] . "!\nYour mail is: " . $_POST['mail'] . "\n"; file_put_contents('filename.txt'.$var); you can even name your text file something.doc instead of .txt...
  15. you could just use a little bit of javascript from within your login script... this way, no matter where they login from, they'll always be taken back to the page they were before... echo '<script>history.back();</script>'; or echo '<script>history.go(-1);</script>';
  16. It depends on what you mean by 'transferring' data... If you want to pass variables from one page to another, you can use $_SESSION to store values, you can write them to a database and read them again on the next page, you can write them to text files, etc... $_GET and $_POST are more widely used for submitting stuff through the browser, like forms a user has to fill in, etc... We could give you a much better answer if you explain exactly what you're trying to do.
  17. Javascript is your best bet to do that, since the selection of 3 (out of the 4) answers is done on the client side (i.e. before he posts the results), and php is a server side language. The 'basic' user almost always has javascript active (or they would not be able to use most of the 'cool' time-wasting sites they frequent, like facebook, twitter, instagram, etc...) Without javascript, your option would be to update/refresh the page after every vote, which is silly and painful for the user. If you still want to have a safeguard for people with disabled javascript, just do both versions, and redirect them accordingly.
  18. you could write the same thing like this: <?php if (!empty($error_message)) { echo '<p class="error">' . $error_message . '</p>'; } ?> Whoever wrote that code is just trying to keep html code out of the php tags.
  19. That script works fine (just tested on my server). Maybe it's an smtp problem?
  20. From what I understand (I did not read your code), you're trying to move data from one server to another, but you're selecting specific content and also changing some fields? I would create a table called 'oldDump' or something and import the whole thing (like thorpe suggested), then do a script to clean it up before copying to new table. I guess it depends on how many records/database size we're talking about. is it in the 'many millions of records' category?
  21. Just a suggestion: This also sounds like the website is doing some sort of IP based check, and since you're all using the same network, chances are you all arrive with the same router IP.
  22. maybe the database field cannot take such a value? (just a suggestion, but if your database field type is set as INT, for example, and you try to insert characters, it will not work)
  23. the or die() should not be included in the query.... try changing this: mysql_query("INSERT INTO weekly_picks (t_id, tournament, user, player, backup, timestamp) VALUES ('$t_id', '$tournament', '$usr', '$golfer', '$backup', '$time') or die('Error, insert query failed')"); to mysql_query("INSERT INTO weekly_picks (t_id, tournament, user, player, backup, timestamp) VALUES ('$t_id', '$tournament', '$usr', '$golfer', '$backup', '$time')",$link) or die('Error, insert query failed');
  24. to replace, you should not use <php? (proper sintaxe is <?php, but you'll also need an echo.) <?php echo $_SERVER['PHP_SELF']; ?>
×
×
  • 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.