Jump to content
xisto Community

kook

Members
  • Content Count

    6
  • Joined

  • Last visited

Posts posted by kook


  1. make check session for stuff and make table for stuff

     

    make new table by use phpMyAdmin

     

    make check session for stuff

    but you must have start session function in process login page same this

    session_start();           $_SESSION[sess_userid]=session_id();           $_SESSION[sess_username]=$username;           header("Location:where");
    here is code

    <?session_start();$sess_userid=$_SESSION[sess_userid];$sess_username=$_SESSION[sess_username];if ($sess_userid<>session_id() or $sess_username==""){	header("Location:index.php(or where that you need)");	exit();}$host="localhost";$user="username";$pass="password";$dbname="database name";$connect=mysql_connect($host,$user,$pass);if(!$connect){	echo"Can't connect to sql";	exit();}$sql="SELECT * FROM tbname WHERE username(field that is username)='$sess_username' "; $result=mysql_db_query($dbname,$sql);$num=mysql_num_rows($result);mysql_close();if ($num<=0){	header("Location:index.php(or where you need when he or she don't have permission)");	exit();}else{}?>
    :D

    to use

    insert the following code into page that for staff

    <?phpinclude "name of check session page that you saved";?>

  2. sorry plz delete upper post caz i post error(my comp's has problem with javascript)

    You can use

    <?............?>
    or
    <?php...........?>
    or
    <script language="php">............</script>
    use echo "............."; when you need type html
    use //........ or /*........ or #............. to comments
    can use insert in html e.g.
    <html><head><title>....</title></head><body><?echo "..........";?></body></html>
    or inset html in php e.g.
    <?php<html><body>..............</body></html>?>

    $.......... is variable form:
    $variable's name="value";
    <?php$a="123";echo "$a";
    it'll show 123
    symbol
    + -- add e.g. 10+2 = 12- -- minus e.g. 10-2 = 8* -- mutiply e.g. 10*2 = 20/ -- device e.g. 10/2 = 8 < -- less than e.g. $1<10 =variable $1 has value less than 10> -- more than e.g. $1>10 =variable $1 has value more than 10>= -- more than or equal e.g. $1>=10 =variable $1 has value more than 10 or=10<= -- less than or equal e.g. $1>=10 =variable $1 has value less than 10 or =10!= -- don't equal e.g. $1!=10 =variable $1 has value don't equal 10== -- equal e.g. $1==10 =variable $1 's value is 10or -- or! -- notand -- and

    increase value
    <?phpwhile ($1=10;$1<15;$1++){echo "$1  ";}?>
    it'll show 10 11 12 13 14

    if
    Form:
    if (function or variable){.......echo "....";}else{.......echo ".....";}
    e.g.
    if (mysql_db_query($dbname,$sql)){echo "yes";}else{echo "no";}
    result:if it do function(mysql_db_query($dbname,$sql))complete it'll show "yes",if it do function(mysql_db_query($dbname,$sql))don't complete it'll show "no"

    next row: \n e.g.
    <?echo "hh"; \n?>

    mysql
    you can use phpMyAdmin to handle mysql easier
    to connect sql by use code
    form:
    <?php$host="hostname";$user="username";$pass="password";mysql_connect($host,$user,$pass) or die("Can't connect to mysql");?>
    to create db(database)
    <?php$host="hostname";$user="username";$pass="password";mysql_connect($host,$user,$pass) or die("Can't connect to mysql");$dbname="dbname";mysql_create_db($dbname);?>

    this's a past of php i'll post about other later.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.