|
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
|
|
|
|
|
Actually, the best way to optimize your Secure login is by slowing it down.
The login page is exposed to all the world wide web, including automated scripts. If you add a "Do Nothing" line that waste an increasing number of seconds for every attempt right before querying your DB, it will slow down scripts from finding a way in. It will also helps in guaranteeing DB bandwidth to your real users, in case someone is requesting 10000 logins per second.
Claudio
|
|
|
|
|
I have a pretty simple multidimensional array.
Array (
[183] => Array (
[info] => Array (
[name] => Ben
[points] => 4800
)
)
[380] => Array (
[info] => Array (
[name] => Ruben
[points] => 14500
)
)
[450] => Array (
[info] => Array (
[name] => Alex
[points] => 4800
)
)
)
I also have some PHP code. It sorts the array.
The first criteria is points which will be sorted descending. The second criteria is name which will be sorted ascending.
uasort($array, function($a, $b)
{
if ($a['info']['points'] == $b['info']['points'])
{
return strcmp($a['info']['name'], $b['info']['name']);
}
return $b['info']['points'] - $a['info']['points'];
});
After my code does its job, the array looks like this:
Array (
[380] => Array (
[info] => Array (
[name] => Ruben
[points] => 14500
)
)
[450] => Array (
[info] => Array (
[name] => Alex
[points] => 4800
)
)
[183] => Array (
[info] => Array (
[name] => Ben
[points] => 4800
)
)
)
Sorting goes just fine, but I also would like to add position numbers while sorting the array.
In other words, if the points are better, the position is better. If the points are equal, the position must be equal.
The final array should look like this:
Array (
[380] => Array (
[info] => Array (
[name] => Ruben
[points] => 14500
[position] => 1
)
)
[450] => Array (
[info] => Array (
[name] => Alex
[points] => 4800
[position] => 2 /* because Alex has less points than Ruben */
)
)
[183] => Array (
[info] => Array (
[name] => Ben
[points] => 4800
[position] => 2 /* because Ben has same points with Alex */
)
)
)
So, how could I add those position numbers? The faster way, the better way.
http://btsoft.vn/thiet-ke-web-hcm
|
|
|
|
|
Hello everyone i need to hashed my password when i put it in my login application android and then i need to compare it with my password in my table fos_user of symfony and the password in fos_user is encoders:bcrypt
This is my code:
<?php
include 'config.inc.php';
if(isset($_POST['username']) && isset($_POST['password']))
{
$result='';
$username = $_POST['username'];
$password = $_POST['password'];
$hash = password_hash($password, PASSWORD_BCRYPT);
$sql = "SELECT password FROM fos_user WHERE username = '$username' AND password = '$hash'";
$test = mysql_query($sql) or die( mysql_error() );
$row = mysql_fetch_assoc($test);
if ($hash == $row['password'])
{
$result="true";
}
else
{
$result="false";
}
echo $result;
}
?>
My file config.inc.php is this code:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "projet_grh";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
die("OOPs something went wrong");
}
?>
|
|
|
|
|
There is no need to compare the password hash because that is already done by the SQL query.
Omit calling mysql_fetch_assoc and use PHP: mysql_num_rows - Manual[^] instead to check if a matching recordset has been found (optionally after checking for errors by testing if $test is false).
|
|
|
|
|
I test this code but the same problem
<?php
if(isset($_POST['username']) && isset($_POST['password']))
{
$link = mysql_connect("localhost", "root", "");
mysql_select_db("projet_grh", $link);
$result='';
$username = $_POST['username'];
$password = $_POST['password'];
$hash = password_hash($password, PASSWORD_BCRYPT);
$sql = mysql_query("SELECT password FROM fos_user WHERE username = '$username' AND password = '$hash'", $link);
$num_rows = mysql_num_rows($sql);
if (($num_rows == 0))
{
$result="false";
}
else
{
$result="true";
}
echo $result;
}
?>
|
|
|
|
|
What kind of problem?
You never specified any.
Are all mysql calls successful (you did not check for errors)?
Is the hash wrong?
|
|
|
|
|
i do this code in my application android
if(result.equalsIgnoreCase("true"))
{
Intent intent2 = new Intent(MainActivity.this,Main2Activity.class);
startActivity(intent2);
MainActivity.this.finish();
}else if (result.equalsIgnoreCase("false")){
Toast.makeText(MainActivity.this, "nom utilisateurs ou mot de passe incorrect", Toast.LENGTH_LONG).show();
all the time php return the result false and show me the message "nom utilisateurs ou mot de passe incorrect"
|
|
|
|
|
Check the status of all mysql calls and return an error message if a call failed. Then show that error message within your application.
Only then you will know what is happening.
|
|
|
|
|
Programming buddies,
I'm back online after nearly 2wks of offline. Gonna be harassing you guys again and more this time. Eeek!
Anyway, right now, I'm trying to build a script that adds multi entries into same single cell or mysql row.
The script tries monitoring what you are browsing via the:
<pre><input type="text" name="browse_url" size="120">
and then record your viewed urls into the same row (position: 0), column: browsings like so:
1.com,2.com and so on.
So, at first, the mysql array or cell is blank. When you view a url (eg.) 1.com then the array would show like this:
1.com
And then afterwards, if you view facebook.com then the cell should get updated by first grabbing the previously viewed urls and then adding the latest url onto the same cell/array like so (each url separated by comma):
1.com,facebook.com
Throw your precious eyes on line 79 onwards on both sample scripts. I reckon the 1st script is no good but the 2nd should work. Gave you both scripts to show the variety of ways I attempted.
Sample 1:
[php]
<?php
session_start();
require "conn.php";
require "site_details.php";
if(!isset($_SESSION["user"]))
{
header("location:login.php");
}
else
{
$user = $_SESSION["user"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Browse!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
<p>
<p>
<?php
?>
<iframe src='<?php echo $db_latest_view;?>'></iframe>
<p>
<p>
<p>
<form method="post" action="">
<table border="1" width="50%">
<tr>
<td width="10">Url: </td>
<td><input type="text" name="browse_url" size="120"></td>
</tr>
<tr>
<td width="10">Browse: </td>
<td>
<select name="browsing_type">
<OPTION>Anonymous Browsing</OPTION>
<OPTION>Group Browsing</OPTION>
</SELECT>
</td>
</tr>
<td></td>
<td><input type="submit" name="browse" size="50" value="Browse"><input type="submit" name="search_keywords" size="50" value="Search Keywords"></td>
<tr>
<td width="10">Message: </td><td><textarea name="message" cols="120" rows="10"></textarea></td>
</tr>
<tr>
<td></td>
<td width="50"><input type="submit" name="submit_message" size="50" value="Send Message!"></td>
</tr>
<p>
<p>
</table>
</form>
<?php
if(isset($_REQUEST['browse']))
{
$browse_url = trim(strip_tags(strtolower(mysqli_real_escape_string($conn,$_POST["browse_url"]))));
$browsing_type = trim(strip_tags(strtolower(mysqli_real_escape_string($conn,$_POST["browsing_type"]))));
$sql = "SELECT * FROM users WHERE usernames = '".$user."'";
$result = mysqli_query($conn,$sql);
$numrows = mysqli_num_rows($result);
if($numrows)
{
while($row = mysqli_fetch_assoc($result))
{
$db_user_browsings = $row["browsings"];
}
$sql = "INSERT INTO users(browsings) VALUES('".$browse_url."''".$db_user_browsings."')";
$result = mysqli_query($conn,$sql);
if($sql)
{
echo "true";
}
$sql = "UPDATE users SET browsings_latest = '".$browse_url."' WHERE usernames = '".$user."'";
$result = mysqli_query($conn,$sql);
if($sql)
{
echo "true";
}
}
}
}
?>
[/php]
Sample 2
[php]
<?php
session_start();
require "conn.php";
require "site_details.php";
if(!isset($_SESSION["user"]))
{
header("location:login.php");
}
else
{
$user = $_SESSION["user"];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Browse!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
<p>
<p>
<?php
?>
<iframe src='<?php echo $db_latest_view;?>'></iframe>
<p>
<p>
<p>
<form method="post" action="">
<table border="1" width="50%">
<tr>
<td width="10">Url: </td>
<td><input type="text" name="browse_url" size="120"></td>
</tr>
<tr>
<td width="10">Browse: </td>
<td>
<select name="browsing_type">
<OPTION>Anonymous Browsing</OPTION>
<OPTION>Group Browsing</OPTION>
</SELECT>
</td>
</tr>
<td></td>
<td><input type="submit" name="browse" size="50" value="Browse"><input type="submit" name="search_keywords" size="50" value="Search Keywords"></td>
<tr>
<td width="10">Message: </td><td><textarea name="message" cols="120" rows="10"></textarea></td>
</tr>
<tr>
<td></td>
<td width="50"><input type="submit" name="submit_message" size="50" value="Send Message!"></td>
</tr>
<p>
<p>
</table>
</form>
<?php
if(isset($_REQUEST['browse']))
{
$browse_url = trim(strip_tags(strtolower(mysqli_real_escape_string($conn,$_POST["browse_url"]))));
$browsing_type = trim(strip_tags(strtolower(mysqli_real_escape_string($conn,$_POST["browsing_type"]))));
$sql = "SELECT * FROM users WHERE usernames = '".$user."'";
$result = mysqli_query($conn,$sql);
$numrows = mysqli_num_rows($result);
if($numrows)
{
while($row = mysqli_fetch_assoc($result))
{
$db_user_browsings = $row["browsings"];
}
$sql = "UPDATE users SET browsings = '".$browse_url."''".$db_user_browsings."' WHERE usernames = '".$user."'";
$result = mysqli_query($conn,$sql);
if($sql)
{
echo "true";
}
$sql = "UPDATE users SET browsings_latest = '".$browse_url."' WHERE usernames = '".$user."'";
$result = mysqli_query($conn,$sql);
if($sql)
{
echo "true";
}
}
}
}
?>
[/php]
|
|
|
|
|
You appear to be spamming because you are posting "weird" statements without asking questions. Shape up or get shipped out.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|