Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
-1
Question by Sargon_of_Akkad · May 30, 2013 at 11:30 AM · wwwphpsql

Why is my PHP echo returning entire PHP file after WWW request?

I'm having a problem accessing my SQL database after transferring it to a new server.

Previously, the scripts were working very well, but I had to migrate it to a new server (I have set up PHP on the new server, and the phpinfo(); function appears to be working successfully).

I'm calling the PHP page with the WWW class in the same manner as before, and instead of returning an echo value that I am using to determine if the login details were correct or not, it's returning the entire contents of the PHP script, starting from .

Some Google-fu has turned up this:

http://answers.unity3d.com/questions/221881/wwwtext-is-returning-entire-indexphp-page.html

This was caused by the PHP page having HTML on it. My PHP page does not have any HTML on it (as far as I can tell) and the same problem is still occurring.

Does anyone have any advice at all? I simply do not know where to look now.

Thanks in advance. :)

 <?
 // CONNECTIONS =========================================================
 
 $host = "localhost"; //put your host here
 
 $user = "----"; //in general is root
 
 $password = "----"; //use your password here
 
 $dbname = "----"; //your database
 
 mysql_connect($host, $user, $password) or die("Cant connect into database");
 
 mysql_select_db($dbname)or die("Cant connect into database");
 
 // =============================================================================
 
 $unityHash = anti_injection_login($_POST["myform_hash"]);
 
 $phpHash = "hashcode"; // same code in here as in your Unity game
 
 $useremail = $_POST["myform_nick"];
 
 $userpassword = $_POST["myform_pass"];
 
 if(!$nick || !$pass) 
 {
    echo "Not enough data";
 } 
 else 
 {
     $SQL = "SELECT * FROM database WHERE ouremail = '" . $useremail . "'";
 
     $result_id = @mysql_query($SQL) or die("DATABASE ERROR!");
 
     $total = mysql_num_rows($result_id);
 
     if($total) 
     {
         $datas = @mysql_fetch_array($result_id);
 
         if(!strcmp($userpassword, $datas["userpasswordfield"])) 
         {
             echo "login okay";
         } 
         else 
         {
             echo "Incorrect details";
         }
     } 
     else 
     {
         echo "Incorrect details";
     }
 }
 
 // Close mySQL Connection
 
 mysql_close();
 
 ?>
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Dave-Carlile · May 30, 2013 at 11:58 AM

This isn't really a Unity related question, but...

Your file starts out with

 <?

By default the short form of the opening tag is disabled. The PHP folks also recommend using the long form of the tag.

 <?php

So I would recommend changing to the long form. If you really want to use the short form then enable the PHP.ini setting.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sargon_of_Akkad · May 30, 2013 at 02:58 PM 0
Share

Thank you, I will try and post the result for posterity. :)

(my apologies that it isn't a strictly Unity question)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

seperate binary retrieved from sql server 1 Answer

connecting to php? 2 Answers

Network class vs php for authoritative actions? 1 Answer

Is it possible to create GameObjects dinamically from a server? 1 Answer

Retrieving varibale values from a php script? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges