Be a Supporter!
Response to: Voting Posted February 10th, 2010 in Programming

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.

Voting Posted February 10th, 2010 in Programming

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);
Coloring Code Posted February 9th, 2010 in Programming

How would I go about coloring any scripts or code that are displayed in my sites forums? Like dreamweaver does with code.

Response to: [php] Sorting Arrays Posted July 31st, 2009 in Programming

alright thanks

Response to: Starting game site? Posted July 31st, 2009 in Programming

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.

Response to: [php] Sorting Arrays Posted July 31st, 2009 in Programming

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?

[php] Sorting Arrays Posted July 31st, 2009 in Programming

Is there a way to sort the contents of an array numericly?

Response to: Cropping Posted June 26th, 2009 in Programming

alright thanks!

Response to: Cropping Posted June 23rd, 2009 in Programming

im not having problems with image cropping its getting a UI that im having the trouble with.

Response to: Cropping Posted June 21st, 2009 in Programming

lol whats that even stand for?

Response to: Cropping Posted June 20th, 2009 in Programming

actually sorry that was close but im looking for the exact same thing as the newgrounds art portal one.

Response to: Cropping Posted June 20th, 2009 in Programming

wow spot on, thanks for the link!

Cropping Posted June 20th, 2009 in Programming

Can anyone point me to a tutorial on how to make a cropping function exactly like the newgrounds one for the art portal?

Response to: (php) Renaming A File Posted June 13th, 2009 in Programming

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.

(php) Renaming A File Posted June 13th, 2009 in Programming

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";
?>
Response to: (ajax & Php) No Response Posted June 2nd, 2009 in Programming

alright ill see what i can find out. im not too good at debugging which is not good realy.

(ajax & Php) No Response Posted May 31st, 2009 in Programming

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>|');
}
?>
Response to: Php: Loops Posted May 3rd, 2009 in Programming

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.

Php: Loops Posted May 3rd, 2009 in Programming

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.

Response to: How To Make Flash Lag Posted March 11th, 2009 in Game Development

i dont mean as in a flash im making i mean to make a flash that im viewing or playing.

How To Make Flash Lag Posted March 11th, 2009 in Game Development

I know people usually ask how to stop it from lagging but i was wondering how you can make it lag.

flash joystick Posted December 15th, 2008 in Game Development

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?

Response to: (php) Case Sensitive Posted November 14th, 2008 in Programming

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.

Response to: Calling A Js Function Posted November 14th, 2008 in Game Development

ok thanks

Calling A Js Function Posted November 14th, 2008 in Game Development

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.

Response to: (php) Case Sensitive Posted November 13th, 2008 in Programming

i dont i md5 encrypt them. i only want to have the username case sensitive

Response to: (php) Case Sensitive Posted November 12th, 2008 in Programming

ok thanks a bunch.

(php) Case Sensitive Posted November 12th, 2008 in Programming

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?

Response to: (php) Case Sensitive Logging In Posted August 29th, 2008 in Programming

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?

(php) Case Sensitive Logging In Posted August 29th, 2008 in Programming

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());