Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PHP logic not working
2014-06-20, 11:25
Post: #2
RE: PHP logic not working
(2014-06-20 09:02)jhonny Wrote:  Hi Guys,

I'm trying to get iPXE working with PHP and MYQSL.

For some reason the PHP logic does not seem to be working.

I've got the following code in a php file that ipxe chain boots:
What its supposed to do is grab the serial number of the server and assign it to the variable: serversn
Code:
<?php
header("Content-type: text/plain");
echo "#!ipxe\n\n";

$serversn = "\${serial}";

I think the problem is the calling factor. ${serial} is a place holder for the iPXE calls, so can the reason why the output is 9 characters is because the actual information stored in serversn is:
${serial}, literally. Which, as it happens, is 9 characters.

The way I pass variables like such back to my php scripts is to send it back in the url.

So I might have something like:
PHP Code:
print "#!ipxe\n";
print 
"chain http://192.168.1.2/boot.php?serversn=\${serial}\n"

Then I use the GET or POST var of servsn, this should now be set to the serial, not literally set to ${serial}.

So my Logic would contain, to check it, something like:
PHP Code:
if ($_GET['serversn'])
{
print 
"#!ipxe\n";
print 
"echo My system's serial number is: ....".$_GET['serversn']."\n";

Hope this helps.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
PHP logic not working - jhonny - 2014-06-20, 09:02
RE: PHP logic not working - mastacontrola - 2014-06-20 11:25
RE: PHP logic not working - jhonny - 2014-06-20, 12:01



User(s) browsing this thread: 1 Guest(s)