Jump to content

ConfigureWEB

New Members
  • Posts

    9
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ConfigureWEB's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The issue seems to be that glob() function is not working on that server. No idea if it is disabled or if it can be disabled somehow. If you have any ideas, please share with me. Thanks.
  2. Why? There is the echo 'No projects found.'; which should output when there is no projects in the "projects" folder, but it doesn't output anything.
  3. Hi, I have the following code in my application and it is not working on a certain VPS server and I have no idea why. Server: Linux - PHP Version 5.3.16 <?php define('PROJECTS_DIR', '../projects/'); // Gets project names from the projects folder. function projects() { $projects = glob(PROJECTS_DIR.'*', GLOB_ONLYDIR); for ($i=0; $i<count($projects); $i++) { $projects[$i] = basename($projects[$i]); } return $projects; } $projects = projects(); if (empty($projects)) { echo 'No projects found.'; } ?> The above code works fine on all other servers I tested but not on this one. No error, no output. What could be the reason? What should I check in phpinfo() or php.ini? Something to do with glob()? Thanks for any ideas.
  4. Hi, I am trying to create and download a .zip archive from a folder that contains files and folders in it. I have the following code which works for folders that has only files in it but it doesn't work for folders that contain subfolders. <?php $dir = 'sample'; $archive = 'sample.zip'; $zip = new ZipArchive; $zip->open($archive, ZipArchive::CREATE); $files = scandir($dir); unset($files[0], $files[1]); foreach ($files as $file) { $zip->addFile($dir.'/'.$file); } $zip->close(); header('Content-Type: application/zip'); header('Content-disposition: attachment; filename='.$archive); header('Content-Length: '.filesize($archive)); readfile($archive); unlink($archive); ?> When I run the above code, a .zip archive is created and downloaded but it doesn't open. How should I change it so that it will work for folders that contain files and subfolders? Thanks.
  5. Hi, I have been reading about URL rewriting and mod_rewrite for a while but it seems I cannot make it work as I want. Here is my website I am working on: http://www.configureweb.com/ On this site I have different type of pages such as page.php, tutorial.php, post.php and category.php. Here is how the URLs are at the moment: http://www.configureweb.com/page.php?page=about http://www.configureweb.com/tutorial.php?tutorial=html-tutorial http://www.configureweb.com/post.php?post=sample-post http://www.configureweb.com/category.php?category=hosting-and-domains and here is how I want them to be: http://www.configureweb.com/page/about http://www.configureweb.com/tutorial/html-tutorial http://www.configureweb.com/post/sample-post http://www.configureweb.com/category/hosting-and-domains I tried something like the following code for pages: RewriteRule ^page/([A-Za-z0-9-]+)/?$ page.php?page=$1 [L] <a href="page/about">About</a> It redirects to the correct page but the stylesheet is not active and links on that page become like this: www.configureweb.com/page/page/about/ What am I doing wrong?
  6. I never thought about iframes, I guess that was the answer I was looking for. I tried it and it works just as I wanted. Thank you very much. By the way, I don't use a blog software, it is a plain simple PHP-MySQL blog that I created from scratch and it allows direct insertion of html.
  7. I don't understand why I need to store IP address in the database. I have a single post about "how to find your IP address" and in that post I want to show the IP address of the visitor. Here is an example: http://www.wallpaperama.com/forums/how-to-display-ip-address-php-script-code-function-from-visitor-user-t399.html
  8. So, how can I add your code into the post which is stored in the database?
  9. Hi, I have a blog and I store posts in a MySQL database. I want to show the IP address of the visitor on one single post. If I didn't store posts in the database and had separate files for each post, the following code would do the job: <?php echo 'Your IP is: ' . $_SERVER['REMOTE_ADRR']; ?> But since the post is stored in the database, I guess I need to use something else. I heard about the eval() function and tried the following code but it didn't work: <?php eval( '?><?php echo $_SERVER['REMOTE_ADDR']; ?><?' ); ?> Do you have any idea how can I show the IP?
×
×
  • 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.