Jump to content

lJesterl

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lJesterl's Achievements

Member

Member (2/5)

0

Reputation

  1. I have been at this all night and im about to give up but I remember I use to post here. Im helping someone with soemthing but based on how the table is structured its a little more complicated for me to do what im looking for. Basicly in his "matches" table im wanting to find the "team" who has the most games. I don't like the way the matches table is structured i think thats what is throwing it off. The table structure for the matches table is "matchid,winnerid,loserid" there is more but that is all I need. So the teamid isnt in the match table, its either inserted as the winnerid or the loserid. I have tried num_rows, I have tried COUNT(), but i cant get what im looking for because i have to do a while on all the teams and then when i get the list of num_rows it gives me every teams maches. Sorry if im confusing Here is my code so far: $mostgames=mysql_query("SELECT teamid FROM team WHERE ladderid='$ladder' ORDER BY teamid"); while(list($teamid)=mysql_fetch_row($mostgames)){ $getmostgames= mysql_query("select matchid from matches where winnerid='$teamid' or loserid='$teamid'"); $getmostgames = mysql_num_rows($getgames); echo $getmostgames; } thats when it returns "0023022110516" lol
  2. please dont kill me. I found the tutorial I referenced if(!get_magic_quotes_gpc()) { $_GET = array_map('mysql_real_escape_string', $_GET); $_POST = array_map('mysql_real_escape_string', $_POST); $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE); } else { $_GET = array_map('stripslashes', $_GET); $_POST = array_map('stripslashes', $_POST); $_COOKIE = array_map('stripslashes', $_COOKIE); $_GET = array_map('mysql_real_escape_string', $_GET); $_POST = array_map('mysql_real_escape_string', $_POST); $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE); } From my understanding I could put this in my global.php which is already included into everyfile, or i could make another file say "trimit.php" and include in every file, and as long as it is at the top of the page (after the db connection config file) then it will automaticly clean the data?
  3. im cleaning up an old app that I wrote fixing some of the vulernabilities from attacks. I have roughly 30 files. I want to be able to edit every $_POST and $_GET $value=$_POST['value']; $value=$_GET['value']; my instinct would be to edit every file and do it manually $value=$_POST['value']; $value=mysql_real_escape_string($value) $value=$_GET['value']; $value=mysql_real_escape_string($value) but if there was a faster way it would make my life easier. What I would like to do is to maybe create a function i can put at the top of every page or into my global.php which is included into every page that would do something like this if (get_magic_quotes_gpc()) { $value = stripslashes($value); }else{ $value=mysql_real_escape_string($value) } i dont intend to have magic quotes on, but other people might on there servers. I just need every $_POST or $_GET within my script to be automaticly cleaned or filtered from SQL Injections I saw something a long time ago where it was something they put at the top of there page, this will be completely wrong, but i will give u an example of what it looked like $_GET = array_map('mysql_real_escape_string', $_GET); $_POST = array_map('mysql_real_escape_string', $_POST); $_COOKIE = array_map('mysql_real_escape_string', $_COOKIE); $_REQUEST = array_map('mysql_real_escape_string', $_REQUEST); im not to sure how that goes about effecting everything, where to put it, etc Any ideas or suggestions? Or am I stuck doing it manually.
  4. This may be a silly question and not possible but im needing to achieve something and i think the best and easiest way would be if i could get the page name, i.e, main.php or testimonial.php and do something like if($pagename = main.php){ $code="0"; } if($pagename = testimonial.php{ $code="1"; } possible?
  5. Would you be willing to elaborate a little bit? [attachment deleted by admin]
  6. I have a script where I check dates to see if they exist in a table. If they exist then there not available. I thought I had everything working untill I noticed a problem. I use the following portion of code $today=date("m/d/Y"); $oneweek = date('m/d/Y', strtotime("$today +7 days")); if($ADate < $oneweek){ $error="Your arrival date must be atleast 1 week from today's date."; } if($ADate < $today){ $error="Your arrival date can not be before today's date."; } $ADate is the date they choose on the previouse page. It is in the DD/MM/YYY format. For example 07/07/2008 I get the following errors. Everything else works and everything works if they pick 2008 or 2009 except for these 2 checks. If they pick 08/01/2009 it tells them it can not be before todays date becase 2008 is less than 2009 and if I take that part out it says your arrival date must be a week away because 2008 is less then 2009. How can I properly do these checks to do $ADate < $today and also $ADate is < $oneweek if its 2008 or 2009.
  7. Ive searched google and came up with nothing. It's also a php issue because i have to generate the popup from a javascript. I get alot of help from this forum so please if you don't know dont be rude and let someone else help me. I love phpfreaks and enjoy asking questions to the community.
  8. I was wondering if anyone could tell me how to check to see if a checkbox is checked. Like if someone has to read some terms and conditions. I want a javascript to popup if the checkbox isnt checked. Please help
  9. nm I got that part. One last question. What code can I use to check if $ADate is a Tuesday, Wednesday, or Thursday? We dont accept Tue, Wed, Thur arrivials on certain vacations.
  10. Fantastic! That works and list the days just the way I want them. Here is my code $result=mysql_query("SELECT count(*) as numrecords FROM blockeddates WHERE date='$ADate'"); $row=mysql_fetch_assoc($result); if ($row['numrecords'] >= 1){ $isavailable="$ADate Is Not Available"; } else { $isavailable="$ADate Is Available"; } if($packagedays=="4 Days 3 Nights"){ $number="4"; }else{ $number="3"; } $Bdate = date('m/d/Y', strtotime("$ADate +$number days")); $out[main]=$out[main]." <b>$isavailable</b><br><br> $starweek<br> $endweek<br> $year<br> $packagename<br> $pa[price]<br> $packagedays<br> $gifts<br> $ADate - $Bdate "; Now I need to take this to the last step. Lets say I choose 03/31/2008 This code lists 03/31/2008 - 04/03/2008 Now what I want to accomplish is to check and see if $ADate, $Bdate, and the dates between are in the blockeddates table using what I have. I am able to check $ADate and $Bate but not the dates in between. Any suggestions?
  11. i've almost got it, i just need to change some things. Here is my code. if($packagedays=="4 Days 3 Nights"){ $number="3"; }else{ $number="2"; } $startDate = date("m/d/Y", mktime(0, 0, 0, 3, 30, 2008)); $endDate = date("m/d/Y", mktime(0, 0, 0, 3, 30+$number, 2008)); $i=0; while ($temp <> $endDate) { echo " <br> "; echo $temp = date("m/d/Y", mktime(0, 0, 0, 3, 30+$i, 2008)); echo " <br> "; $i++; }; ok I need to make the start date the variable $ADate and the enddate $number days past $ADate right now on a 3 Day 2 Night Vacation it list 03/30/2008 03/31/2008 04/01/2008 because i have the date in that code set to 03/30/2008 but I need ot the $ADate that im sending from a previous page. Please help
  12. I am completely lost on this portion of things. If anyone is interested I need to finish up this site. I need few adjustments made to the script if anyone can help. I can pay $30 paypal. Anyone? aim me LJesterL
  13. I have a question and no idea what to do. I'm working on a date booking script. I have booked dates entered into a table. I.e 03/28/2008 or 04/02/2009 if those dates exist then it states $date not available. Here is the code im using. This part works. $result=mysql_query("SELECT count(*) as numrecords FROM blockeddates WHERE date='$ADate'"); $row=mysql_fetch_assoc($result); if ($row['numrecords'] >= 1){ $isavailable="$ADate Is Not Available"; } else { $isavailable="$ADate Is Available"; } $out[main]=$out[main]." <b>$isavailable</b> "; Now my problem is that the packes are 3 day vacations. I need to be able to check if they put 04/01/2008 I need to to check dates 04/01/2008, 04/02/2008, and 04/03/2008 to make sure there not booked instead of just 04/01/2008. I have no idea how to do that with getting the year and how many days per month etc. Can anyone help me?
  14. Sorry to ask alot of questions all the time lol, but if it wasnt for PHP freaks I would never complete certain projects Thanks for all your help. I need help with a php date picker. I have downloaded and tried to use several but there not exactly what I need. Everything is in funky formats. I need something like the following site: https://www.exclusivegetawayvacations.com/check_availability.php?loc=Gatlinburg&pr=99&pi=gat&nt=2&ht=The%20Brookside%20Resort&ca=25&locurl=gatlinburg.php&pl=hotel_bside.php Where it puts it in MM/DD/YYYY Format. All the ones I have downloaded I can not get to use MM/DD/YYYY into a input box. Please help
×
×
  • 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.