Jump to content


  • Content count

  • Joined

  • Last visited

About webbhost

  • Rank
    Advanced Member

Users Experience

  • Experience
  • Area of Expertise
  1. Hi everyone, After having success with my first T-SQL function, I've made it so that I can url-decode data when pulling it from the database without having to it manually - great! However, I'm not having the same sort of luck with trying to base64-decode the data via a T-SQL Function. I've tried various functions found on google, however they're all kicking up errors when I try to import it using phpMyAdmin Code is below: CREATE FUNCTION FromBase64 (@data varchar(max)) RETURNS varchar(8000) AS BEGIN DECLARE @Output varchar(8000), @Bits varbinary(3) — declare vars. DECLARE @XmlData xml — construct an xml var. SET @XmlData = CAST(‘<data>’ + @data + ‘</data>’ as xml) — base64 decode the @data. SELECT @Output= CONVERT(varchar(max), @XmlData.value(‘(data)[1]’, ‘varbinary(max)’)) RETURN @Output END The phpMyAdmin error I am getting is: Static analysis: 2 errors were found during analysis. Unexpected character. (near "[" at position 380) Unexpected character. (near "]" at position 382) SQL query: Documentation CREATE FUNCTION FromBase64 (@data varchar(max) CHARSET utf8) RETURNS varchar(8000) BEGIN DECLARE @Output varchar(8000), @Bits varbinary(3) — declare vars. DECLARE @XmlData xml — construct an xml var. SET @XmlData = CAST(‘<data>’ + @data + ‘</data>’ as xml) — base64 decode the @data. SELECT @Output= CONVERT(varchar(max), @XmlData.value(‘(data)[1]’, ‘varbinary(max)’)) RETURN @Output END MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@data varchar(max) CHARSET utf8) RETURNS varchar(8000) BEGIN DECLARE ' at line 1 I've tried messing about changing the code around to look moire like the my previous function is structured, however nothing is working, and I have tried several of these scripts from google with no success from any!? Can someone shed some light for me please? I'm new to T-SQL so I've not really got a clue! Thanks
  2. Contact Form Help

    dangbim, could you provide more details please - such as a copy of the from your are submitting and the error message? Cheers.
  3. Thanks - sounds like a plan. I'll probably use a mix of the above and my own method to make it as secure as possible. Out of interest if I load some javascript variables via ajax - is it then possible to see these variables using inspection mode on a browser? Not 'overly' fussed if any data is viewed as the user would have to be logged into their account anyway, but I don't want to just gIve the code away either!
  4. Hi all, I'm building an application & it has some data I need to load into it once the page has loaded, so I do this after loading using Ajax / XMLHttpRequest originalPage.php - the user loads this httpreqPage.php - originalPage requests information from this using XMLHttpRequest - I only want htmlreqPage to display this data when originalPage requests it - i.e. if any other web page tried to access it, or if the user tries to access the page directly - it will display no information. Is there a simple and safe way to do this? My current thoughts are to generate a random password when loading originalPage - store this in a PHP Session & to send it with the address - i.e. reuqests httpreqPage.php?pass=1234 Once httpreqpage recieves a pass, it checks that it matches the PHP Session - and assuming it matches, authenticates and deletes the pass from php session. My way just seems a little bit open winded, and it's not 100% effective - i.e. if someone opens the page with javascript disabled then they will be able to get the address and load the info as there will be a generated password & it won't have been used. So yeah, is there something simpler that can detect it is actually a XMLHttpRequest, and the page that requested it - and not a direct load? Thanks
  5. 301 redirect error when using xmlhttp on localhost?

    Figured this one out in the end.... the problem was with the ajax script, not the javascript in itself. My php file it was locating had a check for HTTPS within the globalstart.php settings loader... as it doesn't detect https on localhost, it was constantly redirecting... oops! thanks anyway for anyone that took a look.
  6. 301 redirect error when using xmlhttp on localhost?

    Also, if I change the address so that it reads something that is 'incorrect' - it returns 404 which I would expect.... so it's definitely finding the page... it's just redirecting rather than executing the script?
  7. Hi All, I've been completely stumped by this issue - hopefully one of you guys can help me? Firstly, this script is running completely fine on my live site (i.e. on my paid hosting). I'm trying to get the site working on my own machine so that I can make updates easily without it affecting live clients.... so I have installed xampp and connected the site via remote mysql connection - so far so good! until I hit this.... I use a lot of ajax on my system... but it's not working properly on my local machine. Note from the server this works perfectly. The Code: xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { alert("status " + xmlhttp.status + " - address was: " + address); } } xmlhttp.open("GET", address + "&refresh=" + (new Date().getTime()), true); //time is added in to ensure every request is a unique and up-to-date result. The alert box result I get is this: status 301 - address was: ajax_detectDevice.php?action=findDevice&deviceId=58657b5b82e263.00784914 When I click the link in the page inspection / console (which displays as:) http://localhost/esmie/studentRegister/ajax_detectDevice.php?action=findDevice&deviceId=58657b5b82e263.00784914&refresh=1483049862651 I get exactly the result I would expect when the page loads loadIndexPage(); (the above is evaluated by the javascript when it is returned which initiates another javascript function) Does anyone have any clues why I am getting a 301 redirection error and not the 200 ok status I would normally expect? Thanks for any help or hints anyone can provide.
  8. Thank you for your reply again Nock After 30 days of dispair with this script - I finally got to the bottom of it - and it was the VERY first thing I thought it was and tried to sort out. After sending one last support ticket to TSO last night in a bid to get the problem fixed before I left them and found another hosting company... one of their support guys changed a setting on the servers firewall - and low and behold.... it WORKS!. Some times, you just have to keep going on and on and on until the right person hears your message and knows what to do. Crazy as it sounds this is a massive weight off my shoulders seeing that queue of e-mail start sending out! Thanks for your help anyway - hopefully someone in the future will see this thread and not have to go through the ball ache I've been through to get it fixed. I've asked support what they changed to make it work, so if they tell me I will post the response on here so someone else can point their tech support to the same thing.
  9. Hi Nock, Yes I have tried ports 25, 587 and 465. and I've tried changing the connection type between tls and ssl too... no combination of anything I do seems to work.
  10. bit of further info - I took a basic 'ping' script and tried running it.. function ping($host, $port, $timeout) { $tB = microtime(true); $fP = fSockOpen($host, $port, $errno, $errstr, $timeout); if (!$fP) { return "down"; } $tA = microtime(true); return round((($tA - $tB) * 1000), 0)." ms"; } //Echoing it will display the ping if the host is up, if not it'll say "down". echo ping("www.leicesterjujitsu.co.uk", 80, 10); Even this times out when it accepts other websites such as google and webdesignerforum etc.
  11. Hi All, I've been trying to debug this for weeks and weeks - but no matter what I try and do... I can't seem to fix it. When sending e-mail out to a remote server using phpMailer - I constantly get "SMTP ERROR: Failed to connect to server: Connection timed out (110)" The script I created was working perfectly - but one day it just decided to completely die and give nothing but this message: I tried googling the issue & saw a few hints etc... and a lot of people suggesting it's a firewall issue. TsoHost (the sending server) is convinced the e-mail is leaving the server and that their firewall etc is not blocking the outgoing connection. The guy @ heart (the server receiving the request to send mail) is completely convinced that the problem is not at his side either. If I alter the settings to get the script to send the outgoing e-mail to be sent via an e-mail address stores on tso (the script's server, it works. - which i imagine it naturally would because it's just talking to itself & not trying to communicate with another server.. but the solution is no good as it will be sending e-mail out from the wrong e-mail address. ------------- To try and figure out which server was causing the problem, I tried moving the script to a different server in differenet location (some free hosting I found).... run the script again.. sending an outgoing e-mail from both servers and it won't connect to either. Frankly it's driving me nuts, I don't understand whats wrong and I don't understand why it would have just 'stopped' working. I hope that makes sense.. I have a copy of the script I'm using below... if someone could take a look for any olbvious errors I would appreciate it. <?php echo "free-hosting-server<br/>"; require_once('automatedJobs/phpMailer/PHPMailerAutoload.php'); $server = 1; if ($server == 1){ echo "THANWEBB<br/>"; $host = "mail.thanwebb.co.uk"; $from = "n@thanwebb.co.uk"; $pass = "server_one_pass";//not the real password }else if ($server == 2){ echo "LJJ<br/>"; $host = "mail.leicesterjujitsu.co.uk"; $from = "noreply@leicesterjujitsu.co.uk"; $pass = "server_2_pass"; //not the real password }else{ echo "server not determined"; } $email = new PHPMailer(); $email->IsSMTP(); $email->SMTPDebug = 3; $email->SMTPAuth = true; $email->Host = $host; $email->Username = $from; $email->Password = $pass; $email->From = $from; $email->FromName = $from; //If SMTP requires TLS encryption then set it //Set TCP port to connect to $email->Port = 25; // set the SMTP port $email->Priority = 1; $email->isHTML(true); // testing this one out. $email->Subject = "test"; $body = "body"; $email->Body = $body; $email->AddAddress("email_to@receipent.net"); echo $email->Send(); ?>
  12. Css buttons not working

    You could also try declaring a document type.. I always use the following, and it has fixed 99% of my cross compatability issues so I just use it as a norm now. Not to say this is the best one, DYOR and decide for yourself <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> p.s. this would be the first line in your document, above the <html> tag
  13. Hi Dy40, 1 step ahead as I just chucked this onto the page, and I found the problem. Because I was using innerHTML... when I wrote innerHTML = "<div id=blah>"; Despite me "NOT" saying </div> so that I could then place it "later".. it decided to put one anyway, because the browser olbviously knows better than me and I must have made a mistake by not closing the tag... duh? Anyway, my fix was by compiling the written data into a string, and then writing innerHTML = compiledString; Because all divs are now closed, innerHTML doesn't find the need to do stuff for me. If you ask me, thats a really bad "feature".. but I guess it must be there for a reason?
  14. and I get this image with the following css: #GameGrid{ } #NewGame{ display: none; border: 1px solid; } .newRow{ margin: 0px; padding: 0px; border: 1px solid; height: 70px; } .newColumn{ display: inline-block; height: 42px; margin: 0px; padding: 0px; border: 1px solid; } .gridImage{ margin: 0px; padding: 0px; border: 1px solid; height: 40px; }
  15. images showing problem: And in firefox "inspect" feature