-
Posts
129 -
Joined
-
Last visited
Everything posted by vbcoach
-
Hello. I have a sports league and the captain's page has a menu bar allowing links to sub pages. I would like to only add the URL part if a condition is met. In my database I have a league field called "session" for Spring or Summer sessions. The menu bar has 5 simple columns for hyperlinks: Home | Edit Team | Add Player | Edit My Information | Log Out | What I would like to do is to only display say the "Edit Team" with hyperlink if the league session = "Summer" (that was Spring teams cannot edit their information at this point in time). I am trying to create an IF-Else statement, but can't quite get it right. I am a novice PHP coder, so I could really use some help. Here is the current code for this short section: <table width="800" border="0" cellpadding="0" cellspacing="0"> <tr> <td><img src="images/BBV_CP_top.jpg" width="800" height="200"></td> </tr> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="6%" class="menu"><a href="home.php"> Home</a> </td> <td width="9%" class="menu">Edit Team </a></td> <td width="12%" class="menu">Add Player</td> <td width="63%" class="menu">Edit My Information</a> </td> <td width="10%" class="menu"><a href="logout.php">Log Out </a></td> </tr> </table> How can I create "Edit Team" to be a hyperlink ONLY IF the condition (league = Summer) is TRUE? $team is the query that returns the league results from the MSSQL query. Thanks in advance for your help.
-
Using simple mail.php script. Yet I am getting the dreaded Fatal error: Call to undefined method Mail::AddAttachment() in ... error "Fatal error: Call to undefined method Mail::AddAttachment() in \\...\www\mail.php on line 59" This is mail.php <?php class Mail { var $parts; var $to; var $cc; var $bcc; var $from; var $headers; var $subject; var $body; var $html; var $host; var $port; function __construct() { $this->parts = array(); $this->to = ""; $this->cc = ""; $this->bcc = ""; $this->from = ""; $this->subject = ""; $this->body = ""; $this->headers = ""; $this->html = true; } function buildMultipart() { $boundry = "HKC".md5(uniqid(time())); $multipart = "Content-Type: multipart/mixed; boundary = \"$boundry\"\n\n"; $multipart .= "This is a MIME encoded message.\n\n--$boundry"; for($i = sizeof($this->parts)-1; $i >= 0; $i--) { $multipart .= "\n".$this->buildMessage($this->parts[$i])."--$boundry"; } return $multipart .= "--\n"; } function getMail($complete = true) { $mime = ""; if(!empty($this->from)) { $mime .= "From: ".$this->from."\n"; } if(!empty($this->headers)) { $mime .= $this->headers."\n"; } if($complete) { if(!empty($this->cc)) { $mime .= "Cc: ".$this->cc."\n"; } if(!empty($this->bcc)) { $mime .= "Bcc: ".$this->bcc."\n"; } if(!empty($this->subject)) { $mime .= "Subject: ".$this->subject."\n"; } } if(!empty($this->body)) { $this->AddAttachment($this->body,"",($this->html?"text/html":"text/plain")); } $mime .= "MIME-Version: 1.0\n".$this->buildMultipart(); return $mime; } function send() { if(!empty($this->cc)) { $mime = $this->getMail(true); } else { $mime = $this->getMail(false); } if(!empty($this->host)) { ini_set("SMTP",$this->host); } return mail($this->to,$this->subject,$this->body,$mime); } } ?> And this is the program that makes the call: <?php if (isset($_POST["email"])) { $email = $_POST["email"]; $email= str_replace("'", "''", $email); require_once('../database.php'); $sql="select fa_id,name from freeagents where email='".$email."'"; $emailSearch = mssqlquery($sql); if (!mssqlhasrows($emailSearch)) { mssqlclose(); header("Location: http://www.baltimorebeach.com"); exit(); } $row = mssqlfetchassoc($emailSearch); mssqlclose(); $salt=$row["fa_id"].".baltimorebeach."; $check=hash('ripemd160', $salt.$email); $strMailBody = <<<MAILBODY Hi $row[name], <br><br> A request was made to change your Baltimore beach volleyball free agent registration information. <br><br> If you want to update your registration information click on this link: http://www.baltimorebeach.com/FreeAgents/registerfreeagent.php?email=$email&check=$check <br><br> To remove your name from the Free Agent list deselect all the checkboxes when you update your information. MAILBODY; require_once('../mail.php'); $message = new Mail(); $message->from = "[email protected]"; $message->to = $email; $message->subject = "Baltimore Beach Volleyball Free Agent Registration Update Link"; $message->body = $strMailBody; $message->html = true; $message->send(); } ?> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script> <style type="text/css"> label.error { color:red; } input.error { border:1px solid red; } </style> <script type="text/javascript"> $().ready(function () { // validate registration form on keyup and submit $("#emailform").validate({ rules: { email: { required: true, email: true } }, messages: { email: { required: "Please enter an email address", email: "Please enter a valid email address" } } }); }); </script> </head> <body> To update your free agent registration information enter your email to send yourself a baltimorebeach.com url link that will allow you to access your own registration details. <br> To remove yourself from the free agent list just deselect all the leagues you have previously selected when updating your information. <br> <br> <?php if (!isset($_POST["email"])) { ?> <form id="emailform" action="sendlink.php" method="post"> E-Mail: <input type="text" id="email" name="email" value=""/> <br> <input type="submit" id="sumbit" value="Send"> </form> <?php } else { echo "E-Mail Sent. "."You will receive an email with the update link at the email address your requested shortly"; } ?> </body> </html> I did not write this code, however the person who did is no longer available to me. I can't seem to figure out how to remove this error. Thanks so much!
-
Now that's what I am talking about guys (and gals) Thanks for the explanations!!!
-
Had a programmer see that if he copied the URL and changed the ?X=123 to "anyting" like the letter "A", it reported errors about the website and gives potential hackers all the information they need to take advantage of that exploit.
-
Way over my head. Can you simplify this for me?
-
Hello all. I have a sports website that looks up team/league-specific information based upon the team or league id. This information is presented by url by using a switch in the url. For example: www.widget.com/changeme.php?x=123 As you all probably know, this opens my site to a huge security rick and potential exploit. Is there anyway to hide or otherwise adjust this url so it doesn't display this switch? Any other thoughts on how I could do this securely? Thanks in advance for your help.
-
Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in\\WDP\DFS\30\0\8\8\3049380880\user\sites\3395336.site\www\database.php on line 46 Line 46 from database.php is: //return mssql_fetch_assoc($resource); return sqlsrv_fetch_array($resource, SQLSRV_FETCH_ASSOC); This script has been working for years. Just stopped last night.
-
MsSql connection to dedicated server assistance needed
vbcoach replied to vbcoach's topic in PHP Coding Help
Do I need to add the port number to the IP in the connection string? i.e. 12.345.56.78,1433 ??? -
MsSql connection to dedicated server assistance needed
vbcoach replied to vbcoach's topic in PHP Coding Help
Doubt that is the case. This would be an ISP issue, and he has dozens of clients. -
MsSql connection to dedicated server assistance needed
vbcoach replied to vbcoach's topic in PHP Coding Help
I tried changing to IP. No joy. I can connect to it via SSMS without issue. My ISP says this is a coding issue and has just told me to "google it". All I know is that I get zero output, so is there a quick, down, and dirty way to create or test connections for connectivity via php? -
Hey guys & gals! I could use some assistance here. My hosting provider is switching me from an older web server that had PHP on MsSql (2000) all on one box, to a new server with now a dedicated MsSql (2008) server. That's cool, and I can take advantage of the upgraded features. However I am at a crossroads here. My previous connection settings were pretty straight-forward: /* * MsSQL settings */ define ( "MSSQL_SERVER" , "localhost" ); define ( "MSSQL_USER" , "xxxxxxxx" ); define ( "MSSQL_PASSWORD" , "xxxxxxxxx" ); define ( "MSSQL_DATABASE" , "mydatabase" ); Well guess what? Now I am not connecting. I have tried adding the IP address instead of localhost as the new SQL server is separate and dedicated. Certainly not an expert on these things, so I could use some assistance in generating the new connection string. Can anyone offer assistance please?
-
That worked, thanks! (now I am getting an undefined variable message - more digging) Thanks!
-
Still getting syntax error
-
Hello all. Having trouble with doing an IF statement using a math operator. Seems simple enough, but I keep getting a syntax error. I have a sports league, who's fees are based upon the number of (extra) players on a team. $intPlayers is a variable number derived by a loop of the number of registered players on a given team. $intBsize is the base league size given based upon the league registered (2, 4, or 6) I am trying to come up with a mathmetical PHP statement that will determine if the number of (extra) players over the "base" number. Once that happens, I can charge a fee per player over the team base amount allowed. For example, if a 6's league registers 8 players, they need to pay for those additonal two players. So here is my code with the syntax error: $plyrCount = $intPlayers - $intBsize {if $plyrCount<0 then $plyrCount = '0'} $xtraPlyrs = ($plyrCount * 40) I have tried a bunch of variations, but nothing seems to work. If the value of $plyrCount is a negative number, then set $plyrCount to zero. Can anyone help please?
-
Well my friend, the error is coming from the code YOU gave me. So I am asking you: why this error?
-
Error: Notice: Undefined variable: strCaptainName in E:\Web Server\baltimorebeach_com\htdocs\registration\verify.php on line 34 However the username now did not have the integer.
-
I am really not trying to be a jerk here. The query itself is $strCaptainSearch = "SELECT COUNT(*) FROM captain WHERE username LIKE '%s%%'"; However I did not feel that this part of the code was revelant. My apologies. Does this help now?
-
You do see the code above right?
-
Well here's the thing. This query "$strCaptainCount = (mssql_num_rows($resCaptainSearch) > 0)" should basically return a null value if no captain last name is found. Like I said, the database is currently completely empty and void of any captain entries, so it should not be returning anything. So I think there may be an issue with this statement. And I posted what the query is. Anyone have any thoughts? This same statement used to work just fine. Now that I have truncated all tables, it's not working. Thoughts anyone?
-
Hello. This one is driving me up the wall. It used to work, I have a sports league database (MsSql) and one of the tables contains team Captain's first name, last name, etc.. To create a unique but simple login, the query searches for the captain's first initial of their first name + lastname + league. However since there is the remote possibility of two similar usernames (i.e. David Smith) if the last name is found, the query adds an integer to the end of the last name. So the result would look like this: DSmithM4A At the moment, my database is completely blank. However what is happening when I run the query below is I get: DSmith1M4A Can someone figure out why this code is not working correctly? If there is not more than one "Smith" no integer is supposed to be returned. There is something in the "Captain Count" that I think is not working correctly. /* * Gather captian information */ $strCaptainFirstInitial = substr($arrPost['cpt_first'],0,1); $strCaptainLastName = preg_replace("/[^a-zA-Z]/","",$arrPost['cpt_last']); $strCaptainName = strtolower($strCaptainFirstInitial.$strCaptainLastName); $sqlCaptainSearch = sprintf ( $strCaptainSearch, $strCaptainName ); $resCaptainSearch = mssql_query($sqlCaptainSearch,$conDB); /* * Create unique captain login and Password */ $strCaptainCount = (mssql_num_rows($resCaptainSearch) > 0) ? mssql_num_rows($resCaptainSearch) : "" ; $strLeagueTypeInitial = substr($arrLeagueSearch['type'],0,1); $strCaptainLogin = $strCaptainName . $strCaptainCount . $strLeagueTypeInitial . $arrLeagueSearch['size'] . $arrLeagueSearch['division'];
-
JQuery? Sounds interesting. Thanks for the tip. I will try that.
-
How to color individual words of text inside drop-down menu? A question if you don't mind about coloring text in PHP output - this time inside of a drop-down menu. Do you know if it is possible to color code a single word or words of text in a drop-down menu? For example I have a list of shirt colors and sizes and would like to make the color of the t-shirt text be that color. For example Women's BLUE large - I would like the word "Blue" be in the color Blue if possible. Do you know if this is possible? If so, do you have an example of code that would work? I find codes that change the entire drop-down menu, but not individual words. Thanks in advance. *** PLEASE DO NOT MOVE UNTIL QUESTION IS ANSWERED PROPERLY *** As stated, I already know how to re-color an ENTIRE MENU, I do not want that! I want a specific word to be re-colored, not the entire line.