• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
[QUOTE=Cyberuben;45462419]tons of stuff[/QUOTE] This makes it more clear, thanks for the detailed post! And also thanks to supersnail even though it was a bit short :v:
To elaborate on my MySQL issue, here are the steps I take: 1- Start NodeJS project 2- Visit random page 3- Do not use website for x amount of seconds / minutes (no idea how long actually) 4- Visit random page My NodeJS server completely freezes, and "supervisor app" renders the following output: [img]http://ss.rubensrv.nl/i/12682C.png[/img] Please note, there is no 2nd GET request shown in supervisor. The app renders the following in my browser (after it saying "waiting for localhost:3001" for a while): [t]http://ss.rubensrv.nl/i/1269Za.png[/t] It doesn't break my Jade, but static files are not included (this issue won't happen when I run the live version, as static files there are served by nginx, not NodeJS). The next page I visit, I will get the following error: [t]http://ss.rubensrv.nl/i/1270OM.png[/t] Is this an issue with my MySQL server (Navicat is connected at the time being, giving no disconnect messages whatsoever)? Why does my [url=http://ss.rubensrv.nl/i/1271fj.png]"HandleDisconnect()"[/url] not get called? I really am stuck on this one. I am using node-mysql (as you might have figured from the "var mysql = require('mysql');". I really have to manually restart supervisor, while it is meant to check for file changes and restart on errors...
If I were you I would be opening/closing the connection per-request and not globally, but I could be full of shit. It definitely seems like it's just a timeout error from the connection being opened for so long.
I've got XAMPP working and stuff like that, and I've been having fun with doing things like converting YouTube links to their correct embedded versions and stuff like that, but I've been looking to move onto make a forum through PHP. I want to make my forum run on Steam logins, but I've been having trouble trying to find a "beginner-friendly" tutorial that explains what's going on, and a lot of the normal username-password registration login tutorials are often criticized as being insecure. I don't want anyone to think I'm being lazy or overly stupid or anything - I really do want to jump in and make stuff happen. I'm just having trouble figuring out where to look for help.
[QUOTE=KmartSqrl;45468689]If I were you I would be opening/closing the connection per-request and not globally, but I could be full of shit. It definitely seems like it's just a timeout error from the connection being opened for so long.[/QUOTE] Okay, I will try to implement that. Thanks for the tip at least. It does feel a bit odd though, considering NodeJS is one running process, I wouldn't understand why I would need a separate connection per user rather than one connection that's used process-wide.
[QUOTE=Cyberuben;45474424]Okay, I will try to implement that. Thanks for the tip at least. It does feel a bit odd though, considering NodeJS is one running process, I wouldn't understand why I would need a separate connection per user rather than one connection that's used process-wide.[/QUOTE] Because MySQL has a limited timeout. NodeJS has nothing to do with that, really. It just has to respect it.
Is it possible to catch an error by HTML5 (for example, a field with a required pattern has an input not matching that pattern) with Javascript? I'm searching, because I'm sure there is (html5 and js go hand by hand), but Google doesn't want to be helpful with this one.
[QUOTE=Coment;45476413]Is it possible to catch an error by HTML5 (for example, a field with a required pattern has an input not matching that pattern) with Javascript? I'm searching, because I'm sure there is (html5 and js go hand by hand), but Google doesn't want to be helpful with this one.[/QUOTE] Try searching for "form validation".
^I was looking to use the browser's built-in validation, that's why I didn't want to use some jquery solution. Found the solution: (element).validity.valid will be true or false depending on its validity. Nice to know.
[QUOTE=Coment;45477341]^I was looking to use the browser's built-in validation, that's why I didn't want to use some jquery solution. Found the solution: (element).validity.valid will be true or false depending on its validity. Nice to know.[/QUOTE] Oh, sorry I misunderstood.
So would anyone here recommend a way to create a sitemap.xml for google?
[QUOTE=Icejjfish;45479384]So would anyone here recommend a way to create a sitemap.xml for google?[/QUOTE] That is [B]completely[/B] dependent on what platform your website is built on, how large your website is, etc.
If I have a form that needs to main its GET data integrity after a form call, is there a way to do that? Like for example - file.php?1234 form appears when GET = 1234 On form submission I don't want the GET data to change, because my form will disappear. What it looks like on submit: file.php? Do I need to change the form method to POST?
[QUOTE=WitheredGryphon;45483234]If I have a form that needs to main its GET data integrity after a form call, is there a way to do that? Like for example - file.php?1234 form appears when GET = 1234 On form submission I don't want the GET data to change, because my form will disappear. What it looks like on submit: file.php? Do I need to change the form method to POST?[/QUOTE] you may want to rephrase your question but i asume you're looking for something like this? [code] <form method='GET' action='file.php?1234'> //inputs </form> [/code]
[QUOTE=Lizart;45483593]you may want to rephrase your question but i asume you're looking for something like this? [code] <form method='GET' action='file.php?1234'> //inputs </form> [/code][/QUOTE] Wouldn't it be better to do <input type="hidden" name="1234" value="">?
[QUOTE=Cyberuben;45484344]Wouldn't it be better to do <input type="hidden" name="1234" value="">?[/QUOTE] its up to personal preference i think but I like my method more because that way you can combine POST and GET, if your form method is POST
[QUOTE=Lizart;45484387]its up to personal preference i think but I like my method more because that way you can combine POST and GET, if your form method is POST[/QUOTE] That sounds like complete bullshit. How can you combine POST and GET? If you use PHP, it will not return "POST/GET" or anything. Running $_SERVER['REQUEST_METHOD'] it'll either return "POST" or "GET". Don't combine the two. My method actually works on both post and get, and all you have to do to get the "1234" is isset($_GET['1234']) or isset($_POST['1234'])
[QUOTE=Cyberuben;45484725]That sounds like complete bullshit. How can you combine POST and GET? If you use PHP, it will not return "POST/GET" or anything. Running $_SERVER['REQUEST_METHOD'] it'll either return "POST" or "GET". Don't combine the two. My method actually works on both post and get, and all you have to do to get the "1234" is isset($_GET['1234']) or isset($_POST['1234'])[/QUOTE] let me give you an example [code] <form method='POST' action='updateuser.php?id=1'> <input type='text' name='username'> <input type='text' name='password'> <input type='submit' value='update user'> </form> [/code] on the next page you can retrive the values with [code] $_GET['id']; $_POST['username']; $_POST['password']; [/code] this makes it easier to keep track of the user you're editing
[QUOTE=Cyberuben;45484725]That sounds like complete bullshit. How can you combine POST and GET? If you use PHP, it will not return "POST/GET" or anything. Running $_SERVER['REQUEST_METHOD'] it'll either return "POST" or "GET". Don't combine the two. My method actually works on both post and get, and all you have to do to get the "1234" is isset($_GET['1234']) or isset($_POST['1234'])[/QUOTE] You actually can. While it's debatable to use both methods at the same time, technically it works. I just tried it, to be sure. [IMG]http://i.imgur.com/Emi7uvu.png[/IMG] [editline]24th July 2014[/editline] ugh, ninja'd
Is there anyone here that knows his way around with vagrant and its provisioners? What kind of steps would I theoretically have to take if I wanted to make a machine that runs some servers (lapis and mongodb in this case) with my custom web application on it? I want to be able to just put that on a github repo and share it with my friends so we can work on the exact same environment but can change files and stuff locally without going through ftp. Moving to production should also be fairly easy with [URL="https://github.com/smdahlen/vagrant-digitalocean"]vagrant-digitalocean[/URL]
[QUOTE=Lizart;45484805]let me give you an example [code] <form method='POST' action='updateuser.php?id=1'> <input type='text' name='username'> <input type='text' name='password'> <input type='submit' value='update user'> </form> [/code] on the next page you can retrive the values with [code] $_GET['id']; $_POST['username']; $_POST['password']; [/code] this makes it easier to keep track of the user you're editing[/QUOTE] You could use $_REQUEST to access both. But I think he is right that mixing them isn't the best idea in the world.
[QUOTE=Cyberuben;45484725]That sounds like complete bullshit. How can you combine POST and GET? If you use PHP, it will not return "POST/GET" or anything. Running $_SERVER['REQUEST_METHOD'] it'll either return "POST" or "GET". Don't combine the two. My method actually works on both post and get, and all you have to do to get the "1234" is isset($_GET['1234']) or isset($_POST['1234'])[/QUOTE] You should probably use [code] if(!empty($_GET['1234']) || !empty($_POST['1234'])) [/code] (unless you want the param to serve as a boolean) as isset only checks if the param is set, so I could do [B]index.php?1234[/B] and that isset would give greenlight to continiue the if to then clause.
[QUOTE=Lizart;45484805]let me give you an example [code] <form method='POST' action='updateuser.php?id=1'> <input type='text' name='username'> <input type='text' name='password'> <input type='submit' value='update user'> </form> [/code] on the next page you can retrive the values with [code] $_GET['id']; $_POST['username']; $_POST['password']; [/code] this makes it easier to keep track of the user you're editing[/QUOTE] Used this method, figured that's what I'd end up doing but didn't think you could actually combine the two. Thanks. [editline]Edited:[/editline] [QUOTE=Svenskunganka;45486836]You should probably use [code] if(!empty($_GET['1234']) || !empty($_POST['1234'])) [/code] (unless you want the param to serve as a boolean) as isset only checks if the param is set, so I could do [B]index.php?1234[/B] and that isset would give greenlight to continiue the if to then clause.[/QUOTE] I'm checking around this by confirming the number is actually equal to the correct number before running, otherwise I don't want it running at all.
How about you just make your forms properly and don't combine post and get...
[QUOTE=Cyberuben;45489288]How about you just make your forms properly and don't combine post and get...[/QUOTE] Why are you so uppity about it? I need to run a form only when there is specified GET data without removing that data on the nested form's submission. His solution worked fine. Using other solutions didn't. If you can provide me one that works, feel free. To clarify: when I tried modifying the actions of the form it sends the form back to "page.php?" with no GET data..
I don't think there's really anything wrong with using get to grab an id out of a URL. It's not [I]really[/I] different functionally from just having the ID be part of the URL without using the querystring.
Does steam's openid service use openid connect 1.0 or openid 2.0? All the steamauth libs I can find use openid 2.0 but the steam page links to the openid connect libs? [editline]26th July 2014[/editline] Oh it's openid 2.0, just went to [URL="http://steamcommunity.com/openid"]http://steamcommunity.com/openid[/URL] and read the xml it sends back.
On my site, people can have 'profile' pages with info about them. The url would be something like [url]www.mysite.com/TomJones[/url] if your name is Tom Jones, but how do I make it so that Tom here can use his own domain [url]www.tomjones.com[/url] to go to his profile on [url]www.mysite.com[/url] ?
Tom Jones should point a CNAME to mysite.com/TomJones from his site and control panel.
[QUOTE=Cyberuben;45489288]How about you just make your forms properly and don't combine post and get...[/QUOTE] It's not exactly uncommon. Like in this very form I'm writing this post in: [code]<form class="vbform" name="quick_reply" id="quick_reply" method="post" action="newreply.php?do=postreply&amp;t=1250244" [...] [/code]
Sorry, you need to Log In to post a reply to this thread.