Solved

Excel Spreadsheet not opening up without password

Posted on 2012-03-30
2
297 Views
Last Modified: 2012-04-12
I've got a page that my user can open up in Excel by copying and pasting the URL into the dialog box you get when you hit "Cmd-O" in Excel.

It's worked great until recently. Now it prompts my user for a password. There's nothing on the page that asks for that, yet Excel insists that they need to login.

What could cause that and how can I fix it?

BTW: It works fine when I do it on my computer - no problems. On her computer, it takes forever to load and then it requests a password.

Thoughts?

The code belonging to the page is below...

<?php

include("../carter.inc");
$cxn = mysqli_connect($host,$user,$password,$database)
or die ("couldn't connect to server");
$bruce="select org_name from organization where id = '$_GET[org_id]'";
$bruce_query = mysqli_query($cxn, $bruce)
or die("Couldn't execute query.");
$bruce_row=mysqli_fetch_assoc($bruce_query);
extract($bruce_row);
$the_org_name = stripslashes($org_name);
$org_id = $_GET['org_id'];
$today = date("m/d/Y");
?>


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>The Rainmaker Academy | Revenue Action Plan</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script type="text/javascript" src="../swfobject.js"></script>
<link href="../stylesheet.css" rel="stylesheet" type="text/css" />
</head>

<body>


&nbsp;<BR>
<table width="800" cellspacing="3" cellpadding="3" border="1" align="center">
<tr>
<td colspan="2">
      <table cellspacing="0" cellpadding="0" width=100%>
      <tr>
      <td>
      <b>RAP Sheet for <?php echo $the_org_name; ?></b><BR>
      revenue for this marketing period up through <?php echo date("m/d/Y", strtotime($today)); ?>
      </td>
      </tr>
      </table>
</td>
</tr>
<tr>
<td colspan="2">
      <table border="0" width=100%>
      <tr>
      <td rowspan="2">
      Student Name
      </td>
      <td rowspan="2">
      Class Name
      </td>
      <td colspan="2" align="center">
      Actual Revenue
      </td>
      <td rowspan="2" background="images/spacer.gif" width="100" height="10">
      % of Goal
      </td>
      <td rowspan="2">
      Total Income
      </td>
      </tr>
      <tr>
      <td align="center" width="150">
      New
      </td>
      <td align="center" width="150">
      Existing
      </td>
      </tr>
      <?php
      $grand_new = 0;
      $grand_existing = 0;
      $grand_total=0;
      $michelle = "select * from students where organization = '$the_org_name' order by last_name";
      $michelle_query=mysqli_query($cxn, $michelle)
      or die("Couldn't execute query.");
      while($michelle_row=mysqli_fetch_assoc($michelle_query))
      {
      extract($michelle_row);
      $your_student_id = $id;
      ?>
      <tr>
      <td>
      <A HREF="student_activity_validate.php?id=<?php echo $your_student_id; ?>" target="_blank"><?php echo stripslashes($first_name).' '.stripslashes($last_name); ?></a>
      </td>
      <td>
      <?php
      if($class=="" OR $class==" " OR empty($class)){
      echo "&nbsp;<BR>";
      }
      else
      {
      echo stripslashes($class);
      }
      ?>
      </td>
      <td>$<?php
      $flinch="select SUM(actual_revenue) from revenue where student_id = '$your_student_id' and client_type<> 'Top 7 Client' AND client_type<>'Marketing'";
      $flinch_query=mysqli_query($cxn, $flinch)
      or die("Couldn't execute query.");
      $flinch_row = mysqli_fetch_assoc($flinch_query);
      $new_total = $flinch_row['SUM(actual_revenue)'];
      echo number_format(($new_total),0);
      $total_new_revenue = $new_total;
      $grand_new+=$total_new_revenue;
      ?>
      </td>
      <td>$<?php
      $bingo="select SUM(actual_revenue) from revenue where student_id = '$your_student_id' and client_type='Top 7 Client'";
      $bingo_query=mysqli_query($cxn, $bingo)
      or die("Couldn't execute query.");
      $bingo_row = mysqli_fetch_assoc($bingo_query);
      $current_total = $bingo_row['SUM(actual_revenue)'];
      echo number_format(($current_total),0);
      $total_existing_revenue = $current_total;
      $grand_existing +=$total_existing_revenue;
      ?>
      </td>
      <td><?php
      //estimated fees from revenue
      $esther = "select est_fee, probability FROM revenue where student_id = '$your_student_id'";
      $esther_query = mysqli_query($cxn, $esther)
      or die("Couldn't execute query.");
      $alan_goal=0;
      $alan_goal_total=0;
      while($esther_row=mysqli_fetch_assoc($esther_query))
      {
      extract($esther_row);
      $alan_goal = $est_fee*($probability/100);
      $alan_goal_total +=$alan_goal;
      }
      $alan_total = $alan_goal_total;
      $total_est_fee = $alan_total;
      $total_revenue = $total_existing_revenue + $total_new_revenue;
      $grand_total +=$total_revenue;
      //I've got to build in a way to accommdate those situations where there is no revenue, otherwise you get an error that says "division by zero"
            if(!$total_revenue==0)
            {
            $output = ($total_revenue / $total_est_fee)*100 ;
            echo number_format($output,2);
            }
            else
            {
            echo "0.00";
            }
      ?>%
      </td>
      <td>$<?php
      echo number_format($total_revenue,0);
      ?>
      </td>
      </tr>
      <?php
      }
      ?>
            <tr>
      <td colspan="6"><HR>
      </td>
      </tr>
      <tr>
      <td>
      Total New Revenue:
      </td>
      <td colspan="4">$
      <?php echo number_format($grand_new,0); ?>
      </td>
      </tr>
      <tr>
      <td>
      Total Existing Revenue:
      </td>
      <td colspan="4">$
      <?php echo number_format($grand_existing,0); ?>
      </td>
      </tr>
      <tr>
      <td>
      Grand Total:
      </td>
      <td colspan="4">$
      <?php echo number_format($grand_total,0); ?>
      </td>
      </tr>
      </table>
</td>
</tr>

</body>
</html>
0
Comment
Question by:brucegust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
armchair_scouse earned 500 total points
ID: 37788204
Does your user have the same rights as you to access the database/datbase server that you are connecting to in the line:

$cxn = mysqli_connect($host,$user,$password,$database)

Perhaps the rights have changed?  Could you create a simpler script that just tries to connect to the server and then returns the name of the server to the user, to prove that he/she can connect OK?

Just a thought.
0
 

Author Comment

by:brucegust
ID: 37788242
Rights haven't changed so that's not a problem.

What else could I do to connect to the server that constitutes a simpler approach?
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question