Search Results

Search found 81 results on 4 pages for 'user225269'.

Page 3/4 | < Previous Page | 1 2 3 4  | Next Page >

  • User welcome message in php

    - by user225269
    How do I create a user welcome message in php. So that the user who has been logged on will be able to see his username. I have this code, but it doesn't seem to work. <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $result = mysql_query("SELECT * FROM users WHERE Username='$username'"); while($row = mysql_fetch_array($result)) { echo $row['Username']; echo "<br />"; } ?> I'm trying to make use of the data that is inputted in this login form: <form name="form1" method="post" action="verifylogin.php"> <td> <table border="0" cellpadding="3" cellspacing="1" bgcolor=""> <tr> <td colspan="16" height="25" style="background:#5C915C; color:white; border:white 1px solid; text-align: left"><strong><font size="2">Login User</strong></td> </tr> <tr> <td width="30" height="35"><font size="2">Username:</td> <td width="30"><input name="myusername" type="text" id="idnum" maxlength="5"></td> </tr> <tr> <td width="30" height="35" ><font size="2">Password:</td> <td width="30"><input name="mypassword" type="password" id="lname" maxlength="15"></td> </tr> <td align="right" width="30"><td align="right" width="30"><input type="submit" name="Submit" value="Submit" /></td> <td align="right" width="30"><input type="reset" name="Reset" value="Reset"></td></td> </tr> </form> But this, verifylogin.php, seems to be in the way. <?php $host="localhost"; $username="root"; $password="nitoryolai123$%^"; $db_name="school"; $tbl_name="users"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ session_register("myusername"); session_register("mypassword"); header("location:userpage.php"); } else { echo "Wrong Username or Password"; } ?> How do I do it? I always get this error when I run it: Notice: Undefined variable: username in C:\wamp\www\exp\userpage.php on line 53 Can you recommend of an easier on how I can achieve the same thing?

    Read the article

  • Parse error in PHP login form

    - by user225269
    I'm trying to have a login form in php. But my current code doesnt work. Here is the form: <form name="form1" method="post" action="loginverify.php"> <td><font size="3">Username:</td> <td></td> <td><input type="text" name="uname" value="" maxlength="15"/><br/></td> <td><font size="3">Password:</td> <td></td> <td><input type="text" name="pword" value="" maxlength="15"/><br/></td> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="submit" name="Submit" value="Login" /></td> </form> And the verify.php <?php session_start(); ?> <?php $host="localhost"; $username="root"; $password="nitoryolai123$%^"; $db_name="login"; $tbl="users"; $connection=mysql_connect($host, $username, $password) or die("cannot connect"); mysql_select_db($db_name, $connection) or die("cannot select db"); $user=$_POST['uname'] $pass=$_POST['pword'] $sql="SELECT Username, Password from users where Username='$user' and Password='$pass'"; $result=mysql_query[$sql]; $count=mysql_num_rows($result); if($count==1){ $SESSION['Username']=$user; echo"<a href='searchmain.php'> CONTINUE</a>"; } else{ echo"wrong username or password"; echo"<a href='loginform.php'>Back</a>"; } ?> Is there something wrong with my code. I get this parse error at line 15, which is this: $pass=$_POST['pword'] But when I try to remove it.It goes to line 16 or line 17 again. What do I do

    Read the article

  • mysql_fetch_array() expects parameter 1 to be resource problem

    - by user225269
    I don't get it, I see no mistakes in this code but there is this error, please help: mysql_fetch_array() expects parameter 1 to be resource problem <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $result = mysql_query("SELECT * FROM student WHERE IDNO=".$_GET['id']); ?> <?php while ($row = mysql_fetch_array($result)) { ?> <table class="a" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D3D3D3"> <tr> <form name="formcheck" method="get" action="updateact.php" onsubmit="return formCheck(this);"> <td> <table border="0" cellpadding="3" cellspacing="1" bgcolor=""> <tr> <td colspan="16" height="25" style="background:#5C915C; color:white; border:white 1px solid; text-align: left"><strong><font size="2">Update Students</td> <tr> <td width="30" height="35"><font size="2">*I D Number:</td> <td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $_GET['id']; ?>"></td> </tr> <tr> <td width="30" height="35"><font size="2">*Year:</td> <td width="30"><input name="yr" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/ value="<?php echo $row["YEAR"]; ?>"></td> <?php } ?> I'm just trying to load the data in the forms but I don't know why that error appears. What could possibly be the mistake in here?

    Read the article

  • how to read uploaded files from xampp

    - by user225269
    I have this code for uploading files on the server: <tr> <td> <form enctype="multipart/form-data" action="uploadaction.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> </td> </tr> <tr> <td> Select the image: <input name="uploadedfile" type="file" /> </td> <tr> <td> <input type="submit" value="Upload File" /> </form> </td> </tr> And here's the action form: <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> What php function will I use? Can you give me an example on how to read the file back and display it in the browser? Please help, thanks.

    Read the article

  • Page not redirecting properly(php)

    - by user225269
    I want to do the login page this way so that I won't be having trouble posting the username in the userpage. But everytime I try to access login.php. I get an error in firefox, that the page is not redirecting properly. What do I do? This works when I separate them into two. Into something like, login.php and verifylogin.php as the form action. But if I do it like this, I get redirection errors: <?php $host="localhost"; $username="root"; $password="nitoryolai123$%^"; $db_name="school"; $tbl_name="users"; mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $uname = mysql_real_escape_string($_POST['username']); $pword = mysql_real_escape_string($_POST['password']); $SQL = "SELECT * FROM users WHERE username = '$uname' AND password = '$pword'"; $result = mysql_query($SQL); $num_rows = mysql_num_rows($result); if ($result) { if ($num_rows > 0) { session_start(); $_SESSION['login'] = "1"; header ("Location: userpage.php"); } else { session_start(); $_SESSION['login'] = ""; header ("Location: login.php"); } } else { $errorMessage = "Error logging on"; } ?> <tr> <form name="form1" method="post" action="login.php"> <td> <table> <tr> <td><strong><font size="2">Login User</strong></td> </tr> <tr> <td width="30" height="35"><font size="2">Username:</td> <td width="30"><input name="username" type="text" id="username" maxlength="17"></td> </tr> <tr> <td width="30" height="35" ><font size="2">Password:</td> <td width="30"><input name="password" type="password" id="password" maxlength="17"></td> </tr> <td><td align="right" width="30"><input type="submit" name="Submit" value="Submit" /></td> <td><input type="reset" name="Reset" value="Reset"></td></td> </tr> </form> please help, thanks.

    Read the article

  • undefined offset error in php

    - by user225269
    I don't know why but the code below is working when I have a different query: $result = mysql_query("SELECT * FROM student WHERE IDNO='".$_GET['id']."'") ?> <?php while ( $row = mysql_fetch_array($result) ) { ?> <?php list($year,$month,$day)=explode("-", $row['BIRTHDAY']); ?> <tr> <td width="30" height="35"><font size="2">Month:</td> <td width="30"><input name="mm" type="text" id="mm" onkeypress="return handleEnter(this, event)" value="<?php echo $month;?>"> <td width="30" height="35"><font size="2">Day:</td> <td width="30"><input name="dd" type="text" id="dd" maxlength="25" onkeypress="return handleEnter(this, event)" value="<?php echo $day;?>"> <td width="30" height="35"><font size="2">Year:</td> <td width="30"><input name="yyyy" type="text" id="yyyy" maxlength="25" onkeypress="return handleEnter(this, event)" value="<?php echo $year;?>"> And it works when this is my query: $idnum = mysql_real_escape_string($_POST['idnum']); mysql_select_db("school", $con); $result = mysql_query("SELECT * FROM student WHERE IDNO='$idnum'"); Please help, why do I get the undefined offset error when I use this query: $result = mysql_query("SELECT * FROM student WHERE IDNO='".$_GET['id']."'") I assume that the query is the problem because its the only thing that's different between the two.

    Read the article

  • trying to backup mysql database using php

    - by user225269
    I got this code from this site: http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx But I'm just a beginner so I don't know what the config.php and opendb.php suppose to mean. Do I have to create those 2 files in order for this code to work? If yes, then how do I create it, it isn't included in the site how to create it. <?php include 'config.php'; include 'opendb.php'; $tableName = 'mypet'; $backupFile = 'backup/mypet.sql'; $query = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName"; $result = mysql_query($query); include 'closedb.php'; ?> can I just include these lines on the top code so that I will not be putting the include 'opendb.php' anymore: $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Hospital", $con);

    Read the article

  • How to load data on option box in php

    - by user225269
    I'm having trouble loading the mysql data on the html form option box using php. Here's my code: <?php $con = mysql_connect("localhost","myuname","mypassword"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $idnum= mysql_real_escape_string($_POST['idnum']); $result = mysql_query("SELECT * FROM student WHERE IDNO='$idnum'"); ?> <?php while ( $row = mysql_fetch_array($result) ) { ?> <tr> <td width="30" height="35"><font size="2">*I D Number:</td> <td width="30"><input name="idnum" type="text" maxlength="5" value="<?php echo $row["IDNO"]; ?>" readonly="readonly"></td> </tr> My problem is loading it here: <td><font size="2">Gender</td> <td> <select name="gender" id="gender"> <font size="2"> <option value="<?php echo $line['IDNO']; ?> "><?php $line['GENDER'] ; ?></option> </select></td></td> The table looks like this: IDNO | GENDER 123 | M 321 | F What am I supposed to do?To load the exact gender corresponding to the IDNO?

    Read the article

  • data type trouble in php

    - by user225269
    I don't know why but the data type in this code makes a trouble when the id in the url starts with the number zero like this: http://localhost/exp/update.php?id=03A43 In this case the id is 03A43. And my query looks like this: mysql_select_db("school", $con); $result = mysql_query("SELECT * FROM student WHERE IDNO=".(int)$_GET['id']); ?> There is no problem in the design if the id does not start with the number zero. What might be the proper data type for numbers beginning in zero?

    Read the article

  • How to avoid notice in php when one of the conditions is not true

    - by user225269
    I've notice that when one of the two conditions in a php if statement is not true. You get an undefined index notice for the statement that is not true. And the result in my case is a distorted web page. For example, this code: <?php session_start(); if (!isset($_SESSION['loginAdmin']) && ($_SESSION['loginAdmin'] != '')) { header ("Location: loginam.php"); } else { include('head2.php'); } if (!isset($_SESSION['login']) && ($_SESSION['login'] != '')) { header ("Location: login.php"); } else { include('head3.php'); } ?> If one of the if statements is not true. The one that is not true will give you a notice that it is undefined. In my case it says that the session 'login' is not defined. If session 'LoginAdmin' is used. What can you recommend that I would do in order to avoid these undefined index notice.

    Read the article

  • How to inherit from the main class in java

    - by user225269
    I have two java classes. One is NewFrame.java where the forms(buttons, textfields) are located. And the other one is Main.java where I have put the connection string for mysql: Main.java looks like this: public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { // TODO code application logic here Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee_record", "root", "password"); PreparedStatement statement = con.prepareStatement("select * from employee"); ResultSet result = statement.executeQuery(); } } How do I inherit from the main.java so that the declarations in it would be universally accessible to the forms in NewFrame.java? Please help. Thanks

    Read the article

  • how to import the attributes from one table to another in mysql

    - by user225269
    Is it possible to import the attributes of one table, then I put it into another table using a query in mysql? For example I have table1 with attributes lname, fname, mname And I want to put those attributes into table2. Is there any query that could do that? I'm imagining that the table2 has one attribute that could later be dropped so that it will be the same as table1.

    Read the article

  • Problem with table in php

    - by user225269
    I'm trying to create a table in php that would show the data on the mysql database based on the check box that is checked by the user. As you can see in this screen shot, it will have problems when you did not check on a checkbox before the one that will be the last: http://www.mypicx.com/04282010/1/ Here is my code: if($_POST['general'] == 'ADDRESS'){ $result2 = mysql_query("SELECT * FROM student WHERE ADDRESS='$saddress'"); ?> <table border='1'> <tr> <th>IDNO</th> <th>YEAR</th> <th>SECTION</th> <?php if ( $ShowLastName ) echo "<th>LASTNAME</th>" ?> <?php if ( $ShowFirstName ) echo "<th>FIRSTNAME</th>" ?> <?php if ( $ShowMidName ) echo "<th>MIDNAME</th>" ?> <?php if ( $ShowAddress ) echo "<th>ADDRESS</th>" ?> <?php if ( $ShowGender ) echo "<th>GENDER</th>" ?> <?php if ( $ShowReligion ) echo "<th>RELIGION</th>" ?> <?php if ( $ShowBday ) echo "<th>BIRTHDAY</th>" ?> <?php if ( $ShowContact ) echo "<th>CONTACT</th>" ?> </tr> <?php while($row = mysql_fetch_array($result2)) {?> <tr> <td><?php echo $row['IDNO']?> </td> <td><?php echo $row['YEAR'] ?> </td> <td><?php echo $row['SECTION'] ?></td> <td><?php if ( $ShowLastName ) echo $row['LASTNAME'] ?></td> <td><?php if ( $ShowFirstName ) echo $row['FIRSTNAME'] ?></td> <td><?php if ( $ShowMidName ) echo $row['MI'] ?></td> <td><?php if ( $ShowAddress ) echo $row['ADDRESS'] ?></td> <td><?php if ( $ShowGender ) echo $row['GENDER'] ?></td> <td><?php if ( $ShowReligion ) echo $row['RELIGION'] ?></td> <td><?php if ( $ShowBday ) echo $row['BIRTHDAY'] ?></td> <td><?php if ( $ShowContact ) echo $row['S_CONTACTNUM'] ?></td> </tr> <?PHP } ?> </table> <?PHP } mysql_close($con); ?> What can you recommend so that the output will not look like this when you one of the checkbox before a checkbox is not clicked: http://www.mypicx.com/04282010/2/

    Read the article

  • How to convert ms access data into pdf in vb.net

    - by user225269
    I want to convert the ms access data into a document so that the print function in vb.net will read it. Where do I start from here? Here is my form: http://screencast.com/t/MGU4N2UyNmY And here is the code for print preview. Try PrintPreviewDialog1.ShowDialog() Catch es As Exception MessageBox.Show(es.Message) End Try How do I incorporate the above code, to the code below so that there is something that can be seen when I hit the print button? Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\search.mdb") Dim cmd As OleDbCommand = New OleDbCommand("Select * from GH where NAME= '" & TextBox6.Text & "' ", cn) cn.Open() Dim rdr As OleDbDataReader rdr = cmd.ExecuteReader If rdr.HasRows Then rdr.Read() NoAcc = rdr("NAME") If (TextBox6.Text = NoAcc) Then TextBox1.Text = rdr("IDNUMBER") If (TextBox6.Text = NoAcc) Then TextBox7.Text = rdr("DEPARTMENT") If (TextBox6.Text = NoAcc) Then TextBox8.Text = rdr("COURSE") End If Please help,thanks

    Read the article

  • problem with logout script in php

    - by user225269
    I'm a beginner in php, and I am trying to create a login and logout. But I am having problems in logging out. My logout just calls for the login form which is this: <? session_start(); session_destroy(); ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form name="form1" method="post" action="checklogin.php"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Member Login </strong></td> </tr> <tr> <td width="78">Username</td> <td width="6">:</td> <td width="294"><input name="myusername" type="text" id="myusername"></td> </tr> <tr> <td>Password</td> <td>:</td> <td><input name="mypassword" type="text" id="mypassword"></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="submit" name="Submit" value="Login"></td> </tr> </table> </td> </form> </tr> </table> My problem is, when I try to press the back button in the browser. Whoever user is using it can still access what is not supposed to be accessed when a user hasn't logged in. Do I need to add a code on the user page? I have this code on the user page: <? session_start(); if(!session_is_registered(myusername)){ header("location:main_login.php"); } ?> What can you recommend that I would do so that a script will prompt to enter the username and password again when a user clicks on the back button.

    Read the article

  • How to configure netbeans to show code completion

    - by user225269
    I've just started to use netbeans IDE 6.8. And consulted youtube for tutorials. And I've seen that the code is being completed just like in dreamweaver. Whenever you type something. And it shows some suggestions on what probably would be the next code. But when I tried it on my computer. It does not do this. How do I configure it?

    Read the article

  • How to check if a checkbox/ radio button is checked in php

    - by user225269
    I have this html code: <tr> <td><label><input type="text" name="id" class="DEPENDS ON info BEING student" id="example">ID</label></td> </tr> <tr> <td> <label> <input type="checkbox" name="yr" class="DEPENDS ON info BEING student"> Year</label> </td> </tr> But I don't have any idea on how do I check this checkboxes if they are checked using php, and then output the corresponding data based on the values that are checked. Please help, I'm thinking of something like this. But of course it won't work, because I don't know how to equate checkboxes in php if they are checked: <?php $con = mysql_connect("localhost","root","nitoryolai123$%^"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("school", $con); $id = mysql_real_escape_string($_POST['idnum']); if($_POST['id'] == checked & $_POST['yr'] ==checked ){ $result2 = mysql_query("SELECT * FROM student WHERE IDNO='$id'"); echo "<table border='1'> <tr> <th>IDNO</th> <th>YEAR</th> </tr>"; while($row = mysql_fetch_array($result2)) { echo "<tr>"; echo "<td>" . $row['IDNO'] . "</td>"; echo "<td>" . $row['YEAR'] . "</td>"; echo "</tr>"; } echo "</table>"; } mysql_close($con); ?>

    Read the article

  • matching images inside a link in regex

    - by user225269
    What is wrong with regex pattern that I created: $link_image_pattern = '/\<a\shref="([^"]*)"\>\<img\s.+\><\/a\>/'; preg_match_all($link_image_pattern, $str, $link_images); What I'm trying to do is to match all the links which has images inside of them. But when I try to output $link_images it contains everything inside the first index: <pre> <?php print_r($link_images); ?> </pre> The markup looks something like this: Array ( [0] = Array ([0] = " <p>&nbsp;</p> <p><strong><a href="url">Title</a></strong></p> <p>Desc</p> <p><a href="{$image_url2}"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="{$image_url2}" width="569" height="409"></a></p> But when outputting the contents of the matches, it simply returns the first string that matches the pattern plus all the other markup in the page like this: <a href="{$image_url}"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="{$image_url}" width="568" height="347"></a></p> <p>&nbsp;</p> <p><strong><a href="url">Title</a></strong></p> <p>Desc</p> <p><a href="{$image_url2}"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="{$image_url2}" width="569" height="409"></a></p>")

    Read the article

  • Help with sql query

    - by user225269
    I have two tables: subject and student. I'm trying to count the number of subjects enrolled by each student. How do I do that?I'm trying the code below but it doesn't give the answer I need. Please help. SELECT COUNT( subject.SUBJECT ) , student.IDNO, student.FIRSTNAME, subject.SUBJECT FROM student, subject GROUP BY subject.SUBJECT LIMIT 0 , 30

    Read the article

< Previous Page | 1 2 3 4  | Next Page >