|
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?
|
|
|
|
|
Hello friends I have a problem I would like to modify an employee but it gives me this error:Fatal error: Call to a member function setcin() on a non-object
I do not understand why. This is my function:
<pre>public function update(employe $employe){
$this->makes();
$this->st=$this->pdo->prepare("update employe set cin=:cin,nom_em=:nom_em,id_grade=:id_grade,id_affectation=:id_affectation,adress=:adress where id_em=:id_em");
$this->st->bindvalue(':cin',$employe->getcin(),pdo::PARAM_STR);
$this->st->bindvalue(':nom_em',$employe->getnom_em(),pdo::PARAM_STR);
$this->st->bindvalue(':id_grade',$employe->getid_grade(),pdo::PARAM_INT );
$this->st->bindvalue(':id_affectation',$employe->getid_affectation(),pdo::PARAM_INT );
$this->st->bindvalue(':adress',$employe->getadress(),pdo::PARAM_STR);
$exe=$this->st->execute();
}
public function read($id_em){
$this->makes();
$this->st=$this->pdo->prepare("select * from employe where id_em=:id_em");
$this->st->bindvalue(':id_em',$id_em,pdo::PARAM_INT );
$exe=$this->st->execute();
}
And here is the call of the function:
<pre><?php
include'manager.php';
$manager=new manager();
$co=$manager->read($_POST["id_em"]);
$co->setcin($_POST['cin']);
$co->setnom_em($_POST['nom_em']);
$co->setid_grade($_POST['id_grade']);
$co->setid_affectation($_POST['id_affectation']);
$co->setadress($_POST['adress']);
$manager->update($co);
?>
and thank you
|
|
|
|
|
$co=$manager->read($_POST["id_em"]);
Most likely the above statement did not return an object from the call to read. You need to find out why that call failed.
|
|
|
|
|
The below I am mentioned my coding while am trying to get Hard Disk Serial Number. But I am getting error command on server side
My Code is :
$serial = shell_exec('wmic DISKDRIVE GET SerialNumber 2>&1');
echo $serial;
localhost Result : SerialNumber 202020202020202020202020365a4445334*****
BUT Server Result :
sh: wmic: command not found
kindly revert me as Correct Solution.
|
|
|
|
|
Lakshmanan Duraisamy wrote: wmic: command not found The correct solution is to install wmic on the target system.
|
|
|
|
|
Lakshmanan Duraisamy wrote: sh: wmic: command not found
You are running Linux on the server which does not know the Windows wmic command.
There are several methods to get disk serial numbers with Linux like using hdparm and udevadm. But all these require to specifiy the device (e.g. /dev/sda) and filter the output for the serial number (e.g. using grep). Just search the web for something like "linux get hard disk serial" for examples.
|
|
|
|
|
Remember, your code is running on the server.
If your intention is to get the serial number of the server's disk, that's fine.
But if you were wanting to get the serial number of the user's disk, your code won't work. And you won't be able to do it from Javascript either, because that doesn't have access to the user's hardware.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Goodmorning everyone.. please i need help with how to connect a php application to a vb.net application to obtain data from it
|
|
|
|
|
|
I'm trying to create a secure login script, but my code doesn't seem optimal. It seems to work but I'd like to know if there is a way I could optimize things and make it more secure.
<pre lang="PHP">
<pre><?php
include 'dbconnect.php';
//Database information
if (isset($_POST['submit'])){ //Was the form submitted?
$error = array();//Declare An Array to store any error message
if (filter_var($_POST['Email'], FILTER_VALIDATE_EMAIL)) { //Check to see if email is valid.
$validatedemail = $_POST['Email'];
//Now we know that the email is valid. Let's run some Queries
$sql = "SELECT * FROM users WHERE email = '$validatedemail'";
$result = mysql_query($sql);
$num_result = mysql_numrows($result);
$row = mysql_fetch_row($result);
if ($num_result== 1) {
if ($row[2] == sha1($_POST['Password'])) {
echo "MEGA SUCCESS";
}
else {$error[] = "Passwords do not match";}
}
else {$error[] = "No user found";}
}
else {$error[] = "Not a valid Email";}
}
echo
"<div class=\"errormsgbox\"> <ol>";
foreach ($error as $key => $values) {
echo "<li>".$values."</li>";
}
echo "<form class=\"login\" action=\"login.php\" method=\"post\">
<p class=\"title\">Log in</p>
<input type=\"text\" name=\"Email\" placeholder=\"Email\" autofocus/>
"fa">
<input type=\"Password\" name=\"Password\" placeholder=\"Password\" />
<button>
^__i class=\"spinner\">
<input type=\"submit\" name=\"submit\" value=\"Login!\">
</button>
</form>";
?>
Thanks guys
|
|
|
|
|