PHP - Viewing Error Logs In Php
Hey gang,
Is there any way to view the apache error.log file in PHP? Similar TutorialsHi, on my cpanel I can see some errors: [Mon Mar 12 08:41:05 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/504.shtml, referer: http://www.mysite.com/admin/ [Mon Mar 12 08:33:25 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/404.shtml [Mon Mar 12 08:33:25 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/404.shtml [Mon Mar 12 08:30:12 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/404.shtml [Mon Mar 12 08:30:12 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/favicon.ico [Mon Mar 12 08:30:12 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/504.shtml, referer: http://www.mysite.com/admin/ [Mon Mar 12 08:29:55 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/404.shtml [Mon Mar 12 08:29:55 2012] [error] [client 46.120.43.163] File does not exist: /home/affilinn/public_html/favicon.ico what is that? Hello, I have php application, it is hosted on a shared server. How can I view the errors in my application with the details of the error for my website users? Thanks, I have this function I use to simplify things. function search_string( $needle, $haystack ) { if ( preg_match_all( "/$needle/im", $haystack ) || strpos( $haystack, $needle ) ) { return TRUE; } return FALSE; } I keep getting this error in my PHP logs, and it comes in a sequence: [07-Nov-2020 05:34:14 America/Los_Angeles] PHP Warning: preg_match_all(): Unknown modifier 'G' in /home/baser-b/public_html/include/functions.php on line 791 [07-Nov-2020 05:34:14 America/Los_Angeles] PHP Warning: preg_match_all(): Unknown modifier 'g' in /home/baser-b/public_html/include/functions.php on line 791 Meaning, it will come with one with the small g, then three with the big G, then one with the small g, then five with the big G, and so on.... My question is, how can I stop getting this error. It won't show me the functions being called to arrive at this answer, as this is likely an error generated by another function calling this one. I was wondering if anyone knew what to change in the search_string function to stop getting this error, why this error is happening, or why the strange repetitive sequence. Is it someone trying to do a hack? The only variable that would be changeable by a visitor would be the $needle variable, so what could they type that has something to do with 'g' to get this? Anyway, thanks. Hello everyone, I have a script that shows the news posted on my website in a bigger format with comments ect... but it gives me the error Code: [Select] Parse error: syntax error, unexpected '}' in /home/stormgc/public_html/sources/news_view.php on line 50 I reviewed the code, I know what the error fix would be, but I cannot find the proper place to put it. If someone could please review the script and help that would be awesome! --> Code: [Select] <? $id = $_GET['id']; $news = mysql_query("SELECT * FROM `news` WHERE id='$id'"); if(mysql_num_rows($news) > 0){ $newz = mysql_fetch_array($news); loadHeader($newz['title']); } if($_GET['update'] == 1){ confirm('You have successfully updated this news.'); } ?> <br /> <div class="title"><? echo $newz['title']; ?><span class="options"><a href="index.php">Home</a> / <? echo $newz['title']; ?></span></div> <div class="content"> <? $username = $newz['username']; ?> <div class="category"><a href="index.php?action=news_view&id=<? echo $newz['id']; ?>"><? echo $newz['title']; ?></a> posted on <? displayTime($newz['time'], 'F jS, Y \a\t g:i a'); ?> <span class="options">By <? $accounts = mysql_query("SELECT * FROM accounts JOIN profiles ON accounts.username=profiles.username WHERE accounts.username='$username'"); if(mysql_num_rows($accounts) > 0){ $account = mysql_fetch_array($accounts); ?> <a href="index.php?action=profile&user=<? echo $account['username']; ?>">{<? } echo $account['display_name']; ?></a> <? } else { echo $username; } ?> </span></div> <div class="cell1"> <? echo parseText($newz['message']); ?> <br /><br /> <a href="index.php?action=forums">Discuss this in the forums...</a> <? if($cur_account['staff'] == "on" || $cur_admin == 1){ ?> <br /> <br /> <a href="index.php?action=news_modify&id=<? echo $newz['id']; ?>">Modify</a> | <a href="" onClick="if(confirm('Are you sure you want to delete this news?')){ location.href='index.php?action=news_delete&id=<? echo $newz['id']; ?>'; } return false;">Delete</a> <? } ?> </div> <? loadFooter(); } else { fatalError('The news article you are trying to view does not exist.'); } ?> Thanks, NW I have a mysql table in which will be updated fairly frequently via php code on a form. My question is how do I code a log of the changes made into another table using php or calling a stored procedure from within the database. or if you can think of a better way suggest it. Stored procedure would be more secure if possible. what is the best way to add 1 to the database filed TimesLoggedIn after a user has logged in? Regards Ant Hello all, I have a php login project that I am almost finished with. I have users in a table and I can login with the users BUT when I click the login button I get
Notice: session_start(): A session had already been started - ignoring in E:\xampp\htdocs\PHP_Login\index.php on line 53 Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\PHP_Login\index.php:53) in E:\xampp\htdocs\PHP_Login\index.php on line 60 When I click the refresh button I get what I am supposed to get and I am logged in to the dashboard.
<?php error_reporting(E_ALL); ini_set("display_errors", "1"); // Initialize SESSION session_start(); // Check if logged in ifso sent to Welcome.php if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true) { header("Location: php/welcome.php"); exit; } // Include config mySQL require_once "php/config.php"; // Define all variables and initialize them as 'empty' $username = $password = ""; $usernameerror = $passworderror = ""; // Process form data when submitted if($_SERVER["REQUEST_METHOD"] == "POST") { // Check if username is empty. if(empty(trim($_POST["username"]))) { $usernameerror = "Please enter a username"; } else { $username = trim($_POST["username"]); } // Check if password is empty. if(empty(trim($_POST["password"]))) { $passworderror = "Please enter a password"; } else { $password = trim($_POST["password"]); } // Validate credentials. if(empty($usernameerror) && empty($passworderror)) { // Prepare a SELECT statement. $sql = "SELECT userid, name, username, password FROM users WHERE " . "username = :username"; if($stmt = $pdoConn->prepare($sql)) { // bind variables to the prepared statement as parameters $stmt->bindParam(":username", $param_username, PDO::PARAM_STR); // Set parameters $param_username = trim($_POST["username"]); // Attempt to execute prepared statement. if($stmt->execute()) { // Check if username exists if so check password. if($stmt->rowCount() == 1) { if($row = $stmt->fetch()) { $id = $row["userid"]; $username = $row["username"]; $password_hashed = $row["password"]; $name = $row["name"]; if(password_verify($password, $password_hashed)) { // Password correct start new session session_start(); // store data in SESSION variables $_SESSION["loggedin"] = true; $_SESSION["id"] = $id; $_SESSION["username"] = $username; $_SESSION["name"] = $name; //Redirect to welcome.php header("Location: php/welcome.php"); } else { // If password INCORRECT error msg $passworderror = "Password was <b>Incorrect!</b>"; } } } else { $usernameerror = "No account was found."; } } else { echo "Error something went wrong, incorrect execution "; } } // Close prepared stmt unset($stmt); } // Close connection unset($pdoConn); } ?>
basically could somebody help me with information on having a php script that deletes mysql rows which are older than 3 hours old. I know MYSQL table will need a date/time column but how can I only target ones which are 3 hours old+. Thanks i have added a member area to my wordpress site. everything works good, login, edit, delete, etc. But when i upload the logout.php file to the godaddy server, it starts logging me out on every page. The programs work fine without the logout file, but as soon as it is uploaded it keeps logging out. here is the logout.php i am using <?php // If the user is logged in, delete the session vars to log them out session_start(); if (isset($_SESSION['user_id'])) { // Delete the session vars by clearing the $_SESSION array $_SESSION = array(); // Delete the session cookie by setting its expiration to an hour ago (3600) if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time() - 3600); } // Destroy the session session_destroy(); } // Delete the user ID and username cookies by setting their expirations to an hour ago (3600) setcookie('user_id', '', time() - 3600); setcookie('username', '', time() - 3600); // Redirect to the home page $home_url = 'http://' . $_SERVER['HTTP_HOST'] . '/my-account/'; header('Location: ' . $home_url); ?> i have looked around the internet but haven't found any solutions. Please help. Thank you Hey guys, Im trying to combine 2 logs to seperate parts of a website into 1. One of them uses sessions to store it. And the other uses cookies to login. I cant seem to get it working AT ALL. Even tho the cookies are being set and I can see it being set in firefox. Here is the page with the sessions. <?php if(isset($_POST['username'])){ $username = $_POST['username']; //name of the text field for usernames $password = $_POST['password']; //likewise here just for the password //connect to the db $user = 'root'; $pswd = ''; $db = 'chat'; $conn = mysql_connect('localhost', $user, $pswd); mysql_select_db($db, $conn); //run the query to search for the username and password the match $query = "SELECT * FROM users WHERE username = '$username' AND password ='$password'"; $result = mysql_query($query) or die("Unable to verify user because : " . mysql_error()); //this is where the actual verification happens if(mysql_num_rows($result) == 1){ //the username and password match //so e set the session to true session_start(); $_SESSION['username'] = $username; //STUFF FROM HERE TO THE OTHER COMMENT IS STUFF I ADDED MANUALLY TRYING TO GET THE COOKIES TO BE SET SO THEY WORK FOR BOTH $username = $_COOKIE['user_id']; $pass = $_COOKIE['pass_id']; setcookie("user_id", "$username", time()+3600); setcookie("pass_id", "$pass", time()+3600); //END OF THE CUSTOM STUFF, IT DOESNT WORK FOR SOME REASON //and then move them to the index page or the page to which they need to go header('Location: index.php'); }else{ $err = 'Incorrect username / password.' ; } //then just above your login form or where ever you want the error to be displayed you just put in echo $err; } else ?> I made comments // in the code so you can see whats going on. Here is the code that uses cookies, also it uses 2 pages. This is the one I think that mainly adds the cookies. <?php // Login Logic $username = ""; $err = ""; $err_style = ""; $err_style2= ""; //Checks if there is a login cookie if(isset($_COOKIE['user_id'])) { //if there is, it logs you in and directes you to the members page $username = $_COOKIE['user_id']; $pass = $_COOKIE['pass_id']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());$quer++; while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: index.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // SANITISE $username = sanitize($_POST['username']); $pass = sanitize($_POST['pass']); $red = sanitize($_POST['red']); // makes sure they filled it in if(!$_POST['username']) { $err = 'You did not fill in a required section'; $err_style = "style='border: 1px solid #CC0000'"; $show_login = 1; } if(!$_POST['pass']) { $err = 'You did not fill in a required section'; $err_style2 = "style='border: 1px solid #CC0000'"; $show_login = 1; } // checks it against the database if (!$err) { $check = mysql_query("SELECT * FROM users WHERE username = '".$username."'")or die(mysql_error());$quer++; //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { $err = 'User not found - please try again!'; $err_style = "style='border: 1px solid #CC0000'"; $show_login = 1; } while($info = mysql_fetch_array( $check )) { $info['password'] = stripslashes($info['password']); $pass = $pass; //gives error if the password is wrong if ($pass != $info['password']) { $err = 'Incorrect password, please try again.'; $err_style2= "style='border: 1px solid #B02B2C;'"; $show_login = 1; } else { // if login is ok then we add a cookie $hour = time() + 3600; setcookie("user_id", $username, $hour); setcookie("pass_id", $pass, $hour); //then redirect them to the members area if (!$red) { header("Location: index.php"); } else { header("Location: $red.php"); } exit; } } } } ?> Here is the other page it also includes inside. <?php Check.php session_start(); //checks cookies to make sure they are logged in if(isset($_COOKIE['user_id'])) { $username = $_COOKIE['user_id']; $pass = $_COOKIE['pass_id']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());$quer++; while($info = mysql_fetch_array( $check )) { //if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { header("Location: login.php"); } //otherwise they are shown the admin area else { // Update some info setcookie ("user_id", $_COOKIE['user_id'], time() + 3600 ); setcookie ("pass_id", $_COOKIE['pass_id'], time() + 3600 ); // Get some basic user details, so we can use these later! $uname = $info['username']; $uID = $info['user_id']; $loggedin = 1; $admin_user = $info['admin']; } } } ?> Thanks for the upcoming help that you all provide. If anything else is needed please post here and il provide it. Hello, Recently I put my websites up, but since then it constantly records entrys from domains which are trying to reach strange paths. 103.19.87.175 - - [18/Jun/2014:12:07:12 -0400] "CONNECT www.walmart.com:443 HTTP/1.1" 405 307 "-" "-" 198.100.98.214 - - [18/Jun/2014:12:07:23 -0400] "CONNECT www.amazon.com:443 HTTP/1.1" 405 306 "-" "-" 168.63.216.55 - - [18/Jun/2014:12:07:30 -0400] "GET http://luongson.servegame.com/ HTTP/1.0" 404 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)" 31.6.71.243 - - [18/Jun/2014:12:07:34 -0400] "GET http://www.proxy-listen.de/azenv.php HTTP/1.1" 404 1402 "http://www.google.de...roxy-listen.de" "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) (Prevx 3.0.5)" 168.63.216.55 - - [18/Jun/2014:12:07:39 -0400] "GET http://luongson.servegame.com/ HTTP/1.0" 404 - "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)" 192.155.106.104 - - [18/Jun/2014:12:07:39 -0400] "GET http://pm.5188bh.com/header53621.php HTTP/1.1" 404 1402 "-" "Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; Windows NT 5.1; FunWebProducts)" 192.155.106.116 - - [18/Jun/2014:12:07:48 -0400] "GET http://121.199.31.193/proxyheader.php HTTP/1.1" 404 1402 "-" "Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; Windows NT 5.1; SV1)" 80.138.67.164 - - [18/Jun/2014:12:08:00 -0400] "GET http://www.proxy-listen.de/azenv.php HTTP/1.1" 404 1402 "http://www.google.co...roxy-listen.de" "Opera/9.20 (Windows NT 6.0; U; en)" 192.155.106.109 - - [18/Jun/2014:12:08:03 -0400] "GET http://121.199.31.193/proxyheader.php HTTP/1.1" 404 1402 "-" "Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; Windows NT 5.1; SV1; HbTools 4.7.0)" 98.126.248.250 - - [18/Jun/2014:12:08:06 -0400] "GET http://121.199.31.193/proxyheader.php HTTP/1.1" 404 1402 "-" "Mozilla/5.0 (Windows; U; Win 9x 4.90; de-DE; rv:1.8.1.21) Gecko/20090331 K-Meleon/1.5.3" 61.228.20.235 - - [18/Jun/2014:12:08:07 -0400] "CONNECT mx0.mail2000.com.tw:25 HTTP/1.0" 405 310 "-" "-" 192.155.106.106 - - [18/Jun/2014:12:08:09 -0400] "GET http://pm.5188bh.com/judgelife.php HTTP/1.1" 404 1402 "-" "Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)" 61.228.24.110 - - [18/Jun/2014:12:08:10 -0400] "CONNECT mx2.mail2000.com.tw:25 HTTP/1.0" 405 310 "-" "-" 61.228.88.55 - - [18/Jun/2014:12:08:21 -0400] "CONNECT mx3.mail2000.com.tw:25 HTTP/1.0" 405 310 "-" "-" 192.155.106.124 - - [18/Jun/2014:12:08:24 -0400] "GET http://pm.5188bh.com/judgelife.php HTTP/1.1" 404 1402 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; Acoo Browser; GTB5; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 3.5.30729; .NET CLR 3.0.30618)" 204.44.65.54 - - [18/Jun/2014:12:08:35 -0400] "CONNECT www.walmart.com:443 HTTP/1.1" 405 307 "-" "-" 192.155.106.105 - - [18/Jun/2014:12:08:36 -0400] "GET http://pm.5188bh.com/header53621.php HTTP/1.1" 404 1402 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Acoo Browser; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; FDM; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2)" [Wed Jun 18 12:07:30 2014] [error] [client 168.63.216.55] Directory index forbidden by Options directive: /var/www/html/ [Wed Jun 18 12:07:30 2014] [error] [client 168.63.216.55] File does not exist: /var/www/html/error/noindex.html [Wed Jun 18 12:07:34 2014] [error] [client 31.6.71.243] script '/var/www/html/azenv.php' not found or unable to stat, referer: http://www.google.de...proxy-listen.de [Wed Jun 18 12:07:39 2014] [error] [client 168.63.216.55] Directory index forbidden by Options directive: /var/www/html/ [Wed Jun 18 12:07:39 2014] [error] [client 168.63.216.55] File does not exist: /var/www/html/error/noindex.html [Wed Jun 18 12:07:39 2014] [error] [client 192.155.106.104] script '/var/www/html/header53621.php' not found or unable to stat [Wed Jun 18 12:07:48 2014] [error] [client 192.155.106.116] script '/var/www/html/proxyheader.php' not found or unable to stat [Wed Jun 18 12:08:00 2014] [error] [client 80.138.67.164] script '/var/www/html/azenv.php' not found or unable to stat, referer: http://www.google.co...proxy-listen.de [Wed Jun 18 12:08:03 2014] [error] [client 192.155.106.109] script '/var/www/html/proxyheader.php' not found or unable to stat [Wed Jun 18 12:08:06 2014] [error] [client 98.126.248.250] script '/var/www/html/proxyheader.php' not found or unable to stat [Wed Jun 18 12:08:09 2014] [error] [client 192.155.106.106] script '/var/www/html/judgelife.php' not found or unable to stat [Wed Jun 18 12:08:24 2014] [error] [client 192.155.106.124] script '/var/www/html/judgelife.php' not found or unable to stat [Wed Jun 18 12:08:36 2014] [error] [client 192.155.106.105] script '/var/www/html/header53621.php' not found or unable to stat Is there away to stop those fail path reach logs and only records what's else ? Or even completely stop it ? My operation system is CentOS 32bit. How do you have a log generate two different logs, and having where it posts the log at, depend on if it's a visitor, or a search engine spider HTTP_USER_AGENT (Like Googlebot, Msnbot, Yahoo! Slurp.) <?php define("DATE_FORMAT","m-d-Y - H:i:s"); define("LOG_FILE","/full_path/visitors.html"); define("LOG_FILE2","/full_path/search_engine_bots.html"); $logfileHeader='DATE - IP - HOSTNAME - BROWSER - URI - REFERRER'."\n"; $userAgent = (isset($_SERVER['HTTP_USER_AGENT']) && ($_SERVER['HTTP_USER_AGENT'] != "")) ? $_SERVER['HTTP_USER_AGENT'] : "Unknown"; $userIp = (isset($_SERVER['REMOTE_ADDR']) && ($_SERVER['REMOTE_ADDR'] != "")) ? $_SERVER['REMOTE_ADDR'] : "Unknown"; $refferer = (isset($_SERVER['HTTP_REFERER']) && ($_SERVER['HTTP_REFERER'] != "")) ? $_SERVER['HTTP_REFERER'] : "Unknown"; $uri = (isset($_SERVER['REQUEST_URI']) && ($_SERVER['REQUEST_URI'] != "")) ? $_SERVER['REQUEST_URI'] : "Unknown"; $hostName = gethostbyaddr($userIp); $actualTime = date(DATE_FORMAT); $logEntry = "$actualTime - $userIp - $hostName - $userAgent - $uri - $refferer<BR>\n"; if (!file_exists(LOG_FILE)) { $logFile = fopen(LOG_FILE,"w"); fwrite($logFile, $logfileHeader); } else { $logFile = fopen(LOG_FILE,"a"); } fwrite($logFile,$logEntry); fclose($logFile); ?> Trying to figure out a way to do pdf files other than flash based since apple has screwed that up with the iPad. so what i've thought about so far is embed the pdf but very small and then maybe clickable full size pdf viewer?? I don't really know how I would get that to work with php??? Anyone have any good solutions for this? Thanks Paul Hi all, This is probably a very basic question, but it's the first time I've had to deal with it and I can't find a direct answer anywhere online. I have blocked direct access to a file that a user has uploaded in the Apache configuration and in the .htaccess file, so that the file is only accessible through a viewing (PHP) script, which will determine whether the access is allowed or not depending on several factors. What is the actual code I need to give access? Thanks! this is my query code Code: [Select] <?php $wsi_query = "(SELECT * FROM (SELECT a.no_Yards AS 'yards', a.Day_Swam AS 'date', a.Season AS 'season', (SELECT sum(no_yards) FROM swimming WHERE Season = '$ws') AS 'totalyards', (SELECT AVG(no_Yards) FROM swimming WHERE Season = '$ws') AS 'avg', (SELECT count(*) FROM swimming WHERE Season ='$ws') AS 'timelaps', (SELECT 1 + count(*) FROM swimming b WHERE b.no_Yards > a.no_Yards AND Season = '$ws') AS hrank, (SELECT 1 + count(*) FROM swimming b WHERE b.no_Yards < a.no_Yards AND Season = '$ws') AS lrank FROM swimming AS a) AS x WHERE Season = '$ws' )"; $wsi_result = mysql_query($wsi_query) or die("Query failed ($wsi_query) - " . mysql_error()); $wsi_row = mysql_fetch_assoc($wsi_result); ?> what it should do is output both the min and the max values like this Code: [Select] <?php while ($mm_wsi_row = mysql_fetch_assoc($wsi_result)){ if ($mm_wsi_row['hrank'] == 1){ if ($mm_wsi_row['date'] == "0000-00-00"){$dayswam = "";}else{$dayswam = $mm_wsi_row['date'];} echo "<tr>"; echo "<td style='background-color:#F90'>Max Length:</td>"; echo "<td>" . number_format($mm_wsi_row['yards']) . "</td>"; echo "<td>" . $dayswam . "</td>"; echo "</tr>"; } if($mm_wsi_row['lrank'] == 1){ if ($mm_wsi_row['date'] == "0000-00-00"){$dayswam = "";}else{$dayswam = $mm_wsi_row['date'];} echo"<tr>"; echo "<td style='background-color:#F90'>Min Length:</td>"; echo "<td style='background-color:#FF9'>". number_format($mm_wsi_row['yards']) . "</td>"; echo "<td style='background-color:#FF9'>" . $dayswam . "</td>"; echo "</tr>"; } ?> the problem is that it doesn't work right all the time for some it just shows the min while others it just shows max I've tested the query in MySQL workbench so i know that that is working right but idk why it works right for some and doesn't work for others I know that I can fairly easily pull my data from the database and view it in a browser. I can also 'polish' it with some HTML or put it into a table. Can I get an item from a given VARIABLE to appear inside of an INPUT box, so that it looks the same as when it was initially submitted? Can it be done with a multiple choice SELECT dropdown, so that the item chosen is viewable again? Hello First of all thanks for your help in advance. I build a members website and can use HTML but seem to be going round in circles with php. So Ive made a page that allows users to input there details and register this DOES Work and adds the data to a mysql data base. However I would like when they click register it sends them a email to confirm there info and at the same time send myself one so I can check there details. this is the link http://www.asian-travel-club.co.uk/php/files/register.htm Once this is done I would like to be able to see on a admin page that has a username and password to allow me to active and deactive there members. I know this would need a button added this is where I get lost. the link to the admin page ive made is http://www.asian-travel-club.co.uk/php/files/admin/ Then once i actived them they will recive an auto activtion email . I dont seem to be able to see data from the Database on mysql but i can interact with it. As one you register if you try to log in it say that the username and passwodr is incorrect. I TAKE IT IS BECAUSE THE USER DOES NOT HAVE PERMISSION> how do i do this? Any way if you go to forot password page it allows you to enter data and on submittion it chz the database and then sends you an email with your username and password attached. This is the link to the password recover page. http://www.asian-travel-club.co.uk/php/files/password_recover.php this is what is in my config.php <?php define('DB_SERVER', ''); // database server/host define('DB_USER', ''); // database username define('DB_PASS', ''); // database password define('DB_NAME', ''); // database name ?> Please help if you can I having been searching through the forum and other websites for information on reading a file (an image file) located above my root directory. I would like to store images outside the root directory and then use PHP to call those images for registered users. Basically I want to create a secure web gallery. I am using GoDaddy Deluxe shared hosting, and have managed to create a webroot directory and place files above it. I have found several scripts for reading files using the readfile() function, however when I actually implement the script to find the file and read its contents, it does not seem to find the file. I know my directory path is correct, as I can call an echo function inside a test.php file located in the same folder as the images (above my root). I would love some incite as to where I went wrong, or if there is a specific GoDaddy work around that needs to be implemented. Also, if I am going about this the wrong way, please let me know if there is a more effective way of going about this! Thank you so much! I'm trying to create a profile page that an unregistered user can view when he enters in the username into the url (e.g. http://localhost/username) Just recently got my mode_rewrite going (tried and tested), but I don't get the users information coming up in the page. Am I going about this the right way? This is what the page shows: The requested page was: Notice: Undefined variable: name_id in C:\x\xampp\htdocs\pages\profile.php on line 27 Notice: Undefined variable: name in C:\x\xampp\htdocs\pages\profile.php on line 28 Notice: Undefined variable: password in C:\x\xampp\htdocs\pages\profile.php on line 29 profile.php <?php include 'db.inc.php'; $db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die ('Unable to connect. Check your connection parameters.'); mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db)); $query = 'SELECT name_id, name, password FROM user WHERE name = "' . mysql_real_escape_string($_GET['name'], $db) . '"'; $result = mysql_query($query, $db) or die(mysql_error()); ?> <html> <head> <title> <?php echo $name; ?> </title> </head> <body> <p> The requested page was: <?php echo $name_id; echo $name; echo $password; ?> </p> </body> </html> I've been messing around with this for awhile so I'm going to hit the sack. |