Please fix the code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
saddam123
Forum Newbie
Posts: 3
Joined: Sat Apr 14, 2012 3:26 pm

Please fix the code

Post by saddam123 »

this is the upload to site uploading.com
but stop work Because site uploading.com Change the code
Please fix the code

Code: Select all

$post['email'] = $uploading_com_login;
		$post['password'] = $uploading_com_pass;
		$post["remember"]="on";
		$page = geturl("uploading.com", 80, "/general/login_form/", 0, 0, $post, 0 );
		$cookie=GetCookies($page);
		$page = geturl("uploading.com", 80, "/", "http://uploading.com/login_form/", $cookie);
		preg_match("/upload_url: '(.*)'/", $page, $upurl);
		$upurl = trim($upurl[1]);
		preg_match("/SID: '(.*)'/", $page, $SID);
		$SID = trim($SID[1]);
		$url=parse_url($upurl);
		$post = array();
		$post["Filename"] = $lname;
		$post["SID"] = $SID;
		$post["label_id"] = '0';
		$upfiles = upfile($url["host"],$url["port"] ? $url["port"] : 80, $url["path"].($url["query"] ? "?".$url["query"] : ""), "http://www.uploading.com/",$cookie, $post, $lfile, $lname, "file");
		$path_done =cut_str($upfiles,'answer":"','"');
		$done_url = "http://uploading.com/files/nmanager/D/0/";
		$Url=parse_url($done_url);
		$page = geturl($Url["host"], $url["port"] ? $url["port"] : 80, $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), "http://uploading.com/files/upload/", $cookie, 0, 0, $_GET["proxy"], $pauth);
		preg_match('/http:\/\/uploading\.com\/files\/\w{7,9}\/'.$lname.'/i', $page, $preg) or html_error("Upload error");
		preg_match('/http:\/\/uploading\.com\/files\/edit\/[^\'"]+/i', $page, $pregd);
		$download_link = $preg[0];
		$delete_link = $pregd[0];
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Please fix the code

Post by twinedev »

Well first, it would be easier if we had the complete code which shows some of the custom functions you are using.

Second, it would probably just be easier to send it via FTP that they allow, if I was doing it, that is the route I would take.

Who originally wrote the code for you, maybe they can help you since they would know the missing information.

-Greg
saddam123
Forum Newbie
Posts: 3
Joined: Sat Apr 14, 2012 3:26 pm

Re: Please fix the code

Post by saddam123 »

look this is the code upload mirror for qooy script

and this all code this code work old time but 1 week ago stop work Please fix it

Code: Select all

<?php
	
	####### Account Info. ###########
	$uploading_com_login = ""; //Set you username : 
	$uploading_com_pass = ""; //Set your password
	##############################


	
		
	
	
	
	$hostid=94;

	$timeout=15; //Curl Connection Timeout, 0 for no timeout.

    $file_id = $argv[1];
    require 'includes/db.inc.php';
    require 'includes/configs.inc.php';
    
    if ($argv[2])
    	$status=$argv[2];
    else 
    	$status=0;   


		
		$data = mysql_query("SELECT name FROM file WHERE uid = '$file_id'") or die(mysql_error());		
		$info = mysql_fetch_array( $data ); 
		if ($status==0)
			mysql_query("INSERT INTO mirror (uid, hostid) VALUES ('$file_id', '$hostid')") or die(mysql_error());

		mysql_close();
		$done=1;
		$flag=0;

		$file_loc = 'uploads/'.$info['name'];
	
if(!defined('CRLF')) define('CRLF',"\r\n");

$FileNameVariable = $info['name'];

$FileNameVariable = htmlentities($options['download_dir'].basename($FileNameVariable));

if (!file_exists($FileNameVariable))
	{
		html_error(sprintf(lang(64),$filename));
	}
				
if (is_readable($FileNameVariable))
	{
		$lfile=$FileNameVariable;
		$lname=basename($lfile);

	}
		else
	{
		html_error(sprintf(lang(65),$filename));
	}

$fsize = getSize($lfile);

$not_done=true;
$continue_up=false;


    $continue_up=true;

if ($continue_up)
	{

		$post=array();
		$post['email'] = $uploading_com_login;
		$post['password'] = $uploading_com_pass;
		$post["remember"]="on";
		$page = geturl("uploading.com", 80, "/general/login_form/", 0, 0, $post, 0 );
		$cookie=GetCookies($page);
		$page = geturl("uploading.com", 80, "/", "http://uploading.com/login_form/", $cookie);
		preg_match("/upload_url: '(.*)'/", $page, $upurl);
		$upurl = trim($upurl[1]);
		preg_match("/SID: '(.*)'/", $page, $SID);
		$SID = trim($SID[1]);
		$url=parse_url($upurl);
		$post = array();
		$post["Filename"] = $lname;
		$post["SID"] = $SID;
		$post["label_id"] = '0';
		$upfiles = upfile($url["host"],$url["port"] ? $url["port"] : 80, $url["path"].($url["query"] ? "?".$url["query"] : ""), "http://www.uploading.com/",$cookie, $post, $lfile, $lname, "file");
		$path_done =cut_str($upfiles,'answer":"','"');
		$done_url = "http://uploading.com/files/nmanager/D/0/";
		$Url=parse_url($done_url);
		$page = geturl($Url["host"], $url["port"] ? $url["port"] : 80, $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), "http://uploading.com/files/upload/", $cookie, 0, 0, $_GET["proxy"], $pauth);
		preg_match('/http:\/\/uploading\.com\/files\/\w{7,9}\/'.$lname.'/i', $page, $preg) or html_error("Upload error");
		preg_match('/http:\/\/uploading\.com\/files\/edit\/[^\'"]+/i', $page, $pregd);
		$download_link = $preg[0];
		$delete_link = $pregd[0];

			
			require 'includes/db.inc.php';

			$status=3;
			mysql_query("UPDATE mirror SET url='$download_link', status='$status' WHERE uid = '$file_id' AND hostid = '$hostid'") or die(mysql_error());
			mysql_close();

	}
?>
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Please fix the code

Post by twinedev »

twinedev wrote:Well first, it would be easier if we had the complete code which shows some of the custom functions you are using.
See the above statement which STILL applies. you didn't provide the code behind the functions that actually upload the file. Kinda like taking a car to the mechanic, keeping it locked, not giving them the keys and telling them to fix it.

I'm giving the benefit of the doubt the the wording of your posts is due to trying to translate to English, and not an image of your attitude.

Have you checked with wherever you got the original code to see if they provide an update?

-Greg
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Please fix the code

Post by requinix »

And by the way, stop telling us to fix it. It's not our code. We don't care if it works or not.
Besides telling you to find the original developer, as twinedev has done twice now, we can help you fix the code yourself. But that'll only happen once you've shown us all the code. Which twinedev has also told you to do twice.
saddam123
Forum Newbie
Posts: 3
Joined: Sat Apr 14, 2012 3:26 pm

Re: Please fix the code

Post by saddam123 »

The original code
/upload/uploading.com.php

Code: Select all

<?
####### Account Info. ###########
$uploading_com_login = "xxxxxx"; //Set you username : email
$uploading_com_pass = "xxxxxx"; //Set your password
##############################

$not_done=true;
$continue_up=false;
if ($uploading_com_login & $uploading_com_pass){
	$_REQUEST['my_login'] = $uploading_com_login;
	$_REQUEST['my_pass'] = $uploading_com_pass;
	$_REQUEST['action'] = "FORM";
	echo "<b><center>Use Default login/pass.</center></b>\n";
}
if ($_REQUEST['action'] == "FORM")
    $continue_up=true;
else{
?>
<table border=0 style="width:270px;" cellspacing=0 align=center>
<form method=post>
<input type=hidden name=action value='FORM' />
<tr><td nowrap>&nbsp;Email*<td>&nbsp;<input type=text name=my_login value='' style="width:160px;" />&nbsp;</tr>
<tr><td nowrap>&nbsp;Password*<td>&nbsp;<input type=password name=my_pass value='' style="width:160px;" />&nbsp;</tr>
<tr><td colspan=2 align=center><input type=submit value='Upload' /></tr>
<tr><td colspan=2 align=center><small>*You can set it as default in <b><?php echo $page_upload["uploading.com_premium"]; ?></b></small></tr>
</table>
</form>

<?php
	}

if ($continue_up)
	{
	
	$not_done=false;
?>
<table width=600 align=center>
</td></tr>
<tr><td align=center>
<div id=login width=100% align=center>Login to Uploading.com</div>
<?php
                        $post=array();
	                $post['email'] = $_REQUEST['my_login'];
                        $post['password'] = $_REQUEST['my_pass'];
                        $post["remember"]="on";
                        $page = geturl("uploading.com", 80, "/general/login_form/", 0, 0, $post, 0 );
                        $cookie=GetCookies($page);
                        $page = geturl("uploading.com", 80, "/", "http://uploading.com/login_form/", $cookie);
                        is_page($page);
                        is_notpresent($page, "top_user_panel", "Login failed<br />Wrong login/password?");
?>
<script>document.getElementById('login').style.display='none';</script>
<div id=info width=100% align=center>Retrive upload ID</div>
<?php
	
	
	preg_match("/upload_url: '(.*)'/", $page, $upurl);
                        $upurl = trim($upurl[1]);
                        preg_match("/SID: '(.*)'/", $page, $SID);
                        $SID = trim($SID[1]);
                        $url=parse_url($upurl);
?>
<?php

                        $post = array();
	
	
	$post["Filename"] = $lname;
	
	
	$post["SID"] = $SID;
	
	
	$post["label_id"] = '0';
	
	
	$upfiles = upfile($url["host"],$url["port"] ? $url["port"] : 80, $url["path"].($url["query"] ? "?".$url["query"] : ""), "http://www.uploading.com/",$cookie, $post, $lfile, $lname, "file");

?>
<script>document.getElementById('progressblock').style.display='none';</script>
<?php
	
	
	is_page($upfiles);
                        $path_done =cut_str($upfiles,'answer":"','"');
                        $done_url = "http://uploading.com/files/nmanager/D/0/";
                        $Url=parse_url($done_url);
                        $page = geturl($Url["host"], $url["port"] ? $url["port"] : 80, $Url["path"].($Url["query"] ? "?".$Url["query"] : ""), "http://uploading.com/files/upload/", $cookie, 0, 0, $_GET["proxy"], $pauth);
	
	
	is_page($page);
	
	
	preg_match('/http:\/\/uploading\.com\/files\/\w{7,9}\/[^\'"]+/i', $page, $preg) or html_error("Upload error");
                        preg_match('/http:\/\/uploading\.com\/files\/edit\/[^\'"]+/i', $page, $pregd);
                        $download_link = $preg[0];
                        $delete_link = $pregd[0];
                        echo "<h3><font color='green'>File successfully uploaded to your account</font></h3>";
	}
/*************************\

\*************************/
?>
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Re: Please fix the code

Post by litebearer »

Did you go here.. http://uploading.com/contactus/ and ask what they changed and why you are having problems???
Post Reply