Jump to content

Fearpig

Members
  • Posts

    195
  • Joined

  • Last visited

Everything posted by Fearpig

  1. Hi Guys, Can someone take a quick look at my code for me? I'm getting an error message and I know its got to be something simple but I just can't see it! The code should check if a session variable has been registered and if so show a page and if not throw them back to the log-in screen. <?php //start the session session_start(); //check to make sure the session variable is registered if(session_is_registered('Slash_User')){ include '../Layout_Before.php'; echo "Test"; include '../Layout_After.php'; else{ //the session variable isn't registered, send them back to the login page header( "Location: http://fer-post/sales/" ); } ?> Error Message Parse error: parse error, unexpected T_ELSE in D:\Intranet v3\Sales\home.php Anyhelp would be appreciated! Tom
  2. I think the simplest way to do it would be PHP and MySQL, you could set up a really simple table with the following fields..... (bear in mind this is the simplest way I can think of not the best method if you will want to develop this in the future) Fields: Name Password Position Jan1 Jan2 Jan3..... ...and a load more fields... Dec31 Then each player fills out a form for which days they are available which updates the date fields to a 1 or 0 (available / not available). Really crude but it would work!
  3. Doh!! Cheers for your help again Barand. I'll marked this as solved although it'll take me a good while to do it! Thanks.
  4. Right then, solutions ago-go!! Barand your idea seems the best bet, I've used replacing div elements for changeable content on tabs but how on earth would I get the content to change once results have been returned? I think its probably best to start with the basics... can anyone recommend a tutorial?
  5. OK!... my Javascript skills are pretty lousy and I'm not even sure what AJAX is! Is there a way to put up an intermediate page until the results page is displayed? I'm now thinking of using a spinning timer (or equivalent) instead of a % progress bar.
  6. Thanks MadTechie, That all makes sense but I wouldn't have a clue where to start! How would you get hold of the value for records processed so far? How would you display the animated gif or holding page until the records are processed? I'll keep searching but any help would be appreciated as always.
  7. Hello, Post your code and I'm sure people would take a look.
  8. Hi guys, Can anyone recommend a % progress bar for me!! I've got a fairly simple page that queries a huge database and takes about 30 seconds to return data, is there anyway to put up an intermediate progress bar showing percentage (of time or data) remaining? I just can't work out how I'd predict how much time the next page will take to load! If a % progress bar can't be done... is there a way of putting in a holding page until the query has finished? (It'd just be a blank page with a spinning swf or animated gif.) Any help would be appreciated. Tom
  9. Hi Guys, I'm looking for a tutorial on how to use SUMS and GROUPS to display data from an SQL database. I've had a quick look round but can't find the basics! I'm already familiar with displaying the data as it is but not performing calculations. Could someone point me in the right direction. Cheers Tom
  10. Hello, I thought that setting Register_Globals = Off was a security risk? From another site I've found this fix... set session.bug_compat_warn = 0. Does this just suppress the error message?
  11. Thanks for the help guys but I've managed to take a deep breath and sort it myself! (It was a MSSQL 2005 database that I was using)
  12. Right then.... Why not put a copy of the access database onto your 'ubuntu / apache2 / php5' server and synchronise that. Then schedule an ftp batch file to connect and download a copy of the access file. To ensure you had all of the data on both databases you would have to do an upload and download.... Ftp Upload - Sync - Ftp Download .... I wouldn't have a clue where to start with php though!
  13. Hi Guys, I am getting the following error when I try and use my login script, would someone take a look at this and suggest where I'm going wrong..... Error: Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 Login.php <?php include '../Connect_Product_Database.php'; $Password = $_POST['Password']; $Username = $_POST['Username']; //check that the user is calling the page from the login form and not accessing it directly //and redirect back to the login form if necessary if (!isset($Username) || !isset($Password)) { header( "Location: http://fer-post/internet/site_upload/" ); } //check that the form fields are not empty, and redirect back to the login page if they are elseif (empty($Username) || empty($Password)) { header( "Location: http://fer-post/internet/site_upload/" ); } //convert the field values to simple variables //add slashes to the username and md5() the password $Slash_User = addslashes($_POST['Username']); $MD5_Pass = md5($_POST['Password']); $sql="SELECT * FROM tbl_Users WHERE Username='$Slash_User'"; $Details=odbc_exec($conn,$sql); if (!$Details) {exit("Error in SQL - User not found");} $Stored_Password=odbc_result($Details,"Password"); if ($MD5_Pass == $Stored_Password) { //----------Technical Logon---------- if ($Slash_User == 'technical') { //Starts a session and registers a variable session_start(); session_register('Slash_User'); include '../Navigation.php'; echo "<p class=BodyText1 align=center>Edit technical stuff!</p>"; echo "<div align=center><form action='Technical_Edit_Products.php' method='post'><input name='submit' type='submit' value='Edit Product Details'></form></div><br>"; //----------Training Logon---------- }elseif($Slash_User == 'training'){ //Starts a session and registers a variable session_start(); session_register('Slash_User'); echo "<p class=BodyText1 align=center>edit training stuff</p>"; //----------No Recognised User---------- }else{ include '../Navigation.php'; echo "<p class=BodyText1 align=center>User not configured - Report this to IT.</p>"; } //----------No Recognised Password---------- }else{ include '../Navigation.php'; echo "<p class=BodyText1 align=center>Password Not OK</p>"; } ?> If anyone could suggest whats causing this then I'd appreciate it!!
  14. ------------- sorry posted it in the wrong area ------------------
  15. They have slightly different syntax and as I'm still a noob its really frustrating! ??? Just can't see where I'm going wrong!
  16. Hi guys, Can anyone recomend a good tutorial for a log on system using sql? All the ones I've found so far are Mysql. Cheers.
  17. You could convert the date into three integer variables ($Day, $Month, $Year) and add one to the year and convert them back into a date... that way it will add the correct amount regardless of leap years! There's probably a better way though.
  18. Assuming that you have some sort of VPN secure tunnel between the two servers I would probably go for just a straight query sync of the data and not even use php... ...just a suggestion! Before I get jumped on by the PHP addicts!
  19. Hiya, I think you just need to move the marquee tags outside of the loops. Something like.... <?php echo "<Marquee>"; //....Connect to database //....Define Variables if(xxxxx){ echo " database result goes here ". } echo "</Marquee>"; ?> Sorry can't test it at the moment!
  20. Solved it... follow back from the start, take a deep breath and look at it again!! I had the efficiency saved into an nvchar(10) field so the values were being saved as "A ", "B "... (a letter and 9 spaces). I changed it to a nvchar(1) field and it worked straight away! DOH! Cheers for helping corillo181.
  21. OK... so I changed the if/else statement to the following: <?php if ($Efficiency == 'A'){ $Bg = '#467A4F'; }elseif ($Efficiency == 'B') { $Bg = '#60A17D'; }elseif ($Efficiency == 'D') { $Bg = '#E6EE38'; }else { $Bg = '#FFFFFF'; } ?> ...and now I get the correct data in that column but all of the cells are still white.
  22. Hi guys, Could someone have a look at my code for me... I'm trying to change the colour of a cell in a table according to the data retrieved from a database. In the code below I first define the background colour as white (#FFFFFF), then I pull the data from an SQL database to populate the table. The efficiency column should be coloured according to the efficiency; A=Green, B=Blue/Green, D=Yellow. At the moment all the cells in this column are green and showing A efficiency regardless of what is stored in the database. <?php $Bg = '#FFFFFF'; $sql="SELECT * FROM tbl_Domestic_Boilers ORDER BY $Order"; //$sql="SELECT * FROM qry_Domestic_Boilers_and_Docs"; $result=odbc_exec($conn,$sql); if (!$result) {exit("Error in SQL");} echo "<table class='BodyText1' border=1>\n"; echo "<tr><th>Product</th><th>Type</th><th>Warranty</th><th>Efficiency</th><th>Power Output</th></tr>\n"; while (odbc_fetch_row($result)) { $Product=odbc_result($result,"Product"); $Boiler_Type=odbc_result($result,"Type"); $Warranty=odbc_result($result,"Warranty"); $Efficiency=odbc_result($result,"Efficiency"); $Output_Power=odbc_result($result,"Power"); $Part_ID=odbc_result($result,"Part_ID"); if ($Efficiency = 'A'){ $Bg = '#467A4F'; }elseif ($Efficiency = 'B') { $Bg = '#60A17D'; }elseif ($Efficiency = 'D') { $Bg = '#E6EE38'; }else { $Bg = '#FFFFFF'; } echo "<tr><td>$Product</td><td>$Boiler_Type</td><td>$Warranty</td>"; echo "<td bgcolor='$Bg'>$Efficiency</td><td>$Output_Power</td></tr>"; } echo "</table>\n"; ?> Any help would be appreciated as this is really bugging me now!! Cheers guys.
  23. Hi Guys, I'm having a few problems with a table I'm creating. The table is populated from an SQL database using two tables. I need to link the tables using a left join so that all of the products are visible and only relevant documents. So I created a view on the SQL server using a left join and this displays correctly however if I then try and sort the table using 'ORDER BY' it drops all records where there are not enteries on both tables. This occurs if I make the query in SQL or in PHP. Can anyone see where I am going wrong? Any help would be appreciated. <? $sql="SELECT * FROM qry_Domestic_Boilers_and_Docs ORDER BY 'Product'"; //this one doesn't work //$sql="SELECT * FROM qry_Domestic_Boilers_and_Docs"; //but this one works!! $result=odbc_exec($conn,$sql); if (!$result) {exit("Error in SQL");} echo "<table class='BodyText1' border=1>\n"; echo "<tr><th>Product</th><th>Type</th><th>Warranty</th><th>SEDBUK</th><th>kW</th></tr>"; while (odbc_fetch_row($result)) { $Product=odbc_result($result,"Product"); $Boiler_Type=odbc_result($result,"Type"); $Warranty=odbc_result($result,"Warranty"); $SEDBUK=odbc_result($result,"SEDBUK"); $Output_Power=odbc_result($result,"Power"); $Part_ID=odbc_result($result,"Part_ID"); echo "<tr><td><a href=\"Result_ByDomesticProduct.php?id=$Part_ID\">$Product</a></td><td align='middle'>$Boiler_Type</td><td align='middle'>$Warranty</td><td align='middle'>$SEDBUK</td><td align='middle'>$Output_Power</td></tr>"; } echo "</table>\n"; ?>
  24. You just have to put in the HTML tags for building a table and have your PHP script echo them in the right place..... <table><tr><th>User</th><th>Imps</th><th>Clicks</th><th>ClientRev</th></tr> <?php while(your conditions){ echo "<tr><td>Field 1</td><td>Field 2</td><td>Field 3</td><td>Field 4</td></tr>"; } ?> </table> Look into basic html design if you need anything more complicated (colours, background images, spanning columns).
  25. Hi guys, Can someone have a look at my code and see where I've gone wrong! The code below populates a calendar with a list of events for each day. Unfortunately the list of events appears under the correct day and year but repeat themselves for every month (i.e. an event on the 18th May also appears under 18th June, 18th July, 18th August... and so on. ) Each event has a start date and a duration (in days) so I convert the startdate into an integer of seconds, then add on the duration in seconds to find the enddate. I then list all events where the startdate <= calendar date and enddate >= calendar date. <?php $Calendar_Date = date("d/m/Y",mktime(0,0,0,$Month,$Day,$Year)); echo "$Calendar_Date<br>"; $sql_Event_Details="SELECT * FROM tbl_Visit"; $Event_Details=odbc_exec($conn,$sql_Event_Details); if (!$Event_Details) {exit("Error in SQL");} while (odbc_fetch_row($Event_Details)) { $Event_Title=odbc_result($Event_Details,"Event_Title"); $Duration=odbc_result($Event_Details,"Duration"); $Duration_Seconds=86400 * $Duration; $Start_Date=odbc_result($Event_Details,"Event_Date"); $Start_Date_Seconds= strtotime($Start_Date); $End_Date_Seconds=$Start_Date_Seconds + $Duration_Seconds; $End_Date=($Start_Date !='')?date("Y-m-d",$End_Date_Seconds):''; $Format_Start_Date = ($Start_Date !='')?date("d/m/Y",strtotime($Start_Date)):''; $Format_End_Date = ($End_Date !='')?date("d/m/Y",strtotime($End_Date)):''; if (($Format_Start_Date <= $Calendar_Date) AND ($Format_End_Date >= $Calendar_Date)){ echo "<span class='Body3'>$Event_Title</span><br>"; }else{ echo ""; } } ?> If anyone can help I'd really appreciate it as this is just about my final stumbling block for this project and its driving me mad! (I've probably just stared at it for too long.)
×
×
  • 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.