Unstoppable Domains

HELP - Fopen VS curl

Spaceship Spaceship
Watch
Impact
0
Please I need help to rewrite my code to use curl instead.My host disbled URL file access in the server cofiguration.
Reason:disabled fopen because of hackers.

Here is the code:

PHP:
<?

include ("output_fns.php");

function db_connect()
{
   mysql_pconnect("localhost","databasename","password");
   mysql_select_db("database");
}

function db_result_to_array($query)
{
   $result=mysql_query($query);
   $res_array = array();
   for ($count=0; $row = @mysql_fetch_array($result); $count++)
     $res_array[$count] = $row;
   return $res_array;
}

function parse_template($template)
{
global $menutype;
if ($menutype=="account")
 $menu="<p><font color=\"#FF0000\"><b>Account Management</b></font></p>
<a href=index.php >Summary</a><br>
<a href=editinfo.php >Edit info</a><br>
<a href=subscriptionlist.php> Your Subscriptions</a><br>
<a href=deposit.php >Deposit money</a><br>
<a href=transfer.php >Transfer money</a><br>
<a href=withdraw.php >Withdraw money</a><br>
<a href=request.php >Request money</a><br>
<a href=sell_manual.php >Sell Goods</a><br>
<a href=referrals.php>Referral Status</a><br>
<a href=logout.php >Logout</a><br>";
else if ($menutype=="sell")
 $menu="<p><font size=\"2\" color=\"#FF0000\"><b>Sell your goods and services</b></font></p>
<a href=sell.php?sub=donate >Donations</a><br>
<a href=sell.php?sub=single>Single items</a><br>
<a href=sell.php?sub=subscr >Subscriptions</a><br>";
for ($i=0; $i<count($template); $i++) 
 {
  $template[$i]=str_replace("<#menu#>", "$menu", $template[$i]);
 }
return $template;
}

function usheader()
{
$header=db_result_to_array("select usheader from admin");
if (@$header[0][0]) 
 {
  $header=file($header[0][0]);
  $header=parse_template($header);
  for ($i=0; $i<count($header); $i++) 
   echo $header[$i];
 }
 //echo "<pre>";
 //print_r ( $_SESSION );
 //echo "</pre>";
}

function usfooter()
{
$footer=db_result_to_array("select usfooter from admin");
if (@$footer[0][0]) 
 {
  $footer=readfile($footer[0][0]);
  for ($i=0; $i<count($footer); $i++) 
   echo $footer[$i];
 }
}

function mainheader()
{
$header=db_result_to_array("select mainheader from admin");
if (@$header[0][0]) 
 {
  $header=file($header[0][0]);
  for ($i=0; $i<count($header); $i++) 
   echo $header[$i];
 }
 //echo "<pre>";
 //print_r ( $_SESSION );
 //echo "</pre>";
}

function mainfooter()
{
//checking if login via username or e-mail
$usrnamelogin=db_result_to_array("select usrnamelogin from admin");
$usrnamelogin=$usrnamelogin[0][0];
if ($usrnamelogin==1)
 $usernametext="User name";
else
 $usernametext="E-mail";
$footer=db_result_to_array("select mainfooter from admin");
if (@$footer[0][0]) 
 {
  $footer=file($footer[0][0]);
  for ($i=0; $i<count($footer); $i++) 
  {
   $footer[$i]=str_replace("<#usernametext#>", $usernametext, $footer[$i]);
   echo $footer[$i];
  }
 }
}

function withdraw_calc()
{
global $table;
$total=0;
$user=db_result_to_array("select login from $table where user_id='".$_SESSION['usid']."'");
$withdraws=db_result_to_array("select amt from transactions where fromwho='".$user[0][0]."' and fromwhotype='".$_SESSION['type']."' and descr = 'Withdraw - pending'");
for ($i=0; $i<count($withdraws); $i++)
 $total+=$withdraws[$i][0];
return $total;
}

?>
 
Last edited by a moderator:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
Oh gosh!

Please use [php ][/ php] tags and remove excess line breaks! I'm not going to even look at code unless its a tiny bit neater!

:tu:

Dan

p.s. I could find no fopen in there anyway using Ctrl + F.
 
Last edited:
0
•••
Moved to Programming

You'll get the help you need here, Goodluck :tu:
 
0
•••
Edited original post to correct formatting ;) As far as fopen - I, like Daniel, can not see where it's being used?
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back