Jump to content

skyler_sdf

+Helpers
  • Posts

    279
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by skyler_sdf

  1. ok..mcy..data viitoare dau mai multe explicatii..dar n.at fi rau daca ai arunca ochii p un tutorial ceva, inainte d a citi d aici..
  2. <?php //Open connection to the database mysql_connect("localhost", "phpuser", "sesame") or die("Failure to communicate with database"); mysql_select_db("test"); if($_post['submit']=='submit') { //Format the data $comment_id=$_post['comment_id']; $comment_header=$_post['comment_header']; $as_comment_header=addslashes($comment_header); $comment=$_post['comment']; $as_comment=addslashes($_post['comment']); //Update values $query="update comments set comment_header='as_comment_header', comment='$as_comment' where id=$comment_id"; $result=mysql_query($query); if(mysql_affected_rows()==1) { $succes_msg='<p>Your comment has been updated.</p>'; } else{ error_log(mysql_error()); $succes_msg='<p>Something went wrong.</p>'; } } else{ //Get the comment header and comment $comment_id=$_get['comment_id']; $query="select comment_header, comment from comments where id=$comment_id"; $result=mysql_query($query); $comment_arr=mysql_fetch_array($result); $comment_header=stripslashes($comment_arr[0]); $comment=stripslashes($comment_arr[1]); } $thispage=$_server['php_self']; //have to do this for heredoc $form_page=<<<EOFORMPAGE <style type="text/css"> <!-- body, p{ color:black; font-family:verdana; font-size:10pt} h1{ color:black; font-family:arial; font-size:12pt} --> </style> </head> <body> <table border=0 cellpadding=10 width=100%> <tr> <td bgcolor="#F0F8FF" align=center valign=top width=17%> </td> <td bgcolor="#FFFFFF" align=center valign=top width=83%> <h1>Comment edit</h1> $succes_msg <form method="post" action="$thispage"> <input type="text" size="40" name="comment_header" value="$comment_header"> <br> <br> <textarea name="comment" rows=10 cols=50>$comment</textarea> <br> <br> <input type="hidden" name="comment_id" value="$comment_id"> <input type="submit" name="submit" value="Submit"> </form> </td> </tr> </table> </body> </html> EOFORMPAGE; echo $form_page; ?>
  3. if you say so.......
  4. glumesti?
  5. It's just a short EXAMPLE. The WWW-Authenticate mechanism works only under the Apache Web Server, with PHP as a module!
  6. //http authentication, code <?php $the_right_user='user'; $the_right_password='password'; if(!isset($PHP_AUTH_USER)) { header("WWW-Authenticate: Basic realm=\"PHP book\" "); header("HTTP/1.0 401 Unauthorized"); echo "Canceled by user\n"; exit; } else{ if(($PHP_AUTH_USER=='user') &&(PHP_AUTH_PW=='password')) //see caution below print("The realm is yours<br>"); else print("We don't need your kind<br>"); } ?>
  7. hello..for that problem with the session destroy: first you should use: require_once or include_once for including function and class definition files.

    initiate a session (or pick up an existing one) by using session_start() (which takes no arguments), do not change the structure of session_register(), in your case session_register('email').

×
×
  • 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.