Help: PHP login form to use DHTMLX Touch

I have a simple PHP login script which on authentication success loads another php file. Viewing this on the iPhone Safari browser looks rubbish, so I want to use the Touch framework to make it look nice.

I’ve loaded the touchui.css and touch.js fiels in the and in the body added the required code to show the username and password fields and a submit button, but the button does nothing. Goto this link on the iPhone

Not sure if I’m even doing this right, so can someone please please help me?



$link = mysql_connect('my-host', 'my-username', 'my-password');
if (!$link) {die('Could not connect: ' . mysql_error());}
$db_selected = mysql_select_db('my-database', $link);
if (!$db_selected) {die ('Can\'t use dhtmlx : ' . mysql_error());}

$userid = mysql_real_escape_string($_POST["userid"]);
$pwd = mysql_real_escape_string($_POST["pwd"]);

//Validate username and password
if ($userid != "" && $pwd != "") {
    $res = @mysql_query("SELECT * FROM users WHERE userid='".$userid."' AND pwd=PASSWORD('".$pwd."')"); 
        header("Location: index.php");
    } elseif (mysql_num_rows($res) == 0) { 
        header("Location: index.php");
    } else {
        $_SESSION["authenticated"] = array("userid"=>$userid, "pwd"=>$pwd);
        header("Location: home.php");


DHTMLX Test [/code]


if (!isset($_SESSION[“authenticated”])) {header(“Location: index.php”);}


You are now logged in <?php echo $_SESSION["authenticated"]["userid"]; ?>.


Many thanks for any help.

Check the attached sample (170 KB)

That workd great :stuck_out_tongue:
Many thanks Stanislav.

Can I just ask why the PHP code at the top of the index.php file was removed? Was it just not needed or was it because I cannot have PHP code in the same file as touch code?

You must be able to use php code at the top of file. In sample it was removed just to simplify logic.

Oh I see.

I have it working now, so thanks you :slight_smile: