Montego Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic
Author Message
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Thu Aug 17, 2006 11:18 am Reply with quote

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.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1393

PostPosted: Fri Aug 18, 2006 8:26 am Reply with quote

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 
View user's profile Send private message Visit poster's website
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Fri Aug 18, 2006 8:37 am Reply with quote

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 Wink
 
View user's profile Send private message
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Fri Aug 18, 2006 9:28 am Reply with quote

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.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1393

PostPosted: Fri Aug 18, 2006 9:34 am Reply with quote

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 
View user's profile Send private message Visit poster's website
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Fri Aug 18, 2006 10:18 am Reply with quote

Thanks, much appreciated!!
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1393

PostPosted: Fri Aug 18, 2006 11:14 pm Reply with quote

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 
View user's profile Send private message Visit poster's website
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Sat Aug 19, 2006 4:48 am Reply with quote

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 Sad

Edited: Just noticed my original post here is showing the form tags - thats weird!
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1393

PostPosted: Sat Aug 19, 2006 7:29 am Reply with quote

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... Confused

_________________
“To err is human, but when the eraser wears out ahead of the pencil, you’re overdoing it.”
-- Josh Jenkins 
View user's profile Send private message Visit poster's website
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Sat Aug 19, 2006 8:33 am Reply with quote

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.
 
View user's profile Send private message
floppy
Newbie
Newbie



Joined: Sep 11, 2006
Posts: 92

PostPosted: Mon Sep 11, 2006 9:08 am Reply with quote

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.
 
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1393

PostPosted: Sat Sep 30, 2006 6:11 pm Reply with quote

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 
View user's profile Send private message Visit poster's website
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Sat Nov 25, 2006 1:59 pm Reply with quote

Yes it looks like its stripping all html tags.
I used to be able to register on sites for fun with <s>username</s> but even that is stripped out now.
 
View user's profile Send private message
Guardian
Site Admin
Site Admin



Joined: Jul 18, 2005
Posts: 401

PostPosted: Tue Apr 03, 2007 7:19 pm Reply with quote

Wow, this thread has had some serious 'views' lol.
 
View user's profile Send private message
montego
Site Admin/Owner
Site Admin/Owner



Joined: Feb 12, 2005
Posts: 1393

PostPosted: Tue Apr 03, 2007 8:28 pm Reply with quote

My only "real users" are GoogleBot, msnbot and Slurp, so not sure what else to say there. LOL.
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 4 Hours
 
Forums ©
linear-bunchlinear-bunch
linear-bunch