Jump to content
Larry Ullman's Book Forums

MrJames

Members
  • Content Count

    22
  • Joined

  • Last visited

Community Reputation

4 Neutral

About MrJames

  • Rank
    Member
  1. I am looking to recreate the following function from PDO to MySQLi but having some problems, I've been over the PHP website to read the functions. I'm trying to modularize my code in like the MVC pattern. public function bind($param, $value, $type=''){ if(is_null($type)){ switch(true){ case is_int($value): //Thinking something like, for integer etc $type = mysqli_stmt::bind_param(i); $type = PDO::PARAM_INT; break; case is_bool($value): $type = PDO::PARAM_BOOL; break; default: $type = PDO::PARAM_STR; } } $this->stmt->bindvalue($param,$value,$type); } Is it as simple as just replacing PDO version line to : $type = mysqli_stmt::bind(i); or just putting $type = i; Then in my class I am trying to call the bind function: $database ->bind($stmt,$ype,$variables); $database->execute(); Any help would be much appreciated Regards My Setup Chrome Windows XP Wamp SublimeText
  2. MrJames

    Design/Development Question

    My question was like: 1) Are these graphical elements created in Photoshop which is why they look so perfect ? 2) Are they also pictured through use of a MAC with retina displays rather than a PC ? regards
  3. MrJames

    Design/Development Question

    Hi, I have been looking at profiles on Behance, some of which are what I would call 'pitches' (individuals putting their ideas/designs forward for how they would design/development popular websites), some of these designs are art/artistic, some are UI/UX. But one thing I have noticed is that all the images/pictures showcasing their work all look 'Clean, Crisp and really sharp'. Now when I develop a website on a PC it never looks as sharp as what some of these individuals are showcasing, So are they using MAC's with Retina displays which makes them look so nice, or is this web development done in Photoshop, below is an example of what I mean http://www.behance.net/gallery/E-mail-client/8626803 So what do you think ?
  4. So I am looking at developing a jobsboard, which has three tables: Company - Store details of companies looking to advertise jobs, build profile. Jobs - Store details of Jobs being advertised for a certain period of time. Orders - Store details of the transactions for the jobs being posted. The way it works is the company completes registration form, then has the option of posting jobs which they will be charged a fix fee. Now what foreign key would I store in the Orders table? since I am using Paypal and don't know how much information you can carry over. Would I store the CompanyID or the JobsID or both? PHP5 MySQL 5 Chrome
  5. MrJames

    Problem With Login

    @Marie I have changed the login script to one a one page login script file. That works fine at the moment. @Larry When you say remove the "includes" from the include line, do you mean this: <?php include ('loginForm.php'); ?> Because I tried that at that moment in time, but then brought up another few errors. Any comments, suggestions would be much appreciated.
  6. MrJames

    Problem With Login

    My Directory structure is set up exactly the same way as in the book: Index Includes - LoginForm.php (displays the form) - Login.inc.php (processes the form) - config.inc.php (setup for the website directory structure) - Header.php (display all relevant head information(titles, meta,) - Footer.php (holds all the Javascript files, also ends with the html,body) ================================================================== Top of my Index.php file <?php require ('./includes/config.inc.php'); require (MYSQL); if ($_SERVER['REQUEST_METHOD'] == 'POST') { include ('./includes/login.inc.php'); } include ('./includes/header.php'); ?> Now here is header.php file: <?php if (isset($_SESSION['user_id'])) { echo '<ul class="nav pull-right"> <li><a href="http://www.webzoost.com/postJob.php">post job</a></li> <li class="divider-vertical"></li> <li><a href="http://www.webzoost.com/resumeSearch.php">search</a></li> <li class="divider-vertical"></li> <li class="dropdown"> <a class="dropdown-toggle" href="#" data-toggle="dropdown">Your Profile <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;"> <ul class="unstyled"> <li><a href="http://www.webzoost.com/change_password.php">Change Password</a></li> <li class="divider"></li> <li><a href="http://www.webzoost.com/logout.php">Logout</a></li> </ul> </div> </li> </ul> </div> </div> </div> </section>'; } else { echo '<ul class="nav pull-right"> <li><a href="http://www.webzoost.com/register.php">register</a></li> <li class="divider-vertical"></li> <li><a href="http://www.webzoost.com/search.php">search</a></li> <li class="divider-vertical"></li> <li class="dropdown"> <a class="dropdown-toggle" href="#" data-toggle="dropdown">sign in <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; require ('includes/loginForm.php'); echo '</div> </li> </ul> </div> </div> </div> </section>'; } ?> Now here is loginForm.php file: <?php if (!isset($login_errors)) $login_errors = array(); require_once ('./includes/form_functions.inc.php'); ?> <form action="index.php" id="form-search" method="post" accept-charset="utf-8"> <?php if (array_key_exists('login', $login_errors)) { echo '<span class="alert alert-error">' . $login_errors['login'] . '</span><br />'; } ?> Email <?php create_form_input('email', 'text', 'input-large', $login_errors); ?> <br /> Password <?php create_form_input('password', 'password', 'input-large', $login_errors); ?> <input class="btn btn-primary btn-block" type="submit" id="sign-in" value="Sign In"> </form> <hr> <a href="http://www.webzoost.com/forgot_password.php" class="small">Forgotten Password</a> <br /><br /> and here is the process part login.inc.php file: <?php $login_errors = array(); if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) { $e = mysqli_real_escape_string ($dbc, $_POST['email']); } else { $login_errors['email'] = 'Enter a valid email address<br />'; } if (preg_match ('/^(\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*){1,32}$/',$_POST['password']) ) { $p = mysqli_real_escape_string($dbc,$_POST['password']); } else { $login_errors['password'] = 'You entered the wrong password<br />'; } if (empty($login_errors)) { // OK to proceed! $q = "SELECT id, profile_type, date_joined FROM Profiles WHERE (email='$e' AND password='" . get_password_hash($p) . "')"; $r = mysqli_query ($dbc, $q); if (mysqli_num_rows($r) == 1) { // A match was made. $row = mysqli_fetch_array ($r, MYSQLI_NUM); $_SESSION['user_id'] = $row[0]; $_SESSION['username'] = $row[1]; // Store the data in a session: // Only indicate if the user's account is not expired: //if ($row[3] == 1) $_SESSION['user_not_expired'] = true; } else { // No match was made. $login_errors['login'] = 'Email address and password do not match those on file.'; } } // End of $login_errors IF. When a visitor visits the site, they either click on 'register.php' or 'forgot_password.php' but when they do all they get is the 'header.php' file being displayed with the rest of the page white. Any comments, suggestions would be much appreciated.
  7. MrJames

    Problem With Login

    I have changed the directory structure, to the one that is the same as in the E-Commerce book, the only difference is that my Login form is in the header rather than the footer. Now for some reason whenever a user tries to go to any other page, all they get is a blank page with just the header displaying. I did have require ('./includes/login_form.inc.php'); But that did not originally work so I changed it to include instead. How would the scripts change from example 1 in the E-Commerce book: My navigation is in the Header.html file rather than the Footer.html file, That is the only difference from the example in the book ? And all I am seeing on other pages is white space and the header file. Any comments, suggestions would be much appreciated.
  8. Hi, Having a bit of a problem with regard to someone logging in on my site. It will not display Register page if I include certain files. Here is my header.php file which stores all the navigation links, and the sign-in option or to display their profile options: <body> <section class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand text-info" href="http://www.webzoost.com" name="top">abaloo</a> <div class="nav-collapse collapse"> <ul class="nav pull-right"> <li><a href="http://www.webzoost.com/profiles/register.php">register</a></li> <li class="divider-vertical"></li> <li><a href="#">search</a></li> <li class="divider-vertical"></li> <li class="dropdown"> <?php if (isset($_SESSION['user_id'])) { echo '<a class="dropdown-toggle" href="#" data-toggle="dropdown">Your Profile <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; } else { echo '<a class="dropdown-toggle" href="#" data-toggle="dropdown">sign in <strong class="caret"></strong></a> <div class="dropdown-menu" style="padding: 15px; padding-bottom: 0px;">'; require ('includes/login_form.inc.php'); } ?> </div> </li> </ul> </div> </div> </div> </section> Now the problem comes when i add the following files: - login.inc.php since when i put this file in my index.php file I cannot seem to link to any other part of the website such as "register" which then throws up a blank page, but if I take out the file all-together then register displays. So what I am saying is where do I put file (login.inc.php) with-out it interfering with other links on my website, also could it be a directory issue, I know larry has his navigation in the footer, but mine is in the header.php file. here is my directory setup: index profiles - register.php includes - login.inc.php - login_form.inc.php - header.php // This is where all my navigation is, and also the login form as well. - footer.php I am now getting the following error when I only view the source code, this error is not being displayed for some reason on output to the user(I can't find an option to paste a screenshot/image of the code): An error occurred in script '/home/sites/webzoost.com/public_html/includes/header.php' on line 52:<br /> require(includes/login_form.inc.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory<br /> <pre>Array<br /> Any comments, suggestions would be much appreciated. PHP5 MySQL5 Chrome
  9. Hi, Try the following as an example: <input type="hidden" name="amount" value=" ' . $productPrice . ' "> Regards
  10. Hi, What I got is a log in screen, they enter their username and password then they are redirected to a screen that shows their twitter details/friends etc etc. So I have my SQL SELECT QUERY, I get back a number and I also want to select the users twitter name and put it into a Input box like below: * This is just an example* $num = mysqli_num_rows; $TwitterUsername = row[1]; Then I would echo out a range of input boxes as below: for(i=$num;i<$num;i++) { echo '<input type="hidden" value="' . $TwitterUsername . '">'; } Something along that line, then the JQuery would call Values from the Input boxes if that makes sense, is that possible, or would I be better using a while loop ? Appreciate any Feedback... Regards PHP 6 MySQL 5.2 HTML5 CSS3 Chrome / IE 8
  11. Hi, I have a couple of questions regarding PHP and JavaScript. 1) What I would like to know is once I do a SELECT COUNT Query I want to then do a For-Loop to out put the same number of input boxes but with a PHP variable as the value so that JavaScript could pick that value up, Is that possible to be done, I mean can JavaScript/JQuery read PHP variables. They will be Hidden Input boxes as well. PHP 6 MySQL 5.2 HTML5 CSS3 Chrome / IE 8
  12. MrJames

    Show Us Your Projects!

    Hi, I like the examples 'Antonio Conte' as provided since I am also a football fan as well and it's also good to show what projects you have done as well. I tried to create my own custom theme in Wordpress and it took me hours, I have it up and running at http://www.webzoost.com. Can I ask what are the differences between TextPattern and Wordpress Antonio ? (I am not looking at developing plugins but I am someone who likes to change the HTML/CSS to make it fit my requirements and then just install plugins that I need). Regards
  13. Hi. I was just wondering how facebook does it's continious updates on the wall if you know what I mean, I take it after a certain amount of time it calls a scripts which then gets the latest round of updates. So what technologies would be used here ? and also how would you stop it from repeating it's-self(i.e. calling the same data from before) ? Also does anyone know of any examples of this ? Regards
  14. Hi, As always I appreciate your input/views and opinions. I got in touch with my webhosting provider and they tell me its a shared hosting package and their is a certain URL you have to use. Now if I change my IPN script URL in paypal will that always try the old URL instead of the new one my hosting package gave me ? So I'll have to try and carry out another transaction with the new URL ? As always thanks for your help...
  15. Okay Larry, I hear what you are saying, but from past experiences the only time I have really had HTTP 500 internal server errors is when a query has not been done properly or theirs a problem with the php code(NOT the URLS) ? The only only thing I can think of is the HTTP | HTTPS problems.
×