• Web Dev Questions That Don't Need Their Own Thread v4
    5,001 replies, posted
[QUOTE=01271;41049078]how do I fix this with mongo. Fatal error: Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: localhost:27017: Permission denied' in /var/www/html/MongoDB/mongoDBTest.php:39 Stack trace: #0 /var/www/html/MongoDB/mongoDBTest.php(39): MongoClient->__construct() #1 {main} thrown in /var/www/html/MongoDB/mongoDBTest.php on line 39[/QUOTE] What does it say on line 39?
[QUOTE=gokiyono;41049114]What does it say on line 39?[/QUOTE] $m = new MongoClient();
Is Mongo running and listening on that port? It took me half an hour to figure out Redis wasn't even running once.
Yep, it's turned on. Checked. Doesn't work though.
[QUOTE=01271;41049078]how do I fix this with mongo. Fatal error: Uncaught exception 'MongoConnectionException' with message 'Failed to connect to: localhost:27017: Permission denied' in /var/www/html/MongoDB/mongoDBTest.php:39 Stack trace: #0 /var/www/html/MongoDB/mongoDBTest.php(39): MongoClient->__construct() #1 {main} thrown in /var/www/html/MongoDB/mongoDBTest.php on line 39[/QUOTE] [url]http://ulaptech.blogspot.com/2011/01/fatal-error-uncaught-exception.html[/url]
-snip- Thanks for helping me on Steam eternalflamez!
Does it send the email that states the donation was a success, though? Can't really see anything wrong with the sql, or the script, have you tried turning on error_reporting to E_ALL?
Would anyone know why this isn't working? [php] $item_number = mysql_real_escape_string($_POST['item_number']); $con = mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASS); if (!$con) { mail($PAYPAL_EMAIL, "MySQL ERROR", "MySQL Error - Could not connect to DB."); exit(0); } mysql_select_db($MYSQL_DB, $con); $package = mysql_query("SELECT * FROM donator_packages WHERE itemname='$item_number'"); if (!$package) { mail($PAYPAL_EMAIL, "Error with market script", "MySQL Didn't manage to get Item details from database - Error: ".mysql_error()."."); exit(0); } else { $errmsg = ''; if ($payment_status != 'Completed') { exit(0); } if ($receiver_email != $PAYPAL_EMAIL) { $errmsg .= "'receiver_email' does not match: "; $errmsg .= $receiver_email."\n"; } //Check to see if this purchase is a duplicate $r = mysql_query("SELECT COUNT(*) FROM donator_payments WHERE txn_id = '$txn_id'"); if (!$r) { error_log(mysql_error()); exit(0); } $exists = mysql_result($r, 0); mysql_free_result($r); if ($exists) { $errmsg .= "'txn_id' has already been processed: ".$_POST['txn_id']."\n"; } $packaget = mysql_fetch_row($package); if (!$packaget) { //Says that there is no row for package? mail($PAYPAL_EMAIL, "Donation Successful", $_POST['payer_email']." donated $payment_currency ".$_POST['mc_gross']." , but didn't use a valid itemnumber which was ".$_POST['item_number'].", Item SteamID is: ".$_POST['option_selection1']."."); mysql_query("INSERT INTO donator_payments(itemid, itemname, cost, payer_email, payer_name, payer_id, steamid, txn_id) VALUES ('NONE', 'NONE', $payment_amount, '$payer_email', '$payer_name', '$payer_id', '$steamid', '$txn_id')"); } [/php] Database: [IMG]http://puu.sh/3h5Po.png[/IMG] Paypal Email: [IMG]http://puu.sh/3h5Sj.png[/IMG]
[QUOTE=brandonj4;41057921]Would anyone know why this isn't working? [php] $item_number = mysql_real_escape_string($_POST['item_number']); $con = mysql_connect($MYSQL_HOST, $MYSQL_USER, $MYSQL_PASS); if (!$con) { mail($PAYPAL_EMAIL, "MySQL ERROR", "MySQL Error - Could not connect to DB."); exit(0); } mysql_select_db($MYSQL_DB, $con); $package = mysql_query("SELECT * FROM donator_packages WHERE itemname='$item_number'"); if (!$package) { mail($PAYPAL_EMAIL, "Error with market script", "MySQL Didn't manage to get Item details from database - Error: ".mysql_error()."."); exit(0); } else { $errmsg = ''; if ($payment_status != 'Completed') { exit(0); } if ($receiver_email != $PAYPAL_EMAIL) { $errmsg .= "'receiver_email' does not match: "; $errmsg .= $receiver_email."\n"; } //Check to see if this purchase is a duplicate $r = mysql_query("SELECT COUNT(*) FROM donator_payments WHERE txn_id = '$txn_id'"); if (!$r) { error_log(mysql_error()); exit(0); } $exists = mysql_result($r, 0); mysql_free_result($r); if ($exists) { $errmsg .= "'txn_id' has already been processed: ".$_POST['txn_id']."\n"; } $packaget = mysql_fetch_row($package); if (!$packaget) { //Says that there is no row for package? mail($PAYPAL_EMAIL, "Donation Successful", $_POST['payer_email']." donated $payment_currency ".$_POST['mc_gross']." , but didn't use a valid itemnumber which was ".$_POST['item_number'].", Item SteamID is: ".$_POST['option_selection1']."."); mysql_query("INSERT INTO donator_payments(itemid, itemname, cost, payer_email, payer_name, payer_id, steamid, txn_id) VALUES ('NONE', 'NONE', $payment_amount, '$payer_email', '$payer_name', '$payer_id', '$steamid', '$txn_id')"); } [/php] Database: [IMG]http://puu.sh/3h5Po.png[/IMG] Paypal Email: [IMG]http://puu.sh/3h5Sj.png[/IMG][/QUOTE] Maybe I'm a bad reader, but what is it supposed to do? And does it return an error? [del]Also, consider mysqli. It won't fix it, just make it more secure.[/del]
You should use PDO or MySQLi... Also, might look like nitpicking, but why do you call itemnumber something that is going to be a name? (Because it's a name what you're posting, and not a number that you reference with a name, ala 0 > Perm VIP 1 > 1h VIP etc... right?) EDIT: In fact, this could be easier if you put the values of $_POST
[QUOTE=Coment;41058050]You should use PDO or MySQLi... Also, might look like nitpicking, but why do you call itemnumber something that is going to be a name? (Because it's a name what you're posting, and not a number that you reference with a name, ala 0 > Perm VIP 1 > 1h VIP etc... right?) EDIT: In fact, this could be easier if you put the values of $_POST[/QUOTE] Do you know why it would send the email but not update the query? [php] mail($PAYPAL_EMAIL, "Donation Successful", $_POST['payer_email']." donated $payment_currency ".$_POST['mc_gross']." , but didn't use a valid itemnumber which was ".$_POST['item_number'].", Item SteamID is: ".$_POST['option_selection1']."."); mysql_query("INSERT INTO donator_payments(itemid, itemname, cost, payer_email, payer_name, payer_id, steamid, txn_id) VALUES ('NONE', 'NONE', $payment_amount, '$payer_email', '$payer_name', '$payer_id', '$steamid', '$txn_id')"); [/php]
Hi everyone, I'm getting annoyed with this error I'm getting and I don't understand why it's happening. Here's my JavaScript: [CODE] 11 var innercontainer = document.getElementById("psinnercontainer"); 12 var outtercontainer = document.getElementById("pscontainer"); 13 14 var outterwidth = outtercontainer.style.width; 15 var innerwidth = innercontainer.style.width; [/CODE] and here is my html [HTML] <div id="pscontainer"> <div id="psinnercontainer"> <div id="ps-1" class="ps-imagecontainer"> </div> <div id="ps-2" class="ps-imagecontainer"> </div> <div id="ps-3" class="ps-imagecontainer"> </div> <div id="ps-4" class="ps-imagecontainer"> </div> <div id="ps-5" class="ps-imagecontainer"> </div> <div id="ps-6" class="ps-imagecontainer"> </div> <div id="ps-7" class="ps-imagecontainer"> </div> </div> </div> [/HTML] and I'm getting this error : "Uncaught TypeError: Cannot read property 'style' of null" (line 14) Does anyone see something I'm missing?
[QUOTE=borisjake;41058468]Hi everyone, I'm getting annoyed with this error I'm getting and I don't understand why it's happening. Here's my JavaScript: [CODE] 11 var innercontainer = document.getElementById("psinnercontainer"); 12 var outtercontainer = document.getElementById("pscontainer"); 13 14 var outterwidth = outtercontainer.style.width; 15 var innerwidth = innercontainer.style.width; [/CODE] and here is my html [HTML] <div id="pscontainer"> <div id="psinnercontainer"> <div id="ps-1" class="ps-imagecontainer"></div> <div id="ps-2" class="ps-imagecontainer"></div> <div id="ps-3" class="ps-imagecontainer"></div> <div id="ps-4" class="ps-imagecontainer"></div> <div id="ps-5" class="ps-imagecontainer"></div> <div id="ps-6" class="ps-imagecontainer"></div> <div id="ps-7" class="ps-imagecontainer"></div> </div> </div> [/HTML] and I'm getting this error : "Uncaught TypeError: Cannot read property 'style' of null" (line 14) Does anyone see something I'm missing?[/QUOTE] This should work, works for me on jsfiddle. The error means that your line of code with [code]document.getElementById("pscontainer");[/code] Finds no element with that id, so it has no 'style' property. [editline]16th June 2013[/editline] [QUOTE=brandonj4;41058290]Do you know why it would send the email but not update the query? [php] mail($PAYPAL_EMAIL, "Donation Successful", $_POST['payer_email']." donated $payment_currency ".$_POST['mc_gross']." , but didn't use a valid itemnumber which was ".$_POST['item_number'].", Item SteamID is: ".$_POST['option_selection1']."."); mysql_query("INSERT INTO donator_payments(itemid, itemname, cost, payer_email, payer_name, payer_id, steamid, txn_id) VALUES ('NONE', 'NONE', $payment_amount, '$payer_email', '$payer_name', '$payer_id', '$steamid', '$txn_id')"); [/php][/QUOTE] We managed to solve this. Apparantly his user account does not have rights to use mysql_real_escape_string at the part of: [php]mysql_real_escape_string($_POST['item_number']);[/php] So we are using addslashes instead.
[HR][/HR][QUOTE=eternalflamez;41058544]This should work, works for me on jsfiddle. The error means that your line of code with [code]document.getElementById("pscontainer");[/code] Finds no element with that id, so it has no 'style' property. [/QUOTE] Maybe if you see all the JavaScript it will help? [code] <script type="application/javascript"> var xposition = 0; var direction = true; var innercontainer = document.getElementById("psinnercontainer"); var outtercontainer = document.getElementById("pscontainer"); var outterwidth = outtercontainer.style.width; var innerwidth = innercontainer.style.width; xposition = outterwidth - innerwidth; innercontainer.style.left = xposition + "px"; var distance = innercontainer.offsetLeft; setInterval(update,10); function update() { xposition-=1; innercontainer.style.left = xposition + "px"; } </script> [/code] And might it have something to do with my style sheet? [HTML] #pscontainer{ position:relative; width:912px; height:120px; overflow:hidden; } #psinnercontainer{ position:relative; height:120px; width:1400px; } .ps-imagecontainer{ position:relative; margin-right:4px; float:left; border:#999 solid 1px; height:120px; width:170px; }[/HTML] [B] EDIT: [/B] I've copied out the code that should work like this: [HTML] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <!--<link rel="stylesheet" type="text/css" href="css/ps-css.css"/>--> <script type="application/javascript"> var innercontainer = document.getElementById("psinnercontainer"); var outtercontainer = document.getElementById("pscontainer"); var outterwidth = outtercontainer.style.width; var innerwidth = innercontainer.style.width; xposition = outterwidth - innerwidth; innercontainer.style.left = xposition + "px"; var distance = innercontainer.offsetLeft; setInterval(update,10); function update() { xposition-=1; innercontainer.style.left = xposition + "px"; } </script> </head> <body> <div id="pscontainer"> <div id="psinnercontainer"> <div id="ps-1" class="ps-imagecontainer"> </div> <div id="ps-2" class="ps-imagecontainer"> </div> <div id="ps-3" class="ps-imagecontainer"> </div> <div id="ps-4" class="ps-imagecontainer"> </div> <div id="ps-5" class="ps-imagecontainer"> </div> <div id="ps-6" class="ps-imagecontainer"> </div> <div id="ps-7" class="ps-imagecontainer"> </div> </div> </div> </body> </html> [/HTML] But I'm still getting this: Uncaught TypeError: Cannot read property 'style' of null (anonymous function)
Still works for me. Using: [code]<div id="pscontainer" style="width: 1000px;"> <div id="psinnercontainer" style="width: 100px; position: absolute;"> <div id="ps-1" class="ps-imagecontainer">text</div> <div id="ps-2" class="ps-imagecontainer">text</div> <div id="ps-3" class="ps-imagecontainer"></div> <div id="ps-4" class="ps-imagecontainer"></div> <div id="ps-5" class="ps-imagecontainer"></div> <div id="ps-6" class="ps-imagecontainer"></div> <div id="ps-7" class="ps-imagecontainer"></div> </div> </div> <script type="application/javascript"> var xposition = 0; var direction = true; var innercontainer = document.getElementById("psinnercontainer"); var outtercontainer = document.getElementById("pscontainer"); var outterwidth = outtercontainer.style.width; var innerwidth = innercontainer.style.width; xposition = parseFloat(outterwidth) - parseFloat(innerwidth); innercontainer.style.left = xposition + "px"; var distance = innercontainer.offsetLeft; setInterval(update,10); function update() { xposition-=1; innercontainer.style.left = xposition + "px"; } </script>[/code] I added parseFloats to the part where you get xposition, and some style so the divs actually have widths, [del]but couldn't figure out what your problem is, since it doesn't work. Are you running that javascript on the same page as the html?[/del] Here's my running version: [url]https://dl.dropboxusercontent.com/u/22510918/test.html[/url] Edit: Try placing the javascript below your html. When it's placed above the html, the div doesn't exist yet, the js can't find it yet, and throws an error.
[QUOTE=eternalflamez;41059193]Still works for me. Using: [code]<div id="pscontainer" style="width: 1000px;"> <div id="psinnercontainer" style="width: 100px; position: absolute;"> <div id="ps-1" class="ps-imagecontainer">text</div> <div id="ps-2" class="ps-imagecontainer">text</div> <div id="ps-3" class="ps-imagecontainer"></div> <div id="ps-4" class="ps-imagecontainer"></div> <div id="ps-5" class="ps-imagecontainer"></div> <div id="ps-6" class="ps-imagecontainer"></div> <div id="ps-7" class="ps-imagecontainer"></div> </div> </div> <script type="application/javascript"> var xposition = 0; var direction = true; var innercontainer = document.getElementById("psinnercontainer"); var outtercontainer = document.getElementById("pscontainer"); var outterwidth = outtercontainer.style.width; var innerwidth = innercontainer.style.width; xposition = parseFloat(outterwidth) - parseFloat(innerwidth); innercontainer.style.left = xposition + "px"; var distance = innercontainer.offsetLeft; setInterval(update,10); function update() { xposition-=1; innercontainer.style.left = xposition + "px"; } </script>[/code] I added parseFloats to the part where you get xposition, and some style so the divs actually have widths, [del]but couldn't figure out what your problem is, since it doesn't work. Are you running that javascript on the same page as the html?[/del] Here's my running version: [url]https://dl.dropboxusercontent.com/u/22510918/test.html[/url] Edit: Try placing the javascript below your html. When it's placed above the html, the div doesn't exist yet, the js can't find it yet, and throws an error.[/QUOTE] Thank you so much, that fixed it.
Sorry if this isn't the proper thread, but I have an imageboard that's currently hosted by an extremely incompetent hosting company. They're so incompetent that I can't even pay this years bill because their website is completely broken and their customer support is non-existent. So I need a new host that's around $110 or so annually, and can support 178 gbs (and growing) of bandwidth a year. Disk space isn't as important, but I would like at least 6-10 gbs which should be more than enough for several years. There is a modest amount of NSFW content on a hidden board, so I would also need a host that doesn't get steamed about that sort of thing. Also, I prefer cpanel (if that even matters). I've taken a look at lithium hosting, but I didn't like the sound of their TOS. Any suggestions will be greatly appreciated, as the site will be shut down by the end of month if I can't figure something out.
How can I make this code don't display the password in the source of the page? [code] var password; var pass1="password"; password=prompt('Write the password here:',' '); if (password==pass1) alert('OK!'); else { window.location="http://google.com"; } [/code]
[QUOTE=B-Rabbit;41094709]How can I make this code don't display the password in the source of the page? [code] var password; var pass1="password"; password=prompt('Write the password here:',' '); if (password==pass1) alert('OK!'); else { window.location="http://google.com"; } [/code][/QUOTE] That's the way JavaScript works; the source will always be sent to the client. You'll have to use a serverside language such as PHP.
[QUOTE=jetboy;41095875]That's the way JavaScript works; the source will always be sent to the client. You'll have to use a serverside language such as PHP.[/QUOTE] Damn. Dropbox doesn't want to let any PHP script work and I don't have the money to buy a domain, what's the best free domain host service thingy that allows for PHP scripts? I tried .tk but if I made something cool and wanted to share it with someone mostly it will result in a failed attempt because adressess that end up with .tk are blocked. Also if it would be possible I wouldn't want to have a website ending with 12398712.13.com or similar to that ( For example something like : websitename. freedomains .com would be good for me )
[QUOTE=B-Rabbit;41102685]Damn. Dropbox doesn't want to let any PHP script work and I don't have the money to buy a domain, what's the best free domain host service thingy that allows for PHP scripts? I tried .tk but if I made something cool and wanted to share it with someone mostly it will result in a failed attempt because adressess that end up with .tk are blocked. Also if it would be possible I wouldn't want to have a website ending with 12398712.13.com or similar to that ( For example something like : websitename. freedomains .com would be good for me )[/QUOTE] You could get a [URL="http://codotvu.com"]free domain at Co.Vu[/URL] And point it towards [URL="http://www.appfog.com"]AppFog's free pricing tier[/URL]. When you use AppFog your PHP app runs on a subdomain like so: yourapp.aws.af.cm You could also try [URL="https://www.heroku.com"]Heroku for running your PHP app.[/URL] They have a free pricing tier as well. Also [URL="http://www.windowsazure.com"]Windows Azure[/URL] runs PHP too.
[QUOTE=B-Rabbit;41102685]Damn. Dropbox doesn't want to let any PHP script work and I don't have the money to buy a domain[/QUOTE] What do you actually need this site to do? Is it just for you to learn or do you need to show things to other people?
[QUOTE=CBastard;41104154]What do you actually need this site to do? Is it just for you to learn or do you need to show things to other people?[/QUOTE] Both.
[QUOTE=B-Rabbit;41102685]Damn. Dropbox doesn't want to let any PHP script work.[/QUOTE] Tell me exactly what you want to do. I made a simply PHP stuff to work with the Dropbox API, can it help you?
[QUOTE=asantos3;41108070]Tell me exactly what you want to do. I made a simply PHP stuff to work with the Dropbox API, can it help you?[/QUOTE] No he want's to host PHP on drop box, not use its API.
[QUOTE=B-Rabbit;41102685]Damn. Dropbox doesn't want to let any PHP script work and I don't have the money to buy a domain, what's the best free domain host service thingy that allows for PHP scripts? I tried .tk but if I made something cool and wanted to share it with someone mostly it will result in a failed attempt because adressess that end up with .tk are blocked. Also if it would be possible I wouldn't want to have a website ending with 12398712.13.com or similar to that ( For example something like : websitename. freedomains .com would be good for me )[/QUOTE] Hmm Is it Facebook you are trying to send it over?
[QUOTE=gokiyono;41111240]Hmm Is it Facebook you are trying to send it over?[/QUOTE] Yes. Any .tk site can't be send in a message on Facebook at least in my case.
[QUOTE=B-Rabbit;41111716]Yes. Any .tk site can't be send in a message on Facebook at least in my case.[/QUOTE] Well now, why are you using .tk? Send two messages 1. sitename 2. .tk Or, you can not write anything before sitename.tk (which should send it if you do not copy and paste.)
I've been working on a site recently that makes use of data bought in from a database to add records etc. I've been using drop down lists of the desktop to make it easy for users to find what they want by scrolling or typing what they need. This works great on the desktop however not so great on a tablet. Currently scrolling down in them is ridiculous on a touchscreen and takes so much time, and the potential usage on a tablet would be a killer feature. [B]How can I make these large drop down lists more accessible to a tablet and maybe even desktop users?[/B] Information: These lists contain many, many strings like W0T5. ASP.NET 4.5 currently using dropdownlists and sql datasources
[QUOTE=jlj1;41133952][B]How can I make these large drop down lists more accessible to a tablet and maybe even desktop users?[/B][/QUOTE] [code] <html> <head> <script type="text/javascript"> function updateDropDownMenuWith(selectedCategory){ var a=document.getElementById('dropDownMenu'); if(!a.disabled){ a.disabled=true; for(var z=a.options.length;z>0;z--){a.remove(z-1);} // add 'selectedCategory' options to 'dropDownMenu' now a.selectedIndex=0; a.disabled=false; } } </script> </head> <body> <div> <select id="categoryMenu" onchange="updateDropDownMenuWith(this.options[this.selectedIndex].value)"> <option disabled="disabled">Choose a category...</option> <option value="files">Files</option> <option value="messages">Messages</option> <option value="users">Users</option> <option value="all">All Categories</option> </select> </div> <select id="dropDownMenu"></select> <script type="text/javascript"> document.getElementById('categoryMenu').selectedIndex=0; </script> </body> </html> [/code] Something like above is what I think I would use. Are the options outputted with the page or are they retrieved with an AJAX call? Let me know and I can tailor my above code for you if either be. [editline]22nd June 2013[/editline] [QUOTE=Matoking;41010084]I've been running a pastebin site called BitBin for a while: [url]http://bitbin.it[/url][/QUOTE] Any news with your venture?
Sorry, you need to Log In to post a reply to this thread.