• 0

My backend php


Question

Well i thought i show you my backend php for my site...

http://digital-omni.com/siteadmin/admin.php

and i got the news to display

http://digital-omni.com/news/news.php

note : if it dosent work im fixing bugs or what-not.., and sooner or later when i do my site, it WILL be password protected once i intagrated into my site....

my first backend php type thing

Comments ?

Edited by aaronsam
Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0

rough, but it works. glad to see your interest in actually doing this on your own. too many people expect someone else to code the php for them and bitch if it doesn't do what they want :D

Link to comment
Share on other sites

  • 0

ya..i know what you mean.. but anyway i know your backend it much better :( :blink: :wacko:

p.s. the reason some of the pages are different because i make 3/4 and think of a better way to do it.. so i like edit it and not start over...

Link to comment
Share on other sites

  • 0

--Smifffy

i used the Date in the sql, and in the input i have it as curdate()

but it comes out 02:22:03 weird stuff.. along witht he time..., is there a way to fix this? i

--Keldyn

:crazy: :laugh:

Link to comment
Share on other sites

  • 0

Instead of just curdate do CURDATE() and CURTIME()

that way you can print the date and time seperatly

The sql query statement I used for a site went like this :

$query = ("INSERT INTO `****` (`******` , `********` , `theDate` , `theTime`, `*********`) VALUES ('', '*********', CURDATE( ), CURTIME( ), '*********')");

I put **** in place of the fields i used for showing here, just for security reasons.

Then I created a function that formats the time into a more readable format in am and pm

function format_time($postTime){
  $timeArray = explode(":", $postTime);
  $numItems = count($timeArray);
  $timeHour = $timeArray[0];
  $timeMin = $timeArray[1];
  if($timeHour < 12){
 	 $timeAMPM = "AM";
 	 switch($timeHour){
    case 01:
   	 $timeHour = 1;
   	 break;
    case 02:
   	 $timeHour = 2;
   	 break;    
    case 03:
   	 $timeHour = 3;
   	 break;    
    case 04:
   	 $timeHour = 4;
   	 break;    
    case 05:
   	 $timeHour = 5;
   	 break;    
    case 06:
   	 $timeHour = 6;
   	 break;    
    case 07:
   	 $timeHour = 7;
   	 break;    
    case 08:
   	 $timeHour = 8;
   	 break;    
    case 09:
   	 $timeHour = 9;
   	 break;  
    } 	 
  }
  else{
 	 $timeAMPM = "PM";
 	 
 	 switch($timeHour){
    case 13:
   	 $timeHour = 1;
   	 break;
    case 14:
   	 $timeHour = 2;
   	 break;    
    case 15:
   	 $timeHour = 3;
   	 break;    
    case 16:
   	 $timeHour = 4;
   	 break;    
    case 17:
   	 $timeHour = 5;
   	 break;    
    case 18:
   	 $timeHour = 6;
   	 break;    
    case 19:
   	 $timeHour = 7;
   	 break;    
    case 20:
   	 $timeHour = 8;
   	 break;    
    case 21:
   	 $timeHour = 9;
   	 break;    
    case 22:
   	 $timeHour = 10;
   	 break;    
    case 23:
   	 $timeHour = 11;
   	 break;    
 	 }  
 	 

  }
  $timeString = $timeHour.":".$timeMin." ".$timeAMPM;
  return $timeString;
	}

not enough room, continued on next reply

Link to comment
Share on other sites

  • 0

continued reply...

Then in the loop that displays each news item, to call the function I did

$postTime = format_time($rowNews[3]); ? // $rowNews[3] being the varible I used

so in the end to print the date then time it was like

print $rowNews[2].", ".$postTime

If you goto www.maelstrommusic.com and the main page shows news, you can see what I mean.

My solution may not be the most elegant, but it works, if you wanna dont get it working the other way and wanna use it.

Edit : Ain't this stuff fun!!! The above mentioed site I did a lot in backend php, the whole site is updateable and can add content to and everythign without even really knowing any html at all, and the owner of the site never need to open a web file! Fairly time consuming tho!

Link to comment
Share on other sites

  • 0

i did this

<?php
$date = date("F jS Y");
$time = date("g:ia");
//Adds News to Sql
if ($Post == "Post!") {
$sql = "INSERT INTO News SET
UserName='$usernameform',
UserMail='$usermailform',
MessageSubject='$subjectform',
MessageDate='$date',
MessageTime='$time',
MessageText='$messageform'";
if (@mysql_query ($sql)) {
echo("<P>News has been added.</P>"); } else
{ echo("<P>Error adding submitted news:".mysql_error () ."</P>");}}

Link to comment
Share on other sites

  • 0

http://www.hotscripts.com

http://www.google.com

YOU ARE LAZY AND WILL NOT LEARN ANY OTHER WAY THAN DOING IT FOR YOUR SELF!!!!!!!!!

you know what i mean when i say that- and i am only joking- but seriously- alot of research is not very hard- and will reveal alot. Hotscipts has everything under the sun... and google has the universe.

Link to comment
Share on other sites

  • 0
you know what i mean when i say that- and i am only joking- but seriously- alot of research is not very hard- and will reveal alot. Hotscipts has everything under the sun... and google has the universe.

:D :D :D :D :woot:

anyway i dident want some one to do it for me.. (well i do but) i cant think of a way in php to do it...

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.