| Author |
Message |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Thu Aug 17, 2006 11:18 am |
|
OK I know my brain is befuddled due to pain killers but why doesnt this form work - anyone?
File name: postit.php
| Code: |
if(isset($_GET['submitted']))
{
// Tell the user it has been submitted (optional)
echo('Your url has been submitted.');
// Set Mysql Variables
$host = 'localhost';
$user = 'zzzzzzz';
$pass = 'xxxxxx';
$db = 'yyyyyyyy';
$table = 'sb_ref_karma';
// Set global variables to easier names
$ustatus = $_GET['ustatus'];
$uurl = $_GET['uurl'];
$actioned = time();
//$time = date("Y M D h:i:s");
//date('Y m d');
echo $actioned;
// Connect to Mysql, select the correct database, and run teh query which adds the data gathered from the form into the database
mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
//rk_db_connect();
$add_all = "INSERT INTO `sb_ref_karma` values(`NULL', `$ustatus`, `$uurl`, `1`, `$actioned`)";
echo "Diagnostic" .$ustatus."<br>";
echo "Diagnostic" .$uurl. "<br>";
echo "Diagnostic" .$actioned. "<br>";
mysql_query($add_all) or die(mysql_error());
echo $add_all;
}
else
{
// If the form has not been submitted, display it
?>
<form>
Status : <input><br><br>
Url : <input><br><br>
<input>
<input>
</form>
<?php
echo "Diagnostic status = " .$ustatus."<br>";
echo "Diagnostic url = " .$uurl. "<br>";
echo "Diagnostic" .$actioned. "<br>";
} |
Table schema is;
| Code: |
CREATE TABLE `sb_ref_karma` (
`id` int(11) NOT NULL auto_increment,
`key` enum('black','white','ip_ban','ignore','unknown') NOT NULL default 'unknown',
`value` text NOT NULL,
`used` int(11) NOT NULL default '0',
`last_mod` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `used` (`used`)
) ENGINE=MyISAM; |
For some reason I am not able to echo out the $actioned variable which should be the current server date/time and presumabley because of this, the form data fails to post to the DB. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Fri Aug 18, 2006 8:26 am |
|
Is this the completed code? If so, your form needs to have an *action* and *method* and in this case, it looks as though you are wanting the method to be "GET" since you are looking for the results to be in the $_GET superglobal.
The following appears to "work", but notice that I also changed your IF test at the top. If that is not how you wanted it to work, you'll have to change that.
| Code: |
if(isset($_GET['uurl'])) {
// Tell the user it has been submitted (optional)
echo('Your url has been submitted.');
// Set Mysql Variables
$host = 'localhost';
$user = 'zzzzzzz';
$pass = 'xxxxxx';
$db = 'yyyyyyyy';
$table = 'sb_ref_karma';
// Set global variables to easier names
$ustatus = $_GET['ustatus'];
$uurl = $_GET['uurl'];
$actioned = time();
//$time = date("Y M D h:i:s");
//date('Y m d');
echo 'actioned = '.$actioned.'<br><br>';
// Connect to Mysql, select the correct database, and run teh query which adds the data gathered from the form into the database
//mysql_connect($host,$user,$pass) or die(mysql_error());
//mysql_select_db($db) or die(mysql_error());
//rk_db_connect();
$add_all = "INSERT INTO `sb_ref_karma` values(`NULL', `$ustatus`, `$uurl`, `1`, `$actioned`)";
//mysql_query($add_all) or die(mysql_error());
echo $add_all.'<br><br>';
} else {
// If the form has not been submitted, display it
echo '<form>';
echo 'Status : <input><br><br>';
echo 'Url : <input><br><br>';
echo '<input>';
echo '</form>';
}
echo "Diagnostic status = " .$ustatus."<br>";
echo "Diagnostic url = " .$uurl. "<br>";
echo "Diagnostic" .$actioned. "<br>";
|
[Edited] Oh, yeah, and I commented out everything related to the database... |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Fri Aug 18, 2006 8:37 am |
|
OK I'll try that thanks.
I guess once I know the form is working I can uncomment the DB stuff so that it will append the data to the next row in the table.
Thanks!!
I woke up this morning thinking that I might need to change the single quotes around the $vars in the INSERT statement from single to double quotes but ... one thing at a time  |
| |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Fri Aug 18, 2006 9:28 am |
|
Oh boy, I just noticed that the forum chopped out a lot of code from my post, probably because some of the html tags were not allowed.
Hmm, thats going to be hard to get around I guess I can try reposting using spaces to break up the tags. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Fri Aug 18, 2006 9:34 am |
|
Oh, yeah, you're right. I see what you mean now. I'll email it to you... |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Fri Aug 18, 2006 10:18 am |
|
Thanks, much appreciated!! |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Fri Aug 18, 2006 11:14 pm |
|
That is really weird. Do you have the same issue in your forums with regards to the form tags not showing? |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Sat Aug 19, 2006 4:48 am |
|
No those tags work fine (code-authors.com) within bbcode 'code' tags as well as 'quote' tags (though obviously I lose the br tags when used within quotes as these are parsed as line breaks.
I tried to test them on my RN test site but I think I have broken it as none of my test forums are coming up at all
Edited: Just noticed my original post here is showing the form tags - thats weird! |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Sat Aug 19, 2006 7:29 am |
|
Actually, your original post and mine show similar issues. If your original code looks like your first post, it would not work because the form tag had no action and method and the input tags had no type, name, value. This site here is RN2.02.02...  |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Sat Aug 19, 2006 8:33 am |
|
I'm taking a short break then I'll double check this at my site to re-confirm.
If all is well, I'll post a link to the forum post so you can see it.
I also need to check the versioning on my site (code-authors), I'm pretty sure its latest RN public release. |
| |
|
|
 |
floppy
Newbie


Joined: Sep 11, 2006
Posts: 89
|
Posted:
Mon Sep 11, 2006 9:08 am |
|
I have noticed, 2.0.20 is terrible about chopping off certain html characters. The only version I know that doesn't do so is 2.0.17. |
| |
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Sat Sep 30, 2006 6:11 pm |
|
Well, we can all just blame it on the hackers out there who try XSS and other attacks! However, what I cannot understand is why within a CODE or PRE tag they cannot just use htmlentities on it so that it can post exactly as is... Maybe one of these days I'll look into that more. |
_________________ “To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins |
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Sat Nov 25, 2006 1:59 pm |
|
|
|
 |
Guardian
Site Admin


Joined: Jul 18, 2005
Posts: 311
|
Posted:
Tue Apr 03, 2007 7:19 pm |
|
|
|
 |
montego
Site Admin/Owner


Joined: Feb 12, 2005
Posts: 965
|
Posted:
Tue Apr 03, 2007 8:28 pm |
|
My only "real users" are GoogleBot, msnbot and Slurp, so not sure what else to say there. LOL. |
| |
|
|
 |
|
|