KyleEW12
11-30-2002, 06:31 AM
Alrighty....
All the account info for the database, user acounts, passwords, etc., are all correct.
So, I figure I have something wrong with the actual code itself...which is definitely not a unique problem.
Below is the PHP code that I have for connecting to the database and doing all the work I want done:
<?php
mysql_connect("localhost","kwilli_kwilliams","*********") or die("Unable to connect to SQL server");
mysql_select_db("kwilli_veritas") or die("Unable to select database");
$query = mysql_query("SELECT * from users where login='$user' and password='$password' and id='2'");
if(!mysql_num_rows($query)) {
$db = mysql_connect("localhost", "kwilli_kwilliams", "********");
mysql_select_db("kwilli_veritas",$db);
$sql="INSERT INTO article (article_text, description, title, author, date, subject) VALUES ('$article', '$description', '$title', '$user', '$date', '$subject')";
$result=mysql_query($sql,$db);
echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=article.php\">";
}
else {
echo "<br><br><br><i>Your password or username is incorrect. If you are attempting to hack the website, we'd appreciate it if you stopped. If you forgot your password or username, contact <a href=\"mailto:kyle@captoveritas.com\">Kyle Williams</a>.<br><br><br>You are being returned to the <a href=\"article.php\">Control Panel</a>.</i>";
echo "<META HTTP-EQUIV=\"refresh\" content=\"5;URL=article.php\">";
};
?>
Below here is the form inside a table that I use to enter all the info into the database:
<form action="http://www.captoveritas.com/update/cv.post.php" method="post" name="postdb" onSubmit="return checkFields()">
<table cellpadding="2" cellspacing="0" border="1" width="381">
<tr><td><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Name</b></font></td><td><select name="user" size="1">
<option value="kwilliams">Kyle Williams</option>
<option value="wholzer">William Holzer</option>
<option value="cknight">Chris Knight</option>
<option value="jschroeder">Jacob Schroeder</option>
<option value="jsalzone">Joe Salzone</option>
<option value="cleon">Carlos Leon</option>
<option value="dwilliams">Don Williams</option>
<option value="rtaylor">Rich Taylor</option>
<option value="edoe">Enrique Doe</option>
<option value="jcrockroft">Jeremiah Crockroft</option>
</select> </td><tr>
<td><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Password</b></font></td>
<td><input type="password" name="password" size="24"></td>
<tr><td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Article Title</font></b></td><td><input type="text" name="title" size="28"></td><tr>
<td><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Subject</b></font></td>
<td><select name="subject" size="1">
<option value="conservatism">Conservatism</option>
<option value="liberalism">Liberalism</option>
<option value="libertarianism">Libertarianism</option>
<option value="constitutionalism">Constitutionalism</option>
<option value="politicalcorrectness">Political Correctness</option>
<option value="publiceducation">Public Education</option>
<option value="homeschooling">Homeschooling</option>
<option value="privateeducation">Private Education</option>
<option value="entertainment">Entertainment Industry</option>
<option value="satire">Satire</option>
<option value="religion">Religion</option>
<option value="culture">Culture - General</option>
<option value="politics">Politics - General</option>
<option value="misc">Misc.</option>
</select></td>
<tr><td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Description</font></b></td><td><textarea name="description" cols="25" rows="4"></textarea></td><tr>
<td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Date</font></b></td>
<td><SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
today = new Date();
thismonth = today.getMonth()+1;
thisyear = today.getYear();
thisday = today.getDate();
montharray=new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
maxdays=montharray[thismonth-1];
if (thismonth==2) {
if ((thisyear/4)!=parseInt(thisyear/4)) maxdays=28;
else maxdays=29;
}
thismonth = "" + thismonth
if (thismonth.length == 1) {
thismonth = "0" + thismonth;
}
document.write("<select name=date size=1>");
for (var theday = 1; theday <= maxdays; theday++) {
var theday = "" + theday;
if (theday.length == 1) {
theday = "0" + theday;
}
document.write("<option");
if (theday == thisday) document.write(" selected");
document.write(">");
document.write(thismonth + "-" + theday + "-" + thisyear);
}
document.write("</select>");
// End -->
</SCRIPT></td>
<tr>
<td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Article Text</font></b><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">For paragraph breaks: Enter two </font></b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i><br></i></font><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"> </font><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>HTML tags.</b></font></td>
<td><textarea name="article" cols="26" rows="28"></textarea></td>
</tr>
<tr><td><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Submit</b></font></td><td><input type=submit value="This looks good - send it"></td></tr></table></form>
Sorry for the mess, I used a WYSIWYG editor for putting it together....
Any help is appreciated.
All the account info for the database, user acounts, passwords, etc., are all correct.
So, I figure I have something wrong with the actual code itself...which is definitely not a unique problem.
Below is the PHP code that I have for connecting to the database and doing all the work I want done:
<?php
mysql_connect("localhost","kwilli_kwilliams","*********") or die("Unable to connect to SQL server");
mysql_select_db("kwilli_veritas") or die("Unable to select database");
$query = mysql_query("SELECT * from users where login='$user' and password='$password' and id='2'");
if(!mysql_num_rows($query)) {
$db = mysql_connect("localhost", "kwilli_kwilliams", "********");
mysql_select_db("kwilli_veritas",$db);
$sql="INSERT INTO article (article_text, description, title, author, date, subject) VALUES ('$article', '$description', '$title', '$user', '$date', '$subject')";
$result=mysql_query($sql,$db);
echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=article.php\">";
}
else {
echo "<br><br><br><i>Your password or username is incorrect. If you are attempting to hack the website, we'd appreciate it if you stopped. If you forgot your password or username, contact <a href=\"mailto:kyle@captoveritas.com\">Kyle Williams</a>.<br><br><br>You are being returned to the <a href=\"article.php\">Control Panel</a>.</i>";
echo "<META HTTP-EQUIV=\"refresh\" content=\"5;URL=article.php\">";
};
?>
Below here is the form inside a table that I use to enter all the info into the database:
<form action="http://www.captoveritas.com/update/cv.post.php" method="post" name="postdb" onSubmit="return checkFields()">
<table cellpadding="2" cellspacing="0" border="1" width="381">
<tr><td><font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" size="2"><b>Name</b></font></td><td><select name="user" size="1">
<option value="kwilliams">Kyle Williams</option>
<option value="wholzer">William Holzer</option>
<option value="cknight">Chris Knight</option>
<option value="jschroeder">Jacob Schroeder</option>
<option value="jsalzone">Joe Salzone</option>
<option value="cleon">Carlos Leon</option>
<option value="dwilliams">Don Williams</option>
<option value="rtaylor">Rich Taylor</option>
<option value="edoe">Enrique Doe</option>
<option value="jcrockroft">Jeremiah Crockroft</option>
</select> </td><tr>
<td><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Password</b></font></td>
<td><input type="password" name="password" size="24"></td>
<tr><td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Article Title</font></b></td><td><input type="text" name="title" size="28"></td><tr>
<td><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Subject</b></font></td>
<td><select name="subject" size="1">
<option value="conservatism">Conservatism</option>
<option value="liberalism">Liberalism</option>
<option value="libertarianism">Libertarianism</option>
<option value="constitutionalism">Constitutionalism</option>
<option value="politicalcorrectness">Political Correctness</option>
<option value="publiceducation">Public Education</option>
<option value="homeschooling">Homeschooling</option>
<option value="privateeducation">Private Education</option>
<option value="entertainment">Entertainment Industry</option>
<option value="satire">Satire</option>
<option value="religion">Religion</option>
<option value="culture">Culture - General</option>
<option value="politics">Politics - General</option>
<option value="misc">Misc.</option>
</select></td>
<tr><td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Description</font></b></td><td><textarea name="description" cols="25" rows="4"></textarea></td><tr>
<td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Date</font></b></td>
<td><SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
today = new Date();
thismonth = today.getMonth()+1;
thisyear = today.getYear();
thisday = today.getDate();
montharray=new Array(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
maxdays=montharray[thismonth-1];
if (thismonth==2) {
if ((thisyear/4)!=parseInt(thisyear/4)) maxdays=28;
else maxdays=29;
}
thismonth = "" + thismonth
if (thismonth.length == 1) {
thismonth = "0" + thismonth;
}
document.write("<select name=date size=1>");
for (var theday = 1; theday <= maxdays; theday++) {
var theday = "" + theday;
if (theday.length == 1) {
theday = "0" + theday;
}
document.write("<option");
if (theday == thisday) document.write(" selected");
document.write(">");
document.write(thismonth + "-" + theday + "-" + thisyear);
}
document.write("</select>");
// End -->
</SCRIPT></td>
<tr>
<td><b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">Article Text</font></b><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">For paragraph breaks: Enter two </font></b><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i><br></i></font><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"> </font><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>HTML tags.</b></font></td>
<td><textarea name="article" cols="26" rows="28"></textarea></td>
</tr>
<tr><td><font size="2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><b>Submit</b></font></td><td><input type=submit value="This looks good - send it"></td></tr></table></form>
Sorry for the mess, I used a WYSIWYG editor for putting it together....
Any help is appreciated.