Jump to content

DeanWhitehouse

Members
  • Posts

    2,527
  • Joined

  • Last visited

Everything posted by DeanWhitehouse

  1. wow, i charge way to low mine is about $14 per hour/£7.50 per hour.
  2. how would i do that for when people enter data into a form, and submit it, as this will be data saved from the form
  3. when you submit the password to check it encrypt it with md5 before checking
  4. I would say you should use a javascript style changer with cookies to save the data.
  5. Hi, i am creating a CMS/Website template system. I want it so that when the users enter say the title message into a form, but when i test this, the data is displayed on one line( <br> ). How can i make it so that when they enter the data, it saves it as HTML format(in the sense of breaklines) Here are the codes i am using $intro = "Welcome to my portfolio, this site has been entirerly coded by me Please have a look at other pages"; <html> <head> <? require_once 'includes/main.inc.php'; require_once 'includes/db_connect.php'; require_once 'includes/config_table.inc.php'; require_once 'includes/header.php'; require_once 'includes/footer.php'; require_once 'nav_bar.php'; ?> </head> <table id="time"><tr><td><?php echo gmdate('l jS \of F Y');?><br><?php echo gmdate('h:i:s A');?></td></tr></table> </html> <?php if (is_dir(install)) { echo "<p class='exists'><br>Please remove the install folder</p>"; } else { echo "Please go to the admin centre to cutomise the site"; } echo "$intro"; ?>
  6. ok, try this these lines should work <?php mysql_connect($conn) or die('Could not connect: ' . mysql_error()); mysql_query($sql_update) $sql_update "UPDATE users SET datetime=date("Y.m.d - H:i:s") WHERE username='$_SESSION[username]'") or die ("could not execute the query."; ?>
  7. it seems ok
  8. Try changing these echo "<iframe src='fileB.php' width='800' height='300' scrolling='auto' frameborder='1'>"; echo "<table width='$tablewidth' border='1'><br>";
  9. why would you link to stylesheets like this?
  10. I have this code for the time and date echo gmdate('l jS \of F Y h:i:s A'); But i am unsure how to add different time zone and daylight saving. I also want this data to be saved in a mysql database. i believe the code to apply daylight saving time is a capital I but i don't no where to insert the code
  11. edit to my previous post Edit: Also can you help with this, i want the index page to redirect to whatever the user specified page is. <?php require_once 'main.inc.php'; header('Location: '$home_page''); ?> this kinda works but i get this error: Warning: Division by zero in /home/www/deanwhitehouse.awardspace.co.uk/main.inc.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at /home/www/deanwhitehouse.awardspace.co.uk/main.inc.php:2) in /home/www/deanwhitehouse.awardspace.co.uk/index.php on line 3
  12. so do i not need a code to check for the session? Edit: Also can you help with this, i want the index page to redirect to whatever the user specified page is. <?php require_once 'main.inc.php'; header('Location: '$home_page''); ?> but it is being read as '$home_page' as the page i want, not what is entered into the varaible main.inc.php <?php $home_page = "install/install.php"; ?>
  13. Yer this code works, very well. Now all i need to do is learn sessions, from what i gathered you set a session from the login page and then each page checks for the session?
  14. As you might be able to tell, i am fairly new to PHP, please can you go into more details on how to do this. My other idea was to use the user ID as a way to determine it, because the admin will always be ID 1.
  15. i thought that was a problem, but if i do <?php $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd' AND userlevel='1'" )); ?> this will only check it for admin or if i do <?php $admin == 1; $user == 2; $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd'" userlevel='$admin')); $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd'" userlevel='$user')); ?> the $login_check == 1 will not work, as there is more than one user, but only one main admin
  16. I have begun writing a PHP website template system, and have hit a problem <?php include '../includes/db_connect.php'; include '../includes/config_table.inc.php'; $user_name = $_POST["user_name"]; $user_password = $_POST["user_password"]; if ($user_name && $user_password) { $salt = substr($user_password, 0, 2); $userPswd = crypt($user_password, $salt); $login_check = mysql_num_rows(mysql_query("SELECT * FROM `$user` WHERE user_name='$user_name' AND user_password='$userPswd'" )); $check_ad = mysql_query("SELECT * FROM `$user` WHERE userlevel=0"); $check_us = mysql_query("SELECT * FROM `$user` WHERE userlevel=1"); //echo("DEBUG:\r\n"); //echo("login_check:".$login_check."\r\n"."check_ad:".$check_ad."\r\n"."check_us:".$check_us."\r\n\r\n"); if ($login_check == 1 && $check_ad) { echo "Logged In Sucessfully. Please wait while you are redirected"; echo "<meta http-equiv='refresh' content='2; url=setadmincookie.php?u=$username&p=$user_password'>"; } elseif ($login_check == 1 && $check_us) { echo "Logged In Sucessfully. Please wait while you are redirected"; echo "<meta http-equiv='refresh' content='2; url=setcookie.php?u=$username&p=$user_password'>"; } else { echo 'Login failed. Username and Password did not match database entries.'; } } else { echo "Form was not completed. Please go back and make sure that the form was fully completed."; } mysql_close(); ?> this code is ment to check the userlevel against the database and send them to one place or another depending on there level. How ever is isn't working, it is always sending to the admin area, and not the user area. i have two accounts made on the site, one user and one admin. Admin has userlevel 1, user has userlevel 2.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.