Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=Epiclulz762;42327688]Do the standard frameworks that auto-respond to changes in resolution do so by complex CSS or with JavaScript listeners?[/QUOTE]
They probably use [url=https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries]media queries[/url]
- snip -
[QUOTE=Epiclulz762;42328034]It may be irrelevant but as for browser compatibility, or to include those using Internet Explorer versions before 9, I would implement JavaScript to format containers and wrappers?[/QUOTE]
An unrelated question, but...
I am curious, how many people actually use IE6-8. We always care about these imaginary people that might be accesing our website from a coal furnace powered computer, but how many are there and is it worth to take them in account?
so im about to make a site which needs a shop, forum, picture gallery and video gallery.
which cms system would be best to do this?
[QUOTE=MuffinZerg;42328241]An unrelated question, but...
I am curious, how many people actually use IE6-8. We always care about these imaginary people that might be accesing our website from a coal furnace powered computer, but how many are there and is it worth to take them in account?[/QUOTE]
You should be tracking that for each site you are working on. It can vary a lot from site to site so you need to be tracking it separately to decide if a large enough % of your users are using IE8 to warrant supporting it.
Okay, been stuck on this all day, need some help! I'm trying to pass the customer number "conumber" from one page to another and use it in a sql statement on the 2nd, but I can't get it to work. User inputs their number & password here, then gets forwarded to request.php. The customer number needs to be passed.
[code]<html lang="en">
<head>
<title> Log in </title>
<script src="validation.js"></script>
</head>
<body>
<?php
echo "<h1>Log in to your account</h1>
<form id = 'regform' action='request.php' method='get'>
<label for='conumber'>Customer Number</label>
<input id='conumber' type='text' name='conumber' maxlength='30' /><br />
<label for='password'>Password</label>
<input id='password' type='password' name='password' maxlength='8'/><br />
<input type='submit' value='Submit' />
</form>";
$DBConnect = @mysqli_connect("**", "**","**", "**")
Or die ("<p>Unable to connect to the database server.</p>". "<p>Error code ". mysqli_connect_errno().": ". mysqli_connect_error()). "</p>";
if(isset($_GET['conumber']) && isset($_GET['password']))
{
$CID = $_GET['conumber'];
$CheckCIDString = "SELECT * FROM users WHERE customernumber = $CID";
$queryResult = @mysqli_query($DBConnect, $CheckCIDString);
$row = mysqli_fetch_array($queryResult)
Or die ("<p>Nope.</p>");
if( ($_GET['conumber'] = $row["customernumber"]) && ($_GET['password'] = $row["pw"]))
{
echo "<p>Hi ". $row["name"].", welcome back to Ship Online </p>";
}
}
?>
</body>
</html>[/code]
Here is request.php
[code]<html lang="en">
<head>
<title> Request </title>
</head>
<body>
<h1>Request</h1>
<form id = "regform" >
<label for="itemdesc">Item Description</label>
<input id="itemdesc" type="text" name="itemdesc" maxlength="30" /><br />
<label for="weight">Weight</label>
<select name="weight">
<option value="2">0-2kg $10</option>
<option value="4">2-4kg $12</option>
<option value="6">4-6kg $14</option>
<option value="8">6-8kg $16</option>
<option value="10">8-10kg $18</option>
<option value="12">10-12kg $20</option>
<option value="14">12-14kg $22</option>
</select><br />
<label for="pickupadd">Pick up address</label>
<input id="pickupadd" type="text" name="pickupadd" maxlength="30" /><br />
<label for="pickupadd">Pick up suburb</label>
<input id="pickupsub" type="text" name="pickupsub"/><br />
<label for="pickupstate">Pick up state</label>
<select name="pickupstate">
<option value="vic">VIC</option>
<option value="nsw">NSW</option>
<option value="qld">QLD</option>
<option value="sa">SA</option>
<option value="wa">WA</option>
<option value="act">ACT</option>
<option value="tas">TAS</option>
<option value="nt">NT</option>
</select><br />
<label for="pickuptime">Pick up time</label>
<input id="pickuptime" type="text" name="pickuptime" maxlength="5" /><br />
<label for="recname">Reciever name</label>
<input id="recname" type="text" name="recname" maxlength="30" /><br />
<label for="deliveryadd">Delivery address</label>
<input id="deliveryadd" type="text" name="deliveryadd" maxlength="30" /><br />
<label for="deliveryadd">Delivery suburb</label>
<input id="deliverysub" type="text" name="deliverysub"/><br />
<label for="deliverystate">Delivery state</label>
<select name="deliverystate">
<option value="vic">VIC</option>
<option value="nsw">NSW</option>
<option value="qld">QLD</option>
<option value="sa">SA</option>
<option value="wa">WA</option>
<option value="act">ACT</option>
<option value="tas">TAS</option>
<option value="nt">NT</option>
</select><br />
<input type="submit" value="Submit" />
</form>
<?php
$mycode = $_GET['conumber'];
echo $mycode;
$DBConnect = @mysqli_connect("**", "**","**", "**")
Or die ("<p>Unable to connect to the database server.</p>". "<p>Error code ". mysqli_connect_errno().": ". mysqli_connect_error()). "</p>";
if(isset($_GET['itemdesc']) && isset($_GET['weight']) && isset($_GET['pickupadd']) && isset($_GET['pickupsub']) && isset($_GET['pickupstate']) && isset($_GET['pickuptime']) && isset($_GET['recname']) && isset($_GET['deliveryadd']) && isset($_GET['deliverysub']) && isset($_GET['deliverystate']))
{
echo "can you see this?";
$SQLstring = "insert into request (requestid, customernumber, itemdesc, weight, pickupadd, pickupsub, pickupstate, pickuptime, recname, deladd, delsub, delstate) values (DEFAULT,".$_GET['conumber'].",'".$_GET['itemdesc']."','".$_GET['weight']."','".$_GET['pickupadd']."','".$_GET['pickupsub']."','".$_GET['pickupstate']."','".$_GET['pickuptime']."','".$_GET['recname']."','".$_GET['deliveryadd']."','".$_GET['deliverysub']."','".$_GET['deliverystate']."');";
$queryResult = @mysqli_query($DBConnect, $SQLstring)
Or die ("<p>This shit ain't working</p>");
}
?>
</body>
</html>[/code]
If I replace the customer number thing in the SQL statment near the bottom with just a number, it goes straight in.
When I copy this code and run it on my local server, and fill in 11 for customernumber, 1234 for password, it does echo the 11 for customernumber on the request.php.
On another note, if customernumber is needed for the query, you should add it to the if statement above the query.
[QUOTE=eternalflamez;42333518]When I copy this code and run it on my local server, and fill in 11 for customernumber, 1234 for password, it does echo the 11 for customernumber on the request.php.
On another note, if customernumber is needed for the query, you should add it to the if statement above the query.[/QUOTE]
It echoes fine for me too, it just will not work in the sql statement at the bottom.
[QUOTE=SammySung;42333631]It echoes fine for me too, it just will not work in the sql statement at the bottom.[/QUOTE]
Why are you using the @?
You need error messages to fix your stuff.
[QUOTE=SammySung;42333465]
$SQLstring = "insert into request (requestid, customernumber, itemdesc, weight, pickupadd, pickupsub, pickupstate, pickuptime, recname, deladd, delsub, delstate) values (DEFAULT,".$_GET['conumber'].",'".$_GET['itemdesc']."','".$_GET['weight']."','".$_GET['pickupadd']."','".$_GET['pickupsub']."','".$_GET['pickupstate']."','".$_GET['pickuptime']."','".$_GET['recname']."','".$_GET['deliveryadd']."','".$_GET['deliverysub']."','".$_GET['deliverystate']."');";
$queryResult = @mysqli_query($DBConnect, $SQLstring)
[/QUOTE]
Here we go again.
Never pass values directly from $_GET or $_POST into query strings, escape them or use prepared statements to prevent SQL injection.
Not to mention:
if( ($_GET['conumber'] = $row["customernumber"]) && ($_GET['password'] = $row["pw"]))
Storing passwords as plaintext...
Should we also mention he's doing an assignment in that if statement, not a comparison
So I was trying to install nginx instead of apache but each time I access a PHP page it downloads it for some reason. I have php5-fpm installed. What could be the issue? Is it worth the hassle to switch from apache to nginx?
[QUOTE=Cowabanga;42336531]So I was trying to install nginx instead of apache but each time I access a PHP page it downloads it for some reason. I have php5-fpm installed. What could be the issue? Is it worth the hassle to switch from apache to nginx?[/QUOTE]
You need to set up nginx to actually pass php requests to php5-fpm, with something like this (change the unix socket to what you're using):
[code]
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
[/code]
My fastcgi_params looks like this:
[code]
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_intercept_errors off;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
[/code]
Now it refuses to start when I do service nginx start. Gives me no input at all unless I "stop" it even though it's not running when I do status.
[editline]28th September 2013[/editline]
Okay now it works, I did exactly what you told me but it still tries to download php files.
[editline]28th September 2013[/editline]
/var/run/php5-fpm.sock is a 0 byte file, could it be why?
[editline]28th September 2013[/editline]
I'm going to take a guess and say that I have to put the location ~ php block inside each vhost configuration and not default, right? (have no access to the VPS right now on so can't check)
[QUOTE=Cowabanga;42336772]Now it refuses to start when I do service nginx start. Gives me no input at all unless I "stop" it even though it's not running when I do status.
[editline]28th September 2013[/editline]
Okay now it works, I did exactly what you told me but it still tries to download php files.
[editline]28th September 2013[/editline]
/var/run/php5-fpm.sock is a 0 byte file, could it be why?
[editline]28th September 2013[/editline]
I'm going to take a guess and say that I have to put the location ~ php block inside each vhost configuration and not default, right? (have no access to the VPS right now on so can't check)[/QUOTE]
You'll need that location for every server block yeah (just put it in a file and include it)
Also i don't think php5-fpm by default is set to use a unix socket, you can configure it in /etc/php5/fpm/pool.d/www.conf
Change listen to "listen = /var/run/php5-fpm.sock" then restart php5-fpm
Alright, will give this a shot when I can, thanks man!
is service php-fpm started?
It runs as a service itself.
Did what Gonz3rr said and everything is smooth as butter now. Thanks for everything man.
This is my first time playing around with html for my website and I'm having problems centering an image for my menu bar.
I googled around much but the way I used for my top banner doesn't seem to work in this case.
I got the other two menu items to align properly to the left and the right, but the one in the middle doesn't seem to center.
[URL="www.itslenny.de"]itslenny.de[/URL]
[code]
<div class="container2">
<span>
<img src="resource/img/about me.png" style="float: left">
<img src="resource/img/blog.png" style="float: center">
<img src="resource/img/contact.png" style="float: right">
</span>
</div>
[/code]
What would I do to center it?
[QUOTE=LennyPenny;42345919]This is my first time playing around with html for my website and I'm having problems centering an image for my menu bar.
I googled around much but the way I used for my top banner doesn't seem to work in this case.
I got the other two menu items to align properly to the left and the right, but the one in the middle doesn't seem to center.
[URL="www.itslenny.de"]itslenny.de[/URL]
[code]
<div class="container2">
<span>
<img src="resource/img/about me.png" style="float: left">
<img src="resource/img/blog.png" style="float: center">
<img src="resource/img/contact.png" style="float: right">
</span>
</div>
[/code]
What would I do to center it?[/QUOTE]
You should look into <ul>
They are nice to have.
As for your problems
You should give your images a class, and display it inline-block.
[editline]29th September 2013[/editline]
And you should make sure the things you contain aren't bigger than the container.
[t]http://i.imgur.com/1w6a7pM.png?1[/t]
[QUOTE=gokiyono;42346158]
And you should make sure the things you contain aren't bigger than the container.
[/QUOTE]
Ohh, it's fine on my resolution. Well I guess this stuff is more complex than I thought.
Need to look into that as well, thanks.
[editline]29th September 2013[/editline]
Ok fixed it by setting "text-align: center" in the second container.
Also used px values for the width of the containers instead of % to make it resolution independent (I hope).
I also looked up this <ul> thing, but what do lists have to do with this?
[QUOTE=LennyPenny;42346396]Ohh, it's fine on my resolution. Well I guess this stuff is more complex than I thought.
Need to look into that as well, thanks.
[editline]29th September 2013[/editline]
Ok fixed it by setting "text-align: center" in the second container.
Also used px values for the width of the containers instead of % to make it resolution independent (I hope).
I also looked up this <ul> thing, but what do lists have to do with this?[/QUOTE]
I think, if you set the container with the images to a px width, the children won't be affected by the screen changing.
And it's just that the unordered list are much nicer. There is also the <nav> tag, which I think you should use instead.
Assuming you have the nav tag with a class of mainmenu
[code]
.mainmenu img{
display:inline-block;
margin:0px 10px;
}
[/code]
But the navigation is just text on a background, why not code that instead of using an image?
[QUOTE=gokiyono;42347495]I think, if you set the container with the images to a px width, the children won't be affected by the screen changing.
And it's just that the unordered list are much nicer. There is also the <nav> tag, which I think you should use instead.
Assuming you have the nav tag with a class of mainmenu
[code]
.mainmenu img{
display:inline-block;
margin:0px 10px;
}
[/code]
But the navigation is just text on a background, why not code that instead of using an image?[/QUOTE]
As I said I'm new to web development so getting all these fonts on the website, scaling them properly, aligning them, making the background and stuff seems a bit too much if I can't even get an element centered on the screen.
My plan was to just make everything very basic at first and then start enhancing it as I get more familiar with web development.
All this cool html5 stuff has really interested me.
What has the unordered list to do with this all? On any website I looked it up it's to make a vertical list with points at the start instead of numbers (ordered list).
Thanks anyway will look into the <nav> thing as well.
[QUOTE=LennyPenny;42347767]My plan was to just make everything very basic at first and then start enhancing it as I get more familiar with web development.[/QUOTE]
You will most likely develop bad practices that way.
CSS is pretty nice with some of the property names.
The size of the text is font-size
The placement is text-align.
The background-colour is background-color.
[QUOTE=LennyPenny;42347767]What has the unordered list to do with this all? On any website I looked it up it's to make a vertical list with points at the start instead of numbers (ordered list).
Thanks anyway will look into the <nav> thing as well.[/QUOTE]
You use CSS to style the unordered lists. (Like the one on this page)
The unordered lists are mainly used by screen readers. (Though I think it is safer to use the nav tag (which is html5)
I want to enhance Brackets to my preferences but I'm not sure how to do it.
Basically I want it so in CSS whenever I set a [B]:[/B] it automatically makes a space.
For example:
[code]body {
background-color:red;
}[/code]
It doesn't make a space automatically between the [B]:[/B] and the [B]red[/B].
I know many of you will probably say "get used to it" but if it's possible to make it do that, I would really like to know how, because I'm used to having spaces and never press space, so it slows me down more than it's helpful :suicide:
Also whenever I start styling like:
[code]body {
background-color: red;
}[/code]
It doesn't automatically make a closing bracket [B]}[/B] when I start the opening one [B]{[/B].
Which I'm used to in other editors, but it doesn't do it here, so is that possible to tweak too?
Means a lot to me if someone knows if it can be tweaked, and how!
[QUOTE=Moofy;42355020]
words.about('IDE');
[/QUOTE]
What IDE are you using?
Also, a little tip, try learning the [URL="http://en.wikipedia.org/wiki/British_and_American_keyboards"]English keyboard[/URL].
It is so many times nicer to use when it comes to coding.
[QUOTE=gokiyono;42355624]What IDE are you using?
Also, a little tip, try learning the [URL="http://en.wikipedia.org/wiki/British_and_American_keyboards"]English keyboard[/URL].
It is so many times nicer to use when it comes to coding.[/QUOTE]
He's using Brackets.
[QUOTE=mobrockers;42355640]He's using Brackets.[/QUOTE]
Oh I thought he meant
I might have fallen into a trap
[QUOTE=gokiyono;42355624]
Also, a little tip, try learning the [URL="http://en.wikipedia.org/wiki/British_and_American_keyboards"]English keyboard[/URL].
It is so many times nicer to use when it comes to coding.[/QUOTE]
Sorry but.. No. I can't and I won't learn other keyboard inputs. Personal preference sorry :v:
Sorry, you need to Log In to post a reply to this thread.