Web Dev Questions That Don't Need Their Own Thread v4
5,001 replies, posted
[QUOTE=Dorkslayz;41881319]Yes, get rid of IIS unless you need all of it's advanced features.[/QUOTE]
Before I do so, are there any good alternatives for ftp on windows?
[QUOTE=Cowabanga;41881375]Before I do so, are there any good alternatives for ftp on windows?[/QUOTE]
Filezilla Server - [url]https://filezilla-project.org/download.php?type=server[/url]
I've gone completely numb and don't know how I would approach this, but basically I want a body of text on the left hand side and on the right an image, but I want the image to always be center of the body of text vertically, not sure how I'd approach it. I've made a little image to demonstrate what I'm wanting.
[IMG]http://puu.sh/459F7.png[/IMG]
The black box on the right being the image.
Thanks.
It's a bit late i'm sure, but you can also use Zend server [url]http://www.zend.com/en/products/server/[/url] its kinda like wampp but it's made for production use.
Alright, so I'm using Textpattern, and I'm trying to create a search that uses a couple of dropdown menus and a textbox.
[code]<form method="get" action="<txp:site_url />">
<select name="c">
<option value="" selected="selected"> </option>
<option value="counter-strike-source">Counter-Strike: Source</option>
</select>
<select name="q">
<option value="" selected="selected"> </option>
<option value="large">Large</option>
<option value="medium">Medium</option>
</select>
<input id="search-button" type="submit" value="<txp:text item='go' />">
</form>[/code]
This is the code for the two dropdown menus, and it works perfectly. The resulting url:
[code]http://dotbsp.com/?c=counter-strike-source&q=large[/code]
I need to add a textbox that adds to the last part of the url, so if someone types in "bananas", the resulting code is:
[code]http://dotbsp.com/?c=counter-strike-source&q=large+bananas[/code]
I have no idea how to do that though. :(
I checked my website for the first time in like a month and saw that it's been getting a lot of attention from comment spam bots.
like a shitload.
as in i blew away 122,000 rows in my database.
It looked like a pretty normal comment spammer, but I looked in the HTTP access logs and saw this:
[code]/showpost.php?id=26++++++++++++++++++++++++++++++++Result:+chosen+nickname+%22DinyPymnHon%22;+success;[/code]
What the fuck is this trying to bypass?
I work at a concrete yard and some guy showed up and we talked and it ended up that he was looking for a Web developer to re-do his website. I figured I might give it a shot as he's not in a big rush ~2 months he would like it finished. is there any "quick" learning books I can pick up and learn from? I'm taking Web design in university so I figure that I also might as well start early. I know basic html and I understand that I might have to learn CSS (which I know a bit about) and that I maybe MAYBE need to know some javascript (although it's just for a landscaping company so I assume that it wouldn't need anything TOO intensive. can anyone recommend a book or two I can purchase or free guides that I can follow to "jumpstart" my education? thanks folks! :)
[QUOTE=RoflKawpter;41903121]I work at a concrete yard and some guy showed up and we talked and it ended up that he was looking for a Web developer to re-do his website. I figured I might give it a shot as he's not in a big rush ~2 months he would like it finished. is there any "quick" learning books I can pick up and learn from? I'm taking Web design in university so I figure that I also might as well start early. I know basic html and I understand that I might have to learn CSS (which I know a bit about) and that I maybe MAYBE need to know some javascript (although it's just for a landscaping company so I assume that it wouldn't need anything TOO intensive. can anyone recommend a book or two I can purchase or free guides that I can follow to "jumpstart" my education? thanks folks! :)[/QUOTE]
Did you make sure you told him that you don't know what you're doing?
Yes I did! (I do know somewhat what I'm doing) he said it was okay and that the last guy was completely terrible at doing anything (used one of those pre-built site builders and didn't do anything to it) . At the very worst, I can ask a couple buddies of mine who have done this way more than I have (I'd rather not though as they have very busy schedules) for assistance. I will have lots more free time next week as I will be leaving work in preparation for school and the courses I will be taking are easy peasy .
[QUOTE=RoflKawpter;41904531]Yes I did! (I do know somewhat what I'm doing) he said it was okay and that the last guy was completely terrible at doing anything (used one of those pre-built site builders and didn't do anything to it) . At the very worst, I can ask a couple buddies of mine who have done this way more than I have (I'd rather not though as they have very busy schedules) for assistance. I will have lots more free time next week as I will be leaving work in preparation for school and the courses I will be taking are easy peasy .[/QUOTE]
Don't take this as an insult (because there is nothing wrong with not knowing things) but if you don't know CSS and you've never taken a client project like this before, you don't know what you're doing yet. I just wanted to make sure you didn't set an expectation that you've done this before and will have a nice perfect website done in 2 months.
Hey guys, I'm making a centered navbar and it seems almost impossible to do, any help would be muchly appreciated.
Here's my code
html
[code] <div id="navbar">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</div id="navbar">
[/code]
css
[code]#navbar ul {
list-style-type: none;
padding: 0;
overflow: hidden;
}
#navbar li {
display:inline;
text-align: center;
float:right;
}
#navbar a {
display:block;
width:60px;
background-color:#dddddd;
}
[/code]
I'm using float:right; because if I don't the navbar options will be ontop of eachother, and I think it may be my problem but I'm fresh out of ideas. Might just scrap the centered navbar and go for one on the left...
How could I go about overlaying a solid color with text over an image like a logo in a nav-bar preferably in CSS?
[QUOTE=KmartSqrl;41904809]Don't take this as an insult (because there is nothing wrong with not knowing things) but if you don't know CSS and you've never taken a client project like this before, you don't know what you're doing yet. I just wanted to make sure you didn't set an expectation that you've done this before and will have a nice perfect website done in 2 months.[/QUOTE]
cool! thanks for your input! after thinking about it I'll probably just refer him to the guys I mentioned previously. he wanted cheaper than retail prices (like they all do and which is why I wanted to pick it up and give it a shot - he was thinking of hiring a university student to do it) but I would assume they won't mind going with a referral I give them.
[QUOTE=TrulliLulli;41905345]
I'm using float:right; because if I don't the navbar options will be ontop of eachother, and I think it may be my problem but I'm fresh out of ideas. Might just scrap the centered navbar and go for one on the left...[/QUOTE]
[code]display: inline-block;[/code]
?
[QUOTE=RoflKawpter;41907968]cool! thanks for your input! after thinking about it I'll probably just refer him to the guys I mentioned previously. he wanted cheaper than retail prices (like they all do and which is why I wanted to pick it up and give it a shot - he was thinking of hiring a university student to do it) but I would assume they won't mind going with a referral I give them.[/QUOTE]
Well if it's something that interests you there's nothing wrong with having a go at it as long as he is informed about your skill/experience level. Client work will teach you more than working on your own will most of the time.
So I have two option tags where one of them needs to change depending on the other.
I considered AJAX, and I have Googled tonnes of different things
And I have gotten so far as
X option gets some data from a database
Y option needs to change when X option is, it also gets it's values from a database
[CODE]
<div id="rentaForm">
<form id="rental" method="POST">
<select id="model">
<option value='' class='select computer'>Vælg mærke</option>
<?PHP
while($row = $model->fetch_assoc()){
echo "<option value='" . $row['brandID'] . "' class='computer'>" . $row['brandName'] . "</option>";
}
?>
</select>
<input type='submit' name="submit" value="submit">
</form>
</div>
<script>
$('.computer').blur(function(){
$.ajax({
type: "GET",
dataType: "json",
url: "addons/ajax.php",
data: "model="+$(this).val(),
success: function(result){
}
});
});
</script>
[/CODE]
And some PHP
[PHP]header('Content-Type: application/json');
require_once "../globalIsh.php";
$model = $_GET['model'];
$sql = "SELECT brand, computername FROM computer WHERE brand='$model';";
$query = $con->query($sql);
if($query){
$merke = $query->fetch_assoc();
$json = json_encode($merke);
print_r($json);
}
[/PHP]
I just don't have a big clue of what to do after
[QUOTE=gokiyono;41914744]So I have two option tags where one of them needs to change depending on the other.
I considered AJAX, and I have Googled tonnes of different things
And I have gotten so far as
X option gets some data from a database
Y option needs to change when X option is, it also gets it's values from a database
-code-
I just don't have a big clue of what to do after[/QUOTE]
Now in the result function you need to use "result" to change the option values of the second select tag. You might want to save the values in an array of sorts, so that it doesn't keep using ajax to retreive information it already had at some point.
[QUOTE=eternalflamez;41915358]Now in the result function you need to use "result" to change the option values of the second select tag. You might want to save the values in an array of sorts, so that it doesn't keep using ajax to retreive information it already had at some point.[/QUOTE]
Err
Could you display it in code for someone who is new to this?
[QUOTE=gokiyono;41917753]Err
Could you display it in code for someone who is new to this?[/QUOTE]
[code]
//Changed the event handler to correctly get the <select> and use the right event.
$('#model').change(function(){
$.ajax({
type: "GET",
dataType: "json",
url: "addons/ajax.php",
data: "model="+$(this).val(),
success: function(result){
$("#second_id option").detach(); //empties the second select
// assuming the array given is something like ["id"=>"value", "id2"=>"value2"]
//Adds all options to the select
$.each(result, function(index, value) {
$("#second_id").append("<option value='" + index + "'>" + value + "</option>");
});
}
});
});
[/code]
Note that, I could not find the second select in your script and so I'm using a test-selector. Change it to whatever should tag the other <select>.
Do any of you know of a tool to render github markdown locally? I've tried a few editors but non of them parse [code]```ruby
require 'osrshighscores'
```[/code] properly
I've been trying to get AJAX/JSON and Bootstrap's typeahead to work together for about an hour now, and it's not working. Does anyone know how to go about doing it?
Making a TV tracking site sort of thing.
[url]http://localhost/tellyium/app/addshow_typeahead/?query=doctor[/url]
outputs the following:
[QUOTE]["The Doctors (1963)","Frontier Doctor","The Young Doctors","Doctors & Nurses","Doctors","Doctor Brothers","Doctor, Doctor","Doctor Finlay","Doctor in the House","Doctor Who","Doctor Who (2005)","Doctor Who Confidential","House Doctor","L. A. Doctors","The Bold Ones: The New Doctors","The Flying Doctor","The Flying Doctors","Diet Doctors Inside & Out","Doctor Snuggles","Oh, Doctor Beeching!","Doctor At Large","Doctor In Charge","Doctor At Sea","Doctor On The Go","Doctor At The Top","Doctors' Daughters","Doctor Down Under","Totally Doctor Who","House Doctor: Inside and Out","House Doctor: Designs for Living","Woobinda: Animal Doctor","Animal Doctor","Doctor Zhivago (2002)","Street Doctor","Doctor","Trust Me, I'm A Doctor","Doctor*ology","Doctors' Hospital","Doctors' Private Lives","Doctor Doolittle","Doctor's Diary","The Doctor","Doctor Christian","SuperDoctors","The Doctors (2008)","Doctors and Nurses at War","Doctors Without Borders","Doctor Who Greatest Moments","Bush Doctors","Royal Flying Doctor Service","Fat Doctor, The","The Indian Doctor","Junior Doctors \u00e2\u20ac\u201c Your Life In Their Hands","Doctor Mateo","Doctors Without Borders (2011)","The Witch Doctor Will See You Now","Doctor Cheezy","DOCTORS Saikyou no Meii","The Mob Doctor","The Doctor Blake Mysteries","Reef Doctors","Which Doctor","Sherlock Holmes and Doctor Watson","Obstetrics and Gynecology Doctors","Brain Doctors","Trauma Doctors","Doctor Who: The Doctors Revisited"][/QUOTE]
I've tried using some extensions on GitHub and those are not working either. I don't have a clue.
I don't understand what you're trying to do
[QUOTE=gokiyono;41914744]
And some PHP
[PHP]header('Content-Type: application/json');
require_once "../globalIsh.php";
$model = $_GET['model'];
$sql = "SELECT brand, computername FROM computer WHERE brand='$model';";
$query = $con->query($sql);
if($query){
$merke = $query->fetch_assoc();
$json = json_encode($merke);
print_r($json);
}
[/PHP]
I just don't have a big clue of what to do after[/QUOTE]
The code you posted isn't safe. You really should sanitise/escape the input to avoid SQL-injection and use either PDO or mySQLi with prepared statements like so:
[PHP]
<?php
header('Content-Type: application/json');
$pdo = new PDO('mysql:dbname='.$db.';host='.$ip, $user, $pass);
// Prepare the statement
$statment = $pdo->prepare("SELECT brand, computername FROM computer WHERE brand = :model");
// Bind values
$statement->bindValue(':model', $_GET['model'], PDO::PARAM_STR);
// Run the query
$statement->execute();
// Fetch PDO
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
if($result){
echo json_encode($result);
}
?>
[/PHP]
[QUOTE=CBastard;41921853]The code you posted isn't safe. You really should sanitise/escape the input to avoid SQL-injection and use either PDO or mySQLi with prepared statements like so:
[IMG]http://www.facepunch.com/fp/ratings/programming_king.png[/IMG]
[/QUOTE]
I make sure to REAL_ESCAPE_STRING and FILTER_SANITIZE_
This time though, I would bother too much with it (since there was more focus on the jquery/AJAX parts)
[editline]22nd August 2013[/editline]
I would hate having unfiltered code.
[editline]22nd August 2013[/editline]
That also reminds me about something I have meant to ask for a while
But is there a reason to use PDO over MySQLI?
(Other than more drivers and personal preference)
[QUOTE=sambooo;41919988]Do any of you know of a tool to render github markdown locally? I've tried a few editors but non of them parse [code]```ruby
require 'osrshighscores'
```[/code] properly[/QUOTE]
bumping onto this page
[QUOTE=gokiyono;41924838]That also reminds me about something I have meant to ask for a while
But is there a reason to use PDO over MySQLI?
(Other than more drivers and personal preference)[/QUOTE]
To me, PDO is much nicer to use in regards to prepared statements/bound parameters (which is what people should be using).
[QUOTE=RusselG;41925387](which is what people should be using).[/QUOTE]
Could you explain that a bit more?
[QUOTE=gokiyono;41925406]Could you explain that a bit more?[/QUOTE]
[QUOTE] to[B] prepared statements/bound parameters [/B](which is what people should be using). [/QUOTE]
Anyone have experience with suExec in Apache2? I cannot, for the life of me, get this damn module to execute my PHP scripts as the user who owns the directory and files instead of www-data. Yes, I did set [b]SuexecUserGroup username group[/b] (obviously to the actual owner of the folder).
It's driving me absolutely insane, I'm sick of having to use FTP with Wordpress theme/plugin installations and htaccess modifications.
[QUOTE=Coment;41925511][QUOTE=I;41925406]Could you explain that a bit more?[/QUOTE][/QUOTE]
You are such a great help.
It would be nice to know why that is.
Sorry, you need to Log In to post a reply to this thread.