Jump to content

lJesterl

Members
  • Posts

    52
  • Joined

  • Last visited

    Never

Everything posted by lJesterl

  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
  15. thank you im going to play around with this. I may come back to you for some more help if u dont mind
  16. Hey guys if someone would aim me LJesterL I could explain a little better. Basicly i'm writing a ladder system and i'm done with everything except adjusting the ranks when a loss is reported. I thought I could do it but I cant figure it out. Here's basicly how I need it to work. I need to select id from ladder_$li[ladderid] ORDER by points then I need to update the ranks and set ranks 1 through whatever based on who has the highest points to who has the lowest and if they have 0 points do not update the rank. Can someone help me do this?
  17. Im working on a little project simliar to myspace profiles. I have it set where they can set there profile private or not. When set to private the isprivate value is 1 and when its not private the isprivate value is 0. Here is the code I am using to check if the profile is private. $checkprivate=mysql_query("SELECT * FROM private WHERE playerid='$playerid'"); $chkp=mysql_fetch_array($checkprivate); if($chkp[isprivate] == "1"){ include("functions/error2.php"); display_error("Sorry but this user has there profile set to private.","messagecenter.php"); } Everything works fine as far as if the profile is private it will bring up the error page and if it isnt private it will not. But what I need to do is find out how to ignore that if that person is my friend. For example I have a friends table friend1 friend2 I need to do something where i $blah = select friend1 from friends where friend2=$plyr[alias] (plyr[alias] is the cooke information if im logged in) then i need something like if $blah ignore $checkprivate hope u guys can understand its a little hard to explain
  18. Doesnt work 100% If i leave it along when submiting and the email being the default value for the email say john@john.com then it errors or if i change it to anything that exist in the database, however when i change to something that doesnt exist then it works. The only problem left would be if i leave it default and i try to submit it with no change. Is there a way to ignore my error if its my own name? this is my code $checkemail=mysql_query("SELECT email FROM GCuser WHERE email='$emailx' LIMIT 1"); if(mysql_num_rows($checkemail) == 1){ include("$dir[functions]/error.php"); display_error("Email is already in use please try another email.<br>"); }else{ $query1=mysql_query("DELETE FROM playerprofile WHERE alias='$ui[alias]'"); $query=mysql_query("insert into playerprofile (alias,xboxcard,aim,yahoo,msn,icq,xfire,skype,xbox360,ps3,wii,location,connection,relationship,orientation,drink,smoker,religion,education,interests) values('$ui[alias]','$xboxcard','$aim','$yahoo','$msn','$icq','$xfire','$skype','$xbox360','$ps3','$wii','$location','$connection','$relationship','$orientation','$drink','$smoker','$religion','$education','$interests')"); $query2=mysql_query("UPDATE users SET logo='$avatar2' WHERE id='$ui[id]'"); $query5=mysql_query("UPDATE users SET email='$emailx' WHERE id='$ui[id]'"); $query4=mysql_query("UPDATE GCuser SET email='$emailx' WHERE username='$ui[alias]'"); $query4=mysql_query("UPDATE GCuser SET aim='$aim' WHERE username='$ui[alias]'"); $query4=mysql_query("UPDATE GCuser SET yahoo='$yahoo' WHERE username='$ui[alias]'"); $query4=mysql_query("UPDATE GCuser SET msn='$msn' WHERE username='$ui[alias]'"); $query4=mysql_query("UPDATE GCuser SET skype='$skype' WHERE username='$ui[alias]'"); }
  19. I'm wondering the best method to use to do the following. say if($whatever){ do this }else{ do this } i want $whatever basicly to be this. I want to check to see if the input name='emailx' exist as email in table GCuser. Here is the code I used $checkemail=mysql_query("SELECT email FROM GCuser WHERE email='$emailx'"); $ce=mysql_fetch_array($checkemail); if($emailx == $ce[email]){ //display error }else{ //execute mysql query } it works however if they dont change the emailx input field then it errors for them, or if they change the emailx input field from lets say john@john.com to john1@john.com it errors because john1@john.com doesnt exist. I hope someone understand what im trying to ask lol
  20. I don't really understand vbulletin all that well so im not sure. I know with phpbb you simply use $curpass instead of $password, curpass being the password before md5 + salt
  21. I hope someone here can help me because I simply can't figure it out. Yes I know md5 is safer, more secure etc, but im trying to get the data to be also inserted into another table so i can use it with another script that doesnt have md5 encryption for the passwords. I have attached the file from vbulletin called register.php Here is the code im using $query=mysql_query("insert into users (alias,pass,email,joindate,ipaddress) values('$username','$currentpassword','$email','$dater','$ipr')"); Everything works fine and everything is set into users aswell as vb_users(the vbulleting users table) the only problem is I don't know what to put for $currentpassword I have tried every possible combination I can think of and it doesnt work. The only thing that sorta works is this. $currentpassword = htmlspecialchars_uni($vbulletin->GPC['password_md5']); Only problem is the password is encrypted. I have tried to simply do $currentpassword = htmlspecialchars_uni($vbulletin->GPC['password']); but the password field remains blank. Any suggestions? [attachment deleted by admin]
  22. I cant do that. I want everything from groups. I then want to get everything from people WHERE groupon='$groupid'
  23. All the database stuff is correct.
  24. im trying to do something and i cant figure out how to get it to list properly. Basicly I have 2 tables one called groups with 2 rows gid and gname and one called people with 3 rows pid, pname, and groupon by doing this $listgroups=mysql_query("SELECT gid,gname FROM groups ORDER by gname"); while(list($gid,$gname)=mysql_fetch_row($listgroups)){ $grouplist=$grouplist." $gname "; } echo " $grouplist "; I can get it to list like this: [ Group A ] [ Group B ] I need to go even farther and have it get the names of the pname from people with the groupon being that group id. Let say John Doe Belongs to group A and group a's id is 1 and johndoe has groupon 1 in mysql. How would I also list everyone that has groupon to the coresponding group like so: [ Group A ] John Doe James Kyle etc. [ Group B ] Sam Bill Ted etc.
×
×
  • 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.