PHP - Recoding Old Website Code To Today's Standard.
Hi All, Newbie here.
I run a website using xmb forums software as a base login script to connect to my database and created my own crude and simple pages for adding and displaying the data learning as I went.
Over the years with recent upgrades of php versions its now virtually useless and unsecure code. I archive a lot of news articles but have had trouble pasting text that includes apostrophe's and special characters, but managed to fix that using addslashes() now. Can someone suggest a tutorial or a way to rebuild my site from scratch or something I can use as a template to connect to my pages ?. Similar TutorialsHi there, I'm wondering If anyone can assist me. I am currently a design student In Leeds, UK. I'm currently creating an online campaign whereby customers use QR codes to link to a created website with interesting youtube video on. At the moment I've just created a simple link to the chosen content http://newmedia.leeds.ac.uk/ug10/cs10dw/culture.html However I've come across Youtube API Standard feeds on the Youtube Reference Guide. http://code.google.com/apis/youtube/2.0/reference.html It states you can 'send a GET request to the URL associated with that feed', however, I've never really touched php before. Could anyone give me advise on how I would link say the Top rated feed to my site using https://gdata.youtube.com/feeds/api/standardfeeds/top_rated Would that be difficult? ANY replies would be much appreciated! Regards David. I am currently working on my PHP/MySQL driven website. However, I have read in recent weeks that there are a number of security measures which need to be taken and one of them is sanitising input to prevent html/MySQL injection into a database. So I was wondering if there is an 'industry standard' for sanitising PHP. For example, if a website only want there database to be searched by letters or numbers do they use a specific code? I have found one based on numbers (for ID numbers) but I cant find on one based on letters. I found this but it is quite complicated and looks very different to the guide I found on YouTube. so is there an industry standard which blocks people using any other code than numbers or letters? http://bobby-tables.com/php.html I was also wondering is there are anyother security measures I need to be aware of when using PHP? This topic has been moved to Editor Help (Dreamweaver, Zend, etc). http://www.phpfreaks.com/forums/index.php?topic=322054.0 I'd like to write - or acquire - code that displays a simple table (name, phone number, email address, plus a comments field) on a web page in a password-protected page and allows a user to add his own information, update it or delete it. I figure hundreds of people and companies have written something like this so I'd like to find either an example I can imitate or even an existing package that I can simply customize to the specifics for my own table. Can anyone help me with that? Or am I going to have to reinvent the wheel for the gazillionth time and write it myself? Hi I am trying to add a field to a database that is 4 days from the date the record is added, but it is not adding a value Code: [Select] $end_date=strtotime("+ 4 days"); $add_vehicle_sql=mysql_query("INSERT INTO `tbl_auction_lot`(`cust_id`,`reserve`,`make`,`model`,`spec`,`fuel`,`doors`,`mot_date`,`fns`,`fos`,`rns`,`ros`,`condition`,`reg_no`,`service_history`,`sale_type`,`status`,`keepers`,`gearbox`,`emissions`,`colour`,`date_first_reg`,`date_manufacture`,`bhp`,`engine_size`,`end_date`) VALUES ('$seller_id','$reserve','$make','$model','$body_style','$fuel_type','$no_of_doors','$mot','$fns','$fos','$rns','$ros','$vehicle_condition','$vrm','$service_history','auction','$status','$prev_keepers','$gearbox','$emissions','$colour','$date_reg','$date_man','$bhp','$engine_size','$end_date')") or die(mysql_error()); What am I doing wrong and what is there a better way to achieve the desired result. I'm looking for a simple little code to display today's date, month, day, year and countdown to 365 days. Can anyone please help. This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=333553.0 Hello, In my Mysql database, it has a datetime field. and I have created a $today = date('Y-m-d H:i:s'); <- today's date and time How do I write a query to run in PHP in order to get all today's items by comparing datetime field and $today? Thanks! Is there a way of getting today's date (in European format - day-month-year) into the body of an email sent via phpmailer? Many thanks. is it possible to do something like Code: [Select] $today = date("Y-m-d"); $result = mysql_query("SELECT * FROM staff where date = '.$today.' "); also, is it normal for the first entry in the database not to be displayed? i have 6 entries in a table and only 2-6 are shown. when i changed the id for 1 to 7, it only displayed 3-7. Hello, i'm trying to get the number of users that registered today and the number of users that registered yersterday (seperate), i've got this field in mysql: 'registertime' which stores data in this format 2011-11-14 14:53:49 also i have the field 'time' in the same format that updates everytime the user logs in. Now previously i wanted to find out users online in last 24 hours, the code i used for that is this: Code: [Select] $query = "SELECT COUNT(*) as Anzahl FROM customers WHERE country = 'de' AND time BETWEEN DATE_SUB( NOW(), INTERVAL 24 HOUR ) and NOW() "; $queryerg = mysql_query($query) OR die(mysql_error()); while($row = mysql_fetch_array($queryerg)){ $customers_on_de_24 = $row[0]; } How could i edit that to select the count just by date and ignore the time (hours minutes seconds) ? As far as I can see, this code: Code: [Select] $this->_licence_expires = date('Y/m/d', mktime(0, 0, 0, date("m"), date("d")-1, date("Y"))); results in accounts expiring 1 year from today, right? How can I change it so that it will result in expiry 9 months from today? TIA still shows all records in the database... any idea how i go about this? Code: [Select] $date= date('y-m-d'); $query=mysql_query("SELECT * FROM listing WHERE date >= $date") or die (mysql_error()); Hi Guys. Really Stuck here. I am making a website, its basicall an online shop of sorts. I am making a login page for our customers and an admin page for us lot to upload new products to sql etc. Whats its meant to do is accept the username and pw then allow me to access the adminpage. Although its just saying that user doesnt exist all the time. I dont know why becuase the details are correct. admin_login page is the code below. <?php session_start(); if(isset($_SESSION["manager"])){ header("location:index.php"); exit(); } ?> <?php if(isset($_POST["username"])&&isset($_POST["password"])){ $manager = preg_replace('#[A-Za-z0-9]#i','',$_POST["username"]); $password = preg_replace('#[^A-Za-z0-9]#i','',$_POST["password"]); include"../storescripts/connect_to_mysql.php"; $sql = mysql_query("SELECT id FROM admin WHERE username='$manager' AND password='$password' LIMIT 1"); $existCount = mysql_num_rows($sql); if($existCount == 1){ while($row = mysql_fetch_array($sql)){ $id = $row["id"]; } $_SESSION["id"] = $id; $_SESSION["manager"] = $manager; $_SESSION["password"] = $password; header("location: index.php"); exit(); }else{ echo 'That Information Is Incorrect. Try again <a href="index.php">Click Here</a>'; exit(); } } ?> and now the index.php which is what the admin see when they log in successfully. <?php session_start(); if(isset($_SESSION["manager"])){ header("location: admin_login.php"); exit(); } //Be Sure To Check That This Manager Session Value Is Infact In The DataBase $managerID = preg_replace('#[^0-9#i','',$_SESSION["id"]); $manager = preg_replace('#[^A-Za-z0-9]#i','',$_SESSION["manager"]); $password = preg_replace('#[^A-Za-z0-9]#i','',$_SESSION["password"]); include "../strorescripts/connect_to_mysql.php"; $sql = mysql_query("SELECT * FROM admin WHERE id='$managerID' AND username='$manager' AND password='$password' LIMIT 1"); $existCount = mysql_num_rows($sql); if($existCount == 0){ header("location:../index.php"); exit(); } ?> I have to two variables $cronlast and $cronnow in my php code. I need to have the time 7am of previous day in $cronlast variable and 7am today in $cronnow variable. I need the time in UNIX timestamp format. So everyday when I print the variable I should have: $cronlast=7am Yesterday(in Unix Timestamp) $cronnow=7am Today(in Unix Timestamp) I would appreciate any help. Hi, I have a table that contains posts and each post has a datetime field. Im trying to work out how I can show entries from today, this week and this month so I can have a link that shows all posts from today or this month etc. Any one know how I can do this ? My current piece of code that pulls the data from the db looks like this : Code: [Select] $texts= mysql_query("SELECT * FROM submittedtexts Order by id DESC LIMIT " . (($page - 1) * 6) . ", 6"); I want to add a bit that acts like : WHERE date = today Hope that makes sense, Im a bit of a newbie Thanks in advance, Scott i have been been given a project to create a website where registered users can answer some mathematics test questions,after anwering the questions and submitting, they should be able to see the sumarry of their test score showing the questions they got correctly, the ones anwred wrongly and the test score. please someone should help me with a sample script in php. me email address is nelboy4u@yahoo.com
need a code in php - show all posts from a irc channel on website if anyone knows how to do it, please let me know... i only need to display all the talking on mirc on my website. thank you |