-
Posts
272 -
Joined
-
Last visited
Posts posted by bugzy
-
-
Post the code.
edit_information.php
require_once("../includes/functions.php"); $get_day = substr($get_birthdate,8,; $get_month = substr($get_birthdate,5,2); $get_year = substr($get_birthdate,0,4); global $get_day; global $get_month; global $get_year;
I want to use that $get_day, $get_month and $get_year to one of the function in function.php
like this
function me_date_dropdown($year_limit = 0){ if($get_day == $day) { //output something here } }
-
Ok i have this variable on my edit_information.php
$day = 12
on that edit_information.php I'm using a function that is located at function.php, now I want to use that $day variable on the function that I'm using..
I have tried this on edit_information.php .
global $get_day;
but it aint working...
Anyone?
-
Thank requinix and DavidAM
Working now!
-
I wonder how will I able to this in php. I was able to do this in mysql using this
i.item_reg >= DATE_ADD(CURDATE(), INTERVAL -3 DAY)it will show only the items that were added 3 days ago up to now.
In php, I want to echo something out if an item is added 3 days ago up to now
I have a column in mysql where it is name item_reg and the format is datetime.
I tried this
if($item_reg >= strtotime(date("Y-m-d H:i:s"),3)) { //echo something here }
but I think it's far from what I'm expecting... I tried searching it but I can't find any reference.. Anyone?
-
Finding the right path is a pain in the @ss especially for a beginner like me. If you have huge list of directories and files it is very time consuming especially if you put your websites live in an online server and you run into different errors and issue that involves file paths.
I wonder if I will run into problem if I use absolute path on all my files? I'm planning to do it this way..
I have this file called "domain" with values
$domain = "www.mywebsite.com";
and I will going to include that file on all my files so instead of using
$path = "../../../stylesheet.php"
I will use
$path = $domain . "/directory1/directory2/stylesheet.php";
So regardless on where I am going to deploy it and regardless of what directory I will put the website, I will just change 1 file which is the domain file and its values.
Will I encounter any problem if I do this?
I wonder how you guys are handling paths, if you have some easy way to handle it.. pls. do share it here.. It will be very helpful for a beginner like me
-
Thanks to thorpe for giving me idea and thanks to floridaflatlander for giving an idea on how to generate a new password..
Thanks again guys!
-
Reset the users password to something you know and send them that.
thorpe that was really a great and simple solution though I wonder where will I get that password? as much as possible I want everything to be automated in php. Will I put a default password value for resetting a password or there will be a list of password? Because if there was a list or a default value? Do you think it is very vulnerable for some kind of sabotaging my website?
-
I have my user's password saved in the database using sha1 so base on my research, it's hard to decode it and there's no way I can show to my users the actual password they have saved once they use my feature "forget password" which will be sent via e-mail.
I wonder if is it safe to put the user's ID and sha1 password in the url? The link will be sent via e-mail as what I have said and once they click it, it will be verified via $_GET and then post a new form which will give them an option to put a new password.. I wonder if this will work or there's a security issue on this?
Or do you guys have any approach on this?
Thanks
-
you simply make the title seo friendly so you dont have to worry about adding additional fields
Problem is where will I get those that I will put on the title if I will not add another fields? Aside of course from the domain itself. As much as possible I want php to handle the title..
-
Just a question guys regarding this issue..
If I call session_start() does it mean I'm putting a session right away on the browser?
-
Here's my code for logout
//Find the SESSION session_start(); //Unset all the session variables $_SESSION = array(); //Destroy the session coookie if(isset($_COOKIE[session_name()])) { setcookie(session_name(), '',time()-42000, '/'); } //clearing the cookie for rememberme if(isset($_COOKIE['member_id'])) { setcookie('member_id', '', time()-42000, '/'); } //Destroy the session session_destroy(); me_redirect_to('index.php');
Everytime I logout it seemed like it's not destroying all sessions as I have always this one session left on my browser... any idea guys?
-
Hello guys need some advice on having a good url and page title for public pages.
This is of course for SEO purposes.
I don't want want my visitors to see a pages w/out and page tile and having a url link like
www.mywebsite.com?id=123232323I wonder if I needed to put another column on the table that will serve as the title or just use the page name column and category name column?
I wonder how you guys doing it? any ideas?
-
From the manual entry for mysql_result(): Calls to mysql_result() should not be mixed with calls to other functions that deal with the result set.
When you call mysql_result(), you advance the internal data pointer to the next record, which doesn't exist because the results set is LIMITed to 1 record (and that's all there should be anyhow). Then when you call mysql_fetch_array(), there is no record for it to act on. You either need to move the pointer back to the first record, which isn't what I"d recommend here, or rearrange your logic so it makes all of its "decisions" on the result set at the same time.
Pikachu2000 thanks you for explaining it clearly!
Now instead of me using mysql_result I have use
$found_user = mysql_fetch_array($result);
$found_user['status']
instead. Thanks guys!
-
Ok it seemed like I know where the problem is now but I don't know why it is happening....
the problem is on the login form.
The code where I think the problem is on base on trial and error
$query = "Select member_id,email,status from user where email = '{$email}' AND password = '{$hashed_password}' LIMIT 1"; $result = mysql_query($query,$connection) or die (mysql_error()); $num_user = mysql_num_rows($result); if($num_user == 1) { $time_query = "UPDATE user set last_login=NOW() where email = '{$email}' LIMIT 1"; $time_result = mysql_query($time_query,$connection) or die (mysql_error()); $check_status = mysql_result($result,0,'status'); if($check_status == 3) { echo "<span class=\"error_validation\">Your account is banned!</span>"; } else { $found_user = mysql_fetch_array($result); $_SESSION['member_id'] = $found_user['member_id']; me_redirect_to('admin/index.php'); } } else { echo "<span class=\"error_validation\">E-mail/Password combination is incorrect.<br>Pls. make sure that your CAPS LOCK is off and try again.</span>"; } }
The problem is on these lines
$check_status = mysql_result($result,0,'status'); if($check_status == 3) { echo "<span class=\"error_validation\">Your account is banned!</span>"; }
If I remove it.. The code works fine but if it is there I'm not getting any value on
$_SESSION['member_id'] = $found_user['member_id'];
and is returning
Array ( [member_id] => )
it's not the IF first statement but this
$check_status = mysql_result($result,0,'status');
I wonder why it is happening... Anyone?
-
I don't see a session_start() in login.php. Without that, it would cause $_SESSION['member_id'] to be unset, and result in being redirected to login.php.
Sorry I didn't say on my 1st post that
<?php require_once("includes/session.php"); ?>
is also at the very top of login.php
so what do you think guys is the problem
-
$found_user = mysql_fetch_array($result);
Can we see the mysql you used to generate $result? Copying the all the relevant PHP lines would be ideal.
$query = "Select member_id,email,status from user where email = '{$email}' AND password = '{$hashed_password}' LIMIT 1"; $result = mysql_query($query,$connection) or die (mysql_error());
-
^I have already edited the original post.. what do you think?
-
It is always redirecting me to login page
here are the codes
login.php
if($check_status == 3) { echo "<span class=\"error_validation\">Your account is banned!</span>"; } else { $found_user = mysql_fetch_array($result); $_SESSION['member_id'] = $found_user['member_id']; me_redirect_to('admin/index.php'); }
admin/index.php
<?php require_once("../includes/session.php"); ?> <?php require_once("../includes/connection.php"); ?> <?php require_once("../includes/functions.php"); ?> <?php confirm_logged_in(); ?>
function confirm_logged_in
session_start(); function confirm_logged_in() { if(!isset($_SESSION['member_id'])) { me_redirect_to('/prac/login.php'); } }
Any idea guys?
-
So...did you try what I said??
It's working now... Though I might use absolute path instead to avoid more headaches in the future
Thanks!
-
me_redirect_to('/prac/login.php');
What is the me_redirect_to code?
jesirose
function me_redirect_to( $location = NULL ) { if ($location != NULL) { header("Location:{$location}"); exit; } }
-
../login.php ?
xyph problem with that is, I'm going to also use that function on other files that are located on different root level including the files that are located on the root. So I'm looking for a solution that will cover all files regardless of where their locations are..
-
I have this problem on my path and I'm confused on what to use among relative, document or root relative path. I'm doing this on my local machine so absolute path is not in the option..
All my admin pages are on a folder named "ADMIN"
I have this
function for my session
<?php session_start(); function logged_in() { return (isset($_SESSION['member_id']) || isset($_COOKIE['member_id'])); } function confirm_logged_in() { if(!logged_in()) { me_redirect_to('login.php'); } } ?>
the problem here is on the line me_redirect_to('login.php');
Since my I'm calling the fucntion on all admin pages.. it will keep on saying that
The requested URL /prac/admin/login.php was not found on this server.
It's adding the folder on the url where the admin pages is located.. it's supposed to be only
/prac/login.php
Anyone?
-
I will definitely read that.
Thanks!
-
You don't want to use SHA1 alone. 10258272
how did it happen xyph? how did you do that?
So what the other step that I need and must do after that sha1?
Help Global Variable
in PHP Coding Help
Posted
Now I get it! It's now working!
Thanks Thorpe!