Jump to content

mdvignesh

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by mdvignesh

  1. how to make the id unique in while
  2. change link text <?php require 'connect.php'; ?> <html> <head><title>Admin</title> <link rel="stylesheet" type="text/css" href="tab_style.css"> <script type="text/javascript"> function getXMLHTTP() { var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function approve(e) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById("appr <?php echo $fet['s_id']; ?>").innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", "approve.php?stu="+e, true); req.send(null); } } function block(b) { var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('blok').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", "block.php?blo="+b, true); req.send(null); } } </script> </head> <body> <?php $admin_err=''; $pass_err=''; if (isset ($_REQUEST['submit'])) { require 'connect.php'; $admin = $_REQUEST['admin']; $pass = $_REQUEST['password']; $err=0; if($admin=="") { $admin_err="enter username"; $err=1; } if($pass=="") { $pass_err="enter password"; $err=1; } if ($err == 0) { $check = mysql_query("SELECT admin FROM admin_login WHERE admin='".$admin."' and password='".$pass."' "); $exi = mysql_num_rows ($check); if($exi == 0) $err_msg = "Username/password combination incorrect."; else { $sel = mysql_query("SELECT * FROM stud"); echo "<h4 class='table-caption'>Students</h4>"; while ($fet = mysql_fetch_array($sel)) { ?> <div class="base-layer"> <div class="table-row"> <div class="c_one"><p class="text"> <? echo $fet['name']; ?></p></div> <div class="c_two"><p class="text"> <? echo $fet['email']; ?></p></div> <div class="c_three"><p class="text"> <? echo $fet['school']; ?></p></div> <div class="c_four"><p class="text"> <? echo $fet['subject']; ?></p></div> <div class="c_five"><p class="text"> <? echo $fet['class']; ?></p></div> <div class="c_six"><p class="text"> <? echo $fet['teacher']; ?></p></div> <div class="c_seven" id="appr <?php echo $fet['s_id']; ?>"><p class="text"> <?php if ($fet['approve'] == 0) ?> <a href="#" onClick="return approve(<?php echo $fet['s_id']; ?>);" style="text-decoration:none"> Approve</a> </p> </div> <div class="c_eight" id="block"><p class="text"> <?php if($fet['approve'] == 1) ?> <a href="#" onClick="block(<?php echo $fet['s_id']; ?>);" style="text-decoration:none"> Block </a> </p> </div> <div class="space-line"> </div> </div> </div> <?php } die(mysql_error()); } } } ?> <form id="formid" method="post" name="myform" action=""> <p> <label for="username">Admin:</label> <input name="admin" type="text" size="20" value="<?php if(isset($admin)) echo $admin; ?>" /> <?php echo $admin_err; ?> </p> <p> <label for="pass">Password:</label> <input name="password" type="password" value="<?php if(isset($pass)) echo $pass;?>" /> <?php echo $pass_err; ?> </p> <p> <input name="submit" type="submit" value="Log in" > </p> <?php if(isset($err_msg)) echo $err_msg; ?> </form> </body> </html> approve.php <?php require_once 'connect.php'; $id = $_REQUEST['stu']; $upd = mysql_query ("UPDATE stud SET approve = '1' WHERE s_id = ".$id." "); if (!$upd) die(mysql_error()); //header("Location:administrator.php"); echo "Approved"; //echo "<h3>Student Approved</h3>"; ?>
  3. <?php function generateThumbs() { $pathToScreens = "D:/wamp/www/vignesh_2/up_images/"; // Directory to your images you want converted to thumbnails. $pathToThumbs = "D:/wamp/www/vignesh_2/up_images/thumb/"; // Directory to your thumbnails. $thumbWidth = 70; // Width of the thumbnails generated. $dir = opendir($pathToScreens) or die("Could not open directory"); $counter = 0; while(($fname = readdir($dir)) !== false) { if($fname != "." && $fname != "..") { // Remove folders. $valid_extensions = array("jpg","jpeg","gif","png"); // Only jpeg images allowed. $info = pathinfo($pathToScreens . $fname); // print_r($info); if( in_array (strtolower ($info["extension"]),$valid_extensions)) { // Make sure the file is an image file by checking its extension to the array of image extensions. $img = imagecreatefromjpeg($pathToScreens . $fname); // Select the file as an image from the directory. $width = imagesx($img); $height = imagesy($img); // Collect its width and height. $newHeight = floor($height * ($thumbWidth / $width)); // Calculate new height for thumbnail. $tempImage = imagecreatetruecolor($thumbWidth,$newHeight); // Create a temporary image of the thumbnail. // Copy and resize old image into new image. imagecopyresized($tempImage,$img, 0, 0, 0, 0, $thumbWidth,$newHeight,$width,$height); $genThumb = imagejpeg($tempImage,$pathToThumbs . $fname); // Create the thumbnail with the new width and height in the thumbnails directory. // I added a rand 3 digit number in front of the file name to avoid overwrite. $counter++; // Increment. } } } if($counter > 0) { return $counter . " thumbnails generated from the directory \"".$pathToScreens."\"."; } else { return "No image files could be processed."; } closedir($dir); // Close the directory. } //echo "<img src='up_images/thumb/650Blue hills.jpg' />"; ?> 17526_.php
  4. Help me I am getting Notice: Undefined index: extension
  5. Help me. What I am doing is editing a form with checkboxes... and updating image .. I uploaded scripts I want to delete old jpeg file from thumb folder and update new filename in db <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript"> function show_confirm() { var r=confirm("Delete?"); if (r==true) { //javascript:window.location='view.php'; alert("Deleted!!"); } else { //javascript:window.location='view.php'; alert("You pressed Cancel!"); return false; } } </script> </head> <body> <?php require("connect.php"); if ($_REQUEST['submit']) { $id=$_POST['hide']; for($i=1; $i<=$id; $i++) { $query2 = mysql_query("SELECT * from stu_detail WHERE id = $id "); while($file = mysql_fetch_array($query2)) { $unlink = unlink("up_images/thumb/" . $file['filename']); } } $new_name=$_POST['name']; $new_email=$_POST['email']; $new_phone=$_POST['phone']; $new_gender=$_POST['rad']; $new_city=$_POST['city']; $new_lang=implode(",",$_POST['chk']); $tar = "c:/wamp/www/rms/vignesh_2/up_images/"; if ($_FILES['efile']['error'] > 0) echo "Error" . $_FILES["efile"]["error"]; else { if (file_exists ("$tar" . $_FILES['efile']['name'])) { echo $_FILES['efile']['name'] . " already exsists"; } else { move_uploaded_file ($_FILES['efile']['tmp_name'],"$tar" . $_FILES['efile']['name']); } } $qry=mysql_query("UPDATE stu_detail SET name='".$new_name."', email='".$new_email."', phone='".$new_phone."', gender='".$new_gender."', city='".$new_city."', lang='".$new_lang."', filename='".$_FILES['efile']['name']."' WHERE id=$id ") or die(mysql_error()); require_once("create_thumb.php"); echo generateThumbs(); if (!$qry) { echo "not updated"; } else { echo "<table align='center' border='1' width='800' height='600'>"; ?><tr> <th scope="col">Name</th> <th scope="col">E-mail Address</th> <th scope="col">Phone</th> <th scope="col">Gender</th> <th scope="col">City</th> <th scope="col">Language</th> </tr> <?php $recyc=mysql_query("SELECT * FROM stu_detail where status = 1") or die(mysql_error()); $del = mysql_num_rows($recyc); if ($del != 0) echo "<a href='recycled.php'>Recycle bin</a>"; if ($qry2=mysql_query("SELECT * FROM stu_detail where status = 0 order by id desc") ) { while($res=mysql_fetch_array($qry2)) { ?> <tr> <td><?php echo $res['name']; ?></td> <td><?php echo $res['email']; ?></td> <td><?php echo $res['phone']; ?></td> <td><?php echo $res['gender']; ?></td> <td><?php echo $res['city']; ?></td> <td><?php echo $res['lang']; ?></td> <td> <img src="up_images/thumb/<?php echo $res['filename']; ?>" /> </td> <td> <a href="edit.php?uid=<?php echo $res['id']; ?>">edit</a></td> <!--<td><button type="button" onClick="return show_confirm();">Delete</button> </td>--> <td> <a href="delete.php?uid=<?php echo $res['id']; ?>" onClick="return show_confirm();">delete</a></td> </tr> <?php } } ?> </table> <?php } } ?> </body> </html> 17500_.php 17501_.php
  6. Not able to validate checkbox If no checkbox is selected I need alert message
  7. Checkbox value has to inserted into database Also I have JavaScript check box validation I don't know what to give name for checkbox register.php <html> <head> <script type="text/javascript"> function regval() { //name validation var name_val=document.registration.uname.value; if(name_val=="") { alert("enter first name"); document.registration.uname.focus(); return false; } else if(name_val!='') { var name_re =/^[-A-Za-z. ]*$/; if(name_re.test(name_val) == false) { alert("enter valid name"); document.registration.uname.focus(); return false; } } //email validation var mail_val=document.registration.email1.value; if(mail_val=="") { alert("enter email address"); document.registration.email1.focus(); return false; } else if(mail_val!="") { var mailcheck = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if(mailcheck.test(mail_val)==false) { alert("enter valid email address"); document.registration.email1.focus(); return false; } } //city validation var city_val=document.registration.ucity.value; if(city_val=="") { alert("enter city name"); document.registration.ucity.focus(); return false; } else if(city_val!='') { var city_re =/^[-A-Za-z. ]*$/; if(city_re.test(city_val) == false) { alert("enter valid city name"); document.registration.ucity.focus(); return false; } } //state validation var state_val=document.registration.ustate.value; if(state_val=="") { alert("enter state name"); document.registration.ustate.focus(); return false; } else if(state_val!='') { var state_re =/^[-A-Za-z. ]*$/; if(state_re.test(state_val) == false) { alert("enter valid state name"); document.registration.ustate.focus(); return false; } } //country validation var country_val=document.registration.ucountry.value; if(country_val=="") { alert("enter country name"); document.registration.ucountry.focus(); return false; } else if(country_val!='') { var country_re =/^[-A-Za-z. ]*$/; if(country_re.test(country_val) == false) { alert("enter valid country name"); document.registration.ucountry.focus(); return false; } } //login name validation var lname_val=document.registration.lname.value; if(lname_val=="") { alert("enter username "); document.registration.lname.focus(); return false; } //password validation var pass_val=document.registration.pass.value; if(pass_val=="") { alert("enter password"); document.registration.pass.focus(); return false; } else if(pass_val!="") { var invalid = " "; var minLength = 6; if (pass_val.length < minLength) { alert("Your password must be at least " + minLength + " characters long"); document.registration.pass.focus(); return false; } if (pass_val.indexOf(invalid) > -1) { alert("Sorry, spaces are not allowed."); document.registration.pass.focus(); return false; } } //checkbox if (document.registration.chk[0].checked == false && document.registration.chk[1].checked == false && document.registration.chk[2].checked == false) { alert ("select checkbox"); return false; } } </script> </head> <body> <?php include("data.php"); if(isset($_POST["reg"])) { $name=$_POST['uname']; $mail=$_POST["email1"]; $city=$_POST['ucity']; $state=$_POST['ustate']; $country=$_POST['ucountry']; $uname=$_POST['lname']; $passwd=$_POST['pass']; $inr=mysql_real_escape_string(implode(",",$_POST["chk"])); if(mysql_query("insert into register(name,email,city,state,country,username,password,interest) values ('$name','$mail','$city','$state','$country','$uname','$passwd','$inr')")) $good="You have successfully registered,you can login now"; else $bad="error:".mysql_error(); } mysql_close($cn); ?> <br /> <strong style="background-color:#00CCFF"> REGISTRATION FORM</strong> <br /><br /> <form action="register.php" method="post" name="registration"> <table border="0" width="600" height="600" align="left"> <tr><td>Name:</td><td><input type="text" name="uname"/></td></tr> <tr><td>Email:</font></td><td><input type="text" name="email1" /></td></tr> <tr><td>City:</font></td><td><input type="text" name="ucity" /></td></tr> <tr><td>State:</td><td><input type="text" name="ustate" /></td></tr> <tr><td>Country:</td><td><input type="text" name="ucountry" /></td></tr> <tr><td>Username:</td><td><input type="text" name="lname" /></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" /></td></tr> <tr><td>Intrest: <input name="chk[]" id="chk[]" type="checkbox" value="reading" />Reading <input name="chk[]" id="chk[]" type="checkbox" value="sports" />Sports <input name="chk[]" id="chk[]" type="checkbox" value="travel" />Travel </td></tr> <tr><td> <input type="submit" name="reg" value="ok" style="cursor:pointer;" onclick="return regval();" /> <?php if(isset($good)) {?> <input type="button" value="Login" onclick="javascript:window.location='loginpage.php'" style="cursor:pointer;" /><br /><br /><?php }?> </td></tr> </table> <?php if(isset($good)) echo $good; if(isset($bad)) echo $bad; ?></strong></font> </form> </div> </body> </html> 17377_.php
  8. I have page with male female radio button Here's the code $qry=mysql_query("SELECT * FROM reg_table where id=$id "); $res=mysql_fetch_array($qry); $radio = $res['gender']; switch($radio) { case "male": $mal = "checked"; break; case "female": $fem = "checked"; break; } Gender: <br /> <input type="radio" name="colour" value="male" checked="<?php $mal; ?>" />Male <input type="radio" name="colour" value="female" checked="<?php $fem; ?>" />Female Whats the use of checked in <input type="radio" name="colour" value="male" checked="<?php $mal; ?>" />
  9. I want to delete record which i clicked the delete button in the table. I want a confirm box for delete Help me solve.. Here is code display.php <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $qry2=mysql_query("SELECT * FROM reg_table"); ?> <html> <head> <script type="text/javascript"> function show_confirm() { var r=confirm("Do you want to Delete?"); if (r==true) { } else { alert("You pressed Cancel!"); } } </script> </head> <body> <form action="delete.php" method="get"> <table width="200" border="1"> <tr> <th scope="col">Name</th> <th scope="col">Address</th> <th scope="col">Gender</th> <th scope="col">Qualify</th> </tr> <?php while($res=mysql_fetch_array($qry2)) {?> <tr> <td><?php echo $res['name']; ?></td> <td><?php echo $res['adrs']; ?></td> <td><?php echo $res['gender']; ?></td> <td><?php echo $res['qualify']; ?></td> <td> <a href="edit.php?uid=<?php echo $res['id']; ?>">edit</a></td> <!--<td> <button type="button" onClick="return show_confirm();">Delete</button> </td> --> <td> <input type="hidden" name="nid" value="<?php echo $res['id']; ?>" /> </td> <td> <input type="submit" value="Delete" name="del" onClick="return show_confirm();"> </td> </tr> <?php } ?> </table> </form> </body> </html> delete.php <html> <body> <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $del_id=$_GET['nid']; $qry=mysql_query("delete from reg_table where id='".$del_id."' ") or die(mysql_error()); if($qry) { echo "deleted"; } else { echo "not deleted"; } ?> <!--<form action="update.php" method="get"> <br /> Name: <input name="name" type="text" maxlength="20" /><br /><br /> <input type="hidden" name="uno" value="// echo $id; "> <input name="submit" type="submit" value="Save" /> </form> --> </body> </html>
  10. Hi!! I want to delete record which i clicked the delete button in the table. I want a confirm box for delete Here is code display.php <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $qry2=mysql_query("SELECT * FROM reg_table"); ?> <html> <head> <script type="text/javascript"> function show_confirm() { var r=confirm("Do you want to Delete?"); if (r==true) { } else { alert("You pressed Cancel!"); } } </script> </head> <body> <form action="delete.php" method="get"> <table width="200" border="1"> <tr> <th scope="col">Name</th> <th scope="col">Address</th> <th scope="col">Gender</th> <th scope="col">Qualify</th> </tr> <?php while($res=mysql_fetch_array($qry2)) { ?> <tr> <td><?php echo $res['name']; ?></td> <td><?php echo $res['adrs']; ?></td> <td><?php echo $res['gender']; ?></td> <td><?php echo $res['qualify']; ?></td> <td> <a href="edit.php?uid=<?php echo $res['id']; ?>">edit</a></td> <td> <input type="hidden" name="nid" value="<?php echo $res['id']; ?>" /> </td> <td> <input type="submit" value="Delete" name="del" onClick="return show_confirm();"> </td> </tr> <?php } ?> </table> </form> </body> </html> delete.php <html> <body> <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("register",$cn); $del_id=$_GET['nid']; $qry=mysql_query("delete from reg_table where id='".$del_id."' "); if($qry) { echo "deleted"; } else { echo "not deleted"; } ?> </body> </html>
  11. whats the diff between echo,print,print_r what's the difference between include(),require,require_once
  12. ya <?php session_start(); ob_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Signin</title> </head> <?php include("data.php"); $user_err=''; $pass_err=''; if(isset($_POST['submit'])) { $user=$_POST['user']; $passwd=$_POST['pass']; $err=0; if($user=="") { $user_err="enter username"; $err=1; } if($passwd=="") { $pass_err="enter password"; $err=1; } if($err==0) { $check=mysql_query("select username from register where username='$user'")or die(mysql_error()); $check2=mysql_num_rows($check); if($check2==0) { $uer="User does not exist,enter correct username"; } else { $check1=mysql_query("select password from register where username='$user' and password='$passwd'")or die(mysql_error()); $check2=mysql_num_rows($check1); if($check2==0) { $per="Password mismatch,enter correct password"; } else { $_SESSION['user']=$user; $_SESSION['password']=$passwd; header("location:msg.php"); } } } mysql_close($cn); } ?> <body> <br /><br /> <form method="post" action="loginpage.php"> <table bgcolor="#6699FF" width="500" height="300" align="center"> <tr><td align="center"> <strong>Sign in with your account</strong><br /><br /><br /> USERNAME:<input type="text" name="user" value="" /> <br /><br /> PASSWORD:<input type="password" name="pass" value=""/> <br/><br/> <input type="submit" value="login" name="submit" /> </td></tr> </table> </form> </body> </html>
  13. when user login to his account, I want to expire session after 5 minutes
  14. where to use and when to use $_request whats the use of $_request
  15. When i select unpaid i want only unpaid students that is the status field is 0 and when i select paid the status is 1 without giving any inputs in text box I will attach the whole program and DB [attachment deleted by admin]
  16. problem is when i select unpaid in drop down box it not show the expected result. I dont know wats wrong here I doubt $reg .=" AND status=0 "; find wats wrong Thanks a lot <?php include("connection.php"); $reg=""; if(isset($_POST['filter'])) { if($_POST['sel'] == "0") { $reg .=" AND status=0 "; } elseif($_POST['sel'] == "1") { $reg .=" AND status=1 "; } elseif($_POST['sel'] == "3") { $reg .=" AND (status=0 OR status=1) "; // echo "<a href='vudetails.php?regno=".$qry2['reg_no']."'>".$qry2['name']."</a>"; } $filter=mysql_query("SELECT * FROM stu_details WHERE dept LIKE '%".$_POST['dept']."%' OR course LIKE '%".$_POST['cors']."%' OR YEAR LIKE '%".$_POST['year']."%' OR room_no LIKE '%".$_POST['dept']."%' OR reg_no LIKE '%".$_POST['dept']."%' OR doj BETWEEN '".$_POST['dept']."' AND '".$_POST['dept']."'".$reg); while($f2=mysql_fetch_array($filter)) { echo "<a href='vudetails.php?regno=".$f2['reg_no']."' >".$f2['name']."</a> <br />"; } } ?> <html><head><title>Filter</title></head> <script type="text/javascript" src="datetimepicker.js"> </script> <script type="text/javascript"> function validate() { var a=document.forms['form']['dept'].value; if (a==null || a=="") { alert("Please enter a search."); return false; } /*else { return true; }*/ } </script> <form name="form" action="" method="post"> <table border="0"> <tr><td> <select name="sel"> <option value="3">All </option> <option value="0">Unpaid </option> <option value="1">Paid </option> </select> <tr><td> Department: <input type="text" name="dept"> <tr><td> Course: <input type="text" name="cors"> <tr><td> Year: <input type="text" name="year"> <tr><td> Room No: <input type="text" name="roomno"> <tr><td> Register No: <input type="text" name="regno"> <tr><td> Date of Join: <input type="text" name="doj" id="from"> <a href="javascript:NewCal('from','ddmmyyyy')"> <img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> To: <input type="text" name="datto" id="todat"> <!--<tr><td>Date: <input text="text" id="dp" name="dp" size="25">--> <a href="javascript:NewCal('todat','ddmmyyyy')"> <img src="cal.gif" width="16" height="16" border="0" alt="Pick a date"></a> <tr><td> <!--<input type="submit" name="filter" value="Filter" onclick="return validate()">--> <input type="submit" name="filter" value="Filter" onclick="validate()"> </table> </form> </html> [attachment deleted by admin]
  17. I have some text boxes for searching the students in database also i have a drop down box for selecting student with balance amount to be paid tell me how to filter or search the list of stuents <select> <option value="">All </option> <option value="">Unpaid </option> <option value="">Paid </option> </select>
  18. This is the error I got Forbidden You don't have permission to access /LoginSystem/< on this server. In the url http://localhost/LoginSystem/%3C?%20echo%20$_SERVER[%27PHP_SELF%27];?%3E <?php /* This script was downloaded at: LightPHPScripts.com Please support us by visiting out website and letting people know of it. Produced under: LGPL */ /* Start session */ if($startSession == TRUE){ session_start();} /* Config file */ include('config.php'); /* Check for submition */ if($_POST['submitID'] == 2){ /* Connect to database & query */ if($connectDatabase == TRUE){$action=TRUE;include('connect.php');} /* sanitize and check info */ $userName = mysql_real_escape_string($_POST['userName'],$dbc); $password = mysql_real_escape_string($_POST['password'],$dbc); if($userName == NULL) { $message = 'Please enter username.';} if($message == NULL && $password == NULL){ $message = 'Please enter password.';} if($message == NULL && $password != $_POST['password2']){ $message = 'Passwords do not match.';} if($message == NULL) { $userQuery = mysql_fetch_row(mysql_query("SELECT COUNT(*) FROM `$tableName` WHERE `$userNameField`='$userName'")); if($userQuery[0] > 0){ $message = 'This username already exists. Please select another.'; } else { /* Add user */ $addUser = mysql_query("INSERT INTO `$tableName` (`$userNameField`,`$userPasswordField`) VALUES ('$userName','$password')"); if($addUser) { /* Disconnect from database */ if($connectDatabase == TRUE){$action=FALSE;include('connect.php');} /* Log use in */ $_SESSION['isLoged'] = 'yes'; $_SESSION['userName'] = $userName; /* add cookies ?*/ /* expire in 1 hour */ if($useCookies == TRUE) { setcookie("isLoged", 'yes', time()+logedInFor, "/", ".$domainName", 1); setcookie("userName", $userName, time()+logedInFor, "/", ".$domainName", 1); } /* Redirect to login page */ header("Location: $loginPage"); exit(); } else { $message = 'Internal error. Please contact administrator.'; } } } /* Disconnect from database */ if($connectDatabase == TRUE){$action=FALSE;include('connect.php');} } ?> <!-- /* This script was downloaded at: LightPHPScripts.com Please support us by visiting out website and letting people know of it. Produced under: LGPL */ --> <?php /* Display error messages */ if($message != NULL){?> <table width="100%" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFCCCC"> <tr> <td><div align="center"><strong><font color="#FF0000"><?=$message;?></font></strong></div></td> </tr> </table> <?php } ?> <form action="<? echo $_SERVER['PHP_SELF'];?>" method="post" name="register" id="register" style="display:inline;"> <table width="100%" border="1" align="center" cellpadding="5" cellspacing="0" bordercolor="#99CC33"> <tr bgcolor="#99CC99"> <td colspan="2"><div align="center"><strong>Please enter registration information: </strong></div></td> </tr> <tr> <td width="47%"><strong>Username:</strong></td> <td width="53%"><input name="userName" type="text" id="userName"></td> </tr> <tr> <td><strong>Password:</strong></td> <td><input name="password" type="password" id="password"></td> </tr> <tr> <td><strong>Re-enter password: </strong></td> <td><input name="password2" type="password" id="password2" /></td> </tr> <tr> <td colspan="2"><div align="center"><font face="Georgia, Times New Roman, Times, serif"><strong> <input name="Submit" type="submit" id="Submit" value="Register"> <input name="submitID" type="hidden" id="submitID" value="2"> </strong></font> </div></td> </tr> <tr> <td colspan="2"><div align="right"><a href="http://lightphpscripts.com" target="_blank"><font size="1">Powered by LPS</font></a> </div></td> </tr> </table> </form>
  19. I got this error when i click update button Notice: Undefined index: name in C:\wamp\www\mariyano\New Folder - Copy\New\update.php on line 14 Notice: Undefined index: mobile in C:\wamp\www\mariyano\New Folder - Copy\New\update.php on line 14 Notice: Undefined index: email in C:\wamp\www\mariyano\New Folder - Copy\New\update.php on line 14 Unknown column 'diwakar' in 'where clause' <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("super",$cn); if(isset($_POST['submit'])) { //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $qy="UPDATE users SET name='$_POST[name]', email='$_POST[mobile]', city='$_POST[email]' WHERE username=$username "; mysql_query($qy,$cn) or die(mysql_error()); } } ?> <?php $cn=mysql_connect("localhost","root",""); mysql_select_db("super",$cn); //checks cookies to make sure they are logged in if(!isset($_COOKIE['ID_my_site'])) { header("Location: login.php"); } echo "<h3>Profiles</h3><br/><br/>"; echo "Name: <input type=\"text\" name=\"name\" > "; echo "<br/>"; echo "Email: <input type=\"text\" name=\"email\"> "; echo "<br/>"; echo "City: <input type=\"text\" name=\"city\"> "; //echo "<br/><br/><input type=\"submit\" value=\"Update\" >"; //echo "<br/><br/><a href=logout.php>Logout</a>"; ?> <html> <form action='update.php' method='post'> <br/> <input type='submit' name='submit' value='Update' > <br/><br/><a href=logout.php>Logout</a> </form> </html>
  20. I want to study web application. Where and what I have to study Is there future for I web application
  21. Undefined index: name in C:\wamp\www\Vicky\New Folder (2)\update.php on line 13 Undefined index: mobile in C:\wamp\www\Vicky\New Folder (2)\update.php on line 13 Undefined index: email in C:\wamp\www\Vicky\New Folder (2)\update.php on line 13 <?php include("connect.php"); if(!$cn) { die('could not connect' . mysql_error); } $qry=mysql_query("SELECT * FROM pro"); while($row=mysql_fetch_array($qry)) { $name=$row['name']; $mobile=$row['mobile']; $email=$row['email']; } echo "<h3>Profiles</h3><br/><br/>"; echo "Name: <input type=\"text\" name=\"char\" value=\"$name\"> "; echo "<br/>"; echo "Mobile: <input type=\"text\" name=\"number\" value=\"$mobile\"> "; echo "<br/>"; echo "Email: <input type=\"text\" name=\"mail\" value=\"$email\"> <br/>"; echo "<form action=\"update.php\" method=\"post\">"; echo "<input type=\"submit\" name=\"submit\" value=\"submit\">"; ?>
×
×
  • Create New...

Important Information

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.