-
Notifications
You must be signed in to change notification settings - Fork 0
/
contract_extension.php
1521 lines (1378 loc) · 72.4 KB
/
contract_extension.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php include('Connections/settings.php'); ?>
<?php include("includes/sessionInfo.php") ?>
<?php include("includes/functions.php") ?>
<?php include("includes/langfile.php") ?>
<?php include("includes/langs.php") ?>
<?php include("includes/langs_stats.php") ?>
<?php
switch ($lang){
case 'en':
$l_PlayerRatings = "Player Ratings";
$l_NoTradeDescription = "A no trade clause will help convince the player to sign with your team.";
$l_FrontLoadDescription = " EVEN = Salary will be the same each year of their contract.<br> FRONT-LOAD = Higher salary in first year and will gradually decrease until final year.";
$l_SalaryDistribution = "Salary Distribution";
$l_SalaryPerYear = "Salary Per Year";
$l_SendOffer = "Send Offer";
$l_Offer = "Offer Sheet";
$l_True = "True";
$l_False = "False";
$l_CONTRACTLENGTH = "Contract Length";
$Alert3 = "The owner of your team does not approve sending any more contract offers because you already have 10 active offers. If you want to send an offer to this player, you will have to remove another offer first.";
$Alert2_1 = "The owner of your team does not approve sending a contract greater than $";
$Alert2_2 = "per year because there is not enough league competition for his services. If more bids are placed then he will approve a higher offer.";
$Alert1_1 = "Please enter a salary greater than $";
$Alert1_2 = "per year.";
$l_NoPermission = "You don't have permission to negotiate a contract with this player!";
$l_rejectFinal = "This player has indicated he has no interest in signing a contract extension with your team.";
$l_rejectWait = "The agent asks that you take 24 hours to think over a new offer. So come back in 24 hours.";
$l_AgentBargain = "Bargain with agent";
$l_AskingPrice = "Asking price";
$l_ContractAccepted = "Contract accepted";
$l_years = "years";
$l_perSeason = "per season";
$l_NegStatus = "Negotiations status";
$l_Neg1 = "You have not made any offers.";
$l_Neg2 = "You have made ";
$l_Neg3 = " offer. ";
$l_Neg4 = "You can make up to ";
$l_Neg5 = "more offers. ";
$l_Neg6 = "Contract extension talks have broke off and the player wishes to test the free agency market.";
$l_OfferContract = "Contract extension";
$l_Signed = "Signed Extension";
$l_Odds1 = "<h4>You have a ";
$l_Odds2 = ", he will resign with your team. </h4><em style='padding-left:135px; font-size:11px'>The site will generate a random number between 1 and 100. If the number is between 1 and ";
$l_Odds3 = ", he will sign the contract.</em>";
$l_YouOdds = "Your Odds";
$l_OfferDeclined = "OFFER DECLINED";
$l_FinScore1 = "Your final score of";
$l_FinScore2 = "is greater than the odds of";
$l_FinScore3 = "% beat the odds of";
$l_OfferAccepted = "OFFER ACCEPTED";
$l_Bonus = "Signing Bonus";
break;
case 'fr':
$l_PlayerRatings = "Stat de joueur";
$l_NoTradeDescription = "Une clause de non-échange va aider a convaincre le joueur de signer avec votre équipe.";
$l_FrontLoadDescription = " EVEN = Salaire va être égale a chaque année du contrat<br> FRONT-LOAD = Salaire et plus haut la première année et va diminuer graduellement jusqu'à la dernière année du contrat";
$l_SalaryDistribution = "Distribution de salaire";
$l_SalaryPerYear = "Salaire par an";
$l_SendOffer = "Envoyez l'offre";
$l_Offer = "Offre";
$l_True = "Vrai";
$l_False = "Faux";
$l_CONTRACTLENGTH = "Longueur de contrat";
$Alert3 = "Le propriétaire de votre équipe n'approuve pas envoyer plus d'offres de contrat parce que vous avez déjà 10 offres actives. Si vous voulez envoyer une offre à ce joueur, vous devrez enlever une autre offre d'abord.";
$Alert2_1 = "Le propriétaire de votre équipe n'approuve pas envoyer un contrat plus grand que ";
$Alert2_2 = "$ par an parce qu'il n'y a pas assez de concurrence de ligue pour ses services. Si plus d'offres sont placées alors il approuvera un plus haut offrent.";
$Alert1_1 = "Veuillez écrire un salaire plus grand que ";
$Alert1_2 = "$ année.";
$l_NoPermission = "Vous n'avez pas la permission d'être en pourparlers un contrat avec ce joueur !";
$l_rejectFinal = "Ce joueur a indiqué qu'il n'a aucun intérêt en signant une extension de contrat avec votre équipe.";
$l_rejectWait = "L'agent demande que vous prenez 24 heures pour penser au-dessus d'une nouvelle offre. Ainsi revenu en 24 heures.";
$l_AgentBargain= "Negocier avec l'agent";
$l_AskingPrice = "Prix demandé";
$l_ContractAccepted = "Le contrat acceptent";
$l_years = "années";
$l_perSeason = "par saison";
$l_NegStatus = "Statut de négociations";
$l_Neg1 = "Vous n'avez fait aucune proposition.";
$l_Neg2 = "Vous avez fait ";
$l_Neg3 = " offre. ";
$l_Neg4 = "Vous pouvez composer à ";
$l_Neg5 = "plus offre. ";
$l_Neg6 = "L'extension de contrat que les entretiens ont a interrompu et le joueur souhaite examiner le marché d'agence libre.";
$l_OfferContract = "Extension de contrat";
$l_Signed = "Extension de signée";
$l_Odds1 = "<h4>Vous avez ";
$l_Odds2 = ", il démissionnera avec votre équipe. </h4><em style='padding-left:135px; font-size:11px'>L'emplacement produira d'un à nombre aléatoire entre 1 et 100. Si le nombre est entre 1 et";
$l_Odds3 = ", il signée avec votre équipe.</em>";
$l_YouOdds = "Votre chance";
$l_OfferDeclined = "L'OFFRE A REJETé";
$l_FinScore1 = "Vos points finaux de";
$l_FinScore2 = "est plus grande que la chance de";
$l_FinScore3 = "% gagnez la chance de";
$l_OfferAccepted = "L'OFFRE A ACCEPTé";
$l_Bonus = "Bonification de contrat";
break;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
$PID_GetPlayer = "1";
if (isset($_GET['player'])) {
$PID_GetPlayer = (get_magic_quotes_gpc()) ? $_GET['player'] : addslashes($_GET['player']);
}
$GetType = "player";
if (isset($_GET['type'])) {
$GetType = (get_magic_quotes_gpc()) ? $_GET['type'] : addslashes($_GET['type']);
}
if ($GetType == 'goalie'){
$query_GetPlayer = sprintf("SELECT P.*, 'False' as Position FROM goalies as P, goaliestats as S WHERE P.Number='%s' AND P.Number=S.Number AND S.Active='True'", $PID_GetPlayer);
}else{
$query_GetPlayer = sprintf("SELECT P.*, 'True' as Position FROM players as P, playerstats as S WHERE P.Number='%s' AND P.Number=S.Number AND S.Active='True'", $PID_GetPlayer);
}
$GetPlayer = mysql_query($query_GetPlayer, $connection) or die(mysql_error());
$row_GetPlayer = mysql_fetch_assoc($GetPlayer);
$totalRows_GetPlayer = mysql_num_rows($GetPlayer);
$PlayerName=$row_GetPlayer['Name'];
$MinimumPlayerSalary=10000;
$MaximumPlayerSalary=100000;
$query_GetWebInfo = sprintf("SELECT MaxContract, UFA, MinimumPlayerSalary, MaximumPlayerSalary, PlayerAI, MaximumPlayerSalary, MinimumPlayerSalary,TradeDeadlineDay FROM config");
$GetWebInfo = mysql_query($query_GetWebInfo, $connection) or die(mysql_error());
$row_GetWebInfo = mysql_fetch_assoc($GetWebInfo);
$MinimumPlayerSalary=$row_GetWebInfo['MinimumPlayerSalary'];
$MaximumPlayerSalary=$row_GetWebInfo['MaximumPlayerSalary'];
$TradeDeadlineDay=$row_GetWebInfo['TradeDeadlineDay'];
$PlayerAI=$row_GetWebInfo['PlayerAI'];
$MinimumPlayerSalary=$row_GetWebInfo['MinimumPlayerSalary'];
$UFA=$row_GetWebInfo['UFA'];
$query_GetTotalDays = "select schedule.Day FROM schedule WHERE schedule.Season_ID=".$_SESSION['current_SeasonID']." GROUP BY schedule.Day desc limit 0,1";
$GetTotalDays = mysql_query($query_GetTotalDays, $connection) or die(mysql_error());
$row_GetTotalDays = mysql_fetch_assoc($GetTotalDays);
$totalRows_GetTotalDays = $row_GetTotalDays['Day'];
$query_GetLastDay = "select schedule.Day FROM schedule WHERE (schedule.Play='True' OR schedule.Play='Vrai') AND schedule.Season_ID=".$_SESSION['current_SeasonID']." GROUP BY schedule.Day Desc Limit 0,1";
$GetLastDay = mysql_query($query_GetLastDay, $connection) or die(mysql_error());
$row_GetLastDay = mysql_fetch_assoc($GetLastDay);
$totalRows_GetLastDay = mysql_num_rows($GetLastDay);
if ($totalRows_GetLastDay==0){
$Day_ID = 0;
} else {
$Day_ID = $row_GetLastDay['Day'];
}
$query_GetPlayerExtensionOffers = sprintf("SELECT Attempt,DateCreated FROM playersextensionoffers WHERE Player=%s ORDER BY DateCreated DESC ", $PID_GetPlayer);
$GetPlayerExtensionOffers = mysql_query($query_GetPlayerExtensionOffers, $connection) or die(mysql_error());
$row_GetPlayerExtensionOffers = mysql_fetch_assoc($GetPlayerExtensionOffers);
$totalRows_GetPlayerExtensionOffers = mysql_num_rows($GetPlayerExtensionOffers);
$query_GetPlayerExtensionOffersCT = sprintf("SELECT Attempt,DateCreated FROM playersextensionoffers WHERE Player=%s AND Team=%s ORDER BY DateCreated DESC ", $PID_GetPlayer, $row_GetPlayer['Team']);
$GetPlayerExtensionOffersCT = mysql_query($query_GetPlayerExtensionOffersCT, $connection) or die(mysql_error());
$row_GetPlayerExtensionOffersCT = mysql_fetch_assoc($GetPlayerExtensionOffersCT);
$totalRows_GetPlayerExtensionOffersCT = mysql_num_rows($GetPlayerExtensionOffersCT);
$query_GetPlayerExtensionOffersTeams = sprintf("SELECT COUNT(Team) FROM playersextensionoffers WHERE Player=%s GROUP BY Team ", $PID_GetPlayer);
$GetPlayerExtensionOffersTeams = mysql_query($query_GetPlayerExtensionOffersTeams, $connection) or die(mysql_error());
$row_GetPlayerExtensionOffersTeams = mysql_fetch_assoc($GetPlayerExtensionOffersTeams);
$totalRows_GetPlayerExtensionOffersTeams = mysql_num_rows($GetPlayerExtensionOffersTeams);
$ExtensionAttempts = 0;
$ExtensionAttemptsValue = 0;
$ExtensionLastDate="2009-01-01";
$RemainingOffers = 0;
$NegWithMe = "True";
if($totalRows_GetPlayerExtensionOffersTeams == 1){
if($totalRows_GetPlayerExtensionOffersCT == 0){
$ExtensionAttempts=0;
$ExtensionAttemptsValue = ($totalRows_GetPlayerExtensionOffersCT * 20);
$ExtensionLastDate="2009-01-01";
$RemainingOffers = 3;
} else if($totalRows_GetPlayerExtensionOffersCT == 1){
$ExtensionAttempts = $totalRows_GetPlayerExtensionOffersCT;
$ExtensionAttemptsValue = ($totalRows_GetPlayerExtensionOffersCT * 20);
$ExtensionLastDate = $row_GetPlayerExtensionOffers['DateCreated'];
$RemainingOffers = 2;
} else if($totalRows_GetPlayerExtensionOffersCT == 2){
$ExtensionAttempts = $totalRows_GetPlayerExtensionOffersCT;
$ExtensionAttemptsValue = ($totalRows_GetPlayerExtensionOffersCT * 20);
$ExtensionLastDate = $row_GetPlayerExtensionOffers['DateCreated'];
$RemainingOffers = 1;
} else {
$ExtensionAttempts = 3;
$ExtensionAttemptsValue = ($totalRows_GetPlayerExtensionOffersCT * 20);
$ExtensionLastDate = $row_GetPlayerExtensionOffers['DateCreated'];
$RemainingOffers = 0;
}
} else if($totalRows_GetPlayerExtensionOffersTeams == 2){
if($totalRows_GetPlayerExtensionOffersCT == 0){
$ExtensionAttempts=0;
$ExtensionAttemptsValue = 0;
$ExtensionLastDate="2009-01-01";
$RemainingOffers = 2;
} else {
$ExtensionAttempts = $totalRows_GetPlayerExtensionOffersCT;
$ExtensionAttemptsValue = ($totalRows_GetPlayerExtensionOffersCT * 20);
$ExtensionLastDate = $row_GetPlayerExtensionOffers['DateCreated'];
$RemainingOffers = 1;
}
} else if($totalRows_GetPlayerExtensionOffersTeams >= 3){
if($totalRows_GetPlayerExtensionOffersCT == 0){
$ExtensionAttempts=0;
$ExtensionAttemptsValue = 0;
$ExtensionLastDate="2009-01-01";
$RemainingOffers = 2;
} else if($totalRows_GetPlayerExtensionOffersCT == 1){
$ExtensionAttempts=3;
$ExtensionAttemptsValue = 0;
$ExtensionLastDate="2009-01-01";
$RemainingOffers = 1;
} else {
$ExtensionAttempts = $totalRows_GetPlayerExtensionOffersCT;
$ExtensionAttemptsValue = ($totalRows_GetPlayerExtensionOffersCT * 20);
$ExtensionLastDate=$row_GetPlayerExtensionOffers['DateCreated'];
$RemainingOffers = 0;
}
} else if($totalRows_GetPlayerExtensionOffersTeams == 0){
$ExtensionAttempts = 0;
$ExtensionAttemptsValue = 0;
$ExtensionLastDate = "2009-01-01";
$RemainingOffers = 3;
}
function unique_rand($start, $end, $amount) {
$random = array();
while ($amount) {
$amount--;
do {
$random_num = mt_rand($start, $end);
} while (in_array($random_num, $random));
$random[] = $random_num;
}
return $random;
}
$OfferAccepted = false;
$OfferYears = 1;
$offerSalary = $MinimumPlayerSalary;
$OfferNoTrade = 0;
$modifier = 1;
$PlayerNote = "<font size=14><strong> </strong></font>";
$odds = 90;
$HalfSeason = number_format($totalRows_GetTotalDays / 2,0);
if ($_SESSION['current_SeasonTypeID']==2){
$timeofyear = 0;
} else if ($_SESSION['current_SeasonTypeID']==1){
if ($Day_ID > $HalfSeason){
$timeofyear = 10;
} else {
$timeofyear = 5;
}
} else {
$timeofyear = 15;
}
$odds = $odds - $timeofyear;
$query_GetRequestedTeams = sprintf("SELECT * FROM traderequests WHERE Player='%s' AND Season='%s'", $PlayerName, $_SESSION['current_Season']);
$GetRequestedTeams = mysql_query($query_GetRequestedTeams, $connection) or die(mysql_error());
$row_GetRequestedTeams = mysql_fetch_assoc($GetRequestedTeams);
$totalRows_GetRequestedTeams = mysql_num_rows($GetRequestedTeams);
$RequestedTeams = $row_GetRequestedTeams['RequestedTeams'];
if($RequestedTeams!=""){
$myTeam = explode(",",$RequestedTeams);
if(in_array($_SESSION['U_ID'],$myTeam))
{
$NegWithMe = "True";
} else {
$NegWithMe = "False";
$RemainingOffers = 0;
}
mysql_free_result($GetPlayerExtensionOffers);
}
if (isset($_POST["odds"])){
$odds = $_POST['odds'];
} else {
$odds = $odds - $ExtensionAttemptsValue;
}
if ((isset($_POST["MM_OfferContract"])) && ($_POST["MM_OfferContract"] == "form")) {
$insertSQL = sprintf("INSERT INTO participation (DateCreated,Team,Season_ID,Type) values (%s,%s,%s,%s)",
GetSQLValueString(strftime('%Y-%m-%d', strtotime('now')), "date"),
GetSQLValueString($_SESSION['U_Team'], "text"),
GetSQLValueString($_SESSION['current_SeasonID'], "int"),
GetSQLValueString("Transactions", "text"));
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
$NoTrade = $_POST['notrade'];
$TmpAge = $_POST['age'];
$OfferYears = $_POST['yearsoff'];
$acceptedSalary = number_format(($_POST['newsalfinal']),0);
$acceptedSalary2 = ($_POST['newsalfinal']);
$tmpBonus = 0;
$PlayersDecision = rand(1, 100);
if ($PlayersDecision <= $odds){
$OfferAccepted = true;
if ($_POST['bonus'] != 0){
$tmpBonus = $_POST['bonus'];
}
$PlayerNote = "<font size=18 color=green><strong>".$l_OfferAccepted."</strong></font><p>".$l_FinScore1." <strong>".$PlayersDecision."%</strong> ".$l_FinScore3." ".$odds."%.</p>";
$insertSQL = sprintf("INSERT INTO playerscontractoffers (Player,Type,Team,DateCreated,Contract,Salary1,Salary2,Salary3,Salary4,Salary5,Salary6,Salary7,Salary8,Salary9,Salary10,Approved,NoTrade,Compensation ) values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,'False',%s,%s)",
GetSQLValueString($_POST['player'], "text"),
GetSQLValueString("Extension", "text"),
GetSQLValueString($_SESSION['current_Team_ID'], "text"),
GetSQLValueString(strftime('%Y-%m-%d %H:%M:%S', strtotime('now')), "date"),
GetSQLValueString($_POST['yearsoff'], "double"),
GetSQLValueString($_POST['YearSalary1'], "int"),
GetSQLValueString($_POST['YearSalary2'], "int"),
GetSQLValueString($_POST['YearSalary3'], "int"),
GetSQLValueString($_POST['YearSalary4'], "int"),
GetSQLValueString($_POST['YearSalary5'], "int"),
GetSQLValueString($_POST['YearSalary6'], "int"),
GetSQLValueString($_POST['YearSalary7'], "int"),
GetSQLValueString($_POST['YearSalary8'], "int"),
GetSQLValueString($_POST['YearSalary9'], "int"),
GetSQLValueString($_POST['YearSalary10'], "int"),
GetSQLValueString($_POST['notrade'], "int"),
GetSQLValueString($tmpBonus, "int"));
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
$MailSubject = "CONTRACT EXTENSION - ".$_POST['player'];
$MailMessage = "<p>The ".$_SESSION['U_City']." ".$_SESSION['U_Team']." has signed ".$_POST['player']." to a contract extension. At the end of the season, you must update his salary and contract length.</p>";
sendMail($_SESSION['site_Email'], $_SESSION['U_Email'], $MailSubject, $MailMessage);
//echo "$errortxt";
} else {
$PlayerNote = "<font size=18 color=red><strong>".$l_OfferDeclined."</strong></font><p>".$l_FinScore1." <strong>".$PlayersDecision."%</strong> ".$l_FinScore2." ".$odds."%.</p>";
$insertSQL = sprintf("INSERT INTO playersextensionoffers (Player,Team,Attempt,DateCreated,Season,PlayerType) values (%s,%s,%s,%s,%s,%s)",
GetSQLValueString($PID_GetPlayer, "int"),
GetSQLValueString($_SESSION['current_Team_ID'], "text"),
GetSQLValueString($_POST['ExtensionAttempts'], "int"),
GetSQLValueString(strftime('%Y-%m-%d %H:%M:%S', strtotime('now')), "date"),
GetSQLValueString($_SESSION['current_Season'], "text"),
GetSQLValueString($GetType, "text"));
$Result1 = mysql_query($insertSQL, $connection) or die(mysql_error());
$query_GetPlayerExtensionOffers = sprintf("SELECT Attempt,DateCreated FROM playersextensionoffers WHERE Player=%s order by DateCreated desc", $PID_GetPlayer);
$GetPlayerExtensionOffers = mysql_query($query_GetPlayerExtensionOffers, $connection) or die(mysql_error());
$row_GetPlayerExtensionOffers = mysql_fetch_assoc($GetPlayerExtensionOffers);
$totalRows_GetPlayerExtensionOffers = mysql_num_rows($GetPlayerExtensionOffers);
if($totalRows_GetPlayerExtensionOffers == 0){
$ExtensionAttempts=0;
$ExtensionLastDate="2009-01-01";
}else{
$ExtensionAttempts=$totalRows_GetPlayerExtensionOffers;
$ExtensionLastDate=$row_GetPlayerExtensionOffers['DateCreated'];
}
mysql_free_result($GetPlayerExtensionOffers);
$query_GetRequestedTeams = sprintf("SELECT * FROM traderequests WHERE Player='%s' AND Season='%s'", $PlayerName, $_SESSION['current_Season']);
$GetRequestedTeams = mysql_query($query_GetRequestedTeams, $connection) or die(mysql_error());
$row_GetRequestedTeams = mysql_fetch_assoc($GetRequestedTeams);
$totalRows_GetRequestedTeams = mysql_num_rows($GetRequestedTeams);
$RequestedTeams = $row_GetRequestedTeams['RequestedTeams'];
$RequestedTeamsArray = explode(",", $row_GetRequestedTeams['RequestedTeams']);
if ($totalRows_GetRequestedTeams == 0 && $ExtensionAttempts == 3 ){
$team_list = implode(',', unique_rand(1, $_SESSION['total_teams'], 8));
$team_list = str_replace($_SESSION['current_Team_ID'], "0", $team_list);
if($row_GetPlayer['Age'] < $UFA){
$team_list = implode(',', $_SESSION['MenuTeamsID']);
}
$updateSQL = sprintf("INSERT INTO traderequests (RequestedTeams, Season, Player) values (%s,%s,%s)",
GetSQLValueString($team_list, "text"),
GetSQLValueString($_SESSION['current_Season'], "text"),
GetSQLValueString($PlayerName, "text"));
mysql_real_escape_string(DB_DATABASE, $connection);
$Result2 = mysql_query($updateSQL, $connection) or die(mysql_error());
$query_GetTeamEmails = sprintf("SELECT EmailAlert, Email, Number, City, Name FROM proteam WHERE Number IN (%s)", $team_list);
$GetTeamEmails = mysql_query($query_GetTeamEmails, $connection) or die(mysql_error());
$row_GetTeamEmails = mysql_fetch_assoc($GetTeamEmails);
$totalRows_GetTeamEmails = mysql_num_rows($GetTeamEmails);
$CityList = "";
do {
$CityList = $CityList.", ".$row_GetTeamEmails['City'];
$MailSubject = $PlayerName." is interested in playing for ".$row_GetTeamEmails['City'];
$MailMessage = "<img src='".imageExists("/image/players/".$row_GetPlayer['Photo'])."' border='1' width='100' height='150' align='left' hspace='5'><p>".$PlayerName." has broken off contract negotiations with the ".$row_GetPlayer['Team'].". As a result he has submitted a list of eight teams he'd be willing to play for and continue contract extension talks. Congratulations, the ".$row_GetTeamEmails['City']." ".$row_GetTeamEmails['Name']." was on his list. If you wish to acquire his services and potentially sighn him to a contract extension please contact the ".$row_GetPlayer['Team']." to alert them of your interest.</p>";
$insertSQL = sprintf("INSERT INTO mail (Title,Content,DateCreated,Sender_U_ID,Receiver_U_ID,Viewed) values (%s,%s,%s,%s,%s,'False')",
GetSQLValueString($MailSubject, "text"),
GetSQLValueString(addslashes($MailMessage), "text"),
GetSQLValueString(strftime('%Y-%m-%d %H:%M:%S', strtotime('now')), "date"),
GetSQLValueString(0, "int"),
GetSQLValueString($row_GetTeamEmails['Number'], "int"));
$Result0 = mysql_query($insertSQL, $connection) or die(mysql_error());
} while ($row_GetTeamEmails = mysql_fetch_assoc($GetTeamEmails));
$MailSubject = $PlayerName." indicates he wants to be traded.";
$MailMessage = "<img src='".imageExists("/image/players/".$row_GetPlayer['Photo'])."' border='1' width='100' height='150' align='left' hspace='5'><p>".$PlayerName." has ended his contract extension talks with you and wishes to be traded. He has picked eight potential teams, in which he will have contract extension talks with or he will pursue free agency in the summer. Those teams are ".$CityList.". Please contact these teams to see if they wish to aquire his services.</p>";
$insertSQL = sprintf("INSERT INTO mail (Title,Content,DateCreated,Sender_U_ID,Receiver_U_ID,Viewed) values (%s,%s,%s,%s,%s,'False')",
GetSQLValueString($MailSubject, "text"),
GetSQLValueString(addslashes($MailMessage), "text"),
GetSQLValueString(strftime('%Y-%m-%d %H:%M:%S', strtotime('now')), "date"),
GetSQLValueString(0, "int"),
GetSQLValueString($_SESSION['current_Team_ID'], "int"));
$Result0 = mysql_query($insertSQL, $connection) or die(mysql_error());
} else if ($totalRows_GetRequestedTeams > 0 && $ExtensionAttempts >= 3){
$team_list = str_replace($_SESSION['current_Team_ID'], "0", $row_GetRequestedTeams['RequestedTeams']);
$updateSQL = sprintf("UPDATE traderequests set RequestedTeams='%s' WHERE Season='%s' AND Player='%s'", $team_list, $_SESSION['current_Season'], $PlayerName);
mysql_real_escape_string(DB_DATABASE, $connection);
$Result2 = mysql_query($updateSQL, $connection) or die(mysql_error());
$query_GetTeamEmails = sprintf("SELECT EmailAlert, Email, Number, City, Name FROM proteam WHERE Number IN (%s)", $team_list);
$GetTeamEmails = mysql_query($query_GetTeamEmails, $connection) or die(mysql_error());
$row_GetTeamEmails = mysql_fetch_assoc($GetTeamEmails);
$totalRows_GetTeamEmails = mysql_num_rows($GetTeamEmails);
$CityList = "";
do {
$CityList = $CityList.", ".$row_GetTeamEmails['City'];
$MailSubject = $PlayerName." is interested in playing for ".$row_GetTeamEmails['City'];
$MailMessage = "<img src='".imageExists("/image/players/".$row_GetPlayer['Photo'])."' border='1' width='100' height='150' align='left' hspace='5'><p>".$PlayerName." has broken off contract negotiations with the ".$row_GetPlayer['Team'].". As a result he has submitted a list of eight teams he'd be willing to play for and continue contract extension talks. Congratulations, the ".$row_GetTeamEmails['City']." ".$row_GetTeamEmails['Name']." was on his list. If you wish to acquire his services and potentially sighn him to a contract extension please contact the ".$row_GetPlayer['Team']." to alert them of your interest.</p>";
$insertSQL = sprintf("INSERT INTO mail (Title,Content,DateCreated,Sender_U_ID,Receiver_U_ID,Viewed) values (%s,%s,%s,%s,%s,'False')",
GetSQLValueString($MailSubject, "text"),
GetSQLValueString(addslashes($MailMessage), "text"),
GetSQLValueString(strftime('%Y-%m-%d %H:%M:%S', strtotime('now')), "date"),
GetSQLValueString(0, "int"),
GetSQLValueString($row_GetTeamEmails['Number'], "int"));
$Result0 = mysql_query($insertSQL, $connection) or die(mysql_error());
} while ($row_GetTeamEmails = mysql_fetch_assoc($GetTeamEmails));
$MailSubject = $PlayerName." indicates he wants to be traded.";
$MailMessage = "<img src='".imageExists("/image/players/".$row_GetPlayer['Photo'])."' border='1' width='100' height='150' align='left' hspace='5'><p>".$PlayerName." has ended his contract extension talks with you and wishes to be traded. He has picked eight potential teams, in which he will have contract extension talks with or he will pursue free agency in the summer. Those teams are ".$CityList.". Please contact these teams to see if they wish to aquire his services.</p>";
$insertSQL = sprintf("INSERT INTO mail (Title,Content,DateCreated,Sender_U_ID,Receiver_U_ID,Viewed) values (%s,%s,%s,%s,%s,'False')",
GetSQLValueString($MailSubject, "text"),
GetSQLValueString(addslashes($MailMessage), "text"),
GetSQLValueString(strftime('%Y-%m-%d %H:%M:%S', strtotime('now')), "date"),
GetSQLValueString(0, "int"),
GetSQLValueString($_SESSION['current_Team_ID'], "int"));
$Result0 = mysql_query($insertSQL, $connection) or die(mysql_error());
}
}
}
$query_GetSigned = sprintf("SELECT * FROM playerscontractoffers WHERE Player='%s' AND Type='Extension'", $PlayerName);
$GetSigned = mysql_query($query_GetSigned, $connection) or die(mysql_error());
$row_GetSigned = mysql_fetch_assoc($GetSigned);
$totalRows_GetSigned = mysql_num_rows($GetSigned);
mysql_free_result($GetWebInfo);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><?php echo $l_OfferContract; ?> - <?php echo $_SESSION['SiteName'] ; ?></title>
<link rel="shortcut icon" type="image/png" href="<?php echo $_SESSION['DomainName']; ?>/image/<?php echo $_SESSION['FavIcon'];?>" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/reset.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/html5.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/menu.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/jquery.accessible-news-slider.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/jquery-ui-1.8.custom.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/header.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/tipsy.css">
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/bubbletip.css" />
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/formly.min.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.accessible-news-slider.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.pop.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery.tipsy.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/ui.core.js"></script>
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/jquery-ui-1.8.custom.min.js"></script>
<?php if(isset($_SESSION['username'])){ ?>
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['DomainName']; ?>/css/chat.css" />
<script type="text/javascript" src="<?php echo $_SESSION['DomainName']; ?>/js/chat.js"></script>
<?php } ?>
<!--[if lte IE 9]>
<script src="<?php echo $_SESSION['DomainName']; ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<script type="text/javascript">
$(function(){
$('#cssdropdown li.headlink').hover(
function() { $('ul', this).css('display', 'block'); },
function() { $('ul', this).css('display', 'none'); });
});;
</script>
<SCRIPT language=JavaScript>
function FrontEnd() {
var obj1 = document.getElementById("Year1");
var obj2 = document.getElementById("Year2");
var obj3 = document.getElementById("Year3");
var obj4 = document.getElementById("Year4");
var obj5 = document.getElementById("Year5");
var obj6 = document.getElementById("Year6");
var obj7 = document.getElementById("Year7");
var obj8 = document.getElementById("Year8");
var obj9 = document.getElementById("Year9");
var obj10 = document.getElementById("Year10");
document.form.YearSalary1.value=<?php echo $MinimumPlayerSalary; ?>;
document.form.YearSalary2.value=0;
document.form.YearSalary3.value=0;
document.form.YearSalary4.value=0;
document.form.YearSalary5.value=0;
document.form.YearSalary6.value=0;
document.form.YearSalary7.value=0;
document.form.YearSalary8.value=0;
document.form.YearSalary9.value=0;
document.form.YearSalary10.value=0;
obj1.innerHTML = "$0";
obj2.innerHTML = "$0";
obj3.innerHTML = "$0";
obj4.innerHTML = "$0";
obj5.innerHTML = "$0";
obj6.innerHTML = "$0";
obj7.innerHTML = "$0";
obj8.innerHTML = "$0";
obj9.innerHTML = "$0";
obj10.innerHTML = "$0";
if (document.form.distribute.value == 1) {
$tmpMod = (document.form.yearsoff.value / 2);
$tmp1=0;
$tmp2=0;
$tmp3=0;
$tmp4=0;
$tmp5=0;
$tmp6=0;
$tmp7=0;
$tmp8=0;
$tmp9=0;
$tmp10=0;
if(document.form.yearsoff.value==1){
$tmp1=Math.round(document.form.newsal.value);
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
} else if(document.form.yearsoff.value==2){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp2 < <?php echo $MinimumPlayerSalary; ?>) { $tmp2 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
} else if(document.form.yearsoff.value==3){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value);
$tmp3=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp3 < <?php echo $MinimumPlayerSalary; ?>) { $tmp3 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
} else if(document.form.yearsoff.value==4){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.05)));
$tmp3=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.05)));
$tmp4=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp3 < <?php echo $MinimumPlayerSalary; ?>) { $tmp3 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp4 < <?php echo $MinimumPlayerSalary; ?>) { $tmp4 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
obj4.innerHTML = "$" + formatCurrency($tmp4);
document.form.YearSalary4.value=$tmp4;
} else if(document.form.yearsoff.value==5){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.05)));
$tmp3=Math.round(document.form.newsal.value);
$tmp4=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.05)));
$tmp5=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp4 < <?php echo $MinimumPlayerSalary; ?>) { $tmp4 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp5 < <?php echo $MinimumPlayerSalary; ?>) { $tmp5 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
obj4.innerHTML = "$" + formatCurrency($tmp4);
document.form.YearSalary4.value=$tmp4;
obj5.innerHTML = "$" + formatCurrency($tmp5);
document.form.YearSalary5.value=$tmp5;
} else if(document.form.yearsoff.value==6){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.05)));
$tmp3=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.025)));
$tmp4=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.025)));
$tmp5=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.05)));
$tmp6=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp4 < <?php echo $MinimumPlayerSalary; ?>) { $tmp4 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp5 < <?php echo $MinimumPlayerSalary; ?>) { $tmp5 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp6 < <?php echo $MinimumPlayerSalary; ?>) { $tmp6 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
obj4.innerHTML = "$" + formatCurrency($tmp4);
document.form.YearSalary4.value=$tmp4;
obj5.innerHTML = "$" + formatCurrency($tmp5);
document.form.YearSalary5.value=$tmp5;
obj6.innerHTML = "$" + formatCurrency($tmp6);
document.form.YearSalary6.value=$tmp6;
} else if(document.form.yearsoff.value==7){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.05)));
$tmp3=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.025)));
$tmp4=Math.round(document.form.newsal.value);
$tmp5=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.025)));
$tmp6=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.05)));
$tmp7=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp5 < <?php echo $MinimumPlayerSalary; ?>) { $tmp5 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp6 < <?php echo $MinimumPlayerSalary; ?>) { $tmp6 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp7 < <?php echo $MinimumPlayerSalary; ?>) { $tmp7 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
obj4.innerHTML = "$" + formatCurrency($tmp4);
document.form.YearSalary4.value=$tmp4;
obj5.innerHTML = "$" + formatCurrency($tmp5);
document.form.YearSalary5.value=$tmp5;
obj6.innerHTML = "$" + formatCurrency($tmp6);
document.form.YearSalary6.value=$tmp6;
obj7.innerHTML = "$" + formatCurrency($tmp7);
document.form.YearSalary7.value=$tmp7;
} else if(document.form.yearsoff.value==8){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.05)));
$tmp3=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.025)));
$tmp4=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.015)));
$tmp5=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.015)));
$tmp6=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.025)));
$tmp7=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.05)));
$tmp8=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp4 < <?php echo $MinimumPlayerSalary; ?>) { $tmp4 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp5 < <?php echo $MinimumPlayerSalary; ?>) { $tmp5 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp6 < <?php echo $MinimumPlayerSalary; ?>) { $tmp6 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp7 < <?php echo $MinimumPlayerSalary; ?>) { $tmp7 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp8 < <?php echo $MinimumPlayerSalary; ?>) { $tmp8 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
obj4.innerHTML = "$" + formatCurrency($tmp4);
document.form.YearSalary4.value=$tmp4;
obj5.innerHTML = "$" + formatCurrency($tmp5);
document.form.YearSalary5.value=$tmp5;
obj6.innerHTML = "$" + formatCurrency($tmp6);
document.form.YearSalary6.value=$tmp6;
obj7.innerHTML = "$" + formatCurrency($tmp7);
document.form.YearSalary7.value=$tmp7;
obj8.innerHTML = "$" + formatCurrency($tmp8);
document.form.YearSalary8.value=$tmp8;
} else if(document.form.yearsoff.value==9){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.05)));
$tmp3=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.025)));
$tmp4=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.015)));
$tmp5=Math.round(document.form.newsal.value);
$tmp6=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.015)));
$tmp7=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.025)));
$tmp8=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.05)));
$tmp9=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp5 < <?php echo $MinimumPlayerSalary; ?>) { $tmp5 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp6 < <?php echo $MinimumPlayerSalary; ?>) { $tmp6 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp7 < <?php echo $MinimumPlayerSalary; ?>) { $tmp7 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp8 < <?php echo $MinimumPlayerSalary; ?>) { $tmp8 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp9 < <?php echo $MinimumPlayerSalary; ?>) { $tmp9 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
obj4.innerHTML = "$" + formatCurrency($tmp4);
document.form.YearSalary4.value=$tmp4;
obj5.innerHTML = "$" + formatCurrency($tmp5);
document.form.YearSalary5.value=$tmp5;
obj6.innerHTML = "$" + formatCurrency($tmp6);
document.form.YearSalary6.value=$tmp6;
obj7.innerHTML = "$" + formatCurrency($tmp7);
document.form.YearSalary7.value=$tmp7;
obj8.innerHTML = "$" + formatCurrency($tmp8);
document.form.YearSalary8.value=$tmp8;
obj9.innerHTML = "$" + formatCurrency($tmp9);
document.form.YearSalary9.value=$tmp9;
} else if(document.form.yearsoff.value==10){
$tmp1=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.1)));
$tmp2=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.05)));
$tmp3=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.025)));
$tmp4=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.015)));
$tmp5=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * 0.005)));
$tmp6=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.005)));
$tmp7=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.015)));
$tmp8=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.025)));
$tmp9=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.05)));
$tmp10=Math.round(document.form.newsal.value * ((1 + ($tmpMod) * -0.1)));
if ($tmp6 < <?php echo $MinimumPlayerSalary; ?>) { $tmp6 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp7 < <?php echo $MinimumPlayerSalary; ?>) { $tmp7 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp8 < <?php echo $MinimumPlayerSalary; ?>) { $tmp8 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp9 < <?php echo $MinimumPlayerSalary; ?>) { $tmp9 = <?php echo $MinimumPlayerSalary; ?>; }
if ($tmp10 < <?php echo $MinimumPlayerSalary; ?>) { $tmp10 = <?php echo $MinimumPlayerSalary; ?>; }
obj1.innerHTML = "$" + formatCurrency($tmp1);
document.form.YearSalary1.value=$tmp1;
obj2.innerHTML = "$" + formatCurrency($tmp2);
document.form.YearSalary2.value=$tmp2;
obj3.innerHTML = "$" + formatCurrency($tmp3);
document.form.YearSalary3.value=$tmp3;
obj4.innerHTML = "$" + formatCurrency($tmp4);
document.form.YearSalary4.value=$tmp4;
obj5.innerHTML = "$" + formatCurrency($tmp5);
document.form.YearSalary5.value=$tmp5;
obj6.innerHTML = "$" + formatCurrency($tmp6);
document.form.YearSalary6.value=$tmp6;
obj7.innerHTML = "$" + formatCurrency($tmp7);
document.form.YearSalary7.value=$tmp7;
obj8.innerHTML = "$" + formatCurrency($tmp8);
document.form.YearSalary8.value=$tmp8;
obj9.innerHTML = "$" + formatCurrency($tmp9);
document.form.YearSalary9.value=$tmp9;
obj10.innerHTML = "$" + formatCurrency($tmp10);
document.form.YearSalary10.value=$tmp10;
}
} else {
for (i=1;i<=document.form.yearsoff.value;i++)
{
if(i == 1){document.form.YearSalary1.value=document.form.newsal.value; obj1.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 2){document.form.YearSalary2.value=document.form.newsal.value; obj2.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 3){document.form.YearSalary3.value=document.form.newsal.value; obj3.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 4){document.form.YearSalary4.value=document.form.newsal.value; obj4.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 5){document.form.YearSalary5.value=document.form.newsal.value; obj5.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 6){document.form.YearSalary6.value=document.form.newsal.value; obj6.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 7){document.form.YearSalary7.value=document.form.newsal.value; obj7.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 8){document.form.YearSalary8.value=document.form.newsal.value; obj8.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 9){document.form.YearSalary9.value=document.form.newsal.value; obj9.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
if(i == 10){document.form.YearSalary10.value=document.form.newsal.value; obj10.innerHTML = "$" + formatCurrency(document.form.newsal.value);}
}
}
document.form.submit.disabled=false;
}
function Salary(form) {
var obj1 = document.getElementById("Year1");
var obj2 = document.getElementById("Year2");
var obj3 = document.getElementById("Year3");
var obj4 = document.getElementById("Year4");
var obj5 = document.getElementById("Year5");
var obj6 = document.getElementById("Year6");
var obj7 = document.getElementById("Year7");
var obj8 = document.getElementById("Year8");
var obj9 = document.getElementById("Year9");
var obj10 = document.getElementById("Year10");
var test = 0;
var bargain = (form.bargain.value);
var modifier = (form.modifier.value);
var odds = (form.oddsdefault.value);
var player = (form.player.value);
var prevsal = (form.prevsal.value);
var team = (form.team.value);
var ov = (form.overall.value);
var po = (form.po.value);
var position = (form.position.value);
var yearsoff = (form.yearsoff.value);
var notrade = (form.notrade.value);
var ex = (form.ex.value);
var age = (form.age.value);
var minimum = (form.MinimumPlayerSalary.value);
var maximum = (form.MaximumPlayerSalary.value);
var newsal = (form.newsal.value);
var hike;
var notrade_txt;
var askingprice = form.MinimumPlayerSalary.value;
var playerAI = form.PlayerAI.value;
notrade_txt = "";
if (age < <?php echo $UFA;?>)
{
if (ov < 60)
{ hike = 1.25;}
else if ( ov > 59 && ov < 65)
{ hike = 1.5;}
else if ( ov > 64 && ov < 70)
{ hike = 2.0;}
else if (ov > 69 && ov < 76 && prevsal < 1000000)
{ hike = 3;}
else if (ov > 75 && ov < 81 && prevsal < 1000000)
{ hike = 4;}
else if (ov > 80 && ov < 85 && prevsal < 1000000)
{ hike = 8;}
else if (ov > 75 && ov < 85 && prevsal < 3000000 && prevsal > 2000000)
{ hike = 2.5;}
else if (ov > 75 && ov < 85 && prevsal < 2000000 && prevsal > 1000000)
{ hike = 4;}
else if (ov > 75 && ov < 85 && prevsal < 15000000 && prevsal > 3000000)
{ hike = 1;}
else if (ov > 75 && ov < 85 && prevsal < 3000001 && prevsal > 1000000)
{ hike = 1.25;}
else if (ov >= 85 && prevsal < 1000000)
{ hike = 10;}
else if (ov >= 85 && prevsal < 6000000 && prevsal > 1000000)
{ hike = 1.5;}
else
{ hike = 1.25;}
}
else if (age > <?php echo $UFA-1;?>)
{
if (ov < 66)
{ hike = .9;}
else if ( ov > 65 && ov < 70)
{ hike = 1;}
else if ( ov > 69 && ov < 75)
{ hike = 1.1;}
else if (ov > 74 && ov < 80)
{ hike = 1.25;}
else if (ov > 79 && ov < 85)
{ hike = 1.3;}
else if (ov > 84 && ov < 90)
{ hike = 1.4;}
else if (ov >=70 && prevsal <= 1500000){
hike = hike * 3;
} else if (ov >=70 && prevsal <= 300000){
hike = hike * 2;
} else if (ov >=70 && (prevsal >= 3000000 && prevsal < 5000000)){
hike = 1.5;
} else if (ov >=70 && prevsal >= 5000000){
hike = 1.25;
}else
{ hike = 1.5;}
}
if (po == 1)
{ hike = hike - 0.05;}
else if ( po > 1 && po <= 49)
{ hike = hike - 0.1;}
else if ( po > 50 && po <= 59)
{ hike = hike + 0.2;}
else if ( po > 60 && po <= 69)
{ hike = hike + 0.5;}
else if (po > 70 && po <= 79)
{ hike = hike + 1;}
else if (po > 80 && po <= 90 && prevsal > 1000000)
{ hike = hike + 1.5;}
else if (po >= 80 && po <= 90 && prevsal < 1000000)
{ hike = hike + 2;}
else if (po > 90 && po <= 99 && prevsal < 1000000)
{ hike = hike + 2.5;}
else
{ hike = hike + 0.1;}
if (((prevsal/maximum)*100) >= 60){
hike = hike - 0.2;
}
if (prevsal > 5000000 && hike > 1)
{
hike = hike - 0.3;
}
if (notrade == 1){
hike = hike + 0.1;
notrade_txt = "(No Trade clause)";
odds = eval(odds) + 10;
}
tmpMod = 0;
if (yearsoff == 1){
modifier = 0.2 + tmpMod;
odds = odds ;
} else if (yearsoff == 2){
modifier = 0.15 + tmpMod;
odds = odds - 5;
} else if (yearsoff == 3){
modifier = 0.125 + tmpMod;
odds = odds - 10;
} else if (yearsoff >= 4){
modifier = 0.1 + tmpMod;
odds = odds - 15;
}
askingprice2 = ((1 + (modifier)) * prevsal * hike * (1 +(ex/4/100)));
if(askingprice2 <= 20000000 && ov > 79){
tmpMod = 1.5;
} else if(askingprice2 <= 20000000 && ov > 74 && ov < 80){
tmpMod = 0.5;
} else {
tmpMod = 0;
}
askingprice = formatCurrency(Math.floor(((1 + modifier) * prevsal * hike * (1 +(ex/4/100)))));
askingprice2 = ((1 + (modifier)) * prevsal * hike * (1 +(ex/4/100)));
FinalOffer = 0;
if (bargain == 1){
FinalOffer = formatCurrency(askingprice2 * 1);
FinalOffer2 = (askingprice2 * 1);
odds = odds - 10;
} else if (bargain == 2){
FinalOffer = formatCurrency(askingprice2 * 0.9);
FinalOffer2 = (askingprice2 * 0.9);
odds = odds - 20;
} else if (bargain == 3){
FinalOffer = formatCurrency(askingprice2 * 0.8);
FinalOffer2 = (askingprice2 * 0.8);
odds = odds - 30;
} else if (bargain == 4){
FinalOffer = formatCurrency(askingprice2 * 0.7);
FinalOffer2 = (askingprice2 * 0.7);
odds = odds - 45;
} else if (bargain == 5){
FinalOffer = formatCurrency(askingprice2 * 0.6);
FinalOffer2 = (askingprice2 * 0.6);
odds = odds - 60;
} else if (bargain == 6){
FinalOffer = formatCurrency(askingprice2 * 0.4);
FinalOffer2 = (askingprice2 * 0.4);
odds = odds - 80;
} else if (bargain == 7){
FinalOffer = formatCurrency(askingprice2 * 1.1);
FinalOffer2 = (askingprice2 * 1.1);
odds = odds;
} else if (bargain == 8){
FinalOffer = formatCurrency(askingprice2 * 1.25);
FinalOffer2 = (askingprice2 * 1.285);
odds = odds + 10;
}
if (askingprice >> maximum) {
askingprice = maximum;
}
if (playerAI == 0) {
odds = 100;
}
if (odds > 100) {
odds = 100;
}
var num = FinalOffer2;
num = num / 10000;
num = Math.round(num);
num = num * 10000;
FinalOffer2 = num;
var num = askingprice2;
num = num / 10000;
num = Math.round(num);
num = num * 10000;
askingprice = num;