523 Forum Posts by "Fallin-Again"
well my users only can vote good or bad so those values are 10 and 1. So other than there only being two choices yes something like the newgrounds system.
I am trying to create a voting system, and for the first fiew votes this works, but when the number of votes starts getting higher, even when you vote good, the number starts going down. Here is what I have.
$voteNum = $paget['num_votes'];
$totalScore = $paget['score'];
//check if they voted up or down
if($voteDir == "plus"){
$totalScore = $totalScore + 10;
}else{
$totalScore = $totalScore + 1;
}
//do our math to create a score for the tutorial
$newRating = bcdiv($totalScore, ++$voteNum, 1);
How would I go about coloring any scripts or code that are displayed in my sites forums? Like dreamweaver does with code.
bottom line is, your better off learning php/mysql yourself, getting your own domain and hosting, and going from there. I had asked the same thing before and got the same answers. PM me if you would like to see where im at right now.
I did find this page but i dont know how to apply the flag. I looked at all the examples. Could you show me a quick example on how to apply it to sorting an array?
Is there a way to sort the contents of an array numericly?
im not having problems with image cropping its getting a UI that im having the trouble with.
actually sorry that was close but im looking for the exact same thing as the newgrounds art portal one.
Can anyone point me to a tutorial on how to make a cropping function exactly like the newgrounds one for the art portal?
first off all the file security measures are taken care of by javascript before the info is sent to this script, the querries are secured by a function held in my database config file, all i need is a way to fix this.
I have this script on my site for uploading files, and I cant seem to get renaming it right. This is the code I have, can someone tell me what im doing wrong?
<?php
if (!empty($_FILES)) {
$random_digit = rand(000000000,999999999);
$tempFile = $random_digit . $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/';
//change the file name now.
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
// Uncomment the following line if you want to make the directory if it doesn't exist
// mkdir(str_replace('//','/',$targetPath), 0755, true);
$ourfile = $_GET['folder'] . '/' . $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
include('../includes/dbconfig.php');
$username = $_GET['uname'];
$use = mysql_query("SELECT * FROM login WHERE username = '$username' LIMIT 1")or die("Tpc: ".mysql_error());
$them = mysql_fetch_array($use);
$uid = $them['uid'];
mysql_query("INSERT INTO photos (url, uid, edit) VALUES ('$ourfile','$uid', 'no')") or die(mysql_error());
}
echo "1";
?>
alright ill see what i can find out. im not too good at debugging which is not good realy.
Can anybody tell me why i dont get a response from my code?
Javascript:
<script language="javascript" type="text/javascript">
var AJemail = 'cc-chris-chase@hotmail.com';
var AJusername = 'ChrisChase';
if (window.XMLHttpRequest) {
var ajax = new XMLHttpRequest();
ajax.onreadystatechange = function() { alertContents(ajax); };
ajax.open("POST","/usercheck.php",true);
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("email=" + AJemail + "&username=" + AJusername);
} else if (window.ActiveXObject) {
var ajax = new ActiveXObject("Microsoft.XMLHTTP");
var sid = Math.round(Math.random()*1000);
ajax.onreadystatechange = function() {alertContents(ajax);};
ajax.open("POST","/usercheck.php?sid="+sid,true);
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("email=" + AJemail + "&username=" + AJusername);
}
function alertContents(ajax) {
if (ajax.readyState == 4) {
if (ajax.status == 200) {
var checkRes = 0;
var response = ajax.responseText;
response = response.split('|');
if (response[0] == '<span class="style3">This username is unavailable!</span>') {
checkRes++;
alert('Username already in use!');
}
if (response[1] == '<span class="style3">This e-mail is unavailable!</span>') {
checkRes++;
alert('E-mail address already in use!');
}
if (checkRes > 0){
return false;
}else{
document.getElementById("registration").submit();
}
}
}
}
</script>
PHP:
<?php
@include('includes/dbconfig.php');
//check to see if the email is already in use
$regemail = $_POST['email'];
$regq = mysql_query("SELECT * FROM login WHERE email = '$regemail'") or die(mysql_error());
//if its in use let them know
if(mysql_num_rows($regq) > 0){
echo ('<span class="style3">This e-mail is unavailable!</span>|');
}
//now check to see if the username is in use
$username = $_POST['username'];
$q = mysql_query("SELECT * FROM login WHERE username = '$username'") or die(mysql_error());
if(mysql_num_rows($q) > 0){
echo ('<span class="style3">This username is unavailable!</span>|');
}
?>
well everytime the while loop comes back around i need it to check if the next row its gonna display has that variable in the column.
Ok I have a query that checks for an array in the database. And then I have a while loops which displays the info from the databse. I would like the while loop to only display the rows of the database which dont have a value in the array stored in the row.
I have tried for a day or two now and havent come up with a solution could someone assist me with the proper type of loops or a better way of doing so.
i dont mean as in a flash im making i mean to make a flash that im viewing or playing.
I know people usually ask how to stop it from lagging but i was wondering how you can make it lag.
any idea why it wont work for me? i have my controller plugged in, flash joystick installed, running, and the maps downloaded, and i cant get it to work. Any ideas?
no im saying, i md5 encrypt the passwords, but for some reason they are able to log in with different cases. If their name was Billybob505 they could put BILllybob505 and still get in.
How would I call a javascript function thats on the page from the flash? I have no clue what actionscript is used to do that.
i dont i md5 encrypt them. i only want to have the username case sensitive
On my site I have a bunch of users who login using they're username, but they never use the right cases, and it screws things up sometimes. Is there a way to make sure that the php querries search the database but do it so that they results are case sensitive?
they all have a numerical id, but if they type they're username in with different cases how the script supposed to know which id it is using?
I have a script that searches a database and sometimes people can log in with different cases in thier name. I need to know how to modify it so that it searches the database cases sensitively. Here is what I have:
$username = trim(mysql_real_escape_string($_POST['username']));
$password = md5(trim(mysql_real_escape_string($_POST['password'])));
$query = mysql_query("SELECT * FROM users WHERE username = '$username' LIMIT 1") or die(mysql_error());

