How to use RevCMS SQL engine?

Status
Not open for further replies.

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Hello,

I was wondering, how do I use RevCMS to make SQL queries?
Not sure how to do this.

Thanks in advance.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Whenever I try and use it, this happens:
3df02316a8bf0ad90c9d1edad8f298e4.png
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
It has something to do with it.
The page only goes like that once hitting the submit button on the form using the engine.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Code:
<?php
function sendApp() {
$username = $engine->secure($_POST['username']);
$age = $engine->secure($_POST['age']);
$real_name = $engine->secure($_POST['real_name']);
$why_you = $engine->secure($_POST['why_you']);
$past_exp = $engine->secure($_POST['past_exp']);
$different = $engine->secure($_POST['different']);
$engine->query("INSERT INTO jobs (username,age,why_you,past_exp,different,real_name) VALUES ('" . $username . "','$age','$why_you','$past_exp','$different','$real_name')");
}
$username = $_POST['username'];
$real_name = $_POST['real_name'];
$why_you = $_POST['why_you'];
$past_exp = $_POST['past_exp'];
$different = $_POST['different'];
if(isset($username) && isset($real_name) && isset($why_you) && isset($past_exp) && isset($different)){
    sendApp();
}else{
    echo "error";
}
?>

P.S. I am aware I could've declared the variables and sent them through to the function.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Managed to get it working using the code below.

PHP:
<?php
global $engine;
function sendApp() {
global $engine;
$username = $engine->secure($_POST['username']);
$age = $engine->secure($_POST['age']);
$real_name = $engine->secure($_POST['real_name']);
$why_you = $engine->secure($_POST['why_you']);
$past_exp = $engine->secure($_POST['past_exp']);
$different = $engine->secure($_POST['different']);
$engine->query("INSERT INTO jobs (username,age,why_you,past_exp,different,real_name) VALUES ('" . $username . "','$age','$why_you','$past_exp','$different','$real_name')");
}
$username = $_POST['username'];
$real_name = $_POST['real_name'];
$why_you = $_POST['why_you'];
$past_exp = $_POST['past_exp'];
$different = $_POST['different'];
if(isset($username) && isset($real_name) && isset($why_you) && isset($past_exp) && isset($different)){
    sendApp();
}else{
    echo "error";
}
?>
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,135
2,461
Managed to get it working using the code below.

PHP:
<?php
global $engine;
function sendApp() {
global $engine;
$username = $engine->secure($_POST['username']);
$age = $engine->secure($_POST['age']);
$real_name = $engine->secure($_POST['real_name']);
$why_you = $engine->secure($_POST['why_you']);
$past_exp = $engine->secure($_POST['past_exp']);
$different = $engine->secure($_POST['different']);
$engine->query("INSERT INTO jobs (username,age,why_you,past_exp,different,real_name) VALUES ('" . $username . "','$age','$why_you','$past_exp','$different','$real_name')");
}
$username = $_POST['username'];
$real_name = $_POST['real_name'];
$why_you = $_POST['why_you'];
$past_exp = $_POST['past_exp'];
$different = $_POST['different'];
if(isset($username) && isset($real_name) && isset($why_you) && isset($past_exp) && isset($different)){
    sendApp();
}else{
    echo "error";
}
?>
You can remove "global $engine; at the top.
 
  • Like
Reactions: NSA
Status
Not open for further replies.

Users who are viewing this thread

Top