Jump to content

gffg4574fghsDSGDGKJYM

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by gffg4574fghsDSGDGKJYM

  1. Outsourcing !!! No good programmers would ever dare to work on such bad code, you're safe ! just kidding... There many ways but i'm not sure one of them is really secure. I think you should be more concern about why you are doing that than about how. If someone has access to your filesystem, php code hidden or not it can do a great deal of damage. Why did exactly did you want to hide your code ?
  2. The code seem fine (but it's hard to read) Are you sure that the data in the database are what did you expect for the first row ? You can echo it just to be sure (or use another way to look at it) : ... $minutes_dif = $row1['MinsSinceLastVisit']; echo "<h1>".$minutes_dif."</h1>"; ...
  3. This show how it's done : <?php $code = "echo 'hello world!';"; $b64 = base64_encode($code); echo $b64."<br>"; eval(base64_decode($b64)); ?> But it didn't provide any kind of security. http://en.wikipedia.org/wiki/Obfuscated_code
  4. Can you post the complete script ? I made some small change but this should never show minutes over 60 : $minutes_dif = $row1['MinsSinceLastVisit']; $Ymin = 60 * 24 * 365; $Mmin = 60 * 24 * 30; $Wmin = 60 * 24 * 7; $Dmin = 60 * 24; $Hmin = 60; $Y = (int)($minutes_dif / $Ymin); $minutes_dif = $minutes_dif % $Ymin; $MON = (int)($minutes_dif / $Mmin); $minutes_dif = $minutes_dif % $Mmin; $W = (int)($minutes_dif / $Wmin); $minutes_dif = $minutes_dif % $Wmin; $D = (int)($minutes_dif / $Dmin); $minutes_dif = $minutes_dif % $Dmin; $H = (int)($minutes_dif / $Hmin); $minutes_dif = $minutes_dif % $Hmin; if($Y > 0 ) echo "$Y year(s) "; if($MON > 0) echo "$MON month(s) "; if($W > 0) echo "$W week(s) "; if($D > 0) echo "$D day(s) "; if($H > 0) echo "$H hour(s) "; if($minutes_dif > 0) echo "$minutes_dif minute(s) "; echo "ago"; Or as kickstart say you can do it in SQL too.
  5. Add it after this line : $minutes = $row1['MinsSinceLastVisit']); $minutes_dif = $row1['MinsSinceLastVisit']); $Ymin = 60 * 24 * 365; $Mmin = 60 * 24 * 30; $Wmin = 60 * 24 * 7; $Dmin = 60 * 24; $Hmin = 60; $Min = 1; $Y = (int)($minutes_dif / $Ymin); $minutes_dif = $minutes_dif % $Ymin; $MON = (int)($minutes_dif / $Mmin); $minutes_dif = $minutes_dif % $Mmin; $W = (int)($minutes_dif / $Wmin); $minutes_dif = $minutes_dif % $Wmin; $D = (int)($minutes_dif / $Dmin); $minutes_dif = $minutes_dif % $Dmin; $H = (int)($minutes_dif / $Hmin); $minutes_dif = $minutes_dif % $Hmin; $MIN = (int)($minutes_dif / $Min); $minutes_dif = $minutes_dif % $Min; if($Y > 0 ) echo "$Y year(s) "; if($MON > 0) echo "$MON month(s) "; if($W > 0) echo "$W week(s) "; if($D > 0) echo "$D day(s) "; if($H > 0) echo "$H hour(s) "; if($MIN > 0) echo "$MIN minute(s) "; echo "ago"; Edit : fixed typo.
  6. Try this : $input = '<regionx refid="CAX\SCAQMD\rgVII\rl715\"> Regulation VII, Rule 715 </regionx>'; $input = htmlentities($input, ENT_QUOTES); echo $input; http://www.php.net/manual/en/function.htmlentities.php
  7. If phpmyadmin display correctly the data, then your data is fine and the problem is coming from your script. First set this in your database : Charset : utf8 Collation : utf8_general_ci (ci is for case insensitive) Then you need to tell mysql what charset to use for the connextion like this (right after you connect and select the database) : mysql_query("SET NAMES 'utf8';"); mysql_query("SET CHARACTER SET 'utf8';"); Then you need to tell the browser what charset you use like this : This for the http header (it need to be put before any output even enter or space to work) On each page : header('Content-Type: text/html; charset=utf-8'); And you need to tell the browser again in html because some browser like that : <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> If you are using XHTML instead of HTML it will be more complex depend on how you server your XHTML as text/html or as in XML. Should work fine.
  8. Not sure what darkfreaks are using but they are some FF plugins for that https://addons.mozilla.org/en-US/firefox/addon/7597 Or just search for hack, security or SQL there a lot of plugin.
  9. You don't. You can use AJAX to call a php page then the php access the database and send back the data to javascript. The client side (like javascript) isn't allow to directly connect to the database and it's a good thing. Only server side script like PHP can do that.
  10. For URL like : http://www.mysite.com/2-3_1_abc.html To be internally rewritten for : http://www.mysite.com/index.php?pageID=2&menu=3&id=1&name=abc This work : Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([0-9]+)-([0-9]+)_([0-9]+)_([a-z]+).html$ index.php?pageID=$1&menu=$2&id=$3&name=$4 [NC,L] </IfModule> The error was you can't use these characters -_ in both the regular expression and as separator or it won't know where to split the string.
  11. You need the Options +FollowSymLinks for mod_rewrite to work. Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC] RewriteRule \.(rar|exe|zip)$ - [F] </IfModule> Did you change the mydomain.com to yours ? Did you have mod_rewrite installed and test it ? Did you have 'AllowOverride All' in your main apache configuration file (needed to rewrite url) ? Did you clean the browser cache before trying ? What browser are you using ? As i said the REFERER rely on the browser to work (and isn't reliable but in most case it should work). How did you put the link on the page ? I think most <img> <a> are fine, but i'm not sure about how browser sent the REFERER in case of a javascript. I copy/paste this script after testing it from my local apache and it was working for me.
  12. You didn't read my post at all did you ? I told you what order deny, allo, deny from all actually does, not to use it, isn't the answer to your problem, DO NOT use it. Read my first post. The answer is there.
  13. Yeah it can be a security issue. Only accept directory that are know and safe, exclude everything else. $validdirectory = array('jpg', 'thumb', 'png'); if (!(in_array($_GET['cat'], $validdirectory))) { /* echo error message or redirect to 404 */ die(); } And btw you don't need these anymore : $myDirectory = opendir("$cat"); ... closedir($myDirectory);
  14. The most efficients way will probably be multi thread curl http://www.google.com/search?q=multi+thread+php+curl cUrl offer more options that fopen,fsockopen and file_get_contents and with multi thread you can download many pages at once. the difference between fsockopen and fopen is fsockopen open a connection over internet to grab the file (URL), fopen open the file locally. With the options "allow_url_fopen = On" in php.ini it allow fopen to open file locally or open a connection over internet like fsockopen if the file is a URL.
  15. You have to read all the filelist then sort them, then display them. You can't read 1 filename then display it, then read next, you won't be able to sort them with that. This is a example how to do it : <?php $filelist = glob("*"); sort($filelist); foreach($filelist as $filename) { echo $filename."<br>"; } ?>
  16. Backup all .htaccess localy and delete them on the web server. Put a small hello world php script to test like that : /helloworld.php <?php echo "<b>Hello World!</b>"; ?> If it work, the problem coming from your scripts, if it doesn't call your hosting and ask them to fix it until it does. It's their job to provide you a hosting with a working php you shouldn't have to play with htaccess to make it work, php scripts file should be configure in main apache config. If the problem coming from your scripts, post the complete .htaccess (including .htaccess on root directory that get called too) From my php install.txt : I usually see that in the apache config (not in the .htaccess) : AddType application/x-httpd-php .php
  17. Yes you can with PHP GD module : http://www.php.net/manual/en/ref.image.php
  18. I didn't understand why. I change the database info to match mine and the table and it work fine on my computer. It display both "there are x number of records" AND a html table that containt the data from the database. Did it show you "there are 0 number of records" or any error when you add the code i told you ? What the exact ouput of your script (view source) maybe there CSS that hide the table. All function seem to be PHP 4 so i don't think there any problem with that. You can try to add a flush(); after each line to see if it's change something, but i don't think unless you have a huge table. <?php $db="a3205133_test"; $link = mysql_connect('xxxxxxxxxx', 'xxxxxxx', 'xxxxxx'); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error()); $result = mysql_query( "SELECT * FROM birthdays" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=200 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td>$field</td>\n"; print "</tr>\n"; flush(); <--------- } print "</table>\n"; mysql_close($link); ?>
  19. <textarea> did not have a value="" options like input does. http://www.w3.org/TR/html401/interact/forms.html#h-17.7 You need to put the text inside the tag like this : <textarea> this text will appear inside the box </textarea> Instead of a input like this : <input type="text" value="this text will appear inside the form">
  20. Double post : http://www.phpfreaks.com/forums/index.php/topic,251517.0/topicseen.html Please post your question only once.
  21. try that : <TD> <textarea cols="40" rows="12" wrap="hard" name="content" value=""> <?php echo $_SESSION['content']; ?> </textarea> </TD></TR></TABLE><BR><BR>
  22. You can use sprintf to format your data before display them http://www.php.net/manual/en/function.sprintf.php Probably like that : $integer = 0; $string = sprintf("%02d", $integer); echo $string;
  23. You can post your code in tag [ code] ... [ /code] or [ php] ... [/code] it will be easier to read like that : <?php $db="a3205133_test"; $link = mysql_connect('xxxxxxxxxx', 'xxxxxxx', 'xxxxxx'); if (! $link) die(mysql_error()); mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error()); $result = mysql_query( "SELECT * FROM birthdays" ) or die("SELECT Error: ".mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=200 border=1>\n"; while ($get_info = mysql_fetch_row($result)){ print "<tr>\n"; foreach ($get_info as $field) print "\t<td>$field</td>\n"; print "</tr>\n"; } print "</table>\n"; mysql_close($link); ?> I see nothing wrong with your code, in facts it should work. Did you get a error message or just nothing ? Did your database table is empty ? You can add this at the beggining of your php to display the error : error_reporting(E_ALL); ini_set('display_errors', true);
×
×
  • 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.