Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[php/javascript] java var to php then to mysql?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HackHeaven
How do I cheat?
Reputation: 0

Joined: 13 Aug 2008
Posts: 2

PostPosted: Thu Sep 18, 2008 10:55 pm    Post subject: [php/javascript] java var to php then to mysql? Reply with quote

I didn't use search as i don't really know what i am looking for if there is a name for it so...

I was wondering how to get a var (say a number being updated on the same page) then var it to php then insert it into a mysql table as the user leaves the page

I don't really know much about how java works i do know some php/mysql i was thinking something like


Code:

<script language="javascript">
function unload() {
 <?php
 // update when user leaves page
  $javavar = getfunctionnumberiwanttoupdate();
 mysql_query("UPDATE atable SET something='$javavar' WHERE id='".$_SESSION['asession']."'");
 ?>
}
</script>


but i know that doesn't work Razz any help would be nice
Back to top
View user's profile Send private message
LolSalad
Grandmaster Cheater
Reputation: 1

Joined: 26 Aug 2007
Posts: 988
Location: Australia

PostPosted: Fri Sep 19, 2008 12:43 am    Post subject: Reply with quote

Java != JavaScript.

And this can be achieved by dynamically creating a form with JavaScript and posting the JavaScript variable to an external PHP page, via Postdata, and using that external PHP page to modify the MySQL table.

_________________
Back to top
View user's profile Send private message MSN Messenger
Polynomial
Grandmaster Cheater
Reputation: 5

Joined: 17 Feb 2008
Posts: 524
Location: Inside the Intel CET shadow stack

PostPosted: Fri Sep 19, 2008 7:41 am    Post subject: Reply with quote

If you don't need any form of obscurity when sending the information, create a PHP script that accepts $_GET parameters and insert a hidden IFRAME element into the calling page. Then navigate the IFRAME to the URL with the parameters you want using javascript.

I haven't used JS for a while, so forgive any errors...
Code:
<iframe id="jsphpframe"></iframe>
[...]
<script type="text/javascript">
<!--
function SendMessageToPHP(param1, param2) {
    var f = document.getElementById('jsphpframe');
    f.href = "script.php?var1=" + param1 + "&var2=" + param2;
}
-->
</script>


Then in your PHP script use $_GET['var1'] and $_GET['var2'] to read those parameters back out into your script.
Back to top
View user's profile Send private message
HackHeaven
How do I cheat?
Reputation: 0

Joined: 13 Aug 2008
Posts: 2

PostPosted: Fri Sep 19, 2008 2:30 pm    Post subject: Reply with quote

Thanks for trying to help but i really have no idea how to use that to get what i need

If it helps this is just like Travians update code to update the production when a user leaves the page by any means

The script is
<script src="unx.js" type="text/javascript"></script>

The call is
<body onload="start()">

It updates the number just fine (the one i want to insert into mysql with
<td id=l1 title=valueofproperhour>prothistype/warehousecap</td>

so it reads
1234/4000 and updates the 1234 every second with how much title is

ie
if title = 60 it would add 1 every minute to 1234
if title = 3600 it would add 1 every second
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites