Jump to content

AzeS

Members
  • Posts

    88
  • Joined

  • Last visited

Everything posted by AzeS

  1. im trying to open a modal div after the triggering event from a form, and it doesnt work, soon as i click the button it Flashes briefly anfd then... nothing php if (isset($_POST['btn_exe_det_prf'])) { $id = strip_tags($_POST['btn_exe_det_prf']); $id = trim($id); $reviews = $profile->coment_get($id); echo $id; echo "<script> $(window).Onload(Despair()); </script>"; } js <script> // Get the modal var modal = document.getElementById('myModal'); // Get the button that opens the modal var btn = document.getElementById("myBtn"); // Get the <span> element that closes the modal var span = document.getElementsByClassName("close")[0]; // When the user clicks the button, open the modal function Despair() { modal.style.display = "block"; } // When the user clicks on <span> (x), close the modal span.onclick = function() { modal.style.display = "none"; } // When the user clicks anywhere outside of the modal, close it window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } </script>
  2. $res = $sql->fetch(PDO::FETCH_ASSOC);
  3. Im trying to read two specifec columns from the user profile, i cant read them, i cant return them but evantually i can check them by an if staetment Public function get($ADDRESS) { try { $sql = $this->Db->prepare("SELECT OID,SLEEP FROM profiles WHERE ADDR=:e"); $sql->execute(array(':e' => $ADDRESS)); $res = $sql->fetchAll(); #var_dump($res); echo "S::::-"; echo $res['SLEEP']; echo "-::::EOS"; if (count($res)) { if ($res['SLEEP'] == 1 ) { return 0; } echo "D:::::-"; echo $res["ESTABLISHED_SINCE"]; echo "-:::::EOD"; $OID = $res['OID']; echo ":::::-"; echo $OID; echo "-:::::"; $sql = $this->Db->prepare("SELECT * FROM plout WHERE owner=:e"); $sql->execute(array(':e' => $OID)); $res_get_layout = $sql->fetchAll(); echo "string;:"; var_dump($res_get_layout); if (count($res_get_layout)) { $sql = $this->Db->prepare("SELECT * FROM postss WHERE ownerid=:e AND CANCELED=:f"); $sql->execute(array(':e' => $OID, ':f' => 0 )); $res_get_posts = $sql->fetchAll(); if (count($res_get_posts)) { $stack = array('POSTS' => $res_get_posts, 'LAYOUT' => $res_get_layout); var_dump($stack); return $stack; } else { return 0; # FATAL(REPORT) } } else { return 0; # FATAL(REPORT) } return 1; } else { return 0; } } catch (PDOException $ex) { echo $ex->getMessage(); return 0; }
  4. If you are going to allow an arbitrary number of images, then you need to figure out the workflow from the user's perspective. Do you want to allow them to upload multiple images at one time or only one image at a time. This might be a scenario where you have a special area to manage images. I can't really say since I don't know what you are doing. thats wy i asked in the first place, i decided that it can be implement for me if i use the "for each picture one upload button" method but i also liked to do an all at once button... and thats wy i asked for advise; because i dont have even a clue on how to get around this. its mostly for practice.
  5. Your original question was about updating a user profile. This code is about uploading and saving(?) a file. i thought that the phrase upic was understandeble. What is the connection? i dont undersatand your question here... Id like to give the user the oppertunity to design his profile with pics and vids... so before i started coding, i thought to myself why not ask experienced devops that might have done this before, so that i dont do the bible of code and just mess up with things u know And does one really need a class to upload a file? I guess so eventually, there are two images and one video, for each distrubution an method on the page seems ridicolos for me
  6. yea, i do my own forum, so its necesary, thats wy i asked in the first place, im just an native english speaker so sorry for my grammer.. i Thought because of the "upic" phrase i used in my exampels that it was clear... thats wy i asked in the firstplace anyway xD and i think a class is necassary because i want to give the user the opportunity to update several images at once ok not exactly at once (im working on that so tips are welcome) but fast and effecient with the click of a button
  7. So, time pased, i did alot of code and this is the result that i've come up to: Any suggestions ? Before you say something... its not ready yet i know the exec is missing ^^ <?php class iop { private $Db; function __construct($DB_CON) { $this->Db = $DB_CON; } public function uloader ($OID,$FILE,$stmt) { switch ($stmt) { case 0: #HEAD $sql = $this->Db->prepare("SELECT aboutpic FROM prflout WHERE owner=:e"); $res = $sql->fetchall(); break; case 1: #VID $sql = $this->Db->prepare("SELECT vid FROM prflout WHERE owner=:e"); $res = $sql->fetchall(); break; case 2 #FOOT $sql = $this->Db->prepare("SELECT impress FROM prflout WHERE owner=:e"); $res = $sql->fetchall(); break; case 3 #TEXT $sql = $this->Db->prepare("UPDATE prflout SET Aboutme=:f WHERE owner=:e"); $sql->execute(array(':f' => $FILE, ':e' => $OID)); $fmsg = "changed succesfully."; return $fmsg; break; default: # code... break; } # Delete old files and rewrite in db for udate $dir = $sdir; $fname = $FILE['name']; $ftmp = $FILE['tmp_name']; $ftype = $FILE['type']; $fsize = $FILE['size']; $ferr = $FILE['error']; $fname = preg_replace("/[^A-Z0-9._-]/i", "_", $fname); $fname = date("Y.m.d H.i.s") . rand() . $fname; if (!$ftmp) { $fmsg = "Error: youve not choosen a file please do so in order t upload a file."; return $fmsg; exit(); } if ($ftype != 'video/mp4' || $ftype != 'image/png') { $fmsg = "only mp4 files are allowed where sorry for that. Please upload a mp4 video"; return $fmsg; } if ($ferr !== UPLOAD_ERR_OK) { $fmsg = "An error occurred"; return $fmsg; exit; } $i = 0; $parts = pathinfo($fname); while (file_exists($dir . $fname)) { $i++; $fname = $parts["filename"] . "-" . $i . "." . $parts["extension"]; } $success = move_uploaded_file($ftmp, $dir . $fname); if (!$success) { $fmsg = "upload failed"; return $fmsg; } $f_dir = $dir . $fname; chmod($f_dir, 0644); if !(is_null($res)) { unlink($res); } switch ($stmt) { case 0: #HEAD #Updatedb $sql = $this->Db->prepare("UPDATE prflout SET aboutpic=:e"); $sql->execute(array(':e' => $f_dir)); break; case 1: #VID $sql = $this->Db->prepare("UPDATE prflout SET vid=:e"); $sql->execute(array(':e' => $f_dir)); break; case 2 #FOOT $sql = $this->Db->prepare("UPDATE prflout SET impress=:e"); $sql->execute(array(':e' => $f_dir)); break; default: # code... break; } $fmsg = "upload complete"; return $fmsg; } } ?>
  8. I have a problem with a decision.... i want to give the user the opportunity to update his profile... so how do i get around this the smartest way ? i know how to, but not what the most effective way would be like... i thought about putting all in a function and running it via switch case or maybe for each item a function or update everything at once [edited img=https://media.giphy.com/media/YsTs5ltWtEhnq/giphy.gif] like : Exmp 1 func upic1($id) { sql do your magic thing ! } func upic2($id) { sql you holy wizard ! } func upic3($id) { sql trickshot ! } Exmp 2 func uallpics($stmt,$id) { Switch $stmt { case upic1 sql do your magic thing ! case upic2 sql you holy wizard ! case upic3 sql trickshot ! default sql overload !! } } Exmp 3 func uallpic($id){ sql overload !! }
  9. --> changed dir var to ../../VID/ it works now needed to change the ini a little more... post_max_size upload_max_filesize memory_limit to 1000M thanks alot !
  10. yea i know its meant to be that way ill do this later... xD ive changed the dir var now and it works... but still i cant upload videos to my server
  11. AzeS

    Hello there

    After a little while in this forum i'd like to intruduce my self AzeS my synonyme in the scene... Im from germany so forgive me for my bad english i started programming as a whole thing when i was 11 years old. now im =<18 and i've learned following langueges so far: vb.net['id concider myself a professional xD'] c++['Basics'] c#['Basics'] c['Basics'] to be honest i had a few breaks in my hobby carrier... so dont judge me if my knowledge is a bit sturdy now... but after two years of military im back in the game and like to establish some forums for my community 47 people by now xD and some wsites jff to earn a little extra money, as i do my regular job. i've never had the intention to earn money with programming because i did it for the joy of putting rules together so that something new arises but now i changed my mindset a little and thought to my self wy dont you go ahead and do something with your talent... so here i am learning php and js so that i can establish some platforms for my ideas that are coming up and up around 28 by now so i decided to join a forum so that i can learn faster... i stumbled across many of them untill i found this forum... and it is perfect the responses are comming fast and evrybody is helpful around here so i'd like to say thank you and will do my best to also help others when i gained enough knowlege Sincerly, AzeS
  12. So there are three major problems in my script securityi will do this by my self... so dont judge me for issues in this specific topic i just started this... upload dir won't work instead it drops the file in the main dir where the index lays... and names it with vid instead of putting it to the vid dir it cant upload videos somehow...i already changed the ini so that files in size of 1gb can be uploaded on to the server. there are no errors displayed: Code: Vidbase.php -> public function doupload ($UID,$TAGS,$VTITLE,$VDESCRIPTION,$VIDEO,$QUESTIONS,$GENRE) { $dir = "../../VID"; $fname = $VIDEO['name']; $ftmp = $VIDEO['tmp_name']; $ftype = $VIDEO['type']; $fsize = $VIDEO['size']; $ferr = $VIDEO['error']; $fname = preg_replace("/[^A-Z0-9._-]/i", "_", $fname); if (!$ftmp) { $fmsg = "Error: youve not choosen a file please do so in order t upload a file."; return $fmsg; } if ($ferr !== UPLOAD_ERR_OK) { $fmsg = "An error occurred"; return $fmsg; exit; } $i = 0; $parts = pathinfo($fname); while (file_exists($dir . $fname)) { $i++; $fname = $parts["filename"] . "-" . $i . "." . $parts["extension"]; } $success = move_uploaded_file($ftmp, $dir . $fname); if (!$success) { $fmsg = "upload failed"; return $fmsg; } chmod($dir . $fname, 0644); $fmsg = "upload complete"; return $fmsg; } upload.php <?php if (isset($_POST['submit'])) { $vid->doupload($userRow['userId'],null,"TITLE","DESCR",$_FILES['file'],null,"tech"); } ?> <form id="upload_form" enctype="multipart/form-data" method="post"> <input type="file" name="file" id="file1"><br> <button name="submit">UPLOAD</button> <progress id="progressBar" value="0" max="100" style="width:300px;"></progress> <h3 id="status"></h3> <p id="loaded_n_total"></p> </form> any sugestions ?
  13. !!! SOLVED !!! What was i doing wrong ? as i early mentioned i tried to "move a variable upwards" this seems to be impossible for php at least nobody had a suggestion so my scraped up mind did came up with an great idea!! wy not move them downwards and lift them with the post method... i know it seems obvios but as leazy and sadistic i am i tried to ask the community for help ... but enough of my stupiditie and see what i did wrong... corrected code below: EVENT: if (isset($_POST['smsg'])) { $OBJECT = strip_tags($_POST['smsginp']); $OBJECT = trim($OBJECT); $OBJECT = str_split($OBJECT, 255); $SENDER = strip_tags($_POST['SESSID']); $SENDER = trim($SENDER); $RECIVER = strip_tags($_POST['RECIVER']); $RECIVER = trim($RECIVER); $SESSID = strip_tags($_POST['SESSID']); $SESSID = trim($SESSID); echo $SESSID; if (isset($OBJECT[1])) { $res = $crud->sendmsg($SENDER,$RECIVER,$OBJECT[0],$OBJECT[1],$SESSID,0); } else { $res = $crud->sendmsg($SENDER,$RECIVER,$OBJECT[0],null,$SESSID,0); } if ($res != 0 ) { $msg = "Your message has been sended succesfully."; } else { $msg = "there was been an error sending your message you might report a bug."; } } if (isset($_POST['sdestroy'])) { $res = $crud->sendmsg($SENDER,$RECIVER,"closing the session",null,$SESSID,0); if ($res != 0 ) { $msg = "session has been closed we hope we could help you with your problem"; } else { $msg = "there was been an error closing the session you might report a bug."; } } method: <div class="HeZ Body_E01" id="chatcz"> <ul> <?php $cond = $crud->check($ID); if ($cond > 0) { $ROWS_SESS = $crud->THOUTSESS($ID); $SESSID = $ROWS_SESS['SESSID']; $SENDER = $ID; $RECIVER = $ROWS_SESS['FROM_']; echo "THIS SESSID CURRENT__:" . $SESSID . "<br>"; echo "THIS SENDER CURRENT__:" . $SENDER . "<br>"; echo "THIS RECIVER CURRENT_:" . $RECIVER . "<br>"; $CBA = 1; $smsgtoutall = $crud->getmsg($SESSID); if ($smsgtoutall == 0 ) { echo "<li><p>there are currently no items to display yet..." . "</p></li>"; } else { foreach($smsgtoutall as $row) { if ($row['FROM_'] == $ID) { $SENDERN = "You"; } else { $SENDERN = "Employe"; } echo "<li><p>" . $crud->word($SENDERN, 'UTF-8') . ": " . $crud->word($row['SUBJECT'], 'UTF-8') . $crud->word($row['SUBJECT_2'], 'UTF-8') . "</p><p> " . $crud->word($row['TIMEST'], 'UTF-8') . "</p></li>"; } } } else { echo $crud->check($ID); echo "<br>this: " . $cond; } ?> </ul> </div> <div class="CZ3"> <form method="POST" class="CZT"> <center>You have <input disabled maxlength="3" size="1" value="510" id="counter2"> Characters left</center> <div id="chatcz"> <input type="text" name="SESSID" value="<?php echo $crud->word($SESSID, 'UTF-8') ?>"> <input type="text" name="SENDER" value="<?php echo $crud->word($SENDER, 'UTF-8')?>"> <input type="text" name="RECIVER" value="<?php echo $crud->word($RECIVER, 'UTF-8')?>"> </div> <textarea placeholder="Message..." maxlength="510" name="smsginp" cols="55" rows="5" onkeyup="textCounter(this,'counter2',510);" id="message" > </textarea> <button name="smsg">Send</button> <button name="sdestroy">End Session</button> <p>Or</p> <button name="report">Report abuse</button> </form> </div> Sincerly, AzeS. P.S. #WORKING PHP CHAT APP
  14. yes i do realiz that but in this case i need to update an specific block of php code so that all the data gets frequently displayed, in this case all five seconds. and yes i have a hard time learning php but i will keep my style as i do so in vb... so mention following : i have a var on a function that needs to be declared so it can be returned: public function bla($var2) { return $var2; } and i have a function that needs to be updatet every single 5 seconds magic five seconds code as an single thread.... code thats need to be updatet $var2 = "bla"; and now i have an event that gives the var to the function. $this->bla($var2); but the problem is that var2 is still null..
  15. its likle var 1 is on top and var 2 is on the bottom so how do i get var2 from the bottom to the top ?
  16. its huge thats wy i didnt postet all code... but here we go: Ajax.js for updating the specified div : var timeout = setTimeout(reloadChat, 5000); function reloadChat () { $('#chatcz').load('Help.php #chatcz',function () { $(this).unwrap(); timeout = setTimeout(reloadChat, 5000); }); } send msg code : public function sendmsg($FROM,$TO,$SUB1,$SUB2,$SESSID,$END) { #csessionschat try { $sql = $this->Db->prepare("INSERT INTO csessionschat(FROM_,TO_,SUBJECT,SUBJECT_2,SESSID,ENDSESS) VALUES (:f,:t,:s1,:s2,:si,:e)"); $sql->execute(array(':f' => $FROM, ':t' => $TO, ':s1' => $SUB1, ':s2' => $SUB2, ':si' => $SESSID, ':e' => $END)); if ($END != 0) { $this->killsess($SESSID); } } catch (PDOException $ex) { echo $ex->getMessage(); return 0; } } Help.php: <?php #error_reporting( ~E_NOTICE ); ob_start(); session_start(); require_once '../dbconnect.php'; if( !isset($_SESSION['user']) ) { header("Location: index.php?reqlog"); exit; } $userRow=$crud->getuser($_SESSION['user']); $ID = $userRow['userId']; $cond=0; $CBA=0; global $SENDER, $RECIVER, $SESSID; if (isset($_POST['submit'])) { $BLOCK = $userRow['BLOCK']; $MAIL = $userRow['userEmail']; $TAG = strip_tags($_POST['tag']); $TAG = trim($TAG); if ($BLOCK > 0) { $msg = "Your Blocked for this service " . $crud->word($userRow['UzRI'], 'UTF-8') . " <br>why dont you check on your emails and see the reason why; for taking some further aktions and getting around, faced to this fact? <br>or maybe you contact us via email at: support@(NAME_).com for some help to get arround this problem."; } else { if (!empty($_POST['reason']) || $TAG != "Please select a tag.") { $rs = strip_tags($_POST['reason']); $rs = trim($rs); $rs = str_split($rs, 255); if (isset($rs[1])) { $res = $crud->sendticket($ID,$rs[0],$rs[1],$TAG,$MAIL); } else { $res = $crud->sendticket($ID,$rs[0],null,$TAG,$MAIL); } if ($res != 0 && $res != 2) { $msg = "Your request for help have been succesfully submited " . $crud->word($userRow['UzRI'], 'UTF-8') . "."; } else { if ($res == 2) { $msg = "You already submitted a ticket " . $crud->word($userRow['UzRI'], 'UTF-8') . " wy dont you wait a little more? An service providing employe will be there for you soon. <br>Remember, by leaving this page your ticket will be deleted."; } else { $msg = "There was been an error " . $crud->word($userRow['UzRI'], 'UTF-8') . ". Maybe you try it later again"; } } } else { $msg = "All inputs must be filled for sending your help request to us " . $crud->word($userRow['UzRI'], 'UTF-8') . "."; } } } if (isset($_POST['smsg'])) { $OBJECT = strip_tags($_POST['smsginp']); $OBJECT = trim($OBJECT); $OBJECT = str_split($OBJECT, 255); if (isset($OBJECT[1])) { $res = $crud->sendmsg($SENDER,$RECIVER,$OBJECT[0],$OBJECT[1],$SESSID,0); } else { $res = $crud->sendmsg($SENDER,$RECIVER,$OBJECT[0],null,$SESSID,0); } if ($res != 0 ) { $msg = "Your message has been sended succesfully."; } else { $msg = "there was been an error sending your message you might report a bug."; } } if (isset($_POST['sdestroy'])) { $res = $crud->sendmsg($SENDER,$RECIVER,"closing the session",null,$SESSID,0); if ($res != 0 ) { $msg = "session has been closed we hope we could help you with your problem"; } else { $msg = "there was been an error closing the session you might report a bug."; } } ?> <!DOCTYPE html> <html> <HEAD> <link rel="stylesheet" href="../css/style.css"> <link rel="stylesheet" href="../css/normalize.css"> <title>Welcome - <?php echo $userRow['userEmail']; ?></title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script type="text/javascript" src="../js/ajax.js"></script> <script> function textCounter(field,field2,maxlimit) { var countfield = document.getElementById(field2); if ( field.value.length > maxlimit ) { field.value = field.value.substring( 0, maxlimit ); return false; } else { countfield.value = maxlimit - field.value.length; } } </script> </HEAD> <BODY> <div class="HeaderC" > <DIV class="Header"> <header class="Header clearfix"> <a class="logo" href="../index.php"> <img src="../IMG/LAY/Logo.png" height="85" alt=""> </a> <nav> *** </nav> </header> </DIV> </form> *** </div> <div class="Space_0 Background_0"></div> <div class="Space_0 Background_1"></div> <div class="Space_0 Background_1"></div> <div class="CZC0"> <div class="CZ0"> <form method="POST" class="CZT"> <center>You have <input disabled maxlength="3" size="1" value="510" id="counter"> Characters left</center> <textarea placeholder="Please describe what exactly went wrong, after submitting your problem we will be there for you as fast as we can. Usualy it takes around 1 to 15 minutes." name="reason" cols="110" rows="10" maxlength="510" onkeyup="textCounter(this,'counter',510);" id="message" ></textarea> <select name="tag"> <option>Please select a tag.</option> <option>REASON 1</option> <option>REASON 2</option> <option>REASON 3</option> <option>REASON 4</option> <option>OTHER</option> </select> <button name="submit">Submit</button> </form> </div> </div> <div class="CZC1"> <div class="CZ1"> <?php if (isset($msg)) { echo $msg; } ?> </div> <div class="HeZ Body_E01" id="chatcz"> <ul> <?php $cond = $crud->check($ID); if ($cond > 0) { $ROWS_SESS = $crud->THOUTSESS($ID); $SESSID = $ROWS_SESS['SESSID']; $SENDER = $ID; $RECIVER = $ROWS_SESS['FROM_']; echo "THIS SESSID CURRENT__:" . $SESSID . "<br>"; echo "THIS SENDER CURRENT__:" . $SENDER . "<br>"; echo "THIS RECIVER CURRENT_:" . $RECIVER . "<br>"; $CBA = 1; $smsgtoutall = $crud->getmsg($SESSID); if ($smsgtoutall == 0 ) { echo "<li><p>there are currently no items to display yet..." . "</p></li>"; } else { foreach($smsgtoutall as $row) { if ($row['FROM_'] == $ID) { $SENDERN = "You"; } else { $SENDERN = "Employe"; } echo "<li><p>" . $crud->word($SENDERN, 'UTF-8') . ": " . $crud->word($row['SUBJECT'], 'UTF-8') . $crud->word($row['SUBJECT_2'], 'UTF-8') . "</p><p> " . $crud->word($row['TIMEST'], 'UTF-8') . "</p></li>"; } } } else { echo $crud->check($ID); echo "<br>this: " . $cond; } ?> </ul> </div> <div class="CZ3"> <form method="POST" class="CZT"> <center>You have <input disabled maxlength="3" size="1" value="510" id="counter2"> Characters left</center> <textarea placeholder="Message..." maxlength="510" name="smsginp" cols="55" rows="5" onkeyup="textCounter(this,'counter2',510);" id="message" > </textarea> <button name="smsg">Send</button> <button name="sdestroy">End Session</button> <p>Or</p> <button name="report">Report abuse</button> </form> </div> </div>
  17. i try to declare some vars during an msg sending process but it wont work any sugesstions ? Code snippets: Vars: $ID = $userRow['userId']; $cond=0; $CBA=0; global $SENDER, $RECIVER, $SESSID; Error providing code: if (isset($_POST['smsg'])) { $OBJECT = strip_tags($_POST['smsginp']); $OBJECT = trim($OBJECT); $OBJECT = str_split($OBJECT, 255); if (isset($OBJECT[1])) { $res = $crud->sendmsg($SENDER,$RECIVER,$OBJECT[0],$OBJECT[1],$SESSID,0); } else { $res = $crud->sendmsg($SENDER,$RECIVER,$OBJECT[0],null,$SESSID,0); } if ($res != 0 ) { $msg = "Your message has been sended succesfully."; } else { $msg = "there was been an error sending your message you might report a bug."; } } if (isset($_POST['sdestroy'])) { $res = $crud->sendmsg($SENDER,$RECIVER,"closing the session",null,$SESSID,0); if ($res != 0 ) { $msg = "session has been closed we hope we could help you with your problem"; } else { $msg = "there was been an error closing the session you might report a bug."; } } Declaring code: <?php $cond = $crud->check($ID); if ($cond > 0) { $ROWS_SESS = $crud->THOUTSESS($ID); $SESSID = $ROWS_SESS['SESSID']; $SENDER = $ID; $RECIVER = $ROWS_SESS['FROM_']; echo "THIS SESSID CURRENT__:" . $SESSID . "<br>"; echo "THIS SENDER CURRENT__:" . $SENDER . "<br>"; echo "THIS RECIVER CURRENT_:" . $RECIVER . "<br>"; $CBA = 1; $smsgtoutall = $crud->getmsg($SESSID); if ($smsgtoutall == 0 ) { echo "<li><p>there are currently no items to display yet..." . "</p></li>"; } else { foreach($smsgtoutall as $row) { if ($row['FROM_'] == $ID) { $SENDERN = "You"; } else { $SENDERN = "Employe"; } echo "<li><p>" . $crud->word($SENDERN, 'UTF-8') . ": " . $crud->word($row['SUBJECT'], 'UTF-8') . $crud->word($row['SUBJECT_2'], 'UTF-8') . "</p><p> " . $crud->word($row['TIMEST'], 'UTF-8') . "</p></li>"; } }
  18. Ooooh i gues i coded to long for this day i might take a break... but thanks, solved... ^^
  19. I try to set up a session for an chat betwen two users as i try to establish it it throws out following error message : Fatal error: Call to undefined method SPOP::prepare() in D:\XAMPPmm\htdocs\***\CORE\ADM.php on line 219 Callout: if (isset($_POST['submitcon'])) { $UID = $userRow['userId']; $TARGET = $_POST['uid']; $SID = $UID . $TARGET; $res0 = $SPOP->establishsession($UID,$TARGET,$SID,0); } ADM.php: public function establishsession($UID,$TARGET,$SID,$STMT) { # func zum establieren von chats so das der nutzter einen chat bekommt (SESSION SETUP) switch ($STMT) { case 0: # establish try { $sql = $this->prepare("INSERT INTO csessionsub(FROM_,TO,SESSID) VALUES(:f,:t,:s)"); $sql->execute(array(':f' => $UID, ':t' => $TARGET, ':s' => $SID)); return 1; } catch (PDOException $ex) { echo $ex->getMessage(); return 0; } break; case 1: # delete try { $sql = $this->prepare("DELETE FROM csessionsub WHERE SESSID=:s"); $sql->bindparam(":s", $SID); $sql->execute(); return 1; } catch (PDOException $ex) { echo $ex->getMessage();# return 0; } break; default: return 0; break; } } Any sugestions ?
  20. because if this is vurn i have a lot of work to do
  21. $msg = "Your Blocked for this service " . $userRow['UzRI'] . " <br>why dont you check on your emails and see the reason why; for taking some further aktions and getting around, faced to this fact? <br>or maybe you contact us via email at: support@(NAME_).com for some help to get arround this problem."; Like this ? or is this still vurn ?
  22. i tried to declare a var and it throw out following: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in D:\XAMPPmm\htdocs\***\USM\Help.php on line 17 $msg = "Your Blocked for this service <?php echo $userRow['UzRI']; ?>, <br>why dont you check on your emails and see the reason why; for taking some further aktions and getting around, faced to this fact? <br>or maybe you contact us via email at: support@(NAME_).com for some help to get arround this problem."; any suggestions ?
  23. Thanks alot !!! public function thouhistory($UID,$IND) { #Abruf history für user if ($IND == null) { try { $sql = $this->Db->prepare("SELECT * FROM history WHERE uid=:id"); $sql->execute(array(':id' => $UID)); $res = $sql->fetchAll(); if (count($res)) { return $res; } else { return 0; } return $row; } catch (PDOException $ex) { echo $ex->getMessage(); } } else { try { $sql = $this->Db->prepare("SELECT * FROM history WHERE uid=:id AND DATE_IND=:IND"); $sql->execute(array(':IND' => $IND,':id' => $UID)); $res = $sql->fetchAll(); if (count($res)) { return $res; } else { return 0; } return $row; } catch (PDOException $ex) { echo $ex->getMessage(); } # history $CREDIT['CREDIT'] !!!!!!!!!!!!!!!!!!!!!!!!!!!!! } }
  24. So first of all there is no error msg at all but as i mentioned ther is something wrong i want to give my users the oppertunity to check on theyre historie i also want them to be able to check on there activities by an specific date though... so here is whats happening : First i try to hand over the var : if (isset($_POST['submit'])) { $IND_ = date( "Y-m-d", strtotime($_POST['y'] . "-" . $_POST['m'] . "-" . $_POST['d'])); echo $IND_; echo "<<<"; $ID = $userRow['userId']; $result = $crud->thouhistory($ID, $IND_); echo $IND_; echo "<<<"; #var_dump($result); } So far so good echos the correct date taht the user have been submitted... But then apperantly this happens in the crud.php public function thouhistory($UID,$IND) { #Abruf history für user echo " >0 "; echo $IND; if ($IND == "NONE") { try { echo " >1 "; echo $IND; $sql = $this->Db->prepare("SELECT * FROM history WHERE uid=:id"); $sql->bindparam(":id",$UID); $sql->execute(array(':id' => $UID)); $res = $sql->fetchAll(); if (count($res)) { return $res; } else { return 0; } return $row; } catch (PDOException $ex) { echo $ex->getMessage(); } } elseif($IND = "--") { return 0; } else { echo " >2 "; echo $IND; try { $sql = $this->Db->prepare("SELECT * FROM history WHERE uid=:id AND DATE_IND=:IND"); echo " >3 "; echo $IND; $sql->bindparam(":id",$UID); $sql->bindparam(":IND",$IND); $sql->execute(array(':IND' => $IND,':id' => $UID)); $res = $sql->fetchAll(); if (count($res)) { return $res; } else { return 0; } return $row; } catch (PDOException $ex) { echo $ex->getMessage(); } # history $CREDIT['CREDIT'] !!!!!!!!!!!!!!!!!!!!!!!!!!!!! } echos : >0 NONE >1 NONE (1970-01-01<<<)<-submited (>0 1970-01-01)crud (1970-01-01<<<)submitted but the hilarios point on this is that it displays : no items to display yet (return 0;) so in conclusion there is something wrong... Full code PHP CALL OUT : <?php ob_start(); session_start(); require_once '../dbconnect.php'; if( !isset($_SESSION['user']) ) { header("Location: index.php?reqlog"); exit; } $userRow=$crud->getuser($_SESSION['user']); $IND_ = "NONE"; $ID = $userRow['userId']; $result = $crud->thouhistory($ID, $IND_); if (isset($_POST['submit'])) { $IND_ = date( "Y-m-d", strtotime($_POST['y'] . "-" . $_POST['m'] . "-" . $_POST['d'])); echo $IND_; echo "<<<"; $ID = $userRow['userId']; $result = $crud->thouhistory($ID, $IND_); echo $IND_; echo "<<<"; #var_dump($result); } if (isset($_POST['submitall'])) { $IND_ = "NONE"; $ID = $userRow['userId']; $result = $crud->thouhistory($ID, $IND_); } ?> Crud--> public function thouhistory($UID,$IND) { #Abruf history für user echo " >0 "; echo $IND; if ($IND == "NONE") { try { echo " >1 "; echo $IND; $sql = $this->Db->prepare("SELECT * FROM history WHERE uid=:id"); $sql->bindparam(":id",$UID); $sql->execute(array(':id' => $UID)); $res = $sql->fetchAll(); if (count($res)) { return $res; } else { return 0; } return $row; } catch (PDOException $ex) { echo $ex->getMessage(); } } elseif($IND = "--") { return 0; } else { echo " >2 "; echo $IND; try { $sql = $this->Db->prepare("SELECT * FROM history WHERE uid=:id AND DATE_IND=:IND"); echo " >3 "; echo $IND; $sql->bindparam(":id",$UID); $sql->bindparam(":IND",$IND); $sql->execute(array(':IND' => $IND,':id' => $UID)); $res = $sql->fetchAll(); if (count($res)) { return $res; } else { return 0; } return $row; } catch (PDOException $ex) { echo $ex->getMessage(); } # history $CREDIT['CREDIT'] !!!!!!!!!!!!!!!!!!!!!!!!!!!!! } Html --> <div class="Space_0 Background_1"></div> <div class="HeZC"> <h4><?php echo $userRow['UzRI']; ?> this is your history</h4> <div class="HeZ Body_E01"> <ul> <?php if (isset($result)) { if ($result != 0) { foreach($result as $row) { echo "<li><p>" . $row['subject'] . "</p><p>". $row['DATE_'] . "</p></li>"; } } else { echo "<li><p>there are currently no items to display yet..." . "</p></li>"; } } ?> </ul> </div> </div> <div class="UcZc"> <div class="UcZ Body_E01"> <h4>Or maybe your searching for an specific entry... </h4> <form class="UcZf" method="POST"> <input type="number" name="y" maxlength="4" placeholder="Year"> <input type="number" name="d" maxlength="2" placeholder="Day"> <input type="number" name="m" maxlength="2" placeholder="Month"> <button name="submit">Search</button> <p>Or</p> <button name="submitall">display all</button> </form> </div>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.