Jump to content

Bojak

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Bojak

  1. certainly psycho thanks for the advice!
  2. i would love to use html purfier but at the moment i am unsure how to do that. i really want to allow hyperlinks.
  3. but if i want to post a picture from their photo album i would need to use php? i guess with a button or something.
  4. ah so just let them copy and paste? i guess htmlspecialchars would force it into plain text.
  5. im only asking because im going to be making a comment system. i dont really know how to go about it the correct way. i want the to be able to share websites in a comment.
  6. htmlspecialchars() may be fine for user names but not for user messages? because if the user post a link it would break the link?
  7. im only asking because i dont know what to put in the else bracket. because im only testing for one solution.
  8. im building a registeration form but what do i put in the else? can i put other values i want to check for different inputs? like email and password?
  9. oh that makes sense! thank you!
  10. so it should be the following example? function is_valid_username($username){ if (empty(strip_tags($username))) { echo "username is required"; } else { $username = $_POST["username"]; } }
  11. is this the correct syntax to strip tags and check if username is empty? if (strip_tags((empty($username))) { echo "username is required"; } else { $username = $_POST["username"]; } }
  12. i fixed the issue.. it was blank because there was nothing in the database but i wasnt connecting it to a database just yet. next step is to connect to a database and loop it.
  13. well it seems the issue was the beginning php tag but now its completely blank.
  14. <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"> </script> <script language="javascript"> function toggle() { var element = document.getElementById("textMessage"); var text = document.getElementById("textSwitch"); if(element.style.display == "block") { element.style.display = "none"; text.innerHTML = "show"; } else { element.style.display = "block"; text.innerHTML = "hide"; } } </script> </script> </head> <body> <? $commentMessage = "this would be a test"; $x=1; while ($row = mysql_query($commentMessage) > $x) { echo '<a id="textSwitch" href="javascript:toggle();">show</a>'; echo '<div id="textMessage">' . $commentMessage . '<textarea></textarea></div>'; $x++; } ?> </body> </html> i want this to eventually connect to a database and loop through all the messages but for now i hard coded a message but it isnt working as i had hoped. its posting parts of the script instead of doing an echo. i attached a photo to explain more. if you could explain the issue i would be so thankful.
  15. i figured out line 33 issue. trying to figure out 24 and 26.
  16. dont assume i dont know html. i do know html. this is a beginners tutorial for PDO and OOP. after taking out the html tags the index.php is blank when looking at it in a web browser. but dream weaver says i have errors on 24, 26, 33. blame dreamweaver for not being specific enough. <?php class DB { private static $_instance = null; private $_pdo, $_query, $_error = false, $_results, $_count = 0; private function __construct() { try { $this->_pdo = new PDO('mysql:host=' . Config::get('mysql/host') . ';dbname='. $config::get('mysql/db'),'config::get(mysql/username','config::get(mysql/password'); } catch(PDOException $e) { die($e-getMessage()); } } } public static function getInstance() { if(!isset(self::$_instance) { self:$_instance = new DB(); } } } return self:$_instance; ?>
  17. i havent used any html. im currently following a tutorial.
  18. i fixed the missing file issue. although dreamweaver still says i have errors on on line 32, 34, 41 in the DB.php file and i posted the code above.
  19. ( ! ) Fatal error: require_once(): Failed opening required 'classes/Sanitize.php' (include_path='.;C:\php\pear') in C:\wamp\www\loginsystem\Core\Init.php on line 38 ( ! ) Warning: require_once(classes/Sanitize.php): failed to open stream: No such file or directory in C:\wamp\www\loginsystem\Core\Init.php on line 38 i get that from my localhost
  20. because i dont have it on a localhost at the moment. i just saw the error in dreamweaver and i cant figure it out.
  21. <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php class DB { private static $_instance = null; private $_pdo, $_query, $_error = false, $_results, $_count = 0; private function __construct() { try { $this->_pdo = new PDO('mysql:host=' . Config::get('mysql/host') . ';dbname='. $config::get('mysql/db'),'config::get(mysql/username','config::get(mysql/password'); } catch(PDOException $e) { die($e-getMessage()); } } } public static function getInstance() { if(!isset(self::$_instance) { self:$_instance = new DB(); } } } return self:$_instance; ?> </body> </html> getting errors on line 32, 34, 41 and i dont understand why. maybe ive missed a bracket but i have checked them a few times. any suggestions? thanks! oh, i have more files since i am trying to make it PDO but i thought you would only want to see the file in which the error occured.
  22. im thinking for css i echo divs and put the actual CSS in a CSS file.
  23. I am trying to create a group scrpt in php. the functionality would be just like facebooks groups. i am stuck but any help would be great. i understand i need functions and such but i dont know how to combine all of that with css. do i put that inside the functions? i dont really know what goes inside the functions either. <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php mysql_connect("localhost", "", "") or die(mysql_error()); echo "Connected to MySQL<br />"; mysql_query("INSERT INTO Groups ($user, $userid, $groupid, $groupname, $cmt, $cmtid, $cmtcnt ) VALUES('$_GET[$user]', $_GET[$userid]', $_GET[$groupname]', $_GET[$groupid]', $_GET[$cmtid]', $_GET[$cmt], $_GET[$cmtcnt]' ) ") or die(mysql_error()); $cmtcnt=""; $cmt=""; $cmtid=""; $user=""; $userid=""; $groupname=""; $_GET[$groupid]; $_GET[$groupname]; $_GET[$user]; $_GET[$userid]; $_GET[$cmtid]; $_GET[$cmtcnt]; function userAuth(){ if ( $authid != 1) { echo "you dont belong to this group"; } else { echo "Welcome to the group"; } } function buttonClicked() { if (isset($_GET[cfrm]) && $auid == 1) { echo "user accepted"; } else { echo "user denied"; echo "<div> test </div>"; } } ?> </body> </html>
  24. <HTML> <head> <title>Last Visit Cookie Tester</title> <script type='text/javascript'> function myFunction() { var currentDate = new Date(); var dateTime = (currentDate.getMonth()+1) + "/" + currentDate.getDate() + "/" + currentDate.getFullYear(); document.write("Current Date: " + dateTime); document.write("<br>"); document.write("<br>"); document.write("<br>"); document.cookie = dateTime; var lastVisit = document.cookie; document.write("Last Visit: " + lastVisit); } if (dateTime !="") { document.cookie = dateTime; // document.write("window.dateTime"); alert("Passed! you are awesome!"); } else { alert("failed. try again!"); } </script> </head> its suppose to post passed in an alert if it not null. im using the alert box as a way to test it. it doesnt seem to help.
×
×
  • 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.