Jump to content

driz

Members
  • Posts

    240
  • Joined

  • Last visited

Everything posted by driz

  1. driz

    HTML5 Canvas Help

    It also just crashed Chrome, which displayed a message about the script using too much memory, I think it's just looping over and never actually rendering anything. I've changed those two loops but still not working... any ideas? Thanks.
  2. driz

    HTML5 Canvas Help

    Hi I have tried that but it doesn't seem to have fixed anything. Have I changed the correct loops? (I've updated the code at http://dev.driz.co.uk/canvas/)
  3. driz

    HTML5 Canvas Help

    When I run it in Firebug it throws an error about "Cannot read property x of undefined" and then also "Cannot read property color of undefined" I think their is definitely a bug in the code but I'm not sure what the problem is.I wouldn't think it would be too hard on the processor as I had a previous version working fine before and all I have added is the gradient and also reduced the number of balls down to two so therefore it should run fine. Seems like their is a bug in the code rather than performance problem. I think the bug is also causing the app to run infinite, perhaps I don't need the setInterval but that's required for the update of the canvas when the mouse moves the balls.If you or anyone can take a look at the code and see what the problem is that'd be really awesome. Thanks.
  4. driz

    HTML5 Canvas Help

    Anyone had chance to look at this yet? Thanks.
  5. Hi I have the following Canvas application: http://dev.driz.co.uk/canvas/But it's not rendering anything out. It should be showing a bunch of balls that move around the screen when the user moves the cursor.I think it's just a small bug somewhere because it was working fine in an older version here: http://dev.driz.co.uk/app/It's taking a while to load as if it's doing something but just snagging somewhere, but the code looks fine to me. After testing in Firebug the following error comes up: 'Cannot read property x of undefined on several lines mainly around the gradient creation. I have no idea what the problem is :/If anyone can help it'd be much appreciated. Thank you
  6. I'm building a simple PHP Form that will update the status of a twitter account. I have the following code, but it doesn't update my status (the username and password has been removed for this snippet) anymore because it used basic auth and twitter now requires OAuth.I have been following this tutorial here: http://ditio.net/2010/06/07/twitter-php-oauth-update-status/ and I have registered my App and copied both the Library and Tokens over (again these are removed from this snippet).BUT I'm not sure how to get this working with my current code, ie. what needs changing/adding/removing to get the OAuth working with my current code.If anyone could help me get this working that'd be awesome. As I have no idea where to start. Thanks. <?php function postToTwitter($username,$password,$message) { require_once 'TwitterOAuth.php'; define("CONSUMER_KEY", "???"); define("CONSUMER_SECRET", "???"); define("OAUTH_TOKEN", "???"); define("OAUTH_SECRET", "???"); $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET); $content = $connection->get('account/verify_credentials'); $connection->post('statuses/update', array('status' => date(DATE_RFC822))); // GET the API url via web authentication // add 'status' param to send a message to Twitter $host = "http://api.twitter.com/1/statuses/update.xml?status=".urlencode(stripslashes(urldecode($message))); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt($ch, CURLOPT_USERPWD, "$username:$password"); curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); curl_setopt($ch, CURLOPT_POST, 1); // Go for it!!! $result = curl_exec($ch); // Look at the returned header $resultArray = curl_getinfo($ch); // close curl curl_close($ch); //echo "http code: ".$resultArray['http_code']."<br />"; if($resultArray['http_code'] == "200"){ echo "<br />OK! posted to http://twitter.com/".$username."/<br />"; } else { echo "eek! yegads! error posting to Twitter"; } // debug the result // echo "<pre>"; // print_r($resultArray); // echo "</pre><hr>"; // $sResult = htmlentities($result); // $sResult = str_replace("><","><br /><",$sResult); // echo "<pre>"; // print $sResult; // echo "</pre>"; } if(isset($_POST['submit'])) { $textmessage = $_POST['message']; postToTwitter("whiningwall","u0558234",$textmessage); }?><!DOCTYPE html><html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=1024"> <title></title> <link rel="stylesheet" type="text/css" href="master.css" media="screen" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> </head> <body> <form id="post" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <fieldset> <label for="textArea">What's on your mind?</label> <textarea id="textArea" name="message" maxlength="140"></textarea> <div class="submit"> <span class="charsRemaining"></span> <input type="submit" name="submit" value="Share" /> </div> </fieldset> </form> <script type="text/javascript" src="jquery.maxlength.js"></script> <script type="text/javascript"> $('#textArea').focus(); </script> </body></html>
  7. Where do you find this list of input names? Also how do I get this to work with Aktive merchant ( do I even need it? or would it be easy without? )Would you be able to share some sample code to get my code talking to PayPal. Thanks
  8. Any updates? More than anything I need help getting it started such as what code to add where I've put my comment and then how to use Aktive Merchant to talk to my form and to PayPal.Thanks
  9. Hi, I am building a PHP-based form that grabs a persons contact details and asks them a question, depending on the answer they choose they can either purchase a product or they will be told they don't qualify and a sales person will be in touch. I have managed get all of this working, but now need to do the payment part. Their is only one product and the user has no options all they do is pay a fixed price and job done!I have been told to look at Aktive Merchant: http://github.com/akDeveloper/Aktive-Merchant to handle this. But their seems little documentation and I could do with some help setting this up. I will be using PayPal for the payment system. Some of the things that are confusing me are will a user have to re-enter all their address details (will they even be sent to the paypal site) don't quite get how this code works, but essentially all I want is for a quick easy way to grab the payment details from a user and send them a confirmation email.The code for the form is as follows: <!DOCTYPE html><html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=1024"> <title>Buy</title> <script src="jquery.min.js"></script> <script src="jquery.validate.min.js"></script> <script src="jquery.functions.js"></script> <style> html, input { font: 12px Arial, sans-serif; } body { width: 980px; margin: 30px auto; } label.error { float: right; } ul { list-style: none; } ul.radio input, ul.radio label { cursor: pointer; } label { display: block; } span.name { display: block; float: left; } span.name label { display: block; font-size: 11px; } li { clear: both; } </style> </head> <body> <?php if(isset($_POST['continue'])) { // Send info to email address $to = "talk2driz@gmail.com"; $subject = "SolidCAM Xpress"; $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $phone = $_POST['phone']; $organisation = $_POST['organisation']; $address1 = $_POST['address1']; $address2 = $_POST['address2']; $address3 = $_POST['address3']; $postcode = $_POST['postcode']; $solidworks = $_POST['solidworks']; if($solidworks == 'No') { $reseller = 'None'; } else { $reseller = $_POST['reseller']; } // message $message = " <html> <head> <title>SolidCAM Xpress</title> </head> <body> <p>The following customer has attempted to purhase SolidCAM Xpress</p> <table> <tr> <th>Name</th> <td>$firstname $lastname</td> </tr> <tr> <th>Email</th> <td>$email</td> </tr> <tr> <th>Phone</th> <td>$phone</td> </tr> <tr> <th>Organisation</th> <td>$organisation</td> </tr> <tr> <th>Address Line 1</th> <td>$address1</td> </tr> <tr> <th>Address Line 2</th> <td>$address2</td> </tr> <tr> <th>Address Line 3</th> <td>$address3</td> </tr> <tr> <th>Post code</th> <td>$postcode</td> </tr> <tr> <th>Reseller</th> <td>$reseller</td> </tr> </table> </body> </html> "; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'Reply-To: SolidCAM UK <info@solidcamuk.com>' . "\r\n"; $headers .= 'From: SolidCAM UK <info@solidcamuk.com>'; // Mail it mail($to, $subject, $message, $headers); // run the reseller check function ResellerCheck(); } else { ?> <form id="BuyForm" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <fieldset> <legend>About you</legend> <ul> <li> <label>Name</label> <span class="name"> <input type="text" id="firstname" name="firstname" /> <label for="firstname">First name <em>*</em></label> </span> <span class="name"> <input type="text" id="lastname" name="lastname" /> <label for="lastname">Last name <em>*</em></label> </span> </li> <li> <label for="email">Email <em>*</em></label> <input type="text" id="email" name="email" /> </li> <li> <label for="phone">Phone <em>*</em></label> <input type="text" id="phone" name="phone" /> </li> <li> <label for="organisation">Organisation <em>*</em></label> <input type="text" id="organisation" name="organisation" /> </li> <li> <label for="address1">Address Line 1 <em>*</em></label> <input type="text" id="address1" name="address1" /> </li> <li> <label for="address2">Address Line 2 <em>*</em></label> <input type="text" id="address2" name="address2" /> </li> <li> <label for="address3">Address Line 3</label> <input type="text" id="address3" name="address3" /> </li> <li> <label for="postcode">Post code <em>*</em></label> <input type="text" id="postcode" name="postcode" /> </li> </ul> </fieldset> <fieldset> <legend>Do you currently have SolidWorks <em>*</em></legend> <ul class="radio"> <li><label for="yes"><input type="radio" name="solidworks" id="yes" value="Yes" /> Yes</label></li> <li><label for="no"><input type="radio" name="solidworks" id="no" value="No" /> No</label></li> </ul> <div id="divReseller" style="display:none;"> <p>Who is your SolidWorks reseller?</p> <ul class="radio"> <li><label for="rd1"><input type="radio" id="rd1" name="reseller" value="Cad Connect" /> Cad Connect</label></li> <li><label for="rd2"><input type="radio" id="rd2" name="reseller" value="Cadtek" /> Cadtek</label></li> <li><label for="rd3"><input type="radio" id="rd3" name="reseller" value="CCSL" /> CCSL</label></li> <li><label for="rd4"><input type="radio" id="rd4" name="reseller" value="Innova" /> Innova</label></li> <li><label for="rd5"><input type="radio" id="rd5" name="reseller" value="NT CAD/CAM" /> NT CAD/CAM</label></li> <li><label for="rd6"><input type="radio" id="rd6" name="reseller" value="Solid Engineer" /> Solid Engineer</label></li> <li><label for="rd7"><input type="radio" id="rd7" name="reseller" value="Solid Solutions Ireland" /> Solid Solutions Ireland</label></li> <li><label for="rd8"><input type="radio" id="rd8" name="reseller" value="Solid Solutions Management" /> Solid Solutions Management</label></li> <li><label for="rd9"><input type="radio" id="rd9" name="reseller" value="TMS Scotland" /> TMS Scotland</label></li> </ul> </div> </fieldset> <p>* required fields</p> <p><input type="submit" name="continue" value="Continue" /></p> </form> <?php } ?> <?php // Check if user has selected None from the last question then show the message or go to paypal function ResellerCheck() { $solidworks = $_POST['solidworks']; if($solidworks == 'No') { echo "SolidCAM Xpress requires a valid copy of SolidWorks, we will be in touch shortly to discuss pricing!"; } else { // Do some PAYPAL stuff } } ?> </body></html> As you will see at the very end is a simple if statement that checks if they chose a particular reseller or not, and if they have then I want to do the paypal stuff, but need a little help with how to use that Aktive Merchant, presuming of course that is the best solution.Thanks.
  10. driz

    PHP Form with PayPal

    I don't even know where to start with this. I was hoping it was really simple to setup PayPal with a PHP form, I take it that's not the case?Basically all I want is a quick enter your details and then jump to PayPal pay the fee and land back. Can you recommend some code for that kind of functionality.
  11. driz

    PHP Form with PayPal

    Well all of it to be honest. Basically I want to use only one PHP file for the whole thing (with the exception of the PayPal areas off-site). So to break it down, upon a user entering the buy page they should see the form, and then when they hit the continue button and create the postback it should hide the form and then either show the message if they chose None from the radio button list, or send them to PayPal, this is the part I'm most stuck with as I don't want to user to have to re-enter there details on the PayPal website, I've looked at the API but I'm confused about where to go as there are several options. All I want to is get the user to quickly visit the site, either login to PP or enter there credit card details, and then return back to this page.I also want the user to return to this same page after making the purchase, so there needs to be some check for that and show a message saying Thanks.
  12. driz

    PHP Form with PayPal

    Hi, I'm building a PHP form that asks a user a series of questions like name, email, phone etc, followed by some radio buttons. After the user has clicked the continue button it will send this info to an email address. If user has selected None for the reseller question then they will be shown a message saying someone will be in touch, if they have selected one of the other options then they will be able to purchase the product using PayPal.I need some help sending this data over to PayPal and allowing the user to purchase the product and then sending them back to the page afterwards with some form of thank you.This is the code I have so far: <!DOCTYPE html><html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=1024"> <title>Buy</title> </head> <body> <?php if(isset($_POST['continue'])) { // Send info to email address $to = "info@solidcamxpress.co.uk"; $subject = "SolidCAM Xpress"; $name_field = $_POST['name']; $email_field = $_POST['email']; $phone_field = $_POST['message']; $company_field = $_POST['company']; $reseller_field = $_POST['reseller']; $body = "From: $name_field\n E-Mail: $email_field\n Phone:\n $phone_field\n Company:\n $company_field\n Reseller:\n $reseller_field"; mail($to, $subject, $body); // run the reseller check function ResellerCheck(); } else { ?> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <fieldset> <legend>Purchase SolidCAM Xpress</legend> <ul> <li><label for="name">Name <input type="text" name="name" /></label></li> <li><label for="email">Email <input type="text" name="email" /></label></li> <li><label for="phone">Phone <input type="text" name="phone" /></label></li> <li><label for="company">Company <input type="text" name="company" /></label></li> </ul> <p>Do you currently have SolidWorks, if yes who is your reseller?</p> <ul> <li><label for=""><input type="radio" name="reseller" value="None" /> Don't have SolidWorks</label></li> <li><label for=""><input type="radio" name="reseller" value="Cad Connect" /> Cad Connect</label></li> <li><label for=""><input type="radio" name="reseller" value="Cadtek" /> Cadtek</label></li> <li><label for=""><input type="radio" name="reseller" value="CCSL" /> CCSL</label></li> <li><label for=""><input type="radio" name="reseller" value="Innova" /> Innova</label></li> <li><label for=""><input type="radio" name="reseller" value="NT CAD/CAM" /> NT CAD/CAM</label></li> <li><label for=""><input type="radio" name="reseller" value="Solid Engineer" /> Solid Engineer</label></li> <li><label for=""><input type="radio" name="reseller" value="Solid Solutions Ireland" /> Solid Solutions Ireland</label></li> <li><label for=""><input type="radio" name="reseller" value="Solid Solutions Management" /> Solid Solutions Management</label></li> <li><label for=""><input type="radio" name="reseller" value="TMS Scotland" /> TMS Scotland</label></li> </ul> <p><input type="submit" name="continue" value="Continue" /></p> </fieldset> </form> <?php } ?> <?php // Check if user has selected None from the last question then show the message or go to paypal function ResellerCheck() { if($reseller_field == 'None') { echo "SolidCAM Xpress requires a valid copy of SolidWorks, we will be in touch shortly to discuss pricing!"; } else { // do paypal stuff } }if( /* user is returning from paypal */ ) { echo "Thanks for your purchase, we will be in touch shortly"; } ?> </body></html>
  13. driz

    jQuery Animate

    I want to animate a div by changing it's top property like so: var loadingFrame = 1; loadingFrame = (loadingFrame + 1) % 12; // Loading animation jQuery('div.ModalLoading div').css('top', (loadingFrame * -40) + 'px'); div.ModalLoading { height: 40px; width: 40px; margin: 0 auto 20px; overflow: hidden; z-index: 1104; position: relative; } div.ModalLoading div { position: absolute; top: 0; left: 0; width: 40px; height: 480px; background: url('loading.png'); } The idea is that the inner div will look like it is sliding up inside the ModalLoading div, and needs to continue infinite. At the moment the div is stationary. Thanks.EDIT: This is based upon the loading in FancyBox --> http://fancybox.net/ if that helps anyone debug my code.
  14. driz

    Js Modal Help

    This is what I ended up with in the end: function JS_Utils_BuildModal () { var objModal = document.createElement("div"); var objContent = document.createElement("div"); var objP = document.createElement("p"); objModal.setAttribute('id', 'Modal'); objContent.className = 'ModalContent'; objP.innerHTML = '<img src="loader.gif" alt="loading" /><br /><br />please wait or <a href="java script:JS_Utils_HideModal();">cancel</a>'; objModal.appendChild(objContent); objContent.appendChild(objP); document.body.appendChild(objModal); objModal.style.display = "none"; } function JS_Utils_ShowModal () { objModal = document.getElementById("Modal"); objModal.style.display = "block"; } function JS_Utils_HideModal () { if ( objModal ) objModal.style.display = "none"; window.stop(); }
  15. driz

    Js Modal Help

    Who shouted? Anyway I hope the above comments explain what I mean by stop page and dynamically building the modal box.
  16. driz

    Js Modal Help

    Hopefully this clear up some things:I want to build the modal dynamically because I want to call it into a page without having extra markup inside the page that may or may not be used. By page stop I mean stop the page from doing a postback so if a user submits a form which in turn calls the modal and then the user clicks the cancel button the modal it will hide the modal and then stop the postback on the page.What I'm needing to know with regards to the building part, is how to create a series of elements but have them nested within each other so like: <div id="Modal"><div class="Content"><p>Sending Data ( <a href="java script:JS_Utils_HideModal();">cancel</a>)</p></div></div> This is the ONE and ONLY modal box on the page by the way so I don't need to make clones of it etc.
  17. driz

    Js Modal Help

    Does this all make sense? Let us know if you need more details. Thanks
  18. driz

    Js Modal Help

    I fixed the initial problems. What I need to do is build this HTML structure using the JS code below. I'm not sure how to create all the nested stuff using JS. <div id="Modal"><div class="Content"><p>Sending Data ( <a href="java script:JS_Utils_HideModal();">cancel</a>)</p></div></div> I also want it so that if the user clicks the cancel button then it not only hides the modal box, but stops the page!EDIT: I might also need to prevent multiples of the modal appearing, not sure if that is a possibility or not? This is not a lightbox or anything, just a simple panel that appears when the user submits some content to let them know the process is taking place. <!DOCTYPE html><html> <head> <script type="text/javascript"> //---------------------------------------------------------------------- // Modal //---------------------------------------------------------------------- function JS_Utils_BuildModal () { var objModal = document.createElement("div"); objModal.setAttribute('id', 'Modal'); document.body.appendChild(objModal); objModal.style.display = "none"; } function JS_Utils_ShowModal () { objModal = document.getElementById("Modal"); objModal.style.display = "block"; return true; } function JS_Utils_HideModal () { if ( objModal ) objModal.style.display = "none"; // Need some extra functionality here that stops the page } //---------------------------------------------------------------------- //---------------------------------------------------------------------- </script> <style type="text/css"> div#Modal { position: fixed; top: 0px; left: 0px; width: 100%; height: 200%; background: #333 url('overlay.png') repeat scroll; } div.ModalContent { -webkit-border-radius: 6px; margin: 200px auto 0px; background: #fff url('loading2.gif') center 20px no-repeat scroll; border: 3px solid #FFF; width: 200px; height: 90px; color: #999; position: relative; } div.ModalContent span { display: block; position: absolute; top: 60px; left: 0px; width: 200px; text-align: center; } * html div.Modal { position: absolute; height: 100%; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='overlay.png', sizingMethod='scale'); background: none; } </style> </head> <body onload="JS_Utils_BuildModal();"> <a href="java script:JS_Utils_ShowModal();">Test Link</a> </body></html>
  19. driz

    Htaccess Help

    Any updates on this? Thanks again.
  20. driz

    Htaccess Help

    It redirects perfectly. But /account/ just shows 404. So I'm guessing it's trying to load a directory called /account/ rather than login.php but with the new url.
  21. driz

    Htaccess Help

    I need login.php to remain as login.php as its part of a core system that auto-updates.Essentially what I'm trying to do is the same as:domain.com/index.php?id=about becoming domain.com/about/and if the user trys to access domain.com/index.php?id=about then it auto becomes domain.com/about/But I'm wanting to do it with a file called login.php
  22. driz

    Htaccess Help

    Sorry I guess I wasn't clear enough It now redirects fine to the /account/ but it just throws a 404 error. /account/ doesn't actually exist so what should happening is the user is looking at login.php but the url says /account/ so its just making the url nicer but not actually redirecting to a directory called /account/ just making it look as though it is.
  23. driz

    Htaccess Help

    That's what I meant. I need the file to remain as login.php but I don't want to be accessible. If someone either types it in or a script links to it then the URL is automatically changed to /account/
  24. driz

    Htaccess Help

    If you can still access the file and the system is directing to that file then the current rewrite isn't much good. I need it to change it to the new URL.
×
×
  • Create New...