Jump to content

Ilovetopk

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Ilovetopk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've worked with php, but I've never really found something about this in tutorials. How do you make a webpage work like this: you have a store at http://yoursite.com/store.php and someone looks at an item and the address bar says this: http://yoursite.com/store.php?item="item" [*]how does the ?item="item" work? [*]how can i use it in my coding (make pages that that show that)? [*]Does it involve a database? I have more questions to, but start with these. Thanks, Ilvoetopk.
  2. the error i'm getting is "No input file specified." I guess I thought I put it in the title or something. I should of looked at it closer!
  3. Okay, I've (tried) to set up php with nginx, and php-cgi.exe is on the right port, but i get this error whether i load index.php (a page that exists) or bad.php (a page that doesn't exist) I've tried it without php-cgi running, or it running on the wrong port, and It loads forever than gives a "this page is temporarly unavaliable" error. I've been working at this for hours, please help! here is my nginx.conf file: #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /nginx/html; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } #proxy the PHP scripts to Apache listening on 127.0.0.1:80 #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /nginx/html$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } and here is my error log: 2010/05/08 17:15:43 [error] 1996#1544: *1 CreateFile() "C:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost" 2010/05/08 19:14:53 [error] 5916#4752: *1 CreateFile() "c:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost" 2010/05/08 19:14:53 [error] 5916#4752: *1 CreateFile() "c:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost" 2010/05/08 19:14:53 [error] 5916#4752: *1 CreateFile() "c:\WEMP\nginx/html/favicon.ico" failed (2: The system cannot find the file specified), client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "localhost" 2010/05/08 19:34:14 [error] 5916#4752: *18 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost" 2010/05/08 19:35:30 [emerg] 3100#3544: unknown directive "proxy" in C:\WEMP\nginx/conf/nginx.conf:59 2010/05/08 19:36:37 [emerg] 6816#4544: unknown directive "proxy" in c:\WEMP\nginx/conf/nginx.conf:59 2010/05/08 19:36:37 [alert] 6348#6532: worker process 6816 exited with code 1 2010/05/08 19:36:37 [alert] 6348#6532: can not respawn worker 2010/05/08 19:37:21 [emerg] 3488#4400: unknown directive "proxy" in c:\WEMP\nginx/conf/nginx.conf:59 2010/05/09 09:10:14 [emerg] 2444#3780: unknown directive "proxy" in c:\WEMP\nginx/conf/nginx.conf:59 2010/05/09 16:45:21 [emerg] 6548#5724: bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions) 2010/05/09 17:11:27 [error] 1760#5020: *3 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost" 2010/05/09 17:24:10 [error] 1960#2852: *3 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /bad.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:10000", host: "localhost" 2010/05/09 17:25:19 [error] 1960#2852: *8 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:10000", host: "localhost" I tried to change the port on php-cgi, but that didn't work so i canged it back. I'm calling the folder i've put it in WEMP (windows, engine x, mysql, php) because i'm going to get it all together and package it so anyone can use it if they want. I really need to get this worked out soon. I've got Apache and iis7 on this computer (I'm sure they're not interfering) and i have never had such a problem with them. basically this is going to be used as a test server. Thanks in advance (I hope i have a reason to thank later), Ilovetopk
  4. thanks, i figured that out last night before you posted, and forget to tell you.
  5. okay, now it says theirs a problem on line 71 (the ?> php end tag), see any problems their? the error changed too, it now: Parse error: syntax error, unexpected $end Thanks you two for helping, I've been working with php for a week (you read right, a week) so i'm still getting used to the semi-colon after every line!
  6. i get this when trying to execute my change password script. It says it is on line 24. but it looks fine to me... can you guys see the problem? here is the line: $query = "SELECT * FROM members WHERE login='$login' AND passwd='".md5($passwdo)."'"; here is my entire script: <?php //enters connection details require_once('config.php'); //connects to mysql database $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //selects database $db = mysql_select_db(DB_DATABASE, $link); if(!$db) { die("Unable to select database"); } //assigns entered text as variables $passwdo = $_POST['passwdo']; $passwdc = $_POST['passwdc']; $passwdc2 = $_POST['passwdc2']; $login = $_SESSION['SESS_MEMBER_ID'] //checks password with server $query = "SELECT * FROM members WHERE login='$login' AND passwd='".md5($passwdo)."'"; $result = mysql_query($query); if(!$result) { print("Query Error: ".mysql_error()); } if($result) { if(mysql_num_rows($result) != 1) { echo 'password does not mach password in database.' header("location: change-password-form.php") } //checks for errors if($passwdc != $passwdc2) { $errmsg_arr[] = 'Passwords do not match. please reenter'; $errflag = true; } //error stuff if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: change-password-form.php"); exit(); } //update password on database $query="UPDATE members SET passwd=md5('$passwordc') WHERE login='$login'"; $result=mysql_query($query); if(!$result) { print("Query Error: ".mysql_error()); } //redirects or tells of failure if($result) { header("location: change-password-success.php"); exit(); } else { die("Could not change password, try again in a few minutes, or contact the admin."); } //unset database unset($db); ?>
  7. figured it out, the file type was hidden from me, it was an html, not a php! moved contents to php file, and wala!
  8. figured it out, the file type was hidden from me, it was an html, not a php! moved contents to php file, and wala!
  9. When i submit my data via the form to my script script, it shows a blank page. When i view the source, it shows my php code. when i move the same script to the page with my form, it executes fine. why would this be? Is it something with permissions? <?php //enters connection details require_once('config.php'); //connects to mysql database $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //selects database $db = mysql_select_db(DB_DATABASE, $link); if(!$db) { die("Unable to select database"); } //cleans posted login name $login = $_POST['user']; //gets email from server $query="SELECT email FROM members WHERE login='$login'"; $result=mysql_query($query); if(!$result) { print("Query Error: ".mysql_error()); } $row = mysql_fetch_array($result); //sets $email as their emqail address $email = $row['email']; //generates random password class utility { static $random = ''; // generates a random password // By default of length 12 having special characters static function generate_password($length = 12, $special_chars=true) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; if($special_chars) $chars .= '!@#$%^&*_-()'; $password = ''; for($i=0; $i<$length; $i++) $password .= substr($chars, self::generate_random_number(0, strlen($chars)-1), 1); return $password; } // generates a random number between $min and $max static function generate_random_number($min=0, $max=0) { // generate seed. TO-DO: Look for a better seed value everytime $seed = mt_rand(); // generate $random // special thing about random is that it is 32(md5) + 40(sha1) + 40(sha1) = 112 long // hence if we cut the 1st 8 characters everytime, we can get upto 14 random numbers // each time the length of $random decreases and when it is less than 8, new 112 long $random is generated if(strlen(self::$random) < 8 ) { self::$random = md5(uniqid(microtime().mt_rand(), true).$seed); self::$random .= sha1(self::$random); self::$random .= sha1(self::$random.$seed); } // take first 8 characters $value = substr(self::$random, 0, ; // strip first 8 character, leaving remainder for next call self::$random = substr(self::$random, ; $value = abs(hexdec($value)); // Reduce the value to be within the min - max range. 4294967295 = 0xffffffff = max random number if($max != 0) $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1))); return abs(intval($value)); } } //defines random password as variable $password = utility::generate_password(); //updates password on database $query="UPDATE members SET passwd=md5('$password') WHERE login='$login'"; $result=mysql_query($query); if(!$result) { print("Query Error: ".mysql_error()); } //sends password to email address $to = "$email"; $subject = "Password recovery"; $message = "Your information on Ilovetopk.is-a-geek.com: Login: $login Password: $password Email: $email Login in and change your password as soon as possible. If you did not want to reset your password, please inform me and change it back to normal. Please do not respond to this email."; $from = "admin@ilovetopk.is-a-geek.com"; $headers = "From: $from"; $mail=mail($to,$subject,$message,$headers); //redirects or tells of failure if($mail) { header("location:'recover-success.php'"); exit(); } else { die("Could not mail password, try again in a few minutes, or contact the admin."); } //unset database unset($db); ?>
  10. I have wordpress in one directory on my website, and in another I have a test login form and other thing. The php for one page, my recover password script, will not execute. when i click submit and my form sends the data, it shows a blank page, and the source is my php code. i'm running windows 7 home premium, using firefox to browse the web, i have tested with IE. my script is below: <?php echo "World!"; ?> <?php //enters connection details require_once('config.php'); //connects to mysql database $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //selects database $db = mysql_select_db(DB_DATABASE, $link); if(!$db) { die("Unable to select database"); } //cleans posted login name $login = $_POST['user']; //gets email from server $query="SELECT email FROM members WHERE login='$login'"; $result=mysql_query($query); if(!$result) { print("Query Error: ".mysql_error()); } $row = mysql_fetch_array($result); //sets $email as their emqail address $email = $row['email']; //generates random password class utility { static $random = ''; // generates a random password // By default of length 12 having special characters static function generate_password($length = 12, $special_chars=true) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; if($special_chars) $chars .= '!@#$%^&*_-()'; $password = ''; for($i=0; $i<$length; $i++) $password .= substr($chars, self::generate_random_number(0, strlen($chars)-1), 1); return $password; } // generates a random number between $min and $max static function generate_random_number($min=0, $max=0) { // generate seed. TO-DO: Look for a better seed value everytime $seed = mt_rand(); // generate $random // special thing about random is that it is 32(md5) + 40(sha1) + 40(sha1) = 112 long // hence if we cut the 1st 8 characters everytime, we can get upto 14 random numbers // each time the length of $random decreases and when it is less than 8, new 112 long $random is generated if(strlen(self::$random) < 8 ) { self::$random = md5(uniqid(microtime().mt_rand(), true).$seed); self::$random .= sha1(self::$random); self::$random .= sha1(self::$random.$seed); } // take first 8 characters $value = substr(self::$random, 0, ; // strip first 8 character, leaving remainder for next call self::$random = substr(self::$random, ; $value = abs(hexdec($value)); // Reduce the value to be within the min - max range. 4294967295 = 0xffffffff = max random number if($max != 0) $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1))); return abs(intval($value)); } } //defines random password as variable $password = utility::generate_password(); //updates password on database $query="UPDATE members SET passwd=md5('$password') WHERE login='$login'"; $result=mysql_query($query); if(!$result) { print("Query Error: ".mysql_error()); } //sends password to email address $to = "$email"; $subject = "Password recovery"; $message = "Your information on Ilovetopk.is-a-geek.com: Login: $login Password: $password Email: $email Login in and change your password as soon as possible. If you did not want to reset your password, please inform me and change it back to normal. Please do not respond to this email."; $from = "admin@ilovetopk.is-a-geek.com"; $headers = "From: $from"; $mail=mail($to,$subject,$message,$headers); //redirects or tells of failure if($mail) { header("location:'recover-success.php'"); exit(); } else { die("Could not mail password, try again in a few minutes, or contact the admin."); } //unset database unset($db); ?> the "hello world" was just for testing. also, my view source goes to notepad ++, and it says the pages name is recover-password.php.htm is this a problem?
  11. ok, any suggestions on an easy to set up mail server. I was looking at mercury mail, but i need a good tutorial on how to set it up.
  12. ok, i got the errors down to here. Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in E:\xampplite\htdocs\PHP-Login\forgot.php on line 66 Could not mail password, try again in a few minutes, or contact the admin. The "Could not mail password, try again in a few minutes, or contact the admin." is my error if i can't send the email, so i just need to work out the sendmail function
  13. suddenly something happened World!Query Error: Unknown column 'test' in 'where clause' Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in E:\xampplite\htdocs\PHP-Login\forgot.php on line 27 Query Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '['']) WHERE login=test' at line 1 Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in E:\xampplite\htdocs\PHP-Login\forgot.php on line 67 Could not mail password, try again in a few minutes, or contact the admin. any idea how to fix all of this?
  14. ok, gimme some suggestions! My wordpress blog (in a diffrent directory) is almost entirely php, and it's working!
×
×
  • 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.