dansk
Member-
Posts
18 -
Joined
-
Last visited
About dansk

Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
dansk's Achievements
Junior Member (1/3)
0
Reputation
-
Hello, Revisiting the thread @ The issue with displaying the form's code in the form's fields (as seen in the linked post) was unable to be resolved. Could this have something to do with Joomla and the way it is parsed?
-
And that was using: <form method="post" action="a1.php"> <p><input type="text" name="firstname" placeholder="First name" size="20" value="<?php echo $_POST['firstname']; ?>"></p> <p><input type="text" name="lastname" placeholder="Last name" size="20" value="<?php echo $_POST['lastname']; ?>"></p> <p><input type="text" name="email" placeholder="email address" size="20" value="<?php echo $_POST['email']; ?>"></p> <p><input type="text" name="address1" placeholder="address" size="25" value="<?php echo $_POST['address1']; ?>"></p> <p><input type="text" name="city" placeholder="city" size="15" value="<?php echo $_POST['city']; ?>"></p> <p><input type="text" name="state" placeholder="state" size="15" value="<?php echo $_POST['state']; ?>"></p> <p><input type="text" name="postcode" placeholder="zip or postal code" size="15" value="<?php echo $_POST['postcode']; ?>"></p> <p> <select name="country"> <option value="">Please select</option> <option value="IT">Italy</option> <option value="FR">France</option> <option value="DE">Germany</option> <!-- And so on... --> </select> </p> <p><input type="text" name="phonenumber" placeholder="phone number" size="12" value="<?php echo $_POST['phonenumber']; ?>"></p> <p><input type="submit" value="Submit"></p> </form>
-
Still the same. Displays as
-
Thanks @Kian, I'll play with this and see what I can get done with it. In the meantime, I also have a derivative of the code working that I posted above for the form. The problem is csrf tokens, and to get it to work I had to turn these off in Setup > General Settings > Security. It's not advisable, but it works.
-
Hi, Here a working example of this code in action: While it seemed to work better in the link you posted, it was toggling back and forth between "No address entered" and "No country entered." These fields were both entered on all occasions, but the messages persisted nonetheless. The other thing I noticed is that the password was in plain text too.
-
-
Hi Kian, many thanks. Except for the <p> tags, this is exactly the code I tried later. However, even though the API keys are authorized for exactly this purpose, the form never posted and no response at all was generated. No errors. No response. Keep in mind though that the domain this is hosted on is example.com. and the domain whmcs resides on is subdomain.example.com. Same server. Same domain otherwise. I agree with you on the <p> tags. But, for whatever reason, only the closing tag is necessary. The display works as it should.
-
Seems that way, doesn't it? But, if you don't use the </p> tags fields display horizontally instead of vertically, and the Submit button doesn't show. Best DanSK
-
Thanks for your feedback, Kian! Yes, I am still trying to wrap my head around this. You are correct. A few working examples to get up to speed here with WHMCS certainly helps though. Kind thanks!
-
Hello, So the form to go with this is as: <form method="post" action="https://subscriptions.h-desk.pro/cs/includes/hooks/myclientadd.php"> <input type="text" name="firstname" placeholder="First name" size="20"></p> <input type="text" name="lastname" placeholder="Last name" size="20"></p> <input type="text" name="email" placeholder="email address" size="20"> </p> <input type="text" name="address1" placeholder="address" size="25"> </p> <input type="text" name="city" placeholder="city" size="15"> </p> <input type="text" name="state" placeholder="state" size="15"></p> <input type="text" name="postcode" placeholder="zip or postal code" size="15"></p> <input type="text" name="country" placeholder="country" size="25"> </p> <input type="text" name="phonenumber" placeholder="phone number" size="12"></p> <input type="text" name="password2" placeholder="password" size="15"></p> <input type="hidden" name="firstname" value="<?php $_POST[firstname]; ?>" <input type="hidden" name="lastname" value="<?php $_POST[lastname]; ?>" <input type="hidden" name="email" value="<?php $_POST[email]; ?>" <input type="hidden" name="address1" value="<?php $_POST[address]; ?>" <input type="hidden" name="city" value="<?php $_POST[city]; ?>" <input type="hidden" name="state" value="<?php $_POST[state]; ?>" <input type="hidden" name="postcode" value="<?php $_POST[postcode]; ?>" <input type="hidden" name="country" value="<?php $_POST[country]; ?>" <input type="hidden" name="phonenumber" value="<?php $_POST[phonenumber]; ?>" <input type="hidden" name="password2" value="<?php $_POST[clientip]; ?>" <input type="hidden" name="clientip" value="<?php $_POST[clientip]; ?>"</p> <input type="submit" value="Submit"> </form> And the response is: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://h-desk.pro/cs/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'AddClient', // See https://developers.whmcs.com/api/authentication 'username' => '5uM7VqxuFCaIdazDd4bZ5VyivjcI2i36', 'password' => '9s4pNshx5PVRuJrfJpLIuzPUSMtChr6n', 'firstname' => $firstname, 'lastname' => $lastname, 'email' => '$email, 'address1' => $address1, 'city' => $city, 'state' => $state, 'postcode' => $postcode, 'country' => $country, 'phonenumber' => $phonenumber, 'password2' => $password2, 'clientip' => $clientip, 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch); What went wrong here? Please note that the API keys are inserted where they are supposed to be. However, it is probably not in the right location as it was placed in includes/hooks. I don't think that would impact it though provided it is written correctly. Kind thanks
-
Ok, so except for the keys, would the code look like this? $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://h-desk.pro/cs/includes/api.php'); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query( array( 'action' => 'AddClient', // See https://developers.whmcs.com/api/authentication 'username' => 'IDENTIFIER_OR_ADMIN_USERNAME', 'password' => 'SECRET_OR_HASHED_PASSWORD', 'firstname' => $firstname, 'lastname' => $lastname, 'email' => '$email, 'address1' => $address1, 'city' => $city, 'state' => $state, 'postcode' => $postcode, 'country' => $country, 'phonenumber' => $phonenumber, 'password2' => $password2, 'clientip' => $clientip, 'responsetype' => 'json', ) ) ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $response = curl_exec($ch); curl_close($ch);
-
Hello @Kian, Thanks, and I'll have a look and give you some feeback. In the meantime here is some code for a form that works all except for the fact that it is not exchanging tokens with whmcs. Please have a look and let me know your thoughts if you would. Cheers <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Register - H-Desk Pro LLC</title> <!-- Styling --> <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Raleway:400,700" rel="stylesheet"> <link href="https://subscriptions.h-desk.pro/cs/templates/six/css/all.min.css?v=cff37f" rel="stylesheet"> <link href="https://subscriptions.h-desk.pro/cs/templates/six/css/custom.css" rel="stylesheet"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> <script type="text/javascript"> var csrfToken = 'ed183b9e40c1f385dd230797a9f889ca469e5dcb', markdownGuide = 'Markdown Guide', locale = 'en', saved = 'saved', saving = 'autosaving', whmcsBaseUrl = "https://subscriptions.h-desk.pro/cs/"; </script> <script src="https://subscriptions.h-desk.pro/cs/templates/six/js/scripts.min.js?v=cff37f"></script> </head> <ul class="nav navbar-nav navbar-right"> <li menuItemName="Account" class="dropdown" id="Secondary_Navbar-Account"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> <b class="caret"></b> </a> <ul class="dropdown-menu"> <li menuItemName="Login" id="Secondary_Navbar-Account-Login"> <a href="https://subscriptions.h-desk.pro/cs/clientarea.php"> Login </a> </li> <li menuItemName="Register" id="Secondary_Navbar-Account-Register"> <a href="https://subscriptions.h-desk.pro/cs/register.php"> Register </a> </li> <li menuItemName="Divider" class="nav-divider" id="Secondary_Navbar-Account-Divider"> <a href=""> ----- </a> </li> <li menuItemName="Forgot Password?" id="Secondary_Navbar-Account-Forgot_Password?"> <a href="https://subscriptions.h-desk.pro/cs/pwreset.php"> Forgot Password? </a> </li> </ul> </li> </ul> </div><!-- /.navbar-collapse --> </div> </nav> </section> <section id="main-body"> <div class="container"> <div class="row"> <div class="col-md-9 pull-md-right"> <div class="header-lined"> <h1>Register <small>Create an account with us . . .</small></h1> <ol class="breadcrumb"> <li> <a href="https://h-desk.pro/1/index.php"> Home </a> </li> <li class="active"> Register </li> </ol> </div> </div> <div class="col-md-3 pull-md-left sidebar"> <div menuItemName="Already Registered" class="panel panel-sidebar panel-sidebar"> <div class="panel-heading"> <h3 class="panel-title"> <i class="glyphicon glyphicon-user"></i> Already Registered? <i class="fa fa-chevron-up panel-minimise pull-right"></i> </h3> </div> <div class="list-group"> <div menuItemName="Already Registered Heading" class="list-group-item" id="Primary_Sidebar-Already_Registered-Already_Registered_Heading"> Already registered with us? If so, click the button below to login to our client area from where you can manage your account. </div> <a menuItemName="Login" href="https://subscriptions.h-desk.pro/cs/login.php" class="list-group-item" id="Primary_Sidebar-Already_Registered-Login"> <i class="fa fa-user"></i> Login </a> <a menuItemName="Lost Password Reset" href="https://subscriptions.h-desk.pro/cs/pwreset.php" class="list-group-item" id="Primary_Sidebar-Already_Registered-Lost_Password_Reset"> <i class="fa fa-asterisk"></i> Lost Password Reset </a> </div> </div> </div> <!-- Container for main page display content --> <div class="col-md-9 pull-md-right main-content"> <script type="text/javascript" src="https://subscriptions.h-desk.pro/cs/assets/js/StatesDropdown.js"></script> <script type="text/javascript" src="https://subscriptions.h-desk.pro/cs/assets/js/PasswordStrength.js"></script> <script> window.langPasswordStrength = "Password Strength"; window.langPasswordWeak = "Weak"; window.langPasswordModerate = "Moderate"; window.langPasswordStrong = "Strong"; jQuery(document).ready(function() { jQuery("#inputNewPassword1").keyup(registerFormPasswordStrengthFeedback); }); </script> <div id="registration"> <form method="post" class="using-password-strength" action="https://someexample.com/register.php" role="form" name="orderfrm" id="frmCheckout"> <input type="hidden" name="token" value="03741182865dbf1e95e0ef316de9cef17c10b911" /> <input type="hidden" name="register" value="true"/> <div id="containerNewUserSignup"> <div class="sub-heading"> <span>Personal Information</span> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group prepend-icon"> <label for="inputFirstName" class="field-icon"> <i class="fa fa-user"></i> </label> <input type="text" name="firstname" id="inputFirstName" class="field form-control" placeholder="First Name" value="" required autofocus> </div> </div> <div class="col-sm-6"> <div class="form-group prepend-icon"> <label for="inputLastName" class="field-icon"> <i class="fa fa-user"></i> </label> <input type="text" name="lastname" id="inputLastName" class="field form-control" placeholder="Last Name" value="" required> </div> </div> <div class="col-sm-6"> <div class="form-group prepend-icon"> <label for="inputEmail" class="field-icon"> <i class="fa fa-envelope"></i> </label> <input type="email" name="email" id="inputEmail" class="field form-control" placeholder="Email Address" value=""> </div> </div> <div class="col-sm-6"> <div class="form-group prepend-icon"> <label for="inputPhone" class="field-icon"> <i class="fa fa-phone"></i> </label> <input type="tel" name="phonenumber" id="inputPhone" class="field" placeholder="Phone Number" value=""> </div> </div> </div> <div class="sub-heading"> <span>Billing Address</span> </div> <div class="row"> <div class="col-sm-12"> <div class="form-group prepend-icon"> <label for="inputCompanyName" class="field-icon"> <i class="fa fa-building"></i> </label> <input type="text" name="companyname" id="inputCompanyName" class="field" placeholder="Company Name (Optional)" value=""> </div> </div> <div class="col-sm-12"> <div class="form-group prepend-icon"> <label for="inputAddress1" class="field-icon"> <i class="fa fa-building-o"></i> </label> <input type="text" name="address1" id="inputAddress1" class="field form-control" placeholder="Street Address" value="" required> </div> </div> <div class="col-sm-12"> <div class="form-group prepend-icon"> <label for="inputAddress2" class="field-icon"> <i class="fa fa-map-marker"></i> </label> <input type="text" name="address2" id="inputAddress2" class="field" placeholder="Street Address 2" value=""> </div> </div> <div class="col-sm-4"> <div class="form-group prepend-icon"> <label for="inputCity" class="field-icon"> <i class="fa fa-building-o"></i> </label> <input type="text" name="city" id="inputCity" class="field form-control" placeholder="City" value="" required> </div> </div> <div class="col-sm-5"> <div class="form-group prepend-icon"> <label for="state" class="field-icon" id="inputStateIcon"> <i class="fa fa-map-signs"></i> </label> <label for="stateinput" class="field-icon" id="inputStateIcon"> <i class="fa fa-map-signs"></i> </label> <input type="text" name="state" id="state" class="field form-control" placeholder="State" value="" required> </div> </div> <div class="col-sm-3"> <div class="form-group prepend-icon"> <label for="inputPostcode" class="field-icon"> <i class="fa fa-certificate"></i> </label> <input type="text" name="postcode" id="inputPostcode" class="field form-control" placeholder="Postcode" value="" required> </div> </div> <div class="col-sm-12"> <div class="form-group prepend-icon"> <label for="inputCountry" class="field-icon" id="inputCountryIcon"> <i class="fa fa-globe"></i> </label> <select name="country" id="inputCountry" class="field form-control"> <option value="AU"> Australia </option> <option value="IO"> British Indian Ocean Territory </option> <option value="CA"> Canada </option> <option value="CV"> Cape Verde </option> <option value="KY"> Cayman Islands </option> <option value="GH"> Ghana </option> <option value="GI"> Gibraltar </option> <option value="GD"> Grenada </option> <option value="GU"> Guam </option> <option value="GG"> Guernsey </option> <option value="HK"> Hong Kong </option> <option value="IM"> Isle Of Man </option> <option value="IL"> Israel </option> <option value="JE"> Jersey </option> <option value="LB"> Lebanon </option> <option value="MH"> Marshall Islands </option> <option value="MQ"> Martinique </option> Mauritius </option> <option value="NL"> Netherlands </option> <option value="NZ"> New Zealand </option> <option value="NG"> Nigeria </option> <option value="NF"> Norfolk Island </option> <option value="MP"> Northern Mariana Islands </option> <option value="NO"> Norway </option> <option value="PH"> Philippines </option> <option value="SC"> Seychelles </option> <option value="SG"> Singapore </option> <option value="SB"> Solomon Islands </option> <option value="ZA"> South Africa </option> <option value="GS"> South Georgia And Sandwich Isl. </option> <option value="SZ"> Swaziland </option> <option value="SE"> Sweden </option> <option value="CH"> Switzerland </option> <option value="TZ"> Tanzania </option> <option value="TT"> Trinidad And Tobago </option> <option value="TN"> Tunisia </option> <option value="UG"> Uganda </option> <option value="AE"> United Arab Emirates </option> <option value="GB"> United Kingdom </option> <option value="US" selected="selected"> United States </option> <option value="UM"> United States Outlying Islands </option> < <option value="VN"> Viet Nam </option> <option value="VG"> Virgin Islands, British </option> <option value="VI"> Virgin Islands, U.S. </option> <option value="ZW"> Zimbabwe </option> </select> </div> </div> </div> <div id="containerNewUserSecurity" > <div class="sub-heading"> <span>Account Security</span> </div> <div id="containerPassword" class="row"> <div id="passwdFeedback" style="display: none;" class="alert alert-info text-center col-sm-12"></div> <div class="col-sm-6"> <div class="form-group prepend-icon"> <label for="inputNewPassword1" class="field-icon"> <i class="fa fa-lock"></i> </label> <input type="password" name="password" id="inputNewPassword1" data-error-threshold="50" data-warning-threshold="75" class="field" placeholder="Password" autocomplete="off"> </div> </div> <div class="col-sm-6"> <div class="form-group prepend-icon"> <label for="inputNewPassword2" class="field-icon"> <i class="fa fa-lock"></i> </label> <input type="password" name="password2" id="inputNewPassword2" class="field" placeholder="Confirm Password" autocomplete="off"> </div> </div> <div class="col-sm-6"> <div class="progress"> <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" id="passwordStrengthMeterBar"> </div> </div> </div> <div class="col-sm-6"> <p class="text-center small text-muted" id="passwordStrengthTextLabel">Password Strength: Enter a Password</p> </div> </div> </div> <div class="marketing-email-optin"> <h4>Join our mailing list</h4> <p>We would like to send you occasional news, information and special offers by email. To join our mailing list, simply tick the box below. You can unsubscribe at any time.</p> <input type="checkbox" name="marketingoptin" value="1" checked class="no-icheck toggle-switch-success" data-size="small" data-on-text="Yes" data-off-text="No"> </div> <div class="row"> <div class="col-md-8 col-md-offset-2 col-xs-10 col-xs-offset-1"> <div id="default-captcha-domainchecker" class="text-center"> <p>Please enter the characters you see in the image below into the text box provided. This is required to prevent automated submissions.</p> <div class="col-xs-6 captchaimage"> <img id="inputCaptchaImage" src="https://some/includes/verifyimage.php" align="middle" /> </div> <div class="col-xs-6"> <input id="inputCaptcha" type="text" name="code" maxlength="5" class="form-control pull-left" /> </div> </div> </div> </div> <br/> <p align="center"> <input class="btn btn-large btn-primary" type="submit" value="Register"/> </p> </form> </div> <p style="text-align:center;">Powered by <a href="https://www.whmcs.com/" target="_blank">WHMCompleteSolution</a></p> </div><!-- /.main-content --> <div class="clearfix"></div> </div> </div> </section> <section id="footer"> <div class="container"> <a href="#" class="back-to-top"><i class="fa fa-chevron-up"></i></a> <p>Copyright © 2018 H-Desk Pro LLC. All Rights Reserved.</p> </div> </section> <div class="modal system-modal fade" id="modalAjax" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content panel panel-primary"> <div class="modal-header panel-heading"> <button type="button" class="close" data-dismiss="modal"> <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> <h4 class="modal-title">Title</h4> </div> <div class="modal-body panel-body"> Loading... </div> <div class="modal-footer panel-footer"> <div class="pull-left loader"> <i class="fa fa-circle-o-notch fa-spin"></i> Loading... </div> <button type="button" class="btn btn-default" data-dismiss="modal"> Close </button> <button type="button" class="btn btn-primary modal-submit"> Submit </button> </div> </div> </div> </div> </body> </html>
-
Hello @sokalsondha, Maybe this will help. Go to /templates/yourtemplate/logout.tpl and replace this code: <div class="main-content"> <p class="text-center"> <a href="index.php" class="btn btn-default">{$LANG.logoutcontinuetext}</a> </p> </div> with this code: <div class="main-content"> <p class="text-center"> <a href="clientarea.php" class="btn btn-default">{$LANG.logoutcontinuetext}</a> </p> </div> Cheers
-
Hello @Kian, Actually, WHMCS is hosted on a subdomain of the main domain on the same server. Best
-
Thanks @brian! As I was explaining to @redit above, the example in the documentation falls short of completing a fully working hook for WHMCS, and I need to understand this going forward. The immediate need at the moment is to allow customer registration through the website. Please see the code above, which if not for the fact that tokens are not being exchanged with WHMCS, actually works. Kind thanks!
