-
Posts
840 -
Joined
-
Last visited
-
Days Won
1
Everything posted by gristoi
-
<?php for ($i=1; $i<6; $i++){ $Banner_Image = get_post_meta($post->ID, "Banner_Image_$i", true); if ($Banner_Image_$i !=''){ ?> <a href="javascript:goto('.item<?php echo $i; ?>')">1</a> <?php } }
-
yeah, just store the location in the db then once you have confirmed that they have a valid login assign the location to a variable and use it to redirect. for example you had a variable in your table called homepage: // query run here if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; session_write_close(); $page = $member['homepage'] ; header("location: $page");//change as appropriate exit(); }else { //Login failed header("location: login-failed.php"); exit(); } }
-
you mean something like this? <?php //Start session session_start(); //Include database connection details require_once('config.php'); //Array to store validation errors $errmsg_arr = array(); //Validation error flag $errflag = false; //Connect to mysql server $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); if(!$link) { die('Failed to connect to server: ' . mysql_error()); } //Select database $db = mysql_select_db(DB_DATABASE); if(!$db) { die("Unable to select database"); } //Function to sanitize values received from the form. Prevents SQL injection function clean($str) { $str = @trim($str); if(get_magic_quotes_gpc()) { $str = stripslashes($str); } return mysql_real_escape_string($str); } //Sanitize the POST values $login = clean($_POST['login']); $password = clean($_POST['password']); //Input Validations if($login == '') { $errmsg_arr[] = 'Login ID missing'; $errflag = true; } if($password == '') { $errmsg_arr[] = 'Password missing'; $errflag = true; } //If there are input validations, redirect back to the login form if($errflag) { $_SESSION['ERRMSG_ARR'] = $errmsg_arr; session_write_close(); header("location: login-form.php"); exit(); } //Create query $qry="SELECT * FROM members WHERE login='$login' AND passwd='".md5($_POST['password'])."'"; $result=mysql_query($qry); //Check whether the query was successful or not if($result) { if(mysql_num_rows($result) == 1) { //Login Successful session_regenerate_id(); $member = mysql_fetch_assoc($result); $_SESSION['SESS_MEMBER_ID'] = $member['member_id']; $_SESSION['SESS_FIRST_NAME'] = $member['firstname']; $_SESSION['SESS_LAST_NAME'] = $member['lastname']; session_write_close(); switch($login) { case 'user': $direction = 'member-index.php'; break; case 'Admin': $direction = 'admin-index.php'; break; } header("location: $direction");//change as appropriate exit(); }else { //Login failed header("location: login-failed.php"); exit(); } }else { die("Query failed"); } ?>
-
the image tag is using a $_GET paramater to return the image. because web pages are stateless( the next page does not know the state of the last page) you have to pass variables from page to page to keep a constant state. using $_GET in php is one method of doing this. It is basically concatenating the variables into the url so that it can be re interpreted by the target url. So basically your script is passing data to linegraph.php. the ? tells it that you are passing $_GET paramaeters and the & is used to seperate each variable. i.e: <?php www.mysite.com/page.php?var1=something&var2=somethingelse ?> and when the other page usese the get function they can re assign the variables: <?php $var1 = $_GET['var1']; $var2 = $_GET['var2']; ?>
-
Hi, just a quick pointer, Where at all possible try to never use select *. This is purely from a performance perspective. if the email variable was the only thing you wanted returning from the db then use select email If the table you are selecting from had 20 columns ( for example ) there is no point returning the other 19 columns of data is there
-
if you put your error handler on at the top of your script do you still get no errors or warnings showing? ini_set('display_errors',1); error_reporting(E_ALL);
-
the ?= is the shorthand version of: <?php echo $this->formValues['capture']?> it replaces the need for the php and echo syntax
-
You really need to post your code on the forum. Without this we are all batting in the dark
-
how is the time stored in the database? is it a datetime, or unix timestamp?
-
you are missing a bracket: if(validPassword($pass){ should be if(validPassword($pass)){ and you have an extra curly brace on line 162 that needs removing
-
ok. that is a lot of code to go through. Easiest thing to do is to turn on your error handling and see what error it throws. Place this just below the opening php tag in your form.php: ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); this will display any errors thrown by the system. resubmit your form and see if any errors are shown
-
well, without seeing your emailing code - no
-
Sorry, my bad, skipped right past it ( i blame my tiny iphone screen). try changing the button to an input type: from: <button class="art-button">Send </button></form> to <input type="submit" name="send" value = "send" class="art-button" /></form>
-
your missing your closing form tag : </form>
-
Passing variable from page to page via the url use PHP's $_GET global variable. To assign this to a new variable: $id = $_GET['id']; $desc = $_GET['desc']; $name = $_GET['name'];
-
Mysql has a series of functions that allows you to puload and parse text docs. Try : LOAD DATA LOCAL INFILE '/path/to/yourfile.txt' INTO TABLE `yourtable` LINES TERMINATED BY ','
-
i thought it was $_SERVER that is the global ?
-
at the very top of your php scripts. <?php ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); // rest of script. note that you said this was a cms which could indicate ( and dont quote me lol) that it may be using the (MVC Pattern). which means that everything is routed through one page (usually the index.php). If this is the case then u only need to add it into the index page
-
for every deprecated function you hit just google: PHP5 version of deprecated (whatever the function name is)
-
PHP 4 passes objects by value, php 5 passes by reference, so remove the &
-
your current code looks like this: //E-mail address to send input to, change this $to="[email protected]"; //Title of E-mail $subject="Website Quote Request Form - www.wraptinprint.com.au"; //From $sendmail_from="$email"; needs to be this: //E-mail address to send input to, change this $to="[email protected]"; //Title of E-mail $subject="Website Quote Request Form - www.wraptinprint.com.au"; //From $sendmail_from = 'From: '. { $email } ."\r\n";
-
The best way to do this is really going to be the manual approach. Put your CMS on a server with PHP5 and turn on full error checking: ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); The work through the warnings and errors, you will get a lot more warnings than fatal errors. work through and remove the depreciated functions and replace them with their php5 counterpart for each warning given. Shouldnt take more than a few hours