Jump to content

theycallmepj

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Everything posted by theycallmepj

  1. I should have thought of that.....haha Thanks for the help
  2. Depending on what number is inputed, some numbers will come out positive and some will come out negative. I want each a different color.
  3. Here is the main part of a page I have. The person puts in a number, and this puts out a bunch of numbers. Is it possible to show negative numbers red, and positive numbers blue? How would I do that? <? //If the submit button has been pressed if (isset($_POST['submit'])) { /* Definitions */ $salary = $_POST['salary']; $hundred_percent = 274.13; $sixty_percent = 164.48; $pit = 0.011; $pit_amount = $salary*$pit; $difference_hundred = $hundred_percent-$pit*$salary; $difference_sixty = $sixty_percent-$pit*$salary; /* End Definitions */ echo "<br /><table width=\"360\"><tr><td>"; echo "The Company recommends a PIT at a minimum exclusion of 1.1%."; echo "With your salary level of <b>$$salary</b> you can expect to remit a personal income tax of <b>$$pit_amount</b>."; echo "With a 100% tax collection, as a homestead eligible household, you will recieve a property tax reduction of <b>$$hundred_percent</b>, a difference of <b>$$difference_hundred</b>."; echo "With a 60% tax collection rate, you will recieve a tax reduction of <b>$$sixty_percent</b>, a difference of $<b>$difference_sixty</b>."; echo "</td></tr></table>"; } ?> <form action="eit.php" method="post"> <p> Salary:<br /> <input type="text" name="salary" size="20" maxlength="40" value="" /><br /> <i><b>Do NOT put dollar signs, commas, spaces, etc...The only things allowed are numbers and decimal points</b></i> </p> <input type="submit" name="submit" value="GO!" /> </form> Thanks
  4. Thanks That worked!! I did your test and at first it didn't work, but I had to change in the apache configuration file to AllowOverride ALL After that, the test worked great, so it seems to be working. Thanks
  5. Thanks for the help Is there a way to do it site wide, instead of putting that script in the pages of the applications on my website I read something that it can be done with a .htaccess file. I haven't done much with .htaccess files, but I have seen if you put: [i]php_flag register_globals off[/i] in a .htaccess file it should turn it off. Is there a way for me to test that? If I put the .htaccess in the root of the website directory, will it cover the entire directory recursively? Or do I have to put that file into every directory within the root of the website?
  6. I have a few sites on my web server. From what I understand, having register_globals turned on is a big security risk. I have a site that is coded to use register_globals, and we currently don't have the time to re-write the entire things so it works with register_globals off. This site is secure, you need to log in using SSL to access it. The other site is not secure, and does not need register_globals to be turn on, but has several applications are vulnerable because it is turned on. We have had people drop email bombs on our server due to this being on. My question is, is there a way to have register_globals on for one site, and off for another? Thanks -Paul
  7. I am trying to make a secure site with virtual hosts when I type into the address bar [code]http://somewebsite.com:443[/code] It brings me to the page I want to see but when I do [code]https://somewebsite.com[/code] The browser gives me an error, I've tried this on several computers. Thanks -Paul
  8. How would I go about setting a loop up instead of if and else statements
  9. [!--quoteo(post=368131:date=Apr 24 2006, 04:05 PM:name=rab)--][div class=\'quotetop\']QUOTE(rab @ Apr 24 2006, 04:05 PM) [snapback]368131[/snapback][/div][div class=\'quotemain\'][!--quotec--] It still doesnt work? Try $_COOKIE['screen res']; [/quote] Yes it works, if the user has cookies enabled, it works great. But if the user has cookies disabled, it keeps trying to find a cookie when there isn't one, and if there isn't a cookie, then it tries to set one, but if the user has cookies disabled then it can't set a cookie, then the script keeps repeating its self. Like an infinite loop I need a way to make it so when the user has cookies disabled, it will set $screen_res to 1024. I don't know if there is a script to detect that, or a script to make it only loop 3 times and then just set $screen_res to 1024.
  10. Sorry, I have all the brackets correct in my web page, I missed it when I copied it to here
  11. I have set up this script to change the size of an image on our website, the size of the image depends on the users screen resolution width. The script first looks to see if there is a cookie set, if not it runs this java script. The javascript detects the screen resolution, sets a cookie, and then refreshes the page. It sets a cookie so the page does not have to refresh every time the user visits the page. [code] <? if(isset($HTTP_COOKIE_VARS["users_resolution"]))         $screen_res = $HTTP_COOKIE_VARS["users_resolution"]; else //means cookie is not found set it using Javascript { ?> <script language="javascript"> <!-- writeCookie(); function writeCookie() { var today = new Date(); var the_date = new Date("December 31, 2023"); var the_cookie_date = the_date.toGMTString(); var the_cookie = "users_resolution="+ screen.width; var the_cookie = the_cookie + ";expires=" + the_cookie_date; document.cookie=the_cookie location = '/'; } //--> </script> <? } Some Code.... //Script that takes the users screen width and displays image accordingly if ($screen_res < 1024)//If the screen width is less than 1024 this will shrink the image {   echo "<center><img width=300 src=\"random/rotator.php\"></center>"; } else { //This is for screen widths greater than 1024   echo "<center><img src=\"random/rotator.php\"></center>"; } ?> [/code] My problem is, if a user has cookies disabled, the page just keeps refreshing. Is there a way where if it refreshes three times it will set [code]$screen_res = 1024[/code] Thanks
  12. Here, I added the months and years so it should all work now [code]<? // Change to the name of the file/directory $last_modified = filemtime("images"); $ddate = date("d"); $mdate = date("m"); $ydate = date("y"); $dmod_date = date("d", $last_modified); $mmod_date = date("m", $last_modified); $ymod_date = date("y", $last_modified); $diff_date = $ddate - $dmod_date; if ($diff_date <= 5 && $mdate == $mmod_date && $ydate == $ymod_date) { echo "<font color=red><b>NEW PICTURES!</b></font>"; }else { echo "No New Pictures!"; } ?>[/code]
  13. That makes sence, thanks, I'll work on putting the months in
  14. I figured out how to do it! I have it so it takes the number day out of the date and then subtract today's date by the modified date [code]<? // Change to the name of the file/directory $last_modified = filemtime("/var/www/html/image_gallery"); $date = date("d "); $mod_date = date("d ", $last_modified); $diff_date = $date - $mod_date; if ($diff_date <= 5) { echo "NEW PICTURES!"; }else { echo "No New Pictures!"; } ?>[/code] It seems to work good.
  15. I found a way for php to check the date on when a directory was last updated, and the directory does update every time a file is modified or added. [code]<?php // Change to the name of the file/directory $last_modified = filemtime("images"); // Display the results // eg. Last modified Monday, 21st March, 2006 @ 03:32pm print "Last modified " . date("l, dS F, Y @ h:ia", $last_modified); ?>[/code] Now my question is, how do I take the information that is outputed by that and make an if/else statement? I want to be able to output an image or text "NEW" if the date is newer than 5 days, and if it is older than 5 days, I don't want it to output anything. Any ideas on how I could do this?
  16. Is there a short php script that can look at the date of when a directory was last edited? On our website, we have a home-made type photo gallery, and I want to be able to have the text "NEW" next to our photo gallery link every time new pictures are put in, and I want that link to be there for at least 5 days. I figure that a script that checks the date on a directory would be a good start.
  17. I know this is possible, I would like to know if I could take a php script that would pull data off our mysql database, and turn it into some form of xml. Our website has several news sections on it and we would like to turn them into xml files, for the purpose of letting other websites put our news on their site, or many other programs use xml. Our news is set up in two database tables, the first table contains all the news which has several fields, one field is used for the "news id" (each news item has its own id number), there is a field that contains the title of the news item, there is a field that contains the body of the news item, there is a field that contains the category of the news item (we have several places on our website that have there own separate news, the categories are numbered), we also have two fields for the date the news item was entered, and the date the news item expires. The second table contains all the news categorys which has a field for the category number (same number used in the above table), it has a field for a short name for the news category, a field for the long name, and a field for a description. ( Long Name = Montrose Area News Short Name = mont_news ) What we want to be able to do is make several xml files, one for each news category, and have only current news on them, we don't want old news, that would be determined by the expiration date on each news item. Do you know of any websites that could help me do this? It would be greatly appreciated if someone here would help a little.
×
×
  • 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.