|
|
Please I need a guide on how to use a php $_SERVER['PHP_SELF'] to insert form data into Mysql database and redisplay data entered on another form.
My form action is <pre><form method="post" name="form1" action="<?php echo $editFormAction; ?>
While the print button should be able to open another page with contents of the main form on it. I used this
<input name="Print receipt" type= "button" onclick = "Openform();" value="Print reciept" /></td> Please assist
|
|
|
|
|
So I'm building a website and I've got alot of the core functionality sorted. Been trying to make a register and login system. Everything on the front end works ok. Registering is fine but I can't get the password_verify function to recognise a correct password.
So here's the registration part:
$res = $conn->query("SELECT * FROM `users` WHERE `email`= '$email'");
if (mysqli_num_rows($res) != 0) {
echo "<br> Sorry this email already is registered with us!!! <br>";
$start = microtime(true);
do {
$stop = microtime(true);
} while ($stop - $start < 5);
header("location: index.php");
}
else {
$cost = 8;
$target_time = 0.05;
do {
$start = microtime(true);
$password = password_hash( $password, PASSWORD_BCRYPT, ["cost" => $cost] );
$stop = microtime(true);
$cost++;
} while ($stop - $start < $target_time);
$date = date("Y-m-d ");
$sql="INSERT INTO `users` (`username`, `email`, `password`, `sign_up_date`)
VALUES ('$username', '$email', '$password', '$date')";
if ($conn->query($sql)) {
echo "Registration Successful!!!";
header( "location: index.php" );
}
}
That's just the part where a hash is generated and stored on an SQL database. Now here's the login part:
$conn = new mysqli( "localhost", $user, $pass, $db ) or die("Unable to connect");
$email = mysqli_real_escape_string($conn, $_POST['email']);
$res = $conn->query("SELECT * FROM `users` WHERE `email`= '$email'");
if (mysqli_num_rows($res) == false) {
echo "Sorry no such user exists :(";
}
else {
$user = $res->fetch_assoc();
if ( password_verify( $_POST['password'], $user['password']) ) {
echo " Password login accepted. Redirecting...";
$_SESSION['username'] = $user['username'];
$_SESSION['email'] = $user['email'];
$_SESSION['logged_in'] = true;
header("location: testFront.php");
}
else {
echo "<br>Sorry Wrong Password!!!<br>";
}
}
For some reason the password_verify keeps returning false and I have no idea why. Have I overlooked something in the code. Is it my fundamental understanding of hashes?
Thanks
|
|
|
|
|
I am creating a platform where users sends requests using forms(in a database) to the admin and the admin should reply them when he has finished the job.
Can anyone help me on how to make the admin view form by form and reply to its specific sender.
|
|
|
|
|
Hello
I'm doing a survey web where I keep my questions in a database and then I call them when the user selects which survey will answer and my questions are shown.
This is my code where I show my questions and add raddiobuttons and textareas.
<pre><table>
<tr>
<!--
<td colspan="2"> <h3><?php echo $titulo; ?></h3></td>
<input type="hidden" name="id" value="<?php echo $id; ?>">
</tr>
<?php
$sql = "SELECT texto,id FROM respuestas WHERE idenc='$id'";
$sql = mysqli_query($conexion,$sql);
while ($row = mysqli_fetch_array($sql)){
$texto = $row["texto"];
$idres = $row["id"];
?>
<tr>
<!--
<td width="50"><?php echo $idres; ?></td>
<td width="470"><?php echo $texto; ?></td>
<td> SI <input type="radio" name="radio<?php echo $idres; ?>" value="SI"></td>
<td> NO <input type="radio" name="radio<?php echo $idres; ?>" value="NO"></td>
<td><textarea name="comentarios<?php echo $idres; ?>" rows="5" cols="20">Escribe aquí tus Hallazgos</textarea></td>
<td><textarea name="acciones<?php echo $idres; ?>" rows="5" cols="20">Escribe aquí tus Acciones Correctivas</textarea></td>
</tr>
<?php } ?>
and here I want to save the answers
<pre><?php
$respuesta = $_POST["radio$idres"];
$comentarios = $_POST["comentarios$idres"];
$acciones = $_POST["acciones$idres"];
require 'conexion.php';
$fecha_actual = date("y-m-d");
if(!empty($respuesta)){
$sql = "INSERT INTO opciones(ID, idenc, valor, Accion, hallazgo, fecha) VALUES ('$respuesta' ,'$comentarios' ,'$acciones' ,'$fecha_actual')";
$sql = mysqli_query($conexion,$sql);
}
header("Location: verEncuesta.php");
?>
I just do not know how to save the questions by id question and id survey. I suppose it's a cycle but I do not know how to structure that cycle
|
|
|
|
|
Hai,
<!DOCTYPE html>
<html >
<head>
<style type="text/css">
.centerDiv
{
width: 1000px;
height:600px;
margin: 0 auto;
}
.div1
{
width: 500px;
height:600px;
float:left;
}
.div2
{
width: 500px;
height:600px;
float:left;
}
</style>
</head>
<body>
<div class="centerDiv">
<div class="div1">
<object type="text/html" data="https://Somewebsite.com" width="500px" height="600px" style="inline-block:auto;border:5px ridge blue">
</object>
</div>
<div class="div2">
<object type="text/html" data="https://Somewebsite.com" width="500px" height="600px" style="inline-block:auto;border:5px ridge blue">
</object>
</div>
</div>
</body>
</html>
this is a html code I created. when this page is loaded. the two links in the 'div' will also be loaded. In the original link page there will be a username and password to enter. the user will manually enter this username and password and submit it. then a new page will be loaded which will display the current temperature of two sites. what I need is get that temperature value and load it to a MySQL database. this is my problem. what I plan is to get the html of the loaded link. and search for the element temperature and get the temperature value. but I don't know how to grasp the HTML code of the link.
Can Any one help me to grasp the html of link site using php or any other methods!!
Please help.
|
|
|
|
|
|
Thank you for your reply. but how can i get the url from div?
after entering the username and password. url in the div will be changed because a new page will be loaded.
Please help!
|
|
|
|
|
You wrote
Quote: this is a html code I created so I thought that you know the URLs and just want to load them to get the temperatures.
If you want to load a page from a login form, you have to pass the URL with parameters as send by the form when submitting. If this works depends on the form (how the the login parameters are passed). If it is not your site, it is probably intended by the site owner that you can't automate the process. Then you can only ask him if he provides an API to do such.
|
|
|
|
|
https://somewebsite.com/
this site is null
|
|
|
|
|
I'm trying to create a generic template for multiple pages by retrieving them in the database but it does not work. My database is properly enable at the top of my page.
function stmt_query2(){
$conn = pdo_con();
$query = '
SELECT * FROM layout_template as lt
INNER JOIN page_layout as pl ON lt.page_layout_id = pl.page_layout_id
WHERE pl.page_layout_id = 1';
$result = $heidisql->query($query);
return $result;
}
function item_detail() {
$output = '';
$result = stmt_query2();
while($rows = $result->fetch(PDO::FETCH_ASSOC)) {
$output .='<div class="row">';
$output .= '<div class="col-md-3">'
. '<a href="#"><img class="img-fluid rounded mb-3 mb-md-0" src="'.$rows["mainsub_layout_img"].'" alt="'.$rows["mainsub_layout_alt"].'"></a>'
. '</div>';
$output .= '<div class="col-md-5">';
$output .= '<h3>'.$rows["mainsub_layout_heading"].'</h3>';
$output .= '<p class="sub_description">'.$rows["mainsub_layout_txt"].'</p>';
$output .='<a class="btn btn-primary" href="#">Read More</a>';
$output .=' </div>'
. '</div>';
}
return $output;
}
But it work if I did it like that
$conn = pdo_con();
$query = '
SELECT * FROM layout_template as lt
INNER JOIN page_layout as pl ON lt.page_layout_id = pl.page_layout_id
WHERE pl.page_layout_id = 1';
$result = $heidisql->query($query);
while($rows = $result->fetch(PDO::FETCH_ASSOC)) {
$output .='<div class="row">';
$output .= '<div class="col-md-3">'
. '<a href="#"><img class="img-fluid rounded mb-3 mb-md-0" src="'.$rows["mainsub_layout_img"].'" alt="'.$rows["mainsub_layout_alt"].'"></a>'
. '</div>';
$output .= '<div class="col-md-5">';
$output .= '<h3>'.$rows["mainsub_layout_heading"].'</h3>';
$output .= '<p class="sub_description">'.$rows["mainsub_layout_txt"].'</p>';
$output .='<a class="btn btn-primary" href="#">Read More</a>';
$output .='</div></div>';
$output .='<hr>';
}
echo $output;
|
|
|
|
|
You probably have to call
$conn = pdo_con(); outside of the function.
|
|
|
|
|
The chat functionality is developed on a PHP platform and we are using ratchet as our framework. when its hosted on a server with no SSL installed its working as expected. when SSL is installed on the same server, the functionality is not working. The error in back-end is connection time out. We tried steps given in different discussions is stack overflow, no help. Seems challenging !! Roll eyes | Suggestions are most welcome, regarding the issue. Thanks in Advance.
|
|
|
|
|
I know nothing about php so no idea what you are specifically doing wrong...
However when a Client that IS using SSL attempts to connect to a server that is NOT using SSL then when the client attempts to connect a timeout exception will result.
That is because the client is sending specific requests to the server to set up the SSL protocol and the server does nothing with them - it does not respond. And when a client doesn't get a response it eventually times out.
So that is your problem.
Conversely if a client is NOT using SSL and the server IS using SSL then what happens, normally, is that the client will get a 'connection reset by peer' after a bit because the server is expecting the SSL protocol messages and they never arrive. So eventually (again normally) the server will give up and close the socket.
|
|
|
|
|
Good evening, I'm trying to implement access to our site using Facebook sdk (Ver. 5x PHP 5.6), I always get the following
error "Facebook SDK returned an error: No URL set!"
the code I use works fine in another test site (obviously with a different facebook app and secret keys), i really don't know where is the problem I post sources:
This is the index.php code where the button for the login and the call of SDK appears, for obvious security reasons I entered xxxx instead of the site name and other sensitive data.
require_once 'fbConfig.php';
require_once 'User.php';
if(isset($accessToken)){
if(isset($_SESSION['facebook_access_token'])){
$fb->setDefaultAccessToken($_SESSION['facebook_access_token']);
}else{
$_SESSION['facebook_access_token'] = (string) $accessToken;
$oAuth2Client = $fb->getOAuth2Client();
$longLivedAccessToken = $oAuth2Client->getLongLivedAccessToken($_SESSION['facebook_access_token']);
$_SESSION['facebook_access_token'] = (string) $longLivedAccessToken;
$fb->setDefaultAccessToken($_SESSION['facebook_access_token']);
}
if(isset($_GET['code'])){
header('Location: ./');
}
try {
$profileRequest = $fb->get('/me?fields=name,first_name,last_name,email,link,gen der,locale,picture');
$fbUserProfile = $profileRequest->getGraphNode()->asArray();
} catch(FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
session_destroy();
header("Location: ./");
exit;
} catch(FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$user = new User();
$fbUserData = array(
'oauth_provider'=> 'facebook',
'oauth_uid' => $fbUserProfile['id'],
'first_name' => $fbUserProfile['first_name'],
'last_name' => $fbUserProfile['last_name'],
'email' => $fbUserProfile['email'],
'gender' => $fbUserProfile['gender'],
'locale' => $fbUserProfile['locale'],
'picture' => $fbUserProfile['picture']['url'],
'link' => $fbUserProfile['link']
);
$userData = $user->checkUser($fbUserData);
$_SESSION['userData'] = $userData;
$logoutURL = $helper->getLogoutUrl($accessToken, $redirectURL.'logout.php');
if(!empty($userData)){
$output = "<h1>APP ID ".$appId ."</h1>";
$output .= '<h1>Facebook Profile Details </h1>';
$output .= '<img src="'.$userData['picture'].'">';
$output .= '<br/>Facebook ID : ' . $userData['oauth_uid'];
$output .= '<br/>Name : ' . $userData['first_name'].' '.$userData['last_name'];
$output .= '<br/>Email : ' . $userData['email'];
$output .= '<br/>Gender : ' . $userData['gender'];
$output .= '<br/>Locale : ' . $userData['locale'];
$output .= '<br/>Logged in with : Facebook';
$output .= '<br/><a href="'.$userData['link'].'" target="_blank">Click to Visit Facebook Page</a>';
$output .= '<br/>Logout from <a href="'.$logoutURL.'">Facebook</a>';
}else{
$output = '<h3 style="color:red">Some problem occurred, please try again.</h3>';
}
}else{
$loginURL = $helper->getLoginUrl($redirectURL, $fbPermissions);
$output = '<a href="'.htmlspecialchars($loginURL).'"><img src="images/fblogin-btn.png"></a>';
}
?>
<html>
<head>
<title>Login with Facebook using PHP by CodexWorld</title>
<style type="text/css">
h1{font-family:Arial, Helvetica, sans-serif;color:#999999;}
</style>
</head>
<body>
<!--
<div><?php echo $output; ?></div>
</body>
</html>
---------------- fbConfig.php -----------------
<pre lang="PHP">
error_reporting(E_ALL);
if(!session_id()){
session_start();
}
// Include the autoloader provided in the SDK
require_once __DIR__ . '/facebook-php-sdk/autoload.php';
// Include required libraries
use Facebook\Facebook;
use Facebook\Exceptions\FacebookResponseException;
use Facebook\Exceptions\FacebookSDKException;
/*
* Configuration and setup Facebook SDK
*/
$appId = '22xxxxxxxx'; //Facebook App ID
$appSecret = '50xxxxxx'; //Facebook App Secret
$redirectURL = 'http://xxxxx.altervista.org/fbapp0'; //Callback URL
$fbPermissions = array('email'); //Optional permissions
$fb = new Facebook(array(
'app_id' => $appId,
'app_secret' => $appSecret,
'default_graph_version' => 'v2.2',
));
// Get redirect login helper
$helper = $fb->getRedirectLoginHelper();
// Try to get access token
try {
if(isset($_SESSION['facebook_access_token'])){
$accessToken = $_SESSION['facebook_access_token'];
}else{
$accessToken = $helper->getAccessToken();
}
} catch(FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
In the facebook app configuration panel:
Valid OAuth redirect URIs
http://xxxx.altervista.org/ e http://xxxx.altervista.org/fbapp0/
Again, these two scripts copied with the sdk facebook folder on another site work fine, Thanks in advance for the answers, a greeting
|
|
|
|
|
Hi all. Not sure if someone here can help. I'm trying to pass an associative array from Javascript to PHP. I'm 99% certain the Javascript is ok since the callback function works, but here it is just in case:
var purchase, sendDB;
var purchase, sendDB;
sendDB = [{"item":"Boots", "price":"100"}, {"item":"Phone", "price":"800"}, {"item":"AK","price":"600"}];
console.log(sendDB[0].item);
$.post("POS_DB.php", sendDB, function(r){
alert("sending purchase data to php.");
});
However, the php doesn't quite want to accept/process that data. Here's the php code:
$url = 'http://localhost/POS_Proj/testFront.php';
$data = file_get_contents($url);
$p = json_decode($data, true);
print $p[0]->item;
echo $data;
modified 23-Oct-17 22:46pm.
|
|
|
|
|
|
How do I Attach acrobat pdf page which is download from the website that i worked on when i click manually and that pdf attach with send email in codeigniter from controller .MY question is how to send email every month on 1st date automatically to their company's user?
function download_report($serial)
{
$data['rm_data'] = $this->reports_model->get_cyclemachine($serial);
$data['report_data'] = $this->reports_model->get_cycledata($serial);
$data['solar'] = $this->reports_model->is_solar($serial);
$html=$this->load->view('report/rpt_report_data1',$data,true);
/*$this->load->library('m_pdf');
$m_pdf = $this->m_pdf->load();
$pdfFilePath ="/H:/file1.pdf"; //As PDF creation takes a bit of memory,we're saving the created file in downloads
$message=$m_pdf ->WriteHTML($html); //write the HTML into the PDF
$m_pdf ->Output($pdfFilePath, 'D'); */ // save to file because we can
$config = Array(
'protocol'=>'smtp',
'smtp_host'=>''//i have this hostname,user,and password
'smtp_user'=>'',
'smtp_pass'=>'',
'smtp_port'=>'25',
'validation'=>TRUE,
'charset'=>'utf-8',
'wordwrap'=> TRUE,
'mailtype'=>'html'
);
//$to_email= $this->reports_model->get_cyclemachine($serial);
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->set_crlf( "\r\n" );
$this->email->from('');//I have from
$this->email->to('');
$this->email->subject('report');
$this->email->message($html);
//$this->email->attach($html);
//$this->email->attach('/H:/file1.pdf');
if ($this->email->send())
{
echo 'Email send.';
}
else
{
show_error($this->email->print_debugger());
}
modified 17-Oct-17 10:45am.
|
|
|
|
|
Don't try to fit your entire question into the "Subject" box. Put a small summary of your question there, and provide the details in the "Message" box.
Also, format your code properly. Select the code block, and click the "code" button in the toolbar. If that doesn't work, put <pre>...</pre> tags around it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ask about, like this tp5 query table results array
$ data_play array value tracking:
app \ common \ model \ Player :: __ set_state (array (
'auto' =>
array
),
'update' =>
array
),
'connection' =>
array
),
'parent' => NULL,
'query' => NULL,
'name' => 'Player',
'table' => NULL,
'class' => 'app \\ common \\ model \\ Player'
'error' => NULL,
'validate' => NULL,
'pk' => NULL,
'field' =>
array
),
'readonly' =>
array
),
'visible' =>
array
),
'hidden' =>
array
),
'append' =>
array
),
'data' =>
array
'id' => 1,
'lastip' => '25 .36.21.2 ',
'regdate' => '2017-10-10 11:01:52',
'phone' => '1526564161',
'head' => '123',
'meili' => 888,
'jifen' => 888,
'jushu' => 99,
'shenglv' => 60,
'xingyundou' => 8000,
'xingzuan' => 6,
'level' => 'LV1',
'hua' => 200,
'email' => NULL,
'logintime' => '2017-10-09 11:26:47',
'logouttime' => '2017-10-08 11:38:42',
'logincount' => 0,
'hei' => 0,
'red' => 1,
'oldid' => 'bj1',
),
'origin' =>
array
'id' => 1,
'lastip' => '25 .36.21.2 ',
'regdate' => '2017-10-10 11:01:52',
'phone' => '1526564161',
'head' => '123',
'meili' => 888,
'jifen' => 888,
'jushu' => 99,
'shenglv' => 60,
'xingyundou' => 8000,
'xingzuan' => 6,
'level' => 'LV1',
'hua' => 200,
'email' => NULL,
'logintime' => '2017-10-09 11:26:47',
'logouttime' => '2017-10-08 11:38:42',
'logincount' => 0,
'hei' => 0,
'red' => 1,
),
'relation' =>
array
),
'insert' =>
array
),
'autoWriteTimestamp' => false,
'createTime' => 'create_time',
'updateTime' => 'update_time',
'dateFormat' => 'Y-m-d H: i: s',
'type' =>
array
),
'isUpdate' => true,
'updateWhere' =>
array
0 =>
array
0 => 'exp',
1 => 'id = 1',
),
),
'failException' => false,
'useGlobalScope' => true,
'batchValidate' => false,
'resultSetType' => 'array',
'relationWrite' => NULL,
))
How to remove one of the columns? And then save it to another table?
array_splice ($ data, 0, 1); This does not work because the array is not a simple array.
$ w = new \ app \ common \ model \ W;
$ w-> insert ($ data);
Please educated us, thank you!
The following statement will not work! depressed!
$ data = array ();
$ data = $ data_play [0] ['data'];
$ data = array ();
$ data = $ data_play ['data'];
How can I not output this result?
$ data = Db :: table ('tb_p') -> where ('id = 8') -> select ();
file_put_contents ("log.txt", "data:", FILE_APPEND);
file_put_contents ("log.txt", var_export ($ data, true), FILE_APPEND);
$ data = Db :: name ('tb_p') -> where ('id = 8') -> select ();
Why is this? Please educated us!
$ data_player = $ p-> where ("id = $ id") -> find ();
foreach ($ data_player as $ d => $ v) {
file_put_contents ("log.txt", 'd:'. $ d. 'v:'. $ v, FILE_APPEND);
...
Strange, log.txt did not output anything. After tracking, $ data_player is content, the content is the beginning of those content. What's going on?
foreach ($ data_player as $ d => $ v) {
file_put_contents ("log.txt", 'd:', FILE_APPEND);
file_put_contents ("log.txt", $ d, FILE_APPEND);
file_put_contents ("log.txt", 'v:', FILE_APPEND);
file_put_contents ("log.txt", $ v, FILE_APPEND);
Write this or what did not print out!
Please educated us!
|
|
|
|
|
the code in my site is working well except the error that i don't no how to fix it, the error is, when is make a copy and past from ms word or other website to my site to post it, on the page that the post suppose to show it will not show that post but other content(menu,footer etc) will show but that copied content will not show please help.
|
|
|
|
|
Please edit your question and show the code that is not working.
|
|
|
|
|
<?php
require('incfiles/init.php');
$id = (int)$_GET["topic"];
$num=mysql_num_rows(mysql_query("SELECT * FROM topics WHERE id=$id"));
if($id < 1 || $num < 1)
{
$pagetitle = "forum topic not found";
require('incfiles/head.php');
functions::display_error('forum topic not found');
require('incfiles/end.php');
die();
}
if(!functions::isloggedin())
{
functions::go("/login?redirect=$self");
die();
}
$info = mysql_fetch_array(mysql_query("SELECT * FROM topics WHERE id=$id"));
$locked = $info["locked"];
$bid = $info["boardid"];
$title=functions::cleanoutput($info["subject"]);
$banq = mysql_num_rows(mysql_query("SELECT * FROM `bannedusers` WHERE `username`='$user' AND `boardid`=$bid"));
if($banq > 0)
{
$binfo = mysql_fetch_array(mysql_query("SELECT * FROM `bannedusers` WHERE username='$user' AND boardid=$bid"));
$reason = $binfo["reason"];
$date = $binfo["date"];
$unbandate = $binfo["unbandate"];
$today = time();
if($today < $unbandate) {
$pagetitle = "You Have Been Banished By one of the Administrator From Posting On This Board!.";
require('incfiles/head.php');
$ud = date('l jS F Y \a\t g:I A', $unbandate);
$bd = date('l jS F Y \a\t g:I A', $date);
echo "<h2>You Have Been Banished By one of the Administrator From Posting On This Board!.</h2><div class='display'><p>Reason: $reason<p>Banned Date: $bd<p>Unbanned Date: $ud</div>";
require('incfiles/end.php');
die();
} else {
mysql_query("DELETE FROM bannedusers WHERE username='$user' AND boardid=$bid");
$pagetitle = "U have Just Been Unbanned";
require('incfiles/head.php');
$msg="U Hav Just Been Unbanned Pls Refresh This Page";
echo "<div class='display'>$msg<br/></div>";
}
}
$binfo = mysql_fetch_array(mysql_query("SELECT * FROM boards WHERE id=$bid"));
$name = $binfo["name"];
$type = $binfo["type"];
if($type == child)
{
$typeid = $binfo["typeid"];
$qquery = mysql_fetch_array(mysql_query("SELECT * FROM boards WHERE id=$typeid"));
$ftype = $qquery["type"];
if($ftype == child)
{
$typeid2 = $qquery["typeid"];
$qqquery = mysql_fetch_array(mysql_query("SELECT * FROM boards WHERE id='$typeid2'"));
$typename = ' / <a href="'.urls::board($qqquery['name'], $typeid2).'">'.ucwords($qqquery['name']).'</a>';
} else {
$typename = '';
}
$typename .= ' / <a href="'.urls::board($qquery['name'], $typeid).'">'.ucwords($qquery['name']).'</a>';
} else {
$typename .= '';
}
$modcheck = mysql_num_rows(mysql_query("SELECT * FROM moderators WHERE username = '$user' AND boardid = '$bid'"));
$admincheck = mysql_num_rows(mysql_query("SELECT * FROM admins WHERE username = '$user'"));
if($locked > 0 && $admincheck < 1 && $modcheck < 1)
{
$pagetitle = "This topic As Been Locked From Creatin New Post Please Try Again Later";
require('incfiles/head.php');
functions::display_error('This topic As Been Locked From Creatin New Post Please Try Again Later');
require('incfiles/end.php');
die();
}
$tc = mysql_num_rows(mysql_query("SELECT * FROM follow WHERE type='topic' AND follower='$user' AND itemid=$id"));
if($tc < 1) {
$flow = '<input type="checkbox" name="follow" checked="yes" value="on"> Follow this topic';
} else {
$flow = "";
}
if($_GET["post"])
{
$ppid = $_GET["post"];
$qcheck=mysql_num_rows(mysql_query("SELECT * FROM posts WHERE id=$ppid"));
if($qcheck != 1)
{
$pagetitle = "Post Not Found";
require('incfiles/head.php');
functions::display_error('Post Not Found');
require('incfiles/end.php');
die();
}
$qinfo=mysql_fetch_array(mysql_query("SELECT * FROM posts WHERE id=$ppid"));
$qmessage=$qinfo["message"];
$qmessage = preg_replace("(\[quote author=(.+?)\](.+?)\[\/quote\])is","",$qmessage);
$qauthor = $qinfo["poster"];
$qmessage = '[quote author='.$qauthor.']'.$qmessage.'[/quote]';
} else {
$qmessage = "";
}
$pagetitle = "New Post";
$javascript = '<script type="text/javascript" src="http://www.google-analytics.com/ga.js"></script><script type="text/javascript" src="https://www.gistfans.com/static/javascript.js"></script>';
require('incfiles/head.php');
echo '<h2>'.$config->title.' Forum New Post</h2><p class="bold"><a href="/">'.$config->title.' Forum</a>'.$typename.' / <a href="'.urls::board($name, $bid).'">'.$name.'</a> / <a href="">New Post ('.$title.')</a><p>';
echo "<table summary='posting form'><tbody><tr><td class='l'>Please Observe The Following Rules: (<a href='#skip'>skip</a>)<br>1. Please post on topic always. Don't derail or tribalize threads.<br>2. Don't abuse, bully, deliberately insult/provoke, fight, or wish harm to any ".$config->title." member.<br>3. Don't advocate or encourage violent actions against any person, tribe, race, or group of people.<br>4. Discussions of the art of love-makin is highly prohibited on ".$config->title.".<br>5. Don't post pornographic or disgusting pictures or videos on any section of ".$config->title.".<br>6. Don't post adverts or affiliate links outside the areas where adverts are explicitly allowed.<br>7. Don't say or do anything that's detrimental to the security or success of ".$config->title.".<br>8. Don't post false information on ".$config->title.".<br>9. Don't use ".$config->title." for illegal acts, e.g fraud, piracy, and spreading malware.<br>10. Don't expose the identity or post pictures of any ".$config->title." member without his/her consent.<br>11. Don't create distracting posts e.g. posts in giant fonts or ALL CAPS or with silly gifs.<br>12. Don't insert promotional signatures into your posts. Use the signature feature.<br>13. Please report any post or topic that violates the rules of ".$config->title.".<br>14. Please search the forum before creating a new thread on ".$config->title.".<br>15. Don't attempt to post censored words by misspelling them.<br>16. Don't promote MLM schemes, HYIPS, or other questionable schemes on ".$config->title.".<br>18. Don't spam the forum by posting the same content many times.<br>19. Don't create a new account when banned for breaking a rule. If you do, make sure we don't find out.<br>20. Please cooperate with the moderators, super-moderators, and administrator. Treat them with respect. <br>21. Please spell words correctly when you post, and try to use perfect grammar and punctuation.<a name='skip'></a>";
echo '<form method="POST" action="/do_newpost" id="postform" name="postform" enctype="multipart/form-data">
<p>Message:
<div id="editbar" style="display: block">';
?>
<a href="javascript:void(0);" onclick='wrapText("body", "[b]", "[/b]")' title="Bold">
<img src="/icons/bold.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[i]", "[/i]")' title="Italic">
<img src="/icons/italicize.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[s]", "[/s]")' title="Strikethrough">
<img src="/icons/strike.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[left]", "[/left]")' title="Align Left">
<img src="/icons/left.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[right]", "[/right]")' title="Align Right">
<img src="/icons/right.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[center]", "[/center]")' title="Align Center">
<img src="/icons/center.gif"></a>
<a href="javascript:void(0);" onclick='addText("body", "[hr]")' title="Horizontal Rule">
<img src="/icons/hr.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[size=8pt]", "[/size]")' title="Font Size">
<img src="/icons/size.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[font=Lucida Sans Unicode]", "[/font]")' title="Font Face">
<img src="/icons/face.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[img]", "[/img]")' title="Insert Image/Picture">
<img src="/icons/img.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[url]", "[/url]")' title="Insert Hyperlink">
<img src="/icons/url.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[email]", "[/email]")' title="Insert Email">
<img src="/icons/email.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[sub]", "[/sub]")' title="Subscript">
<img src="/icons/sub.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[sup]", "[/sup]")' title="Superscript">
<img src="/icons/sup.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[code]", "[/code]")' title="Code">
<img src="/icons/code.gif"></a>
<a href="javascript:void(0);" onclick='wrapText("body", "[quote]", "[/quote]")' title="Quote">
<img src="/icons/quote.gif"></a>
<a href="javascript:void(0);" onclick='addText("body", " :)")'><img src="/smileys/smiley.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " ;)")'><img src="/smileys/wink.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " :D")'><img src="/smileys/cheesy.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " ;D")'><img src="/smileys/grin.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " >:(")'><img src="/smileys/angry.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " :(")'><img src="/smileys/sad.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " :o")'><img src="/smileys/shocked.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " 8)")'><img src="/smileys/cool.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " ???")'><img src="/smileys/huh.gif" style="width:15px;height:22px;"></a>
<a href="javascript:void(0);" onclick='addText("body", " :P")'><img src="/smileys/tongue.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " :-[")'><img src="/smileys/embarassed.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " :-X")'><img src="/smileys/lipsrsealed.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " :-\\")'><img src="/smileys/undecided.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick='addText("body", " :-*")'><img src="/smileys/kiss.gif" class="smiley"></a>
<a href="javascript:void(0);" onclick="addText("body", " :'(")"><img src="/smileys/cry.gif" class="smiley"></a>
<select onchange="wrapText('body', '[color='+this.options[this.selectedIndex].value+']', '[/color]'); this.selectedIndex = 0;" style="margin-bottom: 1ex;"><option value="" selected="selected">Change Color</option><option value="#990000">Red</option><option value="#006600">Green</option><option value="#000099">Blue</option><option value="#770077">Purple</option><option value="#550000">Brown</option><option value="#000000">Black</option></select>
</div>
<script>document.getElementById("editbar").style.display = 'block';</script>
<textarea rows="12" cols="80" name="body" id="body"><?php echo ''.$qmessage.''; ?></textarea><p>
<input type="submit" name="submit" value="Submit" accesskey="s">
<?php echo ''.$flow.''; ?>
<p>
<?php
echo '<!--<button onclick="previewclick();" type="button">Preview</button>-->
<input type="hidden" name="session" value="'.$sessionkey.'">
<input type="hidden" name="topic" value="'.$id.'">
<div id="attachments" class="clearfix">
<input type="file" name="attachment[]"><br>
<input type="file" name="attachment[]"><br>
<input type="file" name="attachment[]"><br>
<input type="file" name="attachment[]">
</div>
</form></table><p>';
function user_link($user)
{
$sex = functions::user_info($user, 'sex');
if(strlen($sex) == 4)
{
return '<a href="/'.$user.'" class="user">'.$user.'</a>(<span
class="m">m</span>)';
}
elseif(strlen($sex) == 6)
{
return "<a href='/$user' class='user'>$user</a>(<span
class='f'>f</span>)";
}
else {
return "<a href='/$user' class='user'>$user</a>";
}
}
$rowsperpage = $config->postsperpage;
$ppquery = mysql_query("SELECT * FROM posts WHERE topicid=$id AND hide=0 ORDER BY id DESC LIMIT $rowsperpage");
echo '<table summary="posts"><tbody>';
$tt = mysql_num_rows(mysql_query("SELECT * FROM posts WHERE topicid=$id AND hide=0 ORDER BY id DESC"));
$i = $tt;
while($ppinfo = mysql_fetch_assoc($ppquery))
{
$ppid = $ppinfo["id"];
$pposter = functions::cleanoutput($ppinfo["poster"]);
$pmessage = functions::cleanoutput($ppinfo["message"]);
$bbcodes = new bbcode($pmessage);
$pmessage = $bbcodes->display();
$time = time();
$ptdate = functions::maindate($time);
$pdate = functions::display_date(functions::cleanoutput($pinfo["date"]));
echo '<tr><td class=" l"><a name="$ppid"></a><a href="'.urls::topic($title, $id).'#'.$ppid.'" title="'.$ptdate.'">'.$i.'</a>. '.user_link($pposter).': ';
?>
<a href="javascript:void(0);" onclick="quotePost('<?php echo ''.$ppid.''; ?>', '<?php echo ''.$sessionkey.''; ?>')">Quote Post</a><p>
<?php
echo ''.$pmessage.'';
$i--;
}
mysql_free_result($ppquery);
echo '</tbody></table>';
require('incfiles/end.php');
?>
|
|
|
|
|
this the do post code
0)
{
$binfo = mysql_fetch_array(mysql_query("SELECT * FROM `bannedusers` WHERE username='$user' AND boardid=$bid"));
$reason = $binfo["reason"];
$date = $binfo["date"];
$unbandate = $binfo["unbandate"];
$today = time();
if($today < $unbandate) {
$pagetitle = "You Have Been Banished By one of the Administrator From Posting On This Board!.";
require('incfiles/head.php');
$ud = date('l jS F Y \a\t g:I A', $unbandate);
$bd = date('l jS F Y \a\t g:I A', $date);
echo "You Have Been Banished By one of the Administrator From Posting On This Board!.Reason: $reason Banned Date: $bd Unbanned Date: $ud ";
require('incfiles/end.php');
die();
} else {
mysql_query("DELETE FROM bannedusers WHERE username='$user' ANd id=$bid");
$pagetitle = "U have Just Been Unbanned";
require('incfiles/head.php');
$msg="U Hav Just Been Unbanned Pls Refresh This Page";
echo "$msg
";
}
}
$modcheck = mysql_num_rows(mysql_query("SELECT * FROM moderators WHERE username = '$user' AND boardid = '$bid'"));
$admincheck = mysql_num_rows(mysql_query("SELECT * FROM admins WHERE username = '$user'"));
$modcheck2 = mysql_num_rows(mysql_query("SELECT * FROM moderators WHERE username = '$user' AND type = 'super'"));
if($locked > 0 && $admincheck < 1 && $modcheck < 1 && $modcheck2 < 1)
{
$pagetitle = "This topic As Been Locked From Creatin New Post Please Try Again Later";
require('incfiles/head.php');
functions::display_error('This topic As Been Locked From Creatin New Post Please Try Again Later');
require('incfiles/end.php');
die();
}
$erros=array();
if(isset($_FILES["attachment"]))
{
for ($i = 0; $i <= 3; $i++)
{
$ffilename = $_FILES['attachment']['name'][$i];
if($ffilename)
{
$ext = end(explode(".",strtolower($ffilename)));
$valid_exts = $config->validExtension;
$size = $_FILES["attachment"]["size"][$i];
$path = "attachment/".$_FILES['attachment']['name'][$i];
if($size<10)
{
$errors[]="File must be larger than 10Bytes!";
}
if($size>50000000)
{
$errors[]="size too larg!";
}
$img_exts = $config->imgExtension;
if(in_array($ext,$img_exts))
{
if($size > 10000000)
{
$errors[]="size too larg!";
}
}
if(!in_array($ext,$valid_exts))
{
$errors[] ="invalid file extension!";
}
}
}
}
$message = functions::cleaninput($_POST["body"]);
if(empty($message) || strlen($message)<4 || strlen($message)>5000000)
{
$errors[]="Your content is too short or more than 5000000";
}
$ctime = time() - 20;
$pcheck = mysql_num_rows(mysql_query("SELECT * FROM posts WHERE topicid=$id AND date>'$ctime' AND poster='$user' AMD message='$message'"));
if($pcheck > 0)
{
$errors[]="You can't post same post in less than 20sec";
}
if(count($errors) > 0)
{
$string = "";
foreach($errors as $error)
{
$string .= "$error ";
}
$pagetitle = "Error";
require('incfiles/head.php');
functions::display_error($string);
require('incfiles/end.php');
die();
}
$numrows3 = mysql_num_rows(mysql_query("SELECT * FROM posts WHERE topicid=$id"));
$position = $numrows3 + 1;
$date = time();
$query = mysql_query("INSERT INTO posts SET poster='$user', date='$date', topicid='$id', message='$message', type='reply', position='$position'");
if(!$query)
{
$pagetitle = "An error occured";
require('incfiles/head.php');
functions::display_error('An error occured');
require('incfiles/end.php');
die();
}
$fabc = mysql_fetch_array(mysql_query("SELECT * FROM posts WHERE date='$date' AND message='$message' AND topicid='$id'"));
$ffid=$fabc["id"];
if(isset($_FILES["attachment"]))
{
for ($i = 0; $i <= 3; $i++)
{
$ffilename = $_FILES['attachment']['name'][$i];
if($ffilename)
{
$frand=rand(0000, 9999);
$filename = preg_replace('/[^a-zA-Z0-9-_\.]/i','',$_FILES['attachment']['name'][$i]);
$path = $config->attachmentFolder . $frand . preg_replace('/[^a-zA-Z0-9-_\.]/i','',$_FILES['attachment']['name'][$i]);
$sfile = $frand.$filename;
$size = $_FILES["attachment"]["size"][$i];
$ext = end(explode(".",strtolower($ffilename)));
copy($_FILES['attachment']['tmp_name'][$i],
$path);
if(strlen($filename) > 3)
{
mysql_query("INSERT INTO attachment SET `name`='$filename', `by`='$user', `url`='$sfile', size='$size', extension='$ext', `date`='$date', `postid`='$ffid', `topicid`='$id'") or mysql_error();
}
}
}
}
mysql_query("UPDATE topics SET lastposter='$user', lastpostdate='$date' WHERE id=$id");
mysql_query("UPDATE usersfollow SET hasread=hasread+1 WHERE following='$user'");
mysql_query("UPDATE follow SET hasread=hasread+1 WHERE type='topic' AND itemid=$id");
if(isset($_POST["follow"]) && $_POST["follow"] =='on')
{
mysql_query("INSERT INTO follow SET follower='$user', date='$date', itemid='$id', type='topic'");
}
$rowsperpage2 = $config->postsperpage;
$numrows2 = mysql_num_rows(mysql_query("SELECT * FROM posts WHERE topicid='$id'"));
$lpage = ceil($numrows2/$rowsperpage2);
header("location: ".urls::topic($title, $id, $lpage)."#".$ffid."");
exit();
} else {
$pagetitle = "Error";
require('incfiles/head.php');
functions::display_error('Error');
require('incfiles/end.php');
die();
}
?>
|
|
|
|
|
Multiple pages of code, with no explanation; what do you expect from this?
|
|
|
|
|