-
Posts
783 -
Joined
-
Last visited
Everything posted by ZulfadlyAshBurn
-
what the the country you are in?
-
ok, sorry. please mark topic as solved
-
How to add some non standard font to website?
ZulfadlyAshBurn replied to voip03's topic in PHP Coding Help
no prob its my honour to help people -
use date_default_timezone_set();
-
haha. no prob its my honour to help peeple
-
How to add some non standard font to website?
ZulfadlyAshBurn replied to voip03's topic in PHP Coding Help
you can google it if you want mark topic as solve -
add another else. <? $error = ""; $pass = ($_POST['pass']); if(!$pass) { $error .= "Please enter your password! "; } if($error){ echo "<div align='center'><h2>Error!</h2><>"; echo "<div align='center'>\n<p>$error</p><>"; echo "<div align='center'>\n<>"; echo "<div align='center'>\n<p><a href='$HTTP_REFERER'>Return and try again</a></p><>"; } else { if (!$error && $pass == 'test'); { $fn = "../../scripts/tabs_index/pages/news.html"; $content = stripslashes($_POST['content']); $fp = fopen($fn,"w") or die ("Error opening file in write mode!"); fputs($fp,$content); fclose($fp) or die ("Error closing file!"); echo "<div align='center'><h2>Change Successful!</h2><>"; echo "<div align='center'>\n <p>News has been successfully changed and is now live!</p><>"; echo "<div align='center'>\n---------------------------------------------------------------<>"; echo "<meta http-equiv=\"refresh\" content=\"3; url=http://xxxxxxxxxxx/account=administrator\" />\n"; } else { $error .= "Wrong Password!"; echo "<div align='center'><h2>Error!</h2><>"; echo "<div align='center'>\n<p>$error</p><>"; echo "<div align='center'>\n<>"; echo "<div align='center'>\n<p><a href='$HTTP_REFERER'>Return and try again</a></p><>"; } } ?>
-
you may want to have the $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbdata = 'accounts'; in another file named connDB.php then make it require from your config.php thus the config, connDB & editer page would look like this. config.php <?php require("connDB.php"); $connection = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Could not connect to server ... \n" . mysql_error ()); mysql_select_db($dbdata) or die ("Could not connect to database ... \n" . mysql_error ()); ?> connDB.php <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $dbdata = 'accounts'; ?> then on editer.php <?php // check if user edited the page. if(isset($_REQUEST['editfile'])) { $editfile = $_REQUEST['editfile']; $filename = "includes/connDB.php"; $handle = fopen($filename, "w+"); fwrite($handle, $editfile); fclose($handle); echo "Done Editing!"; } // if not show the form else { $self = $_SERVER['PHP_SELF']; echo "<form action='" .$self. "' method='post'/><textarea name='editfile' rows='20' cols='50'>"; $filename = "includes/connDB.php"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); echo $contents; fclose($handle); echo "</textarea><input type='submit' value='Submit'/></form>"; } ?> its much simpler
-
sorry, my bad. so you just want the user to edit the db part?
-
How to add some non standard font to website?
ZulfadlyAshBurn replied to voip03's topic in PHP Coding Help
copy the font type from your computer and upload it to your server. can be done using css3 @font-face { font-family: fontname; src: url('fontname.ttf'); } .my_CSS3_class { font-family: fontname; font-size: 3.2em; } change fontname to the actual font name -
opps. sorry. i forget to change the save point to includes/config.php // check if user edited the page. if(isset($_REQUEST['editfile'])) { $editfile = $_REQUEST['editfile']; $filename = "includes/config.php.php"; $handle = fopen($filename, "w+"); fwrite($handle, $editfile); fclose($handle); echo "Done Editing!"; } // if not show the form else { $self = $_SERVER['PHP_SELF']; echo "<form action='" .$self. "' method='post'/><textarea name='editfile' rows='20' cols='50'>"; $filename = "includes/config.php"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); echo $contents; fclose($handle); echo "</textarea><input type='submit' value='Submit'/></form>"; } it should work now
-
use else. <? $error = ""; $pass = ($_POST['pass']); if(!$pass) { $error .= "Please enter your password! "; } if($error){ echo "<div align='center'><h2>Error!</h2></div>"; echo "<div align='center'>\n<p>$error</p></div>"; echo "<div align='center'>\n</div>"; echo "<div align='center'>\n<p><a href='$HTTP_REFERER'>Return and try again</a></p></div>"; } else { if (!$error && $pass == 'test'); { $fn = "../../scripts/tabs_index/pages/news.html"; $content = stripslashes($_POST['content']); $fp = fopen($fn,"w") or die ("Error opening file in write mode!"); fputs($fp,$content); fclose($fp) or die ("Error closing file!"); echo "<div align='center'><h2>Change Successful!</h2></div>"; echo "<div align='center'>\n <p>News has been successfully changed and is now live!</p></div>"; echo "<div align='center'>\n---------------------------------------------------------------</div>"; echo "<meta http-equiv=\"refresh\" content=\"3; url=http://xxxxxxxxxxx/account=administrator\" />\n"; } } ?> use that code. i've edited it for you.
-
this is how you are gonna have it done. use this exact code. // check if user edited the page. if(isset($_REQUEST['editfile'])) { $editfile = $_REQUEST['editfile']; $filename = "r.php"; $handle = fopen($filename, "w+"); fwrite($handle, $editfile); fclose($handle); echo "Done Editing!"; } // if not show the form else { $self = $_SERVER['PHP_SELF']; echo "<form action='" .$self. "' method='post'/><textarea name='editfile' rows='20' cols='50'>"; $filename = "includes/config.php"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); echo $contents; fclose($handle); echo "</textarea><input type='submit' value='Submit'/></form>"; }
-
oh lol. do you even have a page which is edit.php?
-
its works pretty well on my local server o.0 make sure that the apostrophes are correct?
-
you may want to try this. echo "<form action='edit.php' method='POST'><textarea name='editpage'>"; $filename = "index.php"; // replace to actual file name $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); echo $contents; fclose($handle); echo "</textarea><input type='submit' value='Submit'/></form>"; that will place everything in the file into a textarea which is in a form the will pass the data to edit.php
-
you may want to use fopen to open the file?
-
Call javascript function from php echo href
ZulfadlyAshBurn replied to anton_1's topic in Javascript Help
anyway, did you use my code? $strLink = "<a href='viewTicket.php?id=" .$row['id']. "'>" .$strName. "</a>"; and it looks like you are using mySql for the $row[] -
Call javascript function from php echo href
ZulfadlyAshBurn replied to anton_1's topic in Javascript Help
anton_1, are you trying to use the $strLink = "<a href='viewTicket.php?id={$row['id']}' class='simpledialog'>$strName</a>"; to fade in an id called box? you are already using the href to link it to another page thus the simpledialog function cannot be used. -
so is it allowed or not?
-
I started to love programming when I was in a games creation competition. I was force by my school to join the competition. I was reluctant to join the competition. Then I have this friend from my school who was super extreme in AS scripting. From there, I started to love coding. He thought me the basic of AS scripting. After a few days, I was telling myself, how is a website build. I went to Google and search. They told me, programming. So i went to the library and search some books about programming. There, I learn the basic of Html and JavaScript. I went on further by trying to learn how people are logged in to sites. Initially, I used JavaScript to code how people would logged in to my site, then I realised that they are able to see the username and password by view source. I tried to disabled view source by JavaScript but it was easy to crack. Then again, I Googled website login script and a new language came to me, PHP & MySQL. There, I started building my login page and members restricted area. I also picked up jQuery and python. I learn ajax when my site requires the login to be done without reloading and it was great. The reason why I love programming is because I have the passion to do it. Every single day, I have to program something. Its like a drug. And thanks to phpfreaks forum, I am able to fix my code asap