Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php] taki url nie dziala "index.php?id=cos"
Forum PHP.pl > Forum > Przedszkole
nszablin
Witajcie.
Wlasnie zainstalowalem server apache 2.2 + php 5.1.4 i nie wiem dlaczego nie dzialaja linki w formie "index.php?id=cos" moze ktos cos podpowie. Z gory wielkie dzieki
nospor
w jakim sensie ci nie dziala? Wyskakuje bląd serwera? CZy moze oczekiwales czegos innego a dostajesz cos inne?
nszablin
nie ma zadnych bledow klikam przycisk i nic sie nie dzieje a powinno bo na kombajnie easyphp wszystko jest ok
nospor
ojejku.... ale wysil sie troche. co ma byc? pokaz kod php. przyczyn bledu moze byc wiele, a we wrozke dzis naprawde nie mam ochoty sie bawic.
nszablin
blad nie lezy po stronie kodu php tylko po stronie serwera bo przeciez na kombajnie easyphp i na "innym" serwerze dziala. musialem cos zle skonfigurowac i nie wiem co. Czy jest jakas opcja w php.ini ktora blokuje taki zapis url?
nospor
toc ci tlumacze: pokaz kod, to moze bede wiedzial jakie mozesz miec bledy. moze to byc wylaczone np. register_globals, ale rownie dobrze moze to byc wiele innych.

Ale jak nie chcesz zeby ci pomoc to mnie tym bardziej nie zalezy. nara.
nszablin
nie denerwuj sie tak. potrzebuje pomocy. przepraszam

[php]

engine = On

zend.ze1_compatibility_mode = Off


short_open_tag = On


asp_tags = Off


precision = 12


y2k_compliance = On

output_buffering = Off


zlib.output_compression = Off

implicit_flush = Off


unserialize_callback_func=

serialize_precision = 100

allow_call_time_pass_reference = On

safe_mode = Off

safe_mode_gid = Off

safe_mode_include_dir =

safe_mode_exec_dir =

safe_mode_allowed_env_vars = PHP_

safe_mode_protected_env_vars = LD_LIBRARY_PATH

;open_basedir =

disable_functions =

disable_classes =

; ignore_user_abort = On

; realpath_cache_size=16k

; realpath_cache_ttl=120

expose_php = On

max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)

error_reporting = E_ALL & ~E_NOTICE

display_errors = On

display_startup_errors = Off

log_errors = Off

log_errors_max_len = 1024

ignore_repeated_errors = Off

ignore_repeated_source = Off

report_memleaks = On

track_errors = Off

;html_errors = Off

;error_prepend_string = "<font color=ff0000>"

;error_append_string = "</font>"

;error_log = filename

;error_log = syslog


;arg_separator.output = "&amp;"

;arg_separator.input = ";&"

variables_order = "EGPCS"

register_globals = On

register_long_arrays = On

register_argc_argv = On

auto_globals_jit = On

post_max_size = 8M


magic_quotes_gpc = On

magic_quotes_runtime = Off

magic_quotes_sybase = Off

auto_prepend_file =
auto_append_file =

default_mimetype = "text/html"
;default_charset = "iso-8859-1"

;always_populate_raw_post_data = On

doc_root =

user_dir =

extension_dir = "./"

enable_dl = On

; cgi.force_redirect = 1

; cgi.nph = 1

; cgi.redirect_status_env = ;


; fastcgi.log = 0

;cgi.rfc2616_headers = 0



allow_url_fopen = On

;from="john@doe.com"

; user_agent="php"

default_socket_timeout = 60

; auto_detect_line_endings = Off

extension=php_mbstring.dll
extension=php_bz2.dll
extension=php_curl.dll
extension=php_dba.dll
extension=php_dbase.dll
extension=php_exif.dll
extension=php_fdf.dll
extension=php_filepro.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_ifx.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mcrypt.dll
extension=php_mhash.dll
extension=php_mime_magic.dll
extension=php_ming.dll
extension=php_mssql.dll
extension=php_msql.dll
extension=php_mysql.dll
extension=php_oci8.dll
extension=php_openssl.dll
extension=php_oracle.dll
extension=php_pgsql.dll
extension=php_shmop.dll
extension=php_snmp.dll
extension=php_sockets.dll
extension=php_sqlite.dll
extension=php_sybase_ct.dll
extension=php_tidy.dll
extension=php_xmlrpc.dll
extension=php_xsl.dll



;date.timezone =

define_syslog_variables = Off

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

;mail.force_extra_parameters =

[SQL]
sql.safe_mode = Off

[ODBC]
;odbc.default_db = Not yet implemented
;odbc.default_user = Not yet implemented
;odbc.default_pw = Not yet implemented

; Allow or prevent persistent links.
odbc.allow_persistent = On

; Check that a connection is still valid before reuse.
odbc.check_persistent = On

; Maximum number of persistent links. -1 means no limit.
odbc.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
odbc.max_links = -1

; Handling of LONG fields. Returns number of bytes to variables. 0 means
; passthru.
odbc.defaultlrl = 4096

; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
; of uodbc.defaultlrl and uodbc.defaultbinmode
odbc.defaultbinmode = 1


session.name = PHPSESSID

; Initialize session on request startup.
session.auto_start = 0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; The path for which the cookie is valid.
session.cookie_path = /

; The domain for which the cookie is valid.
session.cookie_domain =

; Handler used to serialize data. php is the standard serializer of php.
session.serialize_handler = php

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 100

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440


session.bug_compat_42 = 1
session.bug_compat_warn = 1

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
session.referer_check =

; How many bytes to read from the file.
session.entropy_length = 0

; Specified here to create the session id.
session.entropy_file =

;session.entropy_length = 16

;session.entropy_file = /dev/urandom

; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
session.cache_limiter = nocache

; Document expires after n minutes.
session.cache_expire = 180

session.use_trans_sid = 0

; Select a hash function
; 0: MD5 (128 bits)
; 1: SHA-1 (160 bits)
session.hash_function = 0

; Define how many bits are stored in each character when converting
; the binary hash data to something readable.
;
; 4 bits: 0-9, a-f
; 5 bits: 0-9, a-v
; 6 bits: 0-9, a-z, A-Z, "-", ","
session.hash_bits_per_character = 4

url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="


[Assertion]
; Assert(expr); active by default.
;assert.active = On

; Issue a php warning for each failed assertion.
;assert.warning = On

; Don't bail out by default.
;assert.bail = Off

; User-function to be called if an assertion fails.
;assert.callback = 0

; Eval the expression with current error_reporting(). Set to true if you want
; error_reporting(0) around the eval().
;assert.quiet_eval = 0

[Verisign Payflow Pro]
; Default Payflow Pro server.
pfpro.defaulthost = "test-payflow.verisign.com"

; Default port to connect to.
pfpro.defaultport = 443

; Default timeout in seconds.
pfpro.defaulttimeout = 30

; Default proxy IP address (if required).
;pfpro.proxyaddress =

; Default proxy port.
;pfpro.proxyport =

; Default proxy logon.
;pfpro.proxylogon =

; Default proxy password.
;pfpro.proxypassword =

[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
;com.typelib_file =
; allow Distributed-COM calls
;com.allow_dcom = true
; autoregister constants of a components typlib on com_load()
;com.autoregister_typelib = true
; register constants casesensitive
;com.autoregister_casesensitive = false
; show warnings on duplicate constat registrations
;com.autoregister_verbose = true

[mbstring]
; language for internal character representation.
;mbstring.language = Japanese

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
;mbstring.internal_encoding = EUC-JP

; http input encoding.
;mbstring.http_input = auto

; http output encoding. mb_output_handler must be
; registered as output buffer to function
;mbstring.http_output = SJIS

; enable automatic encoding translation according to

;mbstring.encoding_translation = Off

; automatic encoding detection order.
; auto means
;mbstring.detect_order = auto

; substitute_character used when character cannot be converted
; one from another
;mbstring.substitute_character = none;


;mbstring.func_overload = 0

; enable strict encoding detection.
;mbstring.strict_encoding = Off


[gd]
; Tell the jpeg decode to libjpeg warnings and try to create
; a gd image. The warning will then be displayed as notices
; disabled by default
;gd.jpeg_ignore_warning = 0

[exif]
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
; With mbstring support this will automatically be converted into the encoding
; given by corresponding encode setting. When empty mbstring.internal_encoding
; is used. For the decode settings you can distinguish between motorola and
; intel byte order. A decode setting cannot be empty.
;exif.encode_unicode = ISO-8859-15
;exif.decode_unicode_motorola = UCS-2BE
;exif.decode_unicode_intel = UCS-2LE
;exif.encode_jis =
;exif.decode_jis_motorola = JIS
;exif.decode_jis_intel = JIS

[Tidy]
; The path to a default tidy configuration file to use when using tidy
;tidy.default_config = /usr/local/lib/php/default.tcfg

; Should tidy clean and repair output automatically?
; WARNING: Do not use this option if you are generating non-html content
; such as dynamic images
tidy.clean_output = Off

[soap]
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=1
; Sets the directory name where SOAP extension will put cache files.
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
soap.wsdl_cache_ttl=86400

; Local Variables:
; tab-width: 4
; End:
nospor
ja sie nie denerwuje winksmiley.jpg

A mowiac kod, mialem na mysli kod php twojego skryptu.

Ta konfuguracja co pokazaleś, to ona jest aktualna dla serwera co uruchamiasz skrypt?
nszablin
jest aktualna wywalilem troche zbednego opis
kod wyglada mniejwiecej tak:
klikam link:

  1. <a href="http://localhost/index.php?id=cos_tam\" target=\"_blank\">cos_tam</a>


nastepnie wykonuje sie:

  1. <?php
  2. switch (TRUE)
  3. {
  4. //Menu glowne
  5.  case ($id == 'aktywacja'): include("moduly/user/user.php"); break;
  6.  case ($id == 'newuser'): include("moduly/user/user.php"); break;
  7.  case ($id == 'newuseradddone'): include("moduly/user/user.php"); break;
  8.  case ($id == 'passremind'): include("moduly/user/user.php"); break;
  9.  case ($id == 'logout'): include("moduly/login/logout.php"); break;
  10.  case ($id == 'newuseradddone'): include("moduly/user/user.php"); break;
  11.  case ($id == 'upload_files'): include("testplik/index.php"); break;
  12.  case ($id == 'glowna'): default: include("glowna.php");
  13. }
  14. ?>


co otwiera odpowiednia strone
nospor
Bardzo dziwnie tego switcha uzywasz.
http://pl.php.net/manual/pl/control-structures.switch.php

czyli u ciebie powiino byc:
  1. <?php
  2. echo 'Moje id to: '.$id;//by sprawdzic czy dostajesz id
  3.  
  4. switch ($id){
  5. case 'aktywacja'://.......
  6. case 'newuser' ://....
  7. //.......
  8. }
  9. ?>
nszablin
ja wiem czy tak dziwnie? Dla mnie jest to wygodne bo zamiast $id moge dac cokolwiek innego na $zam i nic mnie nie ogranicza, jak na moje potrzeby jest to dobre rozwiazanie
nospor
blinksmiley.gif
no to tu zamiast:
switch ($id)
daj:
switch ($zam)
i tez cie nic nie ogranicza smile.gif
Bo to co ty zrobiles to wypaczyles idee switcha. Rownie dobrze mozesz ify dac.

Zrob jak napisalem i powiedz czy dziala.
nszablin
co do switch masz racje. jesli chodzi o moj problem to tak jakby $id nie istniala bo wyswietla sie tylko "moje id to
nospor
No to dziwne, bo wg. konfiguracji masz wlaczone register_globals.
No nic, sprobuj daj tak przed kodem:
  1. <?php
  2. $id = $_GET['id'];
  3. ?>
nszablin
dalem i dziala!!!!! ale wytlumacz mi dlaczego tak jest?questionmark.gif
nospor
najwyraźniej jednak pokazales mi zlą konfigurację.
W przypadku gdy register_globals jest wylączone (tak jak w rzeczywistosci u Ciebie), to do zmiennych musisz dobierac sie poprzez $_GET['zmienna'], $_POST['zmienna'], $_SESSION['zmienna'] itd. a nie tak $zmienna.

ps: przenosze na przedszkole
ps2: na przyszlosc nie dyskutuj tylko od razy rób oco proszą winksmiley.jpg
nszablin
ok pozdrawiam
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.