kwandoa
Members-
Posts
43 -
Joined
-
Last visited
Everything posted by kwandoa
-
I loaded PEAR successfully and loaded the the required packages but when I run login.php I get "Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\bin\php\php5.4.3\pear\Auth.php on line 469" and a "Strict standards: Non-static method DB::isConnection() should not be called statically, assuming $this from incompatible context in C:\wamp\bin\php\php5.4.3\pear\Auth\Container\DB.php on line 150" error. Would you be able to explain this pls? I am on a win7 system and a WAMP server.
-
Hi Sam. this link takes me to PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition) Regarding the problem I have. What i have done to try and debug is copied the style.css file into my includes file (as directed by the file structure in the book pg 54) and into a style folder that I created as the code directs <? <head> <title><?php echo $page_title; ?></title> <link rel="stylesheet" type="text/css" href="style/style.css" title="style" /> </head> ?> and still the css is not loading. I have gone back to 'PHP and MySQL for dynamic websites' book and also went through my working examples and that too has led me nowhere. What I have now done is gone to the website 'www.HTML5webtemplates.co.uk', downloaded another template and that HAS WORKED fine. So I assume that there is something wrong with the CSS file in the .zip file that I downloaded? pls advise
-
function redirect_user($page = 'index.php') { //define URL URL id http:// + host name + current directory $url = 'http://' .$_SERVER['HTTP_HOST']. dirname($_SERVER['PHP_SELF']); //remove any trailing slashes $url = rtrim($url, '/\\'); //add the page: $url .= '/' .$page; //add slashes that u removed //redirect the user header("Location:$url"); exit(); //quit script } //end of redirect_user() /* This function validates the form data(the email address and password). If both are present, the database is queried. The function requires a database connection.The function returns an array of information, including: a TRUE/FALSE variable indicating success - an array of either errors or the database result */ function check_login($dbc, $email = '', $pass = '') { $errors = array(); // initialize error array if(empty($email)) { //validate the email and password $errors[] = 'You forgot to enter your email address'; } else { $e = mysqli_real_escape_string($dbc, trim($email)); } if(empty($pass)) { $erros[] = 'You forgot to enter your password'; } else { $p = mysqli_real_escape_string($dbc, trim($pass)); } if (empty($errors)) { //if no erros occurred, run the databse query // Retrieve the user_id and first_name for that email/password combination: $q = "SELECT user_id, first_name FROM users WHERE email='$e' AND pass=SHA1('$p')"; $r = @mysqli_query($dbc, $q); //now check the results of the query: if(mysqli_num_rows($r) == 1) { //fetch the record $row = mysqli_fetch_array($r, MYSQLI_ASSOC); return array(true, $row); //return true and the record } else { //Not a match! $errors[] = 'The email and password entered do not matCH ThOse oN fiLe'; } } //End of empty($errors) IF //Return False and the errors: return array(false, $errors); } //End of check_login() function
-
Php And Jquery
kwandoa replied to kwandoa's topic in PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
Great!!! awsome, now i understand!! I would like to use this method to validate forms and to play around with what HTML elements to load, depending on the user. -
How would one pass a php variable to a jQuery function. I would like to use jQuery to only show the delete and edit links if $_POST['user_id'] =1. // Table header: echo '<table align="center" cellspacing="0" cellpadding="5" width="75%"> <tr> <td align="left"><b>Edit</b></td> <td align="left"><b>Delete</b></td> <td align="left"><b><a href="view_users.php?sort=ln">Last Name</a></b></td> <td align="left"><b><a href="view_users.php?sort=fn">First Name</a></b></td> <td align="left"><b><a href="view_users.php?sort=rd">Date Registered</a></b></td> </tr> '; // Fetch and print all the records.... $bg = '#eeeeee'; while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { $bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); echo '<tr bgcolor="' . $bg . '"> <td align="left"><a href="edit_user.php?id=' . $row['user_id'] . '">Edit</a></td> <td align="left"><a href="delete_user.php?id=' . $row['user_id'] . '">Delete</a></td> <td align="left">' . $row['last_name'] . '</td> <td align="left">' . $row['first_name'] . '</td> <td align="left">' . $row['dr'] . '</td> </tr> '; } // End of WHILE loop. echo '</table>';
-
My form loads ok. login.php everything works like it should EXCEPT that when I submit the form with no password value I get the followoing error: Notice: Undefined variable: p in C:\EasyPHP\www\basicMySql\includes\login_functions.inc.php on line 41 But if i fill in a value, even a false one, the code works fine. could it be something to do with my isset()/empty() function?
-
list ($check, $data) = check_login ($dbc, $_POST['email'], $_POST['pass']); Regarding the above. would you be able to go into a bit more detail. Another thing ... PHP.net states that it is not really a function "Like array(), this is not really a function, but a language construct. list() is used to assign a list of variables in one operation." - php.net
-
I have uninstalled and reloaded easyPHP and it does run it now BUT it does not show the file (header.html) in the EasyPHP admin page . It does show all the other files, including the 'h1.html'. If I go to the folder via windows7, i can see it... so i'm thinking it's an EasyPHP glitch...I can live with it for now.
-
I guess you've been asked this many times...but amuse us this one time. In your opinion, if you met a beginner web developer and had to advise him/her on what Web Developing language to begin with, keeping in mind the Framework applications that are out there. Would you recommend PHP or Ruby?
-
I am not getting the desired results from the login lesson : Cookies and Sessions page 375 when i try and run http://127.0.0.1/basicMySql/includes/login_page.inc.php I get the form, which I complete BUT when I submit it I get taken to a http://127.0.0.1/basicMySql/includes/login.php which I have deleted from my directory(I am redoing this chapter which I did not get right the first time around). Would this be a cache problem?