Jump to content
xisto Community
cragllo

Urgent: Need Script Made...

Recommended Posts

the download page is not working on my sims website...

 

global vars is turned off, does that effect the download page?

 

here it is, download.php

<?$dbhost = 'localhost';$dbuser = ''; // removed for this$dbpass = ''; // removed for this$dbname = 'toxicsims';mysql_connect($dbhost,$dbuser,$dbpass);mysql_select_db($dbname);?><?if(!$id)return;$query = mysql_query("SELECT * FROM objects WHERE id=$id;");$download = mysql_fetch_array($query);if(!file_exists($download[location])){print "File not found.";exit;}mysql_query("UPDATE templates SET clicks=(clicks+1) WHERE id=$id;");header("Location: $download[location]");?>

Would anything need to be added, I had some help off my bros m8 to do the insert page. he added the $_POST bits in for me...

42616[/snapback]


well man, I think the globals have to be turned on because the page sent an url: download.php?id=1, so, if the globals are turned off it doesn't work. I'll try to found an solution for your problem, and I'll send u another msg if I find it.

Share this post


Link to post
Share on other sites

Thank you FaLgoR, I may be moving all my sites onto one server soon, to save time and hastle, and so global vars will be turned on then.... Not sure yet tho, may cost too much...If and when I do, Ill tell you (If you havent already found a solution that is)Craig.

Share this post


Link to post
Share on other sites

You can do it without the global vars turned on, just instead of having $id in the code you use $_GET['id'].If you think it's too bulky just have $id = $_GET['id'];somewhere at the top of your code.

Share this post


Link to post
Share on other sites

let's make insert.php (or something else):

 

<?php

if($go){ // if var $go is set

mysql_query("INSERT INTO table(name,description,image,location) VALUES ('$name','$desc','$image','$location') or die (mysql_error());

echo "Done!";

exit;

} else { // not really required at this case but...

?>

 

<form action="insert.php" method="post">

Name: <input type="text" name="name"><br>

Description: <input type="text" name="desc"><br>

Image: <input type="text" name="image"><br>

Location: <input type="text" name="location"><br>

<input type="submit" name="go" value="Submit">

</form>

<?php

}

?>

 

But don't forget to connect this page with the database. I suggest that you make a new page called conection.php with all the details and connections, and put: include("conection.php"); at the top of the pages which requires an connection.

40226[/snapback]


My changes are in bold, some of them are not really needed, but this way it's better :D

 

EDIT: Heh, sorry, thought there was only 1 page ^.^, didn't see the other replys.

 

PS Have you been trying out with this script, is MySQL down because of this xD?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.