Jump to content

milanello72

Members
  • Posts

    37
  • Joined

  • Last visited

Posts posted by milanello72

  1. hi... :) my code works fine on localhost... but on server there are some problems... If I want to see this page katarinabulatovic.webuda.com/katarina/senior-clubs.html then I will have this error: The requested URL /katarina/senior-clubs.html was not found on this server.

     

    On server in the root directory it was necessary to put in .htaccess this code:

    RewriteBase /katarinabulatovic.webuda.com
    

    and I have 2 directories because the website has 2 versions... In every folder I have put a file .htaccess ...

    For example in the folder katarina I have this code:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^index.html index.php [N]
    
    RewriteRule ^([a-zA-Z0-9-_]+).html$ index.php?pagina=$1 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+).html$ index.php?pagina=$1&poll=$2 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+)/([0-9-_]+)$ index.php?pagina=$1&paginaphoto=$2&id_photo=$3  [L,QSA]
    

    but I have a problem...  If I want to see this page katarinabulatovic.webuda.com/katarina/senior-clubs.html then I will have this error: "The requested URL /katarina/senior-clubs.html was not found on this server'.

    and if I am in the first version "katarinabulatovic.webuda.com/katarina/" here I have a button "katarinabulatovic.webuda.com/32katarina/index.html" where I want to see the second version, but when I try to see this page I have an error that this page doesnt exist.....

    Is it correct to use a file .htaccess for every folder (because I have 2 versions on the website)?

     

    thank you! :)

  2. it works, but I have a problem in this situation:

     

    print '<a href="/calcioitalia/teams/'.seoUrl($numele.' '.$id_squadra.'.html').'">'.$nume.'</a>';
    

    with $numele='José Mário'

     

    where

     

    function seoUrl($string) {
            //Unwanted:  {UPPERCASE} ; / ? : @ & = + $ , . ! ~ * ' ( )
          //  $string = strtolower($string);
            //Strip any unwanted characters
            $string = preg_replace("/[^A-Za-z0-9._\s-]/", "", $string);
            //Clean multiple dashes or whitespaces
            $string = preg_replace("/[\s-]+/", " ", $string);
            //Convert whitespaces and underscore to dash
            $string = preg_replace("/[\s_]/", "-", $string);
        
            return $string;
    }
    

    so, how could I solve the problem?

    Thank you! :)

  3. hello! :) I have a problem with utf-8 ...

    In horizontalmenu.php I have:

     

     

     print '<a href="/calcioitalia/coaches/'.$name.'.html').'">'.$name.'</a>';
    

    where

     

    $name=José Mário
    

     

    and in .htaccess I have

     

    AddDefaultCharset UTF-8
    AddCharset UTF-8 .html
    

    and doesn't work...

    How could I solve this problem? Thank u! :)

  4. Hello! i'm newer in OOP and I have made an website in PHP classic. I want to modify the website and to use OOP.

    For example in .htaccess I have

     

    RewriteRule ^index.html index.php [N]
    
    RewriteRule ^([a-zA-Z0-9-_]+).html$ index.php?pagina=$1 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+).html$ index.php?pagina=$1&poll=$2 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+)/([0-9-_]+)$ index.php?pagina=$1&paginaphoto=$2&id_photo=$3  [L,QSA]
    
    #RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+)/([0-9-_]+)/?.jpg$ index.php?pagina=$1&paginaphoto=$2&id_photo=$3 [L,QSA]
    

     

    in index.php I have

     

    if ($_GET['pagina']=='katarina')
        {
          if ($_GET['paginaphoto'] == '')
          {
            echo '<td valign="top"    style="border-left: 1px solid #cccccc; padding: 2px;">';
            include('includes/katarina.php');
          }
          elseif ($_GET['paginaphoto'] == 'photo')
          {
            echo '<td valign="top"   style="border-left: 1px solid #cccccc; padding: 2px; border-right: 1px solid #cccccc; padding: 2px;">';
            include('includes/photo.php');
          }
          elseif (!empty($_GET['paginaphoto']) and $_GET['paginaphoto'] != 'photo')
          {
            
            echo '<META HTTP-EQUIV="Refresh" Content="0; URL=/katarina/index.html">';
          exit;
          }
        }  
    

    so in index.php I used the method GET to load the page katarina.php

     

    My problem is how could I change index.php if I would want to use OOP?  I need some suggestions of you... Or maybe a good video on youtube or a good article on web.

    Thank you very much! :)

  5. Hi! :) I'm newer in codeigniter and I have searched on web an example of code captcha that works. Many examples not working, but an example maybe could work. This example is here http://runnable.com/UXb8GazDrMMiAAEA/how-to-add-a-captcha-in-codeigniter

    I want to use this example, but I don't know how to configure the files from application/config

    Could you help me? If you know an example that works you could say me the address on web.

    Thank you very much!

     

  6. Hello, Requinix!  :)

    I have tried, but didn't work.

    In this moment you could see the link here

     

    http://www.katarinabulatovic.uhostall.com/32katarina/index.php
    

    And I want to obtain

     

    http://www.katarinabulatovic.uhostall.com/index.php

    so without 32katarina.

     

    I have all files in the folder 32katarina and .httaccess is

     

    Options +FollowSymlinks
    
    RewriteEngine on
    
    php_flag session.auto_start 1
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    
    RewriteRule ^index.html index.php [N]
    
    
    RewriteRule ^([a-zA-Z0-9-_]+).html$ index.php?pagina=$1 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+).html$ index.php?pagina=$1&poll=$2 [L,QSA]
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9-.\s]+)/([0-9-_]+)$ index.php?pagina=$1&paginaphoto=$2&id_photo=$3 [L,QSA]
    
    AddType image/x-icon .ico
    RewriteRule ^favicon.ico favicon.ico [NC,L]
    
    ErrorDocument 404 /errors/404
    ErrorDocument 403 /errors/403
    ErrorDocument 500 /errors/500
    

     

    What can I add in .htaccess ? Thank you!

  7. Hello!

    I have 2 problems with .htaccess .

    1) I have a path

    http://www.myaccount.domain.com/katarina/index.php

    and I want to remove the folder katarina and to obtain

    http://www.myaccount.domain.com/index.php

    How could I solve this problem?

     

    2) I have a path on localhost

    http://127.0.0.1:8888/katarina/index.php

    and I want to remove the folder katarina and to obtain

    http://127.0.0.1:8888/index.php

    (soI want to remove my folder "katarina")

    How could I solve this problem?

     

    Thank you!

  8. This script in .htaccess works only if I have favicon.ico in the root.

    AddType image/x-icon .ico
    RewriteRule ^favicon.ico favicon.ico [NC,L]
    

    I want to put favicon.ico in the directory IMAGES

    How could I change .htaccess?
    Thank you!

  9. Sure that I have read the php manual, but I have some problems. For exemple in this script from here

    http://php.net/manual/en/function.ignore-user-abort.php:

    <?php
    // Ignore user aborts and allow the script
    // to run forever
    ignore_user_abort(true);
    set_time_limit(0);
    
    echo 'Testing connection handling in PHP';
    
    // Run a pointless loop that sometime
    // hopefully will make us click away from
    // page or click the "Stop" button.
    while(1)
    {
    // Did the connection fail?
    if(connection_status() != CONNECTION_NORMAL)
    {
     break;
    }
    
    // Sleep for 10 seconds
    sleep(10);
    }
    
    // If this is reached, then the 'break'
    // was triggered from inside the while loop
    
    // So here we can log, or perform any other tasks
    // we need without actually being dependent on the
    // browser.
    ?>
    

     

    If I run this script I can't see the message 'Testing connection handling in PHP'. in fact the script is running without ptrint any message. You can see here:

    http://ionutspot.uhostall.com/1.php

     

    And if i delete

    ignore_user_abort(true);
    set_time_limit(0);
    

    the script will make the same thing like on the page http://ionutspot.uhostall.com/1.php

     

    So i hope that you understood me, i can't understand how could i use ignore_user_abort....

  10. i have put in database.php

    class Database {
     protected $_link, $_result, $_numRows;
    
     public function __construct($server, $username, $password, $db) {
       $this->_link=mysql_connect($server, $username, $password);
       mysql_select_db($db, $this->_link);
     }
    
     public function disconnect() {
     mysql_close($this->_link);
     }
    
     public function query($sql) {
     $this->_result=mysql_query($sql, $this->_link);
        $this->_numRows=mysql_num_rows($this->_result);     
     }
    
     public function numRows() {
       return $this->_numRows;
    
     } 
    
     public function rows() {
       $rows=array();
    
       for ($x=0; $x < $this->_numRows; $x++) {
       $rows[] = mysql_fetch_assoc($this->_result);
       }   
       return $rows;
     }
    }
    

    This code works!

    thank you very much for your help!

  11. Hello! I'm trying to learn OOP and I studying this example from phpacademy: http://www.youtube.com/watch?v=Ny4IJwyZKwo

     

    But this code has an error:

    [b]Notice[/b]: Undefined property: Database::$numRows in [b]C:\Program Files (x86)\EasyPHP-5.3.7.0\www\work\php academy\index.php[/b] on line [b]7[/b]
    No books!
    

     

    The line 7 in index.php is

    if ($db->numRows == 0) {
    

     

    The code from index.php

    require_once('classes/database.php');
    
    $db=new Database('localhost', 'root', '', 'librarie');
    
    $db->query("select titlu from carti");
    if ($db->numRows == 0) {
     echo 'No books!';
    }
    else {
      foreach ($db->rows() as $carte) {
       echo $carte['titlu'], '<br>';
      }
      echo '<p>', $db->numRows(), ' carti </p>';
    
    
    }
    
    $db->disconnect();
    

     

    and the code from database.php

    class Database {
     protected $_link, $_result, $_numRows;
    
     public function __construct($server, $username, $password, $db) {
       $this->_link=mysql_connect($server, $username, $password);
       mysql_select_db($db, $this->_link);
     }
    
     public function disconnect() {
     mysql_close($this->_link);
     }
    
     public function query($sql) {
     $this->_result=mysql_query($sql, $this->_link);
        $this->_numRows=mysql_num_rows($this->_result);     
     }
    
     public function numRows() {
       $this->_numRows;
     } 
    
     public function rows() {
       $rows=array();
    
       for ($x=0; $x < $this->_numRows(); $x++) {
       $rows[] = mysql_fetch_assoc($this->_result);
       }   
       return $rows;
     }
    }
    

     

    So, what can I do? Thank you very much for your help!

  12. OK! I will present the problem...

    My link is with $numele=$row['numele']

    href="/calcioitalia/'.$pagina.'/'.$id_squadra.'/'.$numele.'.php"
    

    and in htacces i have

    Options +FollowSymlinks
    
    RewriteEngine on
    
    php_flag session.auto_start 1
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/([a-zA-Z0-9.\s]+)/?.php$ index.php?pagina=$1&id_squadra=$2&numele=$3 [L,QSA]
    
    RewriteRule ^(.*)\.html$ $1.php [nc]
    
    ErrorDocument 404 /errors/404
    ErrorDocument 403 /errors/403
    ErrorDocument 500 /errors/500
    
    

    and the page calcioitalia/teams/1/Juventus F.C. Torino.php works!!!

    *********************************************************************************************

    My link is with $numele=urlencode($numele);

    href="/calcioitalia/'.$pagina.'/'.$id_squadra.'/'.$numele.'.php"
    

    and in htacces i have

    Options +FollowSymlinks
    
    RewriteEngine on
    
    php_flag session.auto_start 1
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/([a-zA-Z0-9.\s]+)/?.php$ index.php?pagina=$1&id_squadra=$2&numele=$3 [L,QSA]
    
    RewriteRule ^(.*)\.html$ $1.php [nc]
    
    ErrorDocument 404 /errors/404
    ErrorDocument 403 /errors/403
    ErrorDocument 500 /errors/500
    
    

    and the page /calcioitalia/teams/1/Juventus+F.C.+Torino.php NOT works!!!

    I have the error 404 Not Found

    The requested URL /calcioitalia/teams/1/Juventus+F.C.+Torino.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    *******************

    So why doesn't work with urlencode???

    ***

    Could you present me one of your examples that work?

    Thank you for all!

  13. OK! I will present the problem...

    My link is with $numele=$row['numele']

    href="/calcioitalia/'.$pagina.'/'.$id_squadra.'/'.$numele.'.html"
    

    and in htacces i have

    Options +FollowSymlinks
    
    RewriteEngine on
    
    php_flag session.auto_start 1
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/([a-zA-Z0-9.\s]+)/?.php$ index.php?pagina=$1&id_squadra=$2&numele=$3 [L,QSA]
    
    RewriteRule ^(.*)\.html$ $1.php [nc]
    
    ErrorDocument 404 /errors/404
    ErrorDocument 403 /errors/403
    ErrorDocument 500 /errors/500
    
    

    and the page calcioitalia/teams/1/Juventus F.C. Torino.php works!!!

    *********************************************************************************************

    My link is with $numele=urlencode($numele);

    href="/calcioitalia/'.$pagina.'/'.$id_squadra.'/'.$numele.'.html"
    

    and in htacces i have

    Options +FollowSymlinks
    
    RewriteEngine on
    
    php_flag session.auto_start 1
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^([a-zA-Z0-9_-]+)/([0-9]+)/([a-zA-Z0-9.\s]+)/?.php$ index.php?pagina=$1&id_squadra=$2&numele=$3 [L,QSA]
    
    RewriteRule ^(.*)\.html$ $1.php [nc]
    
    ErrorDocument 404 /errors/404
    ErrorDocument 403 /errors/403
    ErrorDocument 500 /errors/500
    
    

    and the page /calcioitalia/teams/1/Juventus+F.C.+Torino.php NOT works!!!

    I have the error 404 Not Found

    The requested URL /calcioitalia/teams/1/Juventus+F.C.+Torino.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    *******************

    So why doesn't work with urlencode???

    ***

    Could you present me one of your examples that work?

    Thank you for all!

  14. i think that the problem is that I must to decode $pagina, $id_squadra, $numele in index.php, because in horizontalmenu.php I have

    href="/calcioitalia/'.seoUrl($pagina).'/'.seoUrl($id_squadra).'/'.seoUrl($numele).'.html"
    

    and in index.php, and teams.php I need the originally $pagina, $id_squadra, $numele

    So how could I decode?

×
×
  • 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.