Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by newbtophp

  1. I was told I had to add the following code to php.ini? Is that all i need to do? extension=php_bcompiler.dll
  2. OK I've it find out how to do it, but how do I enable bcompiler on shared hosting?
  3. Anyone know how to use the php bcompiler class to encode a php file?
  4. the txt is located externally on another site, so file path wouldnt work
  5. Tested, it makes the folder and protected files forbidden but fopen wont work. Warning: fopen(http://domain.com/text.txt) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/me/public_html/test.php on line 9 Any other way?
  6. So I create a .htaccess file in the root. Containing the following code: <Files test.txt> Deny from all </Files> What if I wanted to protect a whole folder's content?, do i just replace the file name with the folder path?
  7. I was wondering is their a way i can make the text.txt file execute when using fopen, but when i visit the file directorally it will display a forbidden message? I've tried chmodding, the forbidden message displays but fopen wont work This is my code: //I want the url to be forbidden, so vistors can't access directaly $url="http://domain.com/text.txt"; //But the trouble is if i chmod the above file the below code wont work $fp = fopen($url, "r"); All help is apreciated
  8. Thanks that finally solved it!!!!!!!!!!!!!!!!!!!!!!!!! :D :D :D
  9. a better way to solve the problem is to have autosubmit when form.php?urls=http://www.site.com is used, we've figured out a way to input the urls in the textarea but not submit.
  10. Still the same, what am i doing wrong? Your code if i use url, it just echos the url on the page. It dont show whats executed when submitted. "You need to add the code for the GET to do anything.." Where do i add that.?
  11. I added the code. But when i access by url like: form.php?urls=http://www.site.com the form don't execute it just displays the form as if the url aint submitted. Whereas if i just paste the url in the textarea and submit it will execute.
  12. So this is the overall code? <?php //If FORM was sent if (!isset($_GET['urls']) && isset($_POST['urls'])) { echo "URLS is $_POST['urls']" ; } else { echo "URLS is set through GET: $_GET['urls']"; } ?> <form action="" method="post"> <p align="center">[b]<textarea rows="10" cols="50" name="urls"></textarea>[/b]<br /></p> <p align="center">Display: <input type="checkbox" value="d" name="d" /> Mask: <input type ="checkbox" value ="1" name="go" /><br /></p> <p align="center"><input type="submit" name="submit" /> </p> </form> I get "Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING"
  13. Being passed through the form is uneeded. My aim is to have 2 options to make it work by url and form.
  14. $_GET is not neccesary, I have used it before theirfore I thought I'd use it, but it harder then i thought. Any better ways to accomplish this? or any javascript i can use
  15. I think I've confused you, sorry. Let me brake it down. So if i enter: url=http://www.site.com It will enter site.com the in the below text area: <textarea rows="10" cols="50" name="urls"></textarea> Then submit: <input type="submit" name="submit" /> If theirs a better way of doing it then $_GET, then please tell me
  16. I have a form which functions and executes when I click submit. But I was wondering if theirs a way I can make it also work by url like: mysite.com/form.php?urls=http://www.phpfreaks.com and then when I access that link the form executes/submits and displays the result, as if the submit button was clicked. form.php <form action="" method="post"> <p align="center">[b]<textarea rows="10" cols="50" name="urls"></textarea>[/b]<br /></p> <p align="center">Display: <input type="checkbox" value="d" name="d" /> Mask: <input type ="checkbox" value ="1" name="go" /><br /></p> <p align="center"><input type="submit" name="submit" /> </p> </form> Thanks for you help
  17. Thanks both of you for you help. I can't believe I didnt think of that
  18. That would not auto update when editing the field. Im trying to get the variable content to display within each field by default. The form edits the variable.
  19. Im using $_POST to submit to variables in my config file, but the problem is everytime I view the form, the fields are blank so it looks like the variables are empty. Is their a way I can make the field default values be whatever is currently in the variables?. So for example if I edit the form and I add phpfreaks.com to the siteurl field, everytime I visit that form the default value of that field would be that? (unless changed). My code: <?php include("config.inc.php"); echo "<form action='form.php' method='post' name='Form'>"; ?>Website Url: (this edits $siteurl)<BR> <input type="text" name="siteurl" size="25"><BR><BR> Website Title: (this edits $site_title)<BR> <input type="text" name="site_title" size="25"><BR><BR> Your Email: (this edits $email)<BR> <input type="text" name="email" size="25"><BR><BR> <input name="submit" type="submit" value="Submit"> </form> <?php if(!empty($_POST["submit"])) { $out='<?php //Website Url $siteurl="'. (isset($_POST["siteurl"])? $_POST["siteurl"]:'') .'"; //Website Title $site_title="'. (isset($_POST["site_title"])? $_POST["site_title"]:'') .'"; //Your Email $email="'. (isset($_POST["email"])? $_POST["email"]:'') .'"; ?>'; file_put_contents("config.inc.php",$out); } ?> Thanks for your help
  20. Every post I make here, I always try before I ask, I do never abuse the knowledge of the gurus/recommend's. I started one from scratch at: http://www.phpfreaks.com/forums/index.php/topic,259286.msg1225881.html#msg1225881 But then I got stuck, so Crayon Violent suggested me his tutorial so I literally restarted and used his code, but Im unfamilar with the code, so theirfore I asked for help. I tried modifying this code, but Im back to the same point as I was when I originally started my own code. I cant get the drop down options to work with the submit.
  21. I've used Crayon Violents tutorial, and got to a point where I need help, im trying to remove the id column and add another column where I can select an option from a dropdown menu. <?php /**** Dealing with the database ****/ // connect to db $conn = mysql_connect('localhost','dbuserwebsite','dbpassword') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('dbwebsite',$conn) or trigger_error("SQL", E_USER_ERROR); // INSERT: if we have a website to add... if($_POST['website']) { // little bit of cleaning... $website = mysql_real_escape_string($_POST['website']); // insert new website into table $sql = "INSERT INTO info (id, website) VALUES ('','$website')"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end if // UPDATE: if we have website(s) to change... if($_POST['cwebsite']) { // for each website to change... foreach($_POST['cwebsite'] as $cid => $cwebsite) { // little bit of cleaning... $id = mysql_real_escape_string($cid); $website = mysql_real_escape_string($cwebsite); // update website in the table $sql = "UPDATE info SET website = '$website' WHERE id = '$id'"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end foreach } // end if // DELETE: if we have a website to delete... if($_GET['website']) { // little bit of cleaning... $website = mysql_real_escape_string($_GET['website']); // delete website from table $sql = "DELETE FROM info WHERE website = '$website'"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); } // end if // ORDERBY: if one of the links was clicked.. if ($_GET['orderby']) { // make an aray of allowed websites $allowed = array('id','website'); // bit of cleaning... $order = mysql_real_escape_string($_GET['orderby']); // is it a valid column website? yes: use it. no: default to 'id' $order = (in_array($order, $allowed))? $order : "id"; // if no link clicked, default to 'id' } else { $order = "id"; } // end else // SELECT: get the list of websites from database $sql = "SELECT id, website FROM info ORDER BY $order"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); /**** end deal with the database ****/ /**** list everything out ****/ // list columns echo <<<LISTCOLS <form action = '{$_SERVER['PHP_SELF']}' method = 'post'> <table border = '1'> <tr> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=id'>ID</td> <td><a href = '{$_SERVER['PHP_SELF']}?orderby=website'>Website</td> <td>Delete</td> </tr> LISTCOLS; // loop through list of websites while ($list = mysql_fetch_assoc($result)) { echo <<<LISTINFO <tr> <td>{$list['id']}</td> <td><input type = 'text' website = 'cwebsite[{$list['id']}]' value = '{$list['website']}'> <td><a href = '{$_SERVER['PHP_SELF']}?website={$list['website']}'>delete</a></td> </tr> LISTINFO; } // end while // list input box for adding new entry echo <<<NEWENTRY <tr> <td bgcolor = 'gray'></td> <td><input type = 'text' website = 'website'></td> <td bgcolor = 'gray'></td> </tr><tr> <td></td> <td align = 'center'><input type = 'submit' value = 'submit'></td> <td></td> </tr> </table> </form> NEWENTRY; /**** end list everything out ****/ ?> Heres how it currently looks: Heres how im trying to get it too look: Can anyone help. Thanks
  22. <a href="http://www.link.com" style="text-decoration:none">Link Name</a>
  23. What I'd really like to learn, is how to manage (edit/delete/submit) data via php (form) to a database (table). This would be a greate tutorial, and would really help me, I believe it would also benefit others who are looking to manage sql info via php. So for example the tutorial would consist of: A form which can submit names to a database (Submit) A form to delete names from the database. (Delete) And a form which can edit the names in the database (Edit). names = data This just an example, i know their might better be ways. I've googled tutorials on this and their just for a specific function, ie. Delete. Theirs none that i know which teach how to do all in one. Thanks
  • 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.