-
Posts
827 -
Joined
-
Last visited
-
Days Won
9
Everything posted by fastsol
-
send auto response email after adding data to database
fastsol replied to ianhaney50's topic in PHP Coding Help
http://php.net/manual/en/language.operators.errorcontrol.php -
send auto response email after adding data to database
fastsol replied to ianhaney50's topic in PHP Coding Help
2 main things I see quickly. 1. Remove the @ from in front of the mail(). You should honestly never use @ to suppress php errors. 2. Variables are not evaluated when inside 'single quotes' like you have the $email for the $to. Remove the single quotes around $email. -
Nope nothing in there that would indicate multiples being sent. Is that last code for the PayPal IPN? It looks like it. If it is specifically for the IPN service, that page should not have any html output. It should only handle processing with zero browser output, cause the client will never see the this page cause only PayPal is running it, not the clients browser.
-
There isn't anything in this chunk of code that would send it more than once. I assume this isn't the only code on the page. Is this code inside a loop of any kind? When you hit submit, is there other code on the page that is also executing cause of the posting? Couple other things too, unless you are putting any of the posted data into a database further down the script, the use of mysql_real_escape_string is completely pointless. This is especially true on the $_GET['s']. That function is ONLY to help make it safe to put the data into a database, it has nothing to do with making it safe to compare against or display the data on any screen. These 2 lines $submit = mysql_real_escape_string($_GET['s']); if ($submit == 'submit') { Could simply be this cause you are setting what exact value the var needs to be and you are only comparing it's value. if ($_GET['s'] == 'submit') { Then, because the $name is being sent to a person that will display the data, in your $message var do this with the $name htmlentities($name, ENT_QUOTES) That will ensure that when it's displayed on the users side, if by some chance it did have executable code in the $name, it won't work when it's displayed.
-
Is it running a query to the db for each of these getTotalQuantityBuildingProduct()? Do you have indexes on the columns you are gathering info from on those columns? What kind of query does this getTotalQuantityBuildingProduct() run?
-
populate Combobox from SQL - Im going round in circles here,
fastsol replied to MrScabby's topic in PHP Coding Help
I'll say it again, post your full current code and a copy of the view source so I can look at it. -
populate Combobox from SQL - Im going round in circles here,
fastsol replied to MrScabby's topic in PHP Coding Help
Assuming you're still assigning the option tags to $selectbox .= like your original post, wherever you put this line echo $selectbox; Is where it's going to display. So if that line is not within the exact spot in the html you want it to show then you need to move it further down the line to where you do want it to show. Php echo() outputs it's contents at the exact point you have the echo. -
populate Combobox from SQL - Im going round in circles here,
fastsol replied to MrScabby's topic in PHP Coding Help
Couldn't tell you any more without your current complete code, including the form code. Code from the view source would help too, since I have no idea what "it's outputing in the form background" means. My guess is you have an echo on the <option> tag as you were testing, instead of assigning it to $selectbox. -
populate Combobox from SQL - Im going round in circles here,
fastsol replied to MrScabby's topic in PHP Coding Help
This line is built wrong. It's hard to tell cause you didn't use the proper forum code tags to post the code (tisk tisk). // Was this $selectbox.='<option value=\"' . $row['profile_name'] . '\">' . $row['profile_email'] . '</option>'; // Should be this $selectbox.='<option value="' . $row['profile_name'] . '">' . $row['profile_email'] . '</option>'; You're using single quotes to open the string but for some reason you tried escaping the double quotes within the string. -
populate Combobox from SQL - Im going round in circles here,
fastsol replied to MrScabby's topic in PHP Coding Help
If you do a view source in the browser, does it show any HTML errors or and empty select box? The code looks fine and it's pretty basic code. Make sure to turn error reporting on. -
populate Combobox from SQL - Im going round in circles here,
fastsol replied to MrScabby's topic in PHP Coding Help
You're only selecting profile name in the query. So when you try to display it as profile email, the value doesn't exist. -
how can i insert this into a field / hidden field?
fastsol replied to toolman's topic in Javascript Help
Try document.getElementById("s_creation_date").value = now; -
Reproducing that exact table in an email won't be super easy. Email programs tend to not play by the rules of the modern web. They are still stuck in the 90's. You must use inline styles to get them to cooperate. the code gets messy and complicated to maintain this way, but it's the only way to make it work. What you need to do is build a template of what you want it to look like, but in a manner that you can inject the php info in to the cells you want (sounds like maybe you already have that part handled). Then you take the template and paste the code in to the textarea on this page http://zurb.com/ink/inliner.php and it will inline all the css for you. Here is a video tutorial that you will find very helpful https://www.youtube.com/watch?v=gBiocrJuWOA
-
I removed the code that has to do with the captcha. Looks like you'll probably need to edit the template index.html according to what items are being sent to it in the $twig->loadTemplate. <?php require_once('../include/init.php'); // Prepare the errors array $_errors = array(); // Registration if (Tools::getValue('register')) { if (!Tools::getValue('agree')) { $_errors []= 'Error #RG0010: '.FRONT_ERROR_RG0010; } else { // Initialize a new user... $account = new Account(); $_errors = $account->registration(Tools::getValue('register_username'), Tools::getValue('register_password'), Tools::getValue('repeat_password'), Tools::getValue('email')); // Register the user if there were no errors in initializing an account if (!sizeof($_errors)) { if (!$activation_token = $account->register()) $_errors []= 'Error #RG0009: '.FRONT_ERROR_RG0009; if ($ref = $session->referral) Referral::add($ref, $account->id); } } if (sizeof($_errors)) { $template = $twig->loadTemplate('index.html'); $template->display(array( 'registration_errors' => $_errors, 'goto' => 'registration', 'post' => $_POST)); exit(); } else { Tools::redirect('register.php?send_activation&token='.$activation_token); } } else // Account activation if (Tools::getValue('activate', 'null') != 'null' or Tools::getValue('send_activation', 'null') != 'null') { $_errors = array(); // Initialize the activation $activation = Activation::getByField(array('token' => Tools::getValue('token'))); if (!($activation->id)) $_errors []= 'Error #RG0011: '.FRONT_ERROR_RG0011; else { $account = new Account($activation->id_account); if (!$account->id) Error::get()->report('ACT0003', 'UserID#'.$activation->id_account.' ActivationID#'.$activation->id, CRITICAL_ERROR); } $success = false; // Send activation key if (Tools::getValue('send_activation', 'null') != 'null') { if (!Mail::send($account->email, 'activation', array('activation_token' => $activation->token, 'activation_code' => $activation->getCode(), 'account' => $account))) { Error::get()->report('MAIL0001', 'UserID#'.$account->id, NOTICE_ERROR); $_errors []= 'Error #RG0013: '.FRONT_ERROR_RG0013; } else $success = true; } // Check activation key if (Tools::getValue('activate', 'null') != 'null' and Tools::getValue('activation_code', 'null') != 'null') { $activation_code = Tools::getValue('activation_code'); if ($activation_code != $activation->getCode()) { $_errors []= 'Error #RG0012: '.FRONT_ERROR_RG0012; } elseif(!$activation->success($account)) { // Activation failed $_errors []= 'Error #RG0014: '.FRONT_ERROR_RG0014; } else { // Display successfull activation prompt and mail the welcome message if (!Mail::send($account->email, 'welcome', array('account' => $account))) Error::get()->report('MAIL0003', 'UserID#'.$account->id, NOTICE_ERROR); $template = $twig->loadTemplate('activate.html'); $template->display(array( 'success' => true)); exit(); } } $template = $twig->loadTemplate('activate.html'); $template->display(array( 'activation_errors' => $_errors, 'activation_success_send' => $success, 'post' => $_POST, 'activation_token' => $activation->token, 'email' => $account->email)); exit(); } else Tools::redirect('/'); // An unknown request to this file ?> You can post the index.html template too if you can't figure it out.
-
For the code you did post, this is what needs to be removed. <div id="recaptcha_widget" style="position:relative;"> <div id="recaptcha_image" style="clear:both;display:block;position:relative;z-index:99;top:66px;left:10px"></div> <!--<div class="recaptcha_only_if_incorrect_sol" style="color:red">Incorrect please try again</div> <span class="recaptcha_only_if_image">Enter the words above:</span> <span class="recaptcha_only_if_audio">Enter the numbers you hear:</span> <input type="text" id="recaptcha_response_field" name="recaptcha_response_field" /> <div><a href="javascript:Recaptcha.reload()">Get another CAPTCHA</a></div> <div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type('audio')">Get an audio CAPTCHA</a></div> <div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type('image')">Get an image CAPTCHA</a></div> <div> <a href="javascript:Recaptcha.showhelp()">Help</a></div> </div>--> <script type="text/javascript" src="http://www.google.com/recaptcha/api/KEYHERE"></script> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=KEYHERE" height="300" width="300" frameborder="0"></iframe> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type="hidden" name="recaptcha_response_field" value="manual_challenge"> </noscript> </div> There will be other code in the processing page for the form that also needs to be removed. Post that code here and we can look at it.
-
In order to process multiple forms on a single page you need to tell php how to distinguish between the different postings. In your case it's pretty easy. 1. You need to give the submit buttons an actual name="" attribute and make them different for each form. 2. Don't ever just use if($_POST). $_POST is always present cause it's a php superglobal. So everytime the page is loaded, this code is run. 3. Use if(isset($_POST['submit-button-name-for-the-form-posting'])) Obviously change the "submit-button-name-for-the-form-posting" to the actual name of the submit button
-
Looks like you should be using $_GET['page'] instead of id. You're setting the get var to page through the rest of the code, so why are you trying to get it from id?
-
You could try using MAX() on the specific columns you want to get the highest number of. You may need to also use GROUP BY on something, but I'm not totally sure cause I don't really use this much. SELECT t1.Horse, t1.Track, t1.Race, MAX(t2.speed) AS Highest_Speed, t2.Speed, t2.Class, t2.Form, t2.Last, t2.Conn, t2.Line, t2.win, t2.Total FROM racestoday as t1 LEFT JOIN horses as t2 ON t1.HorseRef = t2.HorseRef WHERE t1.Date = CURDATE() ORDER BY t1.Date ASC, t1.track ASC, t1.Race ASC
-
Do this $options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC); Then remove the $db->setAttribute()s I don't have a clue what you mean by this statement:
-
Couple things to adjust to make this better, set all the PDO options before connecting. You already have the $options array with an option in it, set the others there too. With this query $query = "SELECT id,photo FROM test ORDER BY id"; $stmt = $db->prepare($query); $stmt->execute(); There is no reason to use a prepare and execute on this, you're not inserting any variables to the query so it's already 100% safe, just run a normal query(). Plus there is no reason to do the try/catch block on it either. If it fails it'll be because of a coding or server error during the connection, not cause the $stmt failed. Just my 2 cents.
-
What kind of computer are you using: Mac or PC? Did you use a php package like WAMP or XAMP? Did you make sure the services are running before trying to access the web page?
-
I use something like this: $_SESSION['last_page_queried'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING']; <a href="<?php echo $_SESSION['last_page_queried']; ?>">Back</a>
-
Although Barand had the answer I was looking for, I did research the stored procedures method and have added it to my knowledge.
-
Should probably be $row['visitor_id'] not $visitor_id['visitor_id']