Everything posted by webbhost
-
Cannot get a T-SQL Function (mysql routine) to work?
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
-
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.
-
only allowing display of information when a certain page requests it?
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!
-
only allowing display of information when a certain page requests it?
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
-
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.
-
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?
-
301 redirect error when using xmlhttp on localhost?
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.
-
having a nightmare with phpMailer, at my wits end with this!
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.
-
having a nightmare with phpMailer, at my wits end with this!
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.
-
having a nightmare with phpMailer, at my wits end with this!
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.
-
having a nightmare with phpMailer, at my wits end with this!
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(); ?>
-
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
-
having a css issue getting images to line up into a grid without gaps?
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?
-
having a css issue getting images to line up into a grid without gaps?
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; }
-
having a css issue getting images to line up into a grid without gaps?
images showing problem: And in firefox "inspect" feature
-
having a css issue getting images to line up into a grid without gaps?
Hi all, My brain is again being strained with an issue, hopefully it's an easy fix but its winding me up now!. I'm making a 10 x 10 grid of 40x40 images.. the div's are created by javascript, but it just will not line up!. Can someone please take a look at the code and point out the olbvious error? P.S. Pics to follow as cannot give out page address. CSS: #NewGame{ display: none; } .newRow{ margin: 0px; padding: 0px; } .newColumn{ display: inline; margin: 0px; padding: 0px; } .gridImage{ margin: 0px; padding: 0px; } Grid generation: Display.WriteToGrid("<div class=\"newRow\">"); for (x = 0; x < this.gridMatrix.length; x++){ Display.WriteToGrid("<div class=\"newColumn\" id=\"Tile" + x + "\"></div>"); currentRowPosition++; if (currentRowPosition == this.buildGrid_gridsize){ currentRowPosition = 0; Display.WriteToGrid("</div><div class=\"newRow\">"); } } Display.WriteToGrid("</div>"); Tile image placement: if (Tiletype == "W"){ image = "images/games/leafJump/water.jpg"; }else if (Tiletype == "L"){ image = "images/games/leafJump/leaf.jpg"; }else if (Tiletype == "P"){ image = "images/games/leafJump/snail.jpg"; } document.getElementById("Tile" + tileNumber).innerHTML = "<img src=\"" + image + "\" class=\"gridImage\">"; Thanks (as I say, images to follow very shortly)
-
cannot find bug in code with an eval().. can someone help please?
No matter, as per usual after looking for the answer for a whole hour, I post on here... and THEN I stumble across the answer. For anyone ever having similar issue (but doubtfully under my exact situation), the problem was when I initially declared the array.. I wrote MovesAvailableArray: "", When it should have been: MovesAvailableArray: new Array Thanks anyway guys
-
cannot find bug in code with an eval().. can someone help please?
I also get the alert box saying running applyMoveOptions, however movesAvailableArray.length returns as zero.
-
cannot find bug in code with an eval().. can someone help please?
Hi all, to make things easier, I am not going to include the whole script, just the relevant bits. Please rest assured the rest works fine!. Anyway, I'll show code first, then explain below what the problem is! Process = { MovesAvailableArray: "", //various code after this that works fine. buildGrid_phase2: function(){ ...code here ajax("game_LeafJumpHandle.php?requestAvailableMoves=true", "alert(\"evaluating \" + response); eval (response); Process.applyMoveOptions();", "1"); }, applyMoveOptions: function(){ alert("running applyMoveOptions"); alert (Process.MovesAvailableArray.length); for (x = 0; x < Process.MovesAvailableArray.length; x++){ //code... } } } Okay, so theres the basic outline above.. Rest assured that the "ajax" function works perfectly. The first variable is the address handler, the 2nd is what is to be evaluated and 3rd is not applicable to this script, please ignore! Okay, so to get some basics up, the ajax "does" run properly, and an alert box show the following: evaluating Process.MovesAvailableArray[0] = "90"; Process.MovesAvailableArray[1] = "120"; Process.MovesAvailableArray[2] = "106"; straight after this alert box, the "response" is evaluated... however once it has run and then runs Process.applyMoveOptions, the variables that should have been inserted do not exist?? Can someone please explain this to me, its doing my head in!! P.s. the 2nd variable in the "ajax" is evaluated.. e.g. function ajax(address, evaluate, misc){ // run ajax script. result = // run ajax eval(evaluate) } so effectively eval(alert(\"evaluating \" + response); eval (response); Process.applyMoveOptions(); Also, I have NO Javascript errors appear when the script is run. if anyone can shed some light, I'd appreciate it! Thanks.
-
Php sessions using cookies, do I have to notify the user?
Hi all, Okay so it's my understanding that if a website uses any non-essential cookies then us web designers are now required to notify and get permission from the user on advance. However, for essential cookies (such as allowing logins or neccesary functions for the website) are excluded from this law, and we do not need to get permission. Firstly can someone confirm that this is correct? Now, considering this, if I use a PHP session, a cookie is stored on the users computer containing just the Session ID. So, if the session handles a user login and permissions this is classed as neccesary and therefore I don't have to notify the end user that I am going to store cookies on their computer? Now, what happens if I also add tracking using the session (i.e. using PHP to track a history of pages, time spent on pages on the site and so on, for statistical purposes) - do I then have to notify the user that I am storing a session cookie because the session is being used for more than just handling the required login, or because I am simply storing a session ID, is this okay without notifying the user. Thanks
-
Is there laws for storing personal information?
Hi all, Okay, so I built a website for someone a while ago to help them with their business and I need to question my methods somewhat.. When a customer places an order, their name, address and contact number is stored in the database (*note NO card / payment details kept. Payments are either processed via paypal or by phone). Considering that access to the database is protected (cpanel login), do I have to encrypt the data at all to make un-readable, and is there any standard of encryption that has to be adhered to? My concern is someone managing to malliciously get access to the database and getting hold of customers details, I assume this would have potentially bad concequences? Or maybe I am fine doing exactly what I am doing, or maybe I need to just ensure the data is removed from the database as soon as the order is processed and completed? Cheers for any suggestions / advice that can be given regarding this.
-
I think this years time change has just played a number on my site...? Screwed up calendar, please help!
just had a quick thought, I think when I originally coded the site I was daft enough to make the timestamp an integer in the database rather than "time".... is this a probable cause?
-
I think this years time change has just played a number on my site...? Screwed up calendar, please help!
hi Mike, the time that the time change happened isn't really of relevance.. the only relevance is that it "has" happened at some point. What I was trying to say is that up until today, a timestamp has said Sunday 28th October @ 00:00. Then after the timechange has taken effect, it now says it is Saturday 27th October @ 23:00. I dont see how a fixed time stamp can be 1 thing 1 day, and then another thing the next day. the numbers in the timestamp haven't changed so it should say the same? Just a thought but could it be some countries may still be in the process of having the time change, so its just playing a bit stupid... touch wood it might be alright tomorrow or later on
-
I think this years time change has just played a number on my site...? Screwed up calendar, please help!
Upon looking at timestamps, One registered for 21st October (Sunday) midnight is now showing as Saturday 20th @ 11pm. How is this even possible? I'm stumped..
-
I think this years time change has just played a number on my site...? Screwed up calendar, please help!
PS I dont recall ever having problems with previous years