prashanthkumarp Posted April 15, 2007 Share Posted April 15, 2007 login.sh #!/bin/bash start() { echo 'Content-type:text/html ' } end() { echo '</html> </body>' } body() { echo ' <form action="http://localhost/php/login1.php" method="POST"> <center> <h1> WIND RIVER AUTOMATED TEST FRAMEWORK</h1> <hr> <br> <br> <p align="center"> </p> <p align="center">USERNAME: <input type="text" name="login" maxlength="20"></p> <p align="center"> PASSWORD:<input type="password" name="pass"></p> <p align="center"><input type="submit" value="LOGIN"></p> </form> ' } get() { start body end } get login1.php <?php session_start(); $username=$_POST['login']; $password=$_POST['pass']; $found=0; $mysql = mysql_connect("localhost","root","iamgod") or die("Could not connect"); mysql_select_db("users") or die("Select Failed".mysql_errno().":".mysql_error()); $query="select name,email from info where name LIKE '%$username%' and email LIKE '%$password%'"; $result=mysql_query($query)or die ("Query failed".mysql_errno().":".mysql_error()); if(mysql_num_rows($result)==1) { $found=1; echo "<center> <h1> WELCOME TO WIND RIVER TEST PAGE</h1></center>"; echo "<hr>"; echo "WELCOME <b>$username</b>"; echo "<br>"; echo "your id - "; echo "<b>"; echo session_id(); $_SESSION['login']="$username"; echo "<hr>"; echo " <form method='post' action='test1.php'> <p>SELECT RELEASE:<select size='1' name='release'> <option>--------</option> <option>SPRING 06</option> <option>FALL 06</option> <option>SPRING 07</option> </select></p> <br> <p>SELECT TEST :<select size='1' name='test'> <option>--------</option> <option>SANITY TEST</option> <option>BSP TEST</option> <option>REGRESSION TEST</option> </select></p> <br> <p><input type='submit' value='SUBMIT'></p> <a href=logout1.php> LOGOUT </a> </form> "; } else { echo "<br>"; echo "<b> NO USER FOUND, CONTACT ADMIN </b>"; } ?> <br> <hr> logout.php <?php include('header.php'); session_start(); if(isset($_SESSION['loginname'])){ $_SESSION['loginname']=""; unset($_SESSION['loginname']); session_destroy(); ?> Logged out sucessfulky <br> <?php } include('login_form.php'); include('footer.php'); ?> next.php <? session_start(); $name=$_SESSION['login']; echo "WELCOME <b>$name </b>"; echo "<br>"; echo session_id(); echo "<hr>"; echo "<br>"; echo "<a href=logout1.php> LOGOUT</a>"; ?> test1.php <?php $testname=$_POST['release']; $testname1=$_POST['test']; session_start(); $name=$_SESSION['login']; echo "WELCOME <b>$name </b>"; echo "<br>"; echo session_id(); echo "<hr>"; echo "selected value is $testname"; echo "<br>"; echo "selected 2 value is $testname1"; echo "<br>"; echo "<a href=next.php> NEXT</a>"; echo "<br>"; echo "<a href=logout1.php> LOGOUT</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/47128-session-project/ Share on other sites More sharing options...
prashanthkumarp Posted April 15, 2007 Author Share Posted April 15, 2007 [u][b]login.sh[/b][/u] #!/bin/bash start() { echo 'Content-type:text/html ' } end() { echo '</html> </body>' } body() { echo ' <form action="http://localhost/php/login1.php" method="POST"> <center> <h1> WIND RIVER AUTOMATED TEST FRAMEWORK</h1> <hr> <br> <br> <p align="center"> </p> <p align="center">USERNAME: <input type="text" name="login" maxlength="20"></p> <p align="center"> PASSWORD:<input type="password" name="pass"></p> <p align="center"><input type="submit" value="LOGIN"></p> </form> ' } get() { start body end } get [u][b]login1.php[/b][/u] <?php session_start(); $username=$_POST['login']; $password=$_POST['pass']; $found=0; $mysql = mysql_connect("localhost","root","iamgod") or die("Could not connect"); mysql_select_db("users") or die("Select Failed".mysql_errno().":".mysql_error()); $query="select name,email from info where name LIKE '%$username%' and email LIKE '%$password%'"; $result=mysql_query($query)or die ("Query failed".mysql_errno().":".mysql_error()); if(mysql_num_rows($result)==1) { $found=1; echo "<center> <h1> WELCOME TO WIND RIVER TEST PAGE</h1></center>"; echo "<hr>"; echo "WELCOME <b>$username</b>"; echo "<br>"; echo "your id - "; echo "<b>"; echo session_id(); $_SESSION['login']="$username"; echo "<hr>"; echo " <form method='post' action='test1.php'> <p>SELECT RELEASE:<select size='1' name='release'> <option>--------</option> <option>SPRING 06</option> <option>FALL 06</option> <option>SPRING 07</option> </select></p> <br> <p>SELECT TEST :<select size='1' name='test'> <option>--------</option> <option>SANITY TEST</option> <option>BSP TEST</option> <option>REGRESSION TEST</option> </select></p> <br> <p><input type='submit' value='SUBMIT'></p> <a href=logout1.php> LOGOUT </a> </form> "; } else { echo "<br>"; echo "<b> NO USER FOUND, CONTACT ADMIN </b>"; } ?> <br> <hr> [u][b]logout.php[/b][/u] <?php include('header.php'); session_start(); if(isset($_SESSION['loginname'])){ $_SESSION['loginname']=""; unset($_SESSION['loginname']); session_destroy(); ?> Logged out sucessfulky <br> <?php } include('login_form.php'); include('footer.php'); ?> [u][b]next.php[/b][/u] <? session_start(); $name=$_SESSION['login']; echo "WELCOME <b>$name </b>"; echo "<br>"; echo session_id(); echo "<hr>"; echo "<br>"; echo "<a href=logout1.php> LOGOUT</a>"; ?> [u][b]test1.php[/b][/u] <?php $testname=$_POST['release']; $testname1=$_POST['test']; session_start(); $name=$_SESSION['login']; echo "WELCOME <b>$name </b>"; echo "<br>"; echo session_id(); echo "<hr>"; echo "selected value is $testname"; echo "<br>"; echo "selected 2 value is $testname1"; echo "<br>"; echo "<a href=next.php> NEXT</a>"; echo "<br>"; echo "<a href=logout1.php> LOGOUT</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/47128-session-project/#findComment-229797 Share on other sites More sharing options...
prashanthkumarp Posted April 16, 2007 Author Share Posted April 16, 2007 kses.cgi #!/usr/bin/perl use CGI; use DBI; use CGI':standard'; print "Content-Type:text/html\n\n"; print "<html>"; print "<body>"; if($n <= 0) { open(OUT,'>count.txt'); my $n++; print OUT "$n"; close(OUT); open(OUT,'>ses.txt'); print OUT "$random"; close(OUT); } my $query2; my $year=param("release"); print "SElected year : $year "; my $test=param("test"); print "Selected test : $test "; if($year=='s2006') { my $dbh1=DBI->connect('DBI:mysql:t2006','root','') or die "cant prepare:".DBI->errstr(); print "<h1> Data </h1>"; print "<table border='1'>"; if($test eq "any") { $query2=$dbh1->prepare("select * from test06"); } else { $query2=$dbh1->prepare("select * from s2006 where zone LIKE '$test'"); } $query2->execute(); while(($a,$b,$c,$d,$e,$f)=$query2->fetchrow()) { } $query->finish(); $query2->finish(); $dbh->disconnect(); $dbh1->disconnect(); $dbh2->disconnect(); } if($year=='f2006') { my $dbh1=DBI->connect('DBI:mysql:t2006','root','') or die "cant prepare:".DBI->errstr(); print "<h1> Data </h1>"; print "<table border='1'>"; my($a,$b,$c,$d,$e,$f); if($place eq "any") { $query2=$dbh1->prepare("select * from test07"); } else { $query2=$dbh1->prepare("select * from f2006 where zone LIKE '$test'"); } $query2->execute(); while(($a,$b,$c,$d,$e,$f)=$query2->fetchrow()) { print "<tr><td>$a</td><td>$b</td><td>$c</td><td>$d</td><td>$e</td><td>$f</t d></tr><br>"; } $query->finish(); $query2->finish(); $dbh1->disconnect(); $dbh->disconnect(); } if($year=='s2007') { my $dbh1=DBI->connect('DBI:mysql:t2007','root','') or die "cant prepare:".DBI->errstr(); print "<h1> Data </h1>"; print "<table border='1'>"; my($a,$b,$c,$d,$e,$f); $query2=$dbh1->prepare("select * from s2007"); $query2->execute(); while(($a,$b,$c,$d,$e,$f)=$query2->fetchrow()) { print "<tr><td>$a</td><td>$b</td><td>$c</td><td>$d</td><td>$e</td><td>$f</t d></tr><br>"; } $query->finish(); $query2->finish(); $dbh1->disconnect(); $dbh->disconnect(); } my $q=$dbh2->prepare("update sdata set lout=`date` where lout LIKE $var1"); $q->execute(); print "<a href=http://128.224.224.78/cgi-bin/lout.cgi> logout</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/47128-session-project/#findComment-230277 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.