Jump to content

halben

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by halben

  1. I'm currently working on a WordPress website project and I am hoping someone can help me out on this. In the registration page, the data entered is stored into the WordPress database. I've also build a connection to store those data into an external database as well. So basically, If a visitor registers on the site, their data info is stored in the WP and external DB. My question is since the external DB relies on checking to see if the submit button has been pressed, do those data input values need to be escaped to prevent sql injection into the external DB since the data submitted to WordPress has already been sql escaped? Thanks for helping.
  2. I would like someone to please help look over these lines of codes and help me correct what's wrong with it. The first problem I found out on my registration form is when a user fills out a portion of the form, the WordPress client side and server side validation works as intended but that data gets processed/stored into my external database which it is not suppose to. So what I did to prevent it check if the user pressed the submit button, if it's pressed, check to see if the values aren't empty. If the values are empty, do something and stop the connection but If the values are not empty, run the connection to the external DB using the try/catch statement. I tested it out again and the validation works as intended, no data was processed but when the user completes the registration form correctly, their info gets stored into the WordPress DB but not my external database. Can anyone please help me with this issue? <?php $firstname = esc_attr($_POST['fname']); $lastname= esc_attr($_POST['lname']); $email= esc_attr($_POST['email']); ... $error = false; $required = array($firstname, $lastname, $email ...); if (!isset($_POST['on-reg-submit'])) { // Do nothing } else { foreach($required as $val) { if (empty($_POST[$val])) { $error = true; } } if ($error) { // If errors, prevent from submmiting to external DB } else { // No errors try { // Here is where I connect to the external DB // processing the posts values into it and storing the post values into my external DB } catch { echo "ERROR!"; } } ....
  3. Figured it out. Thanks for viewing!
  4. Hi, I'm working on a reset password for WordPress and I'm stumped on this query. What the query does is when a user requests a password reset, the query makes an update to the user's password and activation key. When I run this query, it's giving me int(0) which is saying there are no rows affected. I ran a var_dump on each POST variables to check if the values are correct and it is, so I'm not sure where the error is coming from this sql statement. $resetQuery = $wpdb -> query($wpdb -> prepare("UPDATE wp_users SET user_pass = %s, user_activation_key = '' WHERE user_login = %s AND user_activation_key = %s" , $hashedPwd , $usernameemail, $key)); If anyone can please assist me, that would be great! -Halben
  5. First off, I'm working on a WordPress website. I'm having issue getting the video to play in the FV WordPress Flowplayer: (1) auto play when the page loads (2) Listen for the button click event (purposedly added the comment tag for testing either one) Here's my code: var $j = jQuery.noConflict(); $j(function(){ (1) $j('#post-1823.flowplayer').flowplayer().play(); (2) /*$j('#post-1823.flowplayer').flowplayer({ play: function(){ console.log('IT PLAYS!'); } });*/ }); The error I'm getting for (1) is "Uncaught TypeError: Object[object Object] has no method 'play'" Uncaught TypeError: Object [object Object] has no method 'play' - custom_scripts.js:33 (anonymous function) - custom_scripts.js:33 x.Callbacks.c - jquery.js?ver=1.10.2:3 x.Callbacks.p.fireWith - jquery.js?ver=1.10.2:3 x.extend.ready - jquery.js?ver=1.10.2:3 q I'm thinking that it's not understanding any of the flowplayer api functions. *Ref Link*: http://flowplayer.org/docs/api.html Can someone please assist me with these issues? Thank you, rolu
  6. I have the following codes: if(window.location.pathname.search(/\?/) != -1) { var refUrl = window.location.pathname.strip(/\?/); } else { var refUrl = window.location.pathname; } var pathname = refUrl += '/' + 'hey' + '/' + 'what'; alert(refUrl); I'm running a check to see if there are any characters in the pathname, if so, strip it out. The output is : /_display//hey/what So basically it didn't strip anything characters out from the pathname after testing this on jsfiddle. Can someone please tell me what's wrong with it? Thank you, halben
  7. I'm getting the error: Error code: ERR_TOO_MANY_REDIRECTS after writing this filter hook function into my child theme functions.php. My code is below: function redirect_wp_login() { $request = basename($_SERVER['REQUEST_URI']); if ($request == 'wp-login.php') { wp_redirect(site_url('/login')); exit(); } } add_filter('init', 'redirect_wp_login'); Anything wrong with the code?
  8. Thanks for the assistance. I'm still pretty new to this so I'll keep on researching.
  9. I found 2 links regarding to automating services: 1) http://www.redolivedesign.com/utah-web-designers-blog/2007/11/17/how-to-run-a-php-or-asp-file-on-a-schedule-with-windows-xmlhttp-object-and-scheduled-tasks/ 2) http://amitdhamu.com/blog/automating-php-using-task-scheduler/ I'm just not sure which to use.
  10. What I meant was can I make HTTP request to call the script since my script is on the server?
  11. How would I configure the script to run if the sript is the server? php -f /path/to/script.php I'm assuming this line of code only retrieves the file from the local computer.
  12. Bummer. Let me know if I'm going in the right direction. I'm working on a WordPress website where new users who registers to the site gets their information stored into the WP database and an external database. I have that fully functional from WordPress DB syncing/updating users information to an external DB. I'm trying to get the external DB to do the same thing to the WordPress DB. What I'm basically trying to do is listen for changes in the external DB so if anything changes in it, it would update only 1 field in the WordPress DB. This is possible right?
  13. Hi PHPFreaks =), I'm in need of some guidance. Is it possible and safe to open a SOAP Connection every 10-15 minutes? Thanks, Hal
  14. Hi All, I'm trying to rename a category name from my url. Here it is: // Register custom post types add_action('init', 'pyre_init'); function pyre_init() { global $data; register_post_type( 'avada_portfolio', array( 'labels' => array( 'name' => 'Portfolio', 'singular_name' => 'Portfolio' ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => $data['portfolio_slug']), 'supports' => array('title', 'editor', 'thumbnail','comments'), 'can_export' => true, ) ); register_taxonomy('portfolio_category', 'avada_portfolio', array('hierarchical' => true, 'label' => 'Categories', 'query_var' => true, 'rewrite' => true)); register_taxonomy('portfolio_skills', 'avada_portfolio', array('hierarchical' => true, 'label' => 'Skills', 'query_var' => true, 'rewrite' => true)); ... Here is what I have at the moment: function custom_portfolio_to_customer_category_url($content) { $current_path = 'portfolio_category'; $new_path = 'customer_category'; $content = str_replace($current_path, $new_path, $content); return $content; } add_filter('term_link', 'custom_portfolio_to_customer_category_url'); I'm using the str_replace() function to rename portfolio_category to customer_category. "It" did replace it but it seems to have wiped out the category and I'm unable to access the portfolio_category post. Can someone please guide me or assist me in what I'm doing wrong here? Thank you, Hal
  15. Figured it out. I had to use the hidden type instead of the button name. It's weird. For the plugin, I had to custom insert a button name value so when the submit button has been pressed, it could read it. But for some reason, it wasn't reading the name value from the button. Thanks for helping.
  16. I tried using OR (||) and it doesn't work. Any more suggestions?
  17. I have the following: .. This is the button with hidden type .. <input type="hidden" name="s2member_pro_paypal_registration[nonce]" id="s2member-pro-paypal-registration-nonce" value="xxx"> <input type="hidden" name="s2p-option" value=""> <input type="submit" name="r_submit" id="s2member-pro-paypal-registration-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-registration-submit" value="Register" tabindex="1000"> My code to detect the submit button: if (!isset($_POST['r_submit']) && $_POST['s2member_pro_paypal_registration']['nonce'] == 'xxx') { // Do nothing } else { var_dump($something); // Do something } My site spits out var_dump() automatically when the form hasn't been submitted yet and I'm not sure why. Can someone please help me? Thanks, Hal
  18. <input type="text" maxlength="100" autocomplete="off" value="" name="s2member_pro_paypal_registration[custom_fields][company_name]" id="s2member-pro-paypal-registration-custom-reg-field-company-name" aria-required="true" tabindex="105" data-expected="alphanumerics-5" class="s2member-pro-paypal-custom-reg-field-company-name s2member-pro-paypal-registration-custom-reg-field-company-name"> And the code above should be: $_POST['s2member_pro_paypal_registration[custom_fields][company_name]']; -> $_POST['s2member_pro_paypal_registration']['custom_fields']['company_name']; Can you please give me a quick explanation?
  19. Hi, I'm running into an issue retrieve data values from a registration submission form. The form is using a POST method Please see code below. More codes above, just a small snippet ... <div id="s2member-pro-paypal-registration-form-email-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-email-div s2member-pro-paypal-registration-form-email-div"> <label for="s2member-pro-paypal-registration-email" id="s2member-pro-paypal-registration-form-email-label" class="s2member-pro-paypal-form-email-label s2member-pro-paypal-registration-form-email-label"> <span><?php echo _x ("Email Address", "s2member-front", "s2member"); ?> </span><span class="red-asterik">∗</span><br /> </label> <input type="text" aria-required="true" data-expected="email" maxlength="100" autocomplete="off" name="s2member_pro_paypal_registration[email]" id="s2member-pro-paypal-registration-email" class="s2member-pro-paypal-email s2member-pro-paypal-registration-email" value="%%email_value%%" tabindex="40" /> </div> ... <div id="s2member-pro-paypal-registration-form-submit-div" class="s2member-pro-paypal-form-div s2member-pro-paypal-registration-form-div s2member-pro-paypal-form-submit-div s2member-pro-paypal-registration-form-submit-div"> %%hidden_inputs%% <!-- Auto-filled by the s2Member software. Do NOT remove this under any circumstance. --> <input type="submit" name="registration_submit" id="s2member-pro-paypal-registration-submit" class="s2member-pro-paypal-submit s2member-pro-paypal-registration-submit" value="<?php echo esc_attr (_x ("Register", "s2member-front", "s2member")); ?>" tabindex="400" /> </div> <div style="clear:both;"></div> </div> For this example, I have the following: // Store POST data into a variable $email = esc_attr($_POST['s2member_pro_paypal_registration[email]']); // Detect Submission if (!isset($_POST['registration_submit'])){ // Do nothing } else { // Check it var_dump($email); } This seems like it's correct but I wasn't able to retrieve the POST data and var_dump() was returning an empty string. Does anyone know why and should I post up more codes for more assistance? Thank you, Hal
  20. I figured it out. It's silly. I checked my error log and the error was posted 2 hours ago. I probably fixed it and forgot it was an old error. Sorry for your time and thanks for checking the code.
  21. I've looked over the code over and over and I'm wondering if there is an escape issue? Or other codes before that.
×
×
  • 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.