Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iPXE PHP and MySQL user input data
2013-10-22, 11:11 (This post was last modified: 2013-10-23 10:21 by robinsmidsrod.)
Post: #1
iPXE PHP and MySQL user input data
I am working with iPXE. My question is how can I make user input in iPXE like in "login"?

My goal is to have user input data to be stored in database, so that when I install remotely, I have the data for reports.

I have created script using "echo" and "read" but these don't work.

Here my sample script:

Code:
header ("Content-type: text/plain");
echo "#!ipxe\n";
echo "echo -n Client Name: ";
echo "read hotelname";
echo "echo -n Contact Person: ";
echo "read contact";
echo "echo -n Phone: ";
echo "read phone";
echo "echo -n Address:";
echo "read address";
echo "echo -n City: ";
echo "read city";
echo "echo -n Country: ";
echo "read country";

$hotel = "\${hotelname}";
$contact = "\${contact}";
$phone = "\${phone}";
$address = "\${address}";
$city = "\${city}";
$country = "\${country}";

Thank you very much.

Regards,
Hermie
Find all posts by this user
Quote this message in a reply
2013-10-23, 10:28
Post: #2
RE: iPXE PHP and MySQL user input data
You need to do it in two parts. First you need to create an iPXE script (either static text or via PHP) that asks the questions (echo/read multiple times). Then you need to send that information to another PHP script that will take the information and insert it into the database.

Your initial script could be as simple as this:

Code:
#!ipxe
echo -n Name:
read name
echo -n Email:
read email
chain http://myserver/store_information.php?name=${name:uristring}&email=${email:uristring}

The script store_information.php will have to fetch the value of the name and email CGI query string variables and then inject that into the database. Check the PHP documentation how you do that (I'm not a PHP programmer myself). Depending on what the result of the store script is, you can emit another dynamic ipxe script that does something else (up to you what).
Visit this user's website Find all posts by this user
Quote this message in a reply
2013-10-23, 12:58
Post: #3
Photo RE: iPXE PHP and MySQL user input data
(2013-10-23 10:28)robinsmidsrod Wrote:  You need to do it in two parts. First you need to create an iPXE script (either static text or via PHP) that asks the questions (echo/read multiple times). Then you need to send that information to another PHP script that will take the information and insert it into the database.

Your initial script could be as simple as this:

Code:
#!ipxe
echo -n Name:
read name
echo -n Email:
read email
chain http://myserver/store_information.php?name=${name:uristring}&email=${email:uristring}

The script store_information.php will have to fetch the value of the name and email CGI query string variables and then inject that into the database. Check the PHP documentation how you do that (I'm not a PHP programmer myself). Depending on what the result of the store script is, you can emit another dynamic ipxe script that does something else (up to you what).


hello robin,
thanks for the reply. I've tested this code but the system bypass the "read" command. I will send to you the screenshot because I cannot upload the image here...
Find all posts by this user
Quote this message in a reply
2013-10-27, 10:27
Post: #4
RE: iPXE PHP and MySQL user input data
Put your image in Dropbox or something similar and provide the link here. That should be more than adequate.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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