
urgent
Members-
Posts
14 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
urgent's Achievements

Newbie (1/5)
0
Reputation
-
huh? Never heard anything about urgent...Is it nice?
-
Thanks for the reply guys... oooh...I have heard of Ajax but don't really know how to use it.. I am using Xampp for my thing. If I am going to use Ajax, how do I integrate it with Xampp. The thing that I am actually doing is: 1. Insert a new subject into the programme table 2. Before I can do that I have to check the rules in the database... I have one table for the prerequisite of the subject & one table for the programme itself 3. I have to check the prerequisite. If there is a prerequisite for that particular subject, I need to check in the programme table whether the prerequisite have been taken. If yes, the subject will be inserted. If no, there will be an error message... Anyone can give me any clue how to do this? The prerequisite is just a part of the thing. I still need to check something else so it is possible to use a simple processing page? Thanks in advance..
-
Hi. Anyone have any idea how to do use javascript for sql statement? I wanted to use javascript to select the content from the database and check the input of certain fields from the form... I have been told that some of the online applications are using this function..
-
This is what I want the system to do: 1. User login in to the system. 2. System authenticate the user according to the username & password that the user have entered earlier. 3. System fetch the user_id of the user & store it in the session. 4. User insert the name, ic & master_id into the system. The master_id value will follow the id stored in the session variable. coding for login.php <html> <head></head> <body> <table border="0" width="694" height="292" cellspacing="0"> <b><font size="5">LOGIN PAGE</font></b><br><hr></tr> <center> <br><br><td width="1000" height="226" align="center" valign="top"> <table width="300" height="50" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <td colspan="3"><strong><center><font size = "5">ADMIN LOGIN</font></center></strong></td> </tr> <tr> <form method="post" action="CHECKLOGIN.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="4" bgcolor="#FFFFFF"> <tr> <td width="78">USERNAME</td> <td width="6">:</td> <td width="294"><input name="username" type="text" ></td> </tr> <tr> <td>PASSWORD</td> <td>:</td> <td><input name="password" type="password" ></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="Login"></td> </tr> </table> </td> </form> </body> </html> coding for checkLogin.php <?php session_start(); $host="localhost"; // Host name $username="foong"; // Mysql username $password="216638"; // Mysql password $db_name="registration"; // Database name $tbl_name="user_info"; // Table name // Connect to server and select databse. $connection=@mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT id, username, password FROM $tbl_name WHERE username='$_POST[username]' and password='$_POST[password]'"; $result=@mysql_query($sql,$connection); // Mysql_num_row is counting table row $count=mysql_num_rows($result); $row = mysql_fetch_array($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername and redirect to file "login_success.php" $_SESSION['login'] = 1; $_SESSION['id']; header("location:INSERT_RECORD.php?id=$row[id]"); } else { $msg = " Problem login,please try again......."; header("location:message.php?msg=$msg"); } coding for insert_record.php <?php session_start(); if(isset($_SESSION['login'])) echo ""; else { header("location: LOGIN.php"); } $id == $_SESSION['id']; echo "ID = $id"; ?> <html> <head></head> <body> <table border="0" width="694" height="292" cellspacing="0"> <b><font size="5">INSERT PAGE</font></b><br><hr></tr> <center> <br><br><td width="1000" height="226" align="center" valign="top"> <table width="300" height="50" border="0" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <td colspan="3"><strong><center><font size = "5">INSERT PAGE</font></center></strong></td> </tr> <tr> <form method="post" action="doINSERT_DETAILS.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="4" bgcolor="#FFFFFF"> <tr> <td width="78">NAME</td> <td width="6">:</td> <td width="294"><input name="name" type="text" ></td> </tr> <tr> <td>GRADE</td> <td>:</td> <td><input name="grade" type="text" ></td> </tr> <tr> <td> </td> <td> </td> <td><input type="submit" name="Submit" value="SUBMIT"></td> </tr> </table> </td> </form> </body> </html> coding for doinsert_details.php <? session_start(); $id == $_SESSION['id']; echo "ID = $id"; $host="localhost"; // Host name $username="TEST"; // Mysql username $password="TEST"; // Mysql password $db_name="registration"; // Database name $tbl_name="bhgn1"; // table name // Connect to server and select databse. $connection=@mysql_connect("$host", "$username", "$password")or die("cannot connect"); $db=@mysql_select_db("$db_name")or die("cannot select DB"); $master_id = $_SESSION[id]; $sql="INSERT INTO $tbl_name (master_id,name,grade) VALUES ('$_SESSION[id]','$_POST[name]','$_POST[grade]')"; $result=@mysql_query($sql,$connection) or die(mysql_error()); ?> <head></head> <body> <center> <table border="0" width="694" height="292" cellspacing="0"> <form method="post" action="INSERT_MAIN.php"> <tr> <td width="1000" height="226" valign="top"><br> <b><font size="5">NEW RECORD ADDED INTO <? echo "$tbl_name" ?></font></b><br><hr> <br><br><b><? echo "$_SESSION[id]</b> has been inserted into <b>$tbl_name</b>";?><br><br><br> <INPUT TYPE="SUBMIT" NAME="submit" VALUE="INSERT ANOTHER RECORD"> </table> </body> </html> Anyone have any idea what is wrong with the codes? ?>
-
Thanks for the reply. ;)I have tried the coding but the session can only be passed across the second page only. I will post the full coding that I have used later on as I don't have it with me now. Can I insert the session value into the table? Is this possible? This is the coding for page 1: <?php session_start(); $host="localhost"; // Host name $username="foong"; // Mysql username $password="216638"; // Mysql password $db_name="registration"; // Database name $tbl_name="user_info"; // Table name // Connect to server and select databse. $connection=@mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT id, username, password FROM $tbl_name WHERE username='$_POST[username]' and password='$_POST[password]'"; $result=@mysql_query($sql,$connection); // Mysql_num_row is counting table row $count=mysql_num_rows($result); $row = mysql_fetch_array($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername and redirect to file "login_success.php" $_SESSION['login'] = 1; $_SESSION['id']; //Is this correct? header("location:ADMIN.php?id=$row[id]"); } else { $msg = " Problem login,please try again......."; header("location:message.php?msg=$msg"); } ?> This is what I have in my third page: <?php session_start(); $master_id == "$_SESSION[id]"; //Is this correct? The value for the master_id will be the same as the id of the user .......... $sql = "INSERT into $tbl_name (name, grade, master_id) values("$_POST[name]", "$_POST[grade]", "what do I suppose to put here?")"; .......... ?>
-
That code is in my signature. It is (I think) pretty well obfuscated (muddle up) code which, when corrected very slightly will output a simple message. Wow..You have a unique signature. Why do we need to put $$parameter? I didn't see any initialization of $out that is used in the eval($out)... To Sasa, sorry about the reply. I didn't notice the initialization of $out at first. I have tried out the coding. But, if I make a small changes the coding didn;t seems to work. This is what I have changed in order to accept input from user. $y = $_POST['y']; while ($row=mysql_fetch_array($result)) { $id = $row['id']; $parameter = $row['parameter']; $operator = $row['operator']; $value = $row['value']; if (isset($$parameter)){ $out = "\$test = \$$parameter $operator $value;"; eval($out); echo "Test $id "; if ($test) echo "true<br />\n"; else echo "false<br />\n"; } else echo "Variable \$$parameter not exist <br />\n"; } I have also tried out the coding by ShogunWarrior. I learned how to use function(). Thanks. Below is the coding that I have come up with the help of obsidian and ShogunWarrior. Thanks guys. Hope to see you guys around next time. By obsidian: <?php $host="localhost"; // Host name $username="1234"; // Mysql username $password="1234"; // Mysql password $db_name="test"; // Database name $tbl_name="testing2"; // Table name // Connect to server and select databse. $connection=@mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql="SELECT * FROM $tbl_name ORDER BY id"; $result = mysql_query($sql,$connection) or die(mysql_error()); while ($row=mysql_fetch_array($result)) { $parameter = $row['parameter']; $operator = $row['operator']; $value = $row['value']; } $parameter = $_POST['parameter']; eval("if (\$parameter $operator \$value) { echo \"hi\"; } else {echo \"bye\";}") ?> By ShogunWarrior: <?php $host="localhost"; // Host name $username="1234"; // Mysql username $password="1234"; // Mysql password $db_name="test"; // Database name $tbl_name="testing2"; // Table name // Connect to server and select databse. $connection=@mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql="SELECT * FROM $tbl_name ORDER BY id"; $result = mysql_query($sql,$connection) or die(mysql_error()); while ($row=mysql_fetch_array($result)) { $parameter = $row['parameter']; $operator = $row['operator']; $value = $row['value']; } $parameter = $_POST['parameter']; function op_test( $operator, $value, $parameter) { switch( $operator ) { case '>':{ return (($parameter>$value)?(true):(false)); } case '<':{ return (($parameter<$value)?(true):(false)); } case '=':{ return (($parameter==$value)?(true):(false)); } default:{ return false; } } } //And then use it like this: if( op_test($operator,$value,$parameter) ) { echo 'hi'; } else { echo 'bye'; } ?>
-
That code is in my signature. It is (I think) pretty well obfuscated (muddle up) code which, when corrected very slightly will output a simple message. Wow..You have a unique signature. Why do we need to put $$parameter? I didn't see any initialization of $out that is used in the eval($out)...
-
Thanks for your reply. The "variable" you specified in the coding is the name of the variable and the "test" is the value? Do I need to put this <?php session_start(); ?> at the heading of every page?
-
Anyone know how to use session? I wanted to do something like this: 1. User login in to the system. 2. System authenticate the user according to the username & password that the user have entered earlier. 3. System fetch the user_id of the user & store it in the session. 4. User insert the name, ic & master_id into the system. The master_id value will follow the id stored in the session variable. I use the coding below to authenticate the user and starts a session. <?php session_start(); $host="localhost"; // Host name $username="foong"; // Mysql username $password="216638"; // Mysql password $db_name="registration"; // Database name $tbl_name="user_info"; // Table name // Connect to server and select databse. $connection=@mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT id, username, password FROM $tbl_name WHERE username='$_POST[username]' and password='$_POST[password]'"; $result=@mysql_query($sql,$connection); // Mysql_num_row is counting table row $count=mysql_num_rows($result); $row = mysql_fetch_array($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername and redirect to file "login_success.php" $_SESSION['login'] = 1; $_SESSION['id']; header("location:ADMIN.php?id=$row[id]"); } else { $msg = " Problem login,please try again......."; header("location:message.php?msg=$msg"); } ?> As I read through the topic posted, I found out that session_register is no longer being used. How to pass the session from the first page until the final page? My session only applicable until the second page. What is the correct way to pass the session? <?php session_start(); ?> Is there anything that I need to specify to pass the session across pages?
-
$_='ca';${$_{1}}=8;${$_{0}}=chr(ord($_)-1);$_;${${$_{0}}{0}}= ord('l')-100;$c{0}=chr(116>>$b-7);*$_;$a<<=($b%8==0);$_; $c.= chr((2<<2<<($b>>2)<<2>>2)+13).chr(-7+(-$b+2*$a<<1));echo $c ; Huh? I don't really understand? What is this? It looks quite complicated to me.
-
I have try out the coding. It works! Thanks... ;)I change the coding into something like below to receive input from the user. $y = $_POST['y']; // eval interprets the string, so we need to escape the proper characters: eval("if (\$y $operator \$value) { echo \"hi\"; } else { echo \"bye\"; }"); May I know what is the difference between $y = $_POST['y']; $y = '$_POST[y]' ; The first one interprete the value that I have input correctly whereas, the second one does not. Why?
-
Thanks for the reply guys. I wanted to use it as a boolean expression. I will try out your coding, obsidian. It seems to me that the solution that you have provided is the thing that I have been searching for. Wish me luck.
-
This is the table and the structure of the table involved ID parameter operator value 1 y > 2 Field Type Extra id int(4) Auto_increment parameter varchar(50) operator varchar(1) value varchar(2) This is the coding that i tried <?php $host="localhost"; // Host name $username="1234"; // Mysql username $password="1234"; // Mysql password $db_name="test"; // Database name $tbl_name="testing2"; // Table name // Connect to server and select databse. $connection=@mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql="SELECT * FROM $tbl_name ORDER BY id"; $result = mysql_query($sql,$connection) or die(mysql_error()); while ($row=mysql_fetch_array($result)) { $parameter = $row['parameter']; $operator = $row['operator']; $value = $row['value']; } $y = 0; $parameter == $y; eval('?>'.$y.$operator.$value.'<?php '); echo "hi"; ?> I think there is something not right with the eval coding. thank u.
-
I m facing some problem with the recognition of syntax that I have stored in MySQL phpMyAdmin database. I wanted to create a dynamic website that can fetch the rules that stored in one of the table. But, unfortunately the syntax fetched was recognized as a normal string in the php coding. I really have no idea how to make the php understand it as a condition and not a string. I try to used the Eval() function but the result still the same. Plz help me..