September 13th, 2000, 06:45 PM
-
Hello, I have 2 small problems, the most serious of which is a problem with a MySQL query, It doesn't seem to work when executed through the web on my download.php file.... i'll post the code below. If you can help please do. But before i post the code my other problem is getting the variable $keyword to put "+" signs in between multiple words. If you can help with anything here please post:
mysql_connect("localhost", "user", "pass");
@mysql_select_db("mp3findit");
mysql_query("UPDATE mp3 SET dls=dls+1 WHERE id='$id'");
mysql_query("update mp3 set checked='$ctime' where id='$id'");
$query = "select * from mp3 where id=$id";$mysql_result = mysql_query($query);
while($row = mysql_fetch_row($mysql_result))
{
$artist = $row[1];
$song = $row[2];
$url = $row[3];
$size = $row[4];
$dls = $row[5];
$added = $row[6];
$checked = $row[7];
$provsite = $row[8];
$provurl = $row[9];
$provemail = $row[10];
}
$stitle = "Download $artist - $song";
include("path/header.php3");
$position = trim($url);
$file = parse_url("$url");
$isthere = @fopen("$url", r);
if($isthere)
{
print("
<SCRIPT LANGUAGE="JavaScript" SRC="http://www.mp3findit.com/xdrive.js"></SCRIPT>
<h3><font face="Arial">Download Your Mp3</font></h3>
<font face="Arial" size="2">
Provided By: <a href="link.php3?site=$provsite&url=$provurl" target="_blank">$provsite</a><br>
ID: $id<BR>
Path: $file[path]</a><BR>
Name: $artist - $song<BR>
Downloads: $dls<BR>
Added To Database: $added<br>
Last Verifyed: $checked<br>
<a href="$url">Click here To Download Your Mp3</a><br>
<a href="javascript:xd_skip('$url')">Download $song Directly To Your <b>X-Drive</b> Account!</a><br>
<a href="http://tracker.clicktrade.com/tracker/tracker.dll?to='http://www.myplay.com/dd/mp/?rurl=$url&sv=023-04-08'&lp=317580&ad=331278">Download $song Directly To Your <b>MyPlay</b> Locker!</a>
<br><br>
<font size="3" face-"Arial"><b>Quick Help</b></font><br>
<font size="2" face-"Arial">
Can't seem to get the file to download? Try <b>RIGHT</b> clicking on the link, then you should see
a dropdown menu in your browser. Choose "Save Target As" (IE), or "Save Link As" (Netscape).
If this does not work, check out our <a href="faq.php3">Frequently Asked Questions</a> section.");
}
else
{
mysql_pconnect("localhost", "user", "pass");
@mysql_select_db("mp3findit");
mysql_query("DELETE FROM mp3 WHERE id='$id'");
print ("<font face="arial" size="2">This link no longer exists and is being deleted from the database. We are sorry for any inconvenience.");
}
September 14th, 2000, 04:38 AM
-
about ur 2nd problem, try
$myvar = "chiasa aonuma";
// replace every occurence of " " with "+"
$myvar = strtr($myvar, " ", "+");
refer to the php manual for more details about the function strtr()
September 14th, 2000, 06:40 PM
-
That works, but then it makes it search for the keywords with "+" signs in them.....
-Scott
September 14th, 2000, 06:51 PM
-
September 14th, 2000, 06:52 PM
-
Hi the regexp is fine, but take a look @ urlencode($string) and urldecode($string) it'll be faster, works for more than a space and it saves typing =)
Bealers
------------------
http://back-end.org
September 14th, 2000, 06:54 PM
-
mysql_query("UPDATE mp3 SET dls=dls+1 WHERE id='$id'");
mysql_query("update mp3 set checked='$ctime' where id='$id'");
Where's this $ctime coming from? Are you trying to set the checked time to the current unix timestamp? And also, wouldn't it be easier to make the DLS field an auto-incrementing number?
------------------
To alcohol! The cause of, and solution to, all of life's problems. -- Homer Simpson