Jump to content

jjacquay712

Members
  • Posts

    197
  • Joined

  • Last visited

About jjacquay712

  • Birthday 08/12/1993

Contact Methods

  • AIM
    johnjjacquay

Profile Information

  • Gender
    Male
  • Location
    Niceville, Florida

jjacquay712's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. What is the error you are getting when you can't open a file? If it is the one I'm thinking of you might me able to use this line: <?php ini_set('memory_limit', '512M'); ?>
  2. Essentially what a .bat file does when it is run, is takes each line and runs it as a command in command prompt. What you could do for testing is just open up a command prompt window (Start > All Programs > Accessories > Command Prompt) and paste the line: php "C:\Path_to_your_script\script.php" The command prompt window will stay open so you can see any error that is reported. If you see any errors you can post them and I can try to resolve them.
  3. I forgot to address your question about having the description of the mysql row in the url instead of the ID. You would need to create a new field in your table called "seo_url" or something similar. Whenever you are inserting a row into your table, you would need to also populate your new field. I made a function you could use the convert the description to put in your seo_url field: <?php function pretty_url($name) { return preg_replace("/[^0-9,a-z,A-Z,-]/", "", str_replace(" ", "-", strtolower(trim($name)))); } ?> Now when you are selecting the row from your php file, the sql query would need to look like this: SELECT * FROM `my_table` WHERE `seo_url` = '{$_GET['request']}' LIMIT 1;
  4. The first thing you will need to do is edit your .htaccess file to look something like this: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ router.php?request=$1 [L] </IfModule> This takes all requests that aren't referencing a file or directory, and sends to your script named router.php. It passes the string of your request to a $_GET variable called request. For example, if you went to the page http://www.example.com/test, the request would look like this: router.php?request=test. You could then access the request with $_GET['request'] from within router.php. This is what my router.php looks like: <?php error_reporting(0); if ( $_GET['request'] ) { $page = $_GET['request'] . ".php"; if ( file_exists($page) ) { require_once($page); } else { require("404.php"); } } else { require('index.php'); } Just make sure you can't include remote files or you will have a RFI vulnerability. Hope this helps. If you have any other questions you can post them or PM me.
  5. If You are using Windows, you could create a batch script to run the php script for you. I'm a little rusty on it but if you open up a new file, paste this: @echo off php "C:\Path_to_your_script\script.php" and save it as a .bat file, you can double click it and it will run. Just make sure you have PHP installed.
  6. I figured out I can use the mb_strlen function. I went ahead and wrote a recursive function for those who might be interested. <?php function varsize($var) { $size = 0; if ( is_array($var) ) { foreach ( $var as $key => $value ) { if ( is_string($key) ) { $size += mb_strlen($key, '8bit'); } if ( is_array($value) ) { $size += varsize($value); } else { $size += mb_strlen((string)$value, '8bit'); } } } else { $size += mb_strlen((string)$var, '8bit'); } return $size; } echo varsize(array("test"=>array("recursive"=>"cool"))); ?>
  7. I am making a website that lets users submit data from their forms to our servers. I want to be able to measure the amount of data being passed to the php script from a form. I know that one character is a byte, so should I just use the strlen() function to count the characters and add the bytes? Is there a better way to do this? Thanks for the help.
  8. What eval does is parse the string you input as if it was in the code. eval("echo 'Hello World';"); // Would print out Hello World. So by doing this: eval("$size[\" " . $fish1 . "\"]"); PHP would parse this string: "$size[\"" . $fish1 . "\"]" Then evaluate it as if it were code. Sorry if my explanation is confusing, it's the best i can do.
  9. You should be able to do this: eval("$size[\"" . $fish1 . "\"]");
  10. Use the header function: <?php if ( $_SESSION['username'] ) { header("Location: page2.php"); } ?>
  11. You shouldn't be worried about piracy for server side code as long as you keep your source private. As for anything that is client side like html, css, js there is not anything you can do to prevent someone from stealing your code. EDIT: I didn't realize that you would selling this, I would use Zend Guard.
  12. When you use PHP's session functions, what happens is PHP sends you a unique id to store in a cookie. When you use $_SESSION the data isn't really being sent to the client, the data is being stored server side. When your browser sends the unique PHP session id to the server, the server looks up the data that relates to that certain id, and lets you access it via $_SESSION.
  13. Not sure how you expect us to know the problem when we cant see any code.
×
×
  • 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.