dannyb785
Members-
Posts
544 -
Joined
-
Last visited
Everything posted by dannyb785
-
I'd suggest against a site that closely resembles wikipedia. People always have different views when it comes to the reliability of its info. You should have your site be a completely separate entity that doesnt remind people of wikipedia
-
yea the nav is way too light... it's hard to see without squinting or looking at a different angle.
-
You need to add "or die(mysql_error());" after your query. Change the end part to just: $result = mysql_query($query) or die(mysql_error()); that will help you with what is going wrong. There is also a worse problem and thats you do not need to insert the literal id into your database in the user_id column. If it's set to auto_increment then just leave it alone, it'll do it on its own.
-
You need to specify which columns each variables is being assigned to. or else it wont know where you want them. So you need to do: $query = "INSERT INTO users (user_id, user_number, _user_rank, user_fname, etc etc...) VALUES ('','$random_number','$rank','$fname','$lname',NOW(),'$date','$zero','$zero','$zero','$about','$email','$password')"; But the number of items in the first parenthesis must be the same number in the second.
-
[SOLVED] Magic quotes and Mysql_real_escape_string question
dannyb785 replied to Prodigal Son's topic in PHP Coding Help
You need to turn off magic quotes in your .htaccess file by adding 'php_flag magic_quotes_gpc off' If that doesn't work(depending on the version of php installed), I think you may be able to modify it in your php.ini, otherwise you need to contact your hosting provider and tell their technical support. they should know how to fix it. I hate magic quotes and pretty much every blog or article about them I've read says you should disable them. It's not adequate enough. -
http://www.dannybianchi.com This is the website that notes some of my works. This isn't meant to be anything extravagant. I did design the template completely from scratch though so please be constructuve. So if you say something like "horrible color scheme" please suggest an alternative. 2 things to note: 1) yes, I know I don't have a resume under the 'resume' section. I'll get to it. 2) I'm currently not happy with the color of the background behind the text(the light blue) but I don't like it with just all white and I dunno what color to go with. Suggestions would be appreciated (unless, that is, you think it looks fine)
-
I have 2 computers that are a few years old and still work(but I got a new computer so they are not needed) so I was wondering if someone could direct me to a book or website that could assist me in making them into servers? I have verizon fios so I figure as long as I knew what I was doing(currently have no clue) then I could use the computers as servers
-
Unless there is an issue with the server executing the mail() function, here is what the problem ALWAYS is. When you write the "from" part in the header, it HAS to be listed as from the domain it's being sent from. So you can't send an email that is "From: bob@gmail.com". It won't work. Ever. I guess if you have an unknowing host OR possibly your own server you can, but otherwise, change the "From:" to be from "whoever@YOURDOMAIN.com" and then test it.
-
the short answer: no. tmp_name is just temporary! It's a random name that way it's unique so that if 10,000 other files were uploaded at the same time, they'd all have different tmp_names. The tmp_name fiole only exists during the script, and it's the file in its entirety, just temporary. So if you did you form, added the file, and the processing page didn't do anything with tmp_name, once the page was complete, you wouldn't have a single byte more of disk space since it's deleted. So the tmp_name file IS the uploaded file, so trying to get a tmp_name before the file is uploaded doesn't make any sense. What I would like to know is, what are you trying to do that you can't(or think you can't) currently?
-
dude, just do $now = strtotime("now") and then insert the variable $now into the database. Does the same exact thing.
-
selecting last record, is this mysql_query correct?
dannyb785 replied to coder9's topic in PHP Coding Help
agreed! I know if you google "php" and then the name of the function you want, you will always get the php function as your first hit -
selecting last record, is this mysql_query correct?
dannyb785 replied to coder9's topic in PHP Coding Help
not the best method. The only time you even need the id is right after inserting something. And if you insert multiple rows in one loop, just use the function and add the id's into an array. No sense using more queries than you need to. Queries aren't just dispensible as if you can use as many as you need with no fear of consequence. Most hosts limit the number of connections/queries allowed. -
tmp_name is just a random name that is assigned to a temporary file. But the file is deleted after the script is over. So I just do something like $tmp_name = $_FILES['blah']['tmp_name'] that way I can continue to use the tmp_name as needed for the current script. There's no need to change tmp name bc you can always reference it during the script. Just remember though, you don't care what the value of tmp_name is because once you move to a different page, the file that tmp_name points to is deleted.
-
selecting last record, is this mysql_query correct?
dannyb785 replied to coder9's topic in PHP Coding Help
No sense in doing a query if you don't have to. You do: $id = mysql_insert_id(); the function returns the primary key of the row that was most recently inserted. -
[SOLVED] Centralising Content Using A DIV Tag??
dannyb785 replied to stublackett's topic in CSS Help
I've never seen margin: 0 auto not work on IE 6 and 7. It's worked every time for me. Text-align isn't good because it's not text that is being centered, it's an element, which makes it non-semantic, and also requires a reset for any child elements as the text-align is inherited by the children. It's just a big I've always run into. -
Ok, so at the moment, I have my site setup so that when I'm uploading an image to a folder, I do an ftp connect with my username, change the folder to 777, upload the pic, then change the folder back to 711, then disconnect. Thing is, sometimes I'm noticing that a folder or 2 every so often is still set to 777(when I view it in filezilla). So it made me think that perhaps the folder stays at 777 if the script is halted before changing back to 711(or perhaps for some other reason gets changed to 777). So an idea I had was that in my php file that connects to my database(and does all other config details) that maybe I could create a long list of all my folders and set them to 711, no matter what they're currently set to? like: $conn = connect(); // sign in as owner change_perms($conn, '0711', 'photos'); // allow folder to be modified change_perms($conn, '0711', 'thumbs'); // allow folder to be modified etc... ftp_close($conn); The thing is, this would be done every single page, so I figure it might be taking up too many resources. So maybe I should do a cronjob of setting folders to 711 every hour? or maybe every 24 hours? What would you recommend? similar question, is 711 okay to set my folders to?
-
[SOLVED] Centralising Content Using A DIV Tag??
dannyb785 replied to stublackett's topic in CSS Help
first: dont use position:relative for the container div second: you'll need to use text-align:center for IE browsers. They dont recognzie margin: 0 auto correctly. Try it out in FF and then IE and test it out. -
It's not complex if you understand what is needed to happen. You have a div with an id of 'xyz', you need a link that will insert the animation when you click the link and then will insert the table after displaying the animation. I took the time to explain everything that is going on. You need to understand what is happening for it to make sense and also if you want to modify something in the future. Sometimes things arent as simple as we hoped they'd be
-
Here's some from one of my sites... I have a table that displays and can be hidden by clicking a link, which will remove it, using ajax. So the link is: <a onclick="ajax_loader('ran_pic'); switch_ran_pic();" style="cursor:pointer;">Hide Picture</a> where ajax_loader() basically overlays the 'ran_pic' div with the loading image gif. initially, the table is within the ran_pic div. To demonstrate this it's like: <div id='ran_pic'> <table> yadda yadda </table> </div> Basically, ajax_loader is an ajax function that calls "loader.php" which echo's out the ajax spinning animation gif that, in essence, replaces the table. This will show the animation. Then the switch_ran_pic() function is another ajax function which basically inserts a blank document into the 'ran_pic' div, hence removing it. The same process is done to display the table if it's hidden, only in the switch_ran_pic() function, it'd check if the pic was hidden and display it if it was(by echo'ing the table, which would end up overlaying the animation). and here's my ajax code in my jsfunc.js file function ajax_loader(div){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById(div); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } ajaxRequest.open("GET", "ajaxloader.php", true); ajaxRequest.send(null); } function switch_ran_pic(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ran_pic'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } ajaxRequest.open("GET", "switchranpic.php", true); ajaxRequest.send(null); } Hope this helps. you'll need to modify the js functions to do what you need. p.s. I can't explain to you exactly what all my ajax functions are doing, but all I know is they work perfectly and I can modify them as I like without trouble. But I got the original function from some website(no clue where). Oh, and there's probably an easier way to replace the ran_pic div with the animation, but I haven't looked into it.
-
^ yeah I added the stuff in the .htaccess file. is there a way I can test that it's correctly disabled?
-
I can't thank you enough! That article was quite helpful and informative. Good stuff guys, I'm another step closer to becoming less vulnerable
-
What I do is have in my submit field, it's a type=button(not type=submit) and I say "onclick='loading(); function(); this.submit(); " where, loading() is a function that just outputs a loading animation wherever I specify, function does the ajax call to another php file, and then submit() submits the form(if you want to submit). If you dont want to submit anything, then keep that function out.
-
I check my php.ini file and didn't see a http trace. closest I saw was mysql trace you can disable http_trace through .htacess file write this in it: # disable TRACE in the main scope of httpd.conf RewriteEngine On RewriteCond %{REQUEST_METHOD} ^TRACE RewriteRule .* - [F] does disabling it make it so you cant spoof the ip and other variables? Or what exactly? I dont remember anyone saying anything about http trace before you mentioned it.
-
duuude!!! I never thought about that! Very good point. and fixed now. quick question... would addslashes be okay?
-
I check my php.ini file and didn't see a http trace. closest I saw was mysql trace