PhotoClickr Posted September 14, 2007 Share Posted September 14, 2007 I know that you can combine PHP with HTML and name the file with the php extension but what I was wondering, does it seem to cause alot of problems for people when doing this?? Why am I asking this you wonder? Well I have a website thats mainly HTML (all but the contact page) and I needed an image hosting script so I got one and combined it with my HTML template, renamed it .php and at first it worked but now its gone all wonky!! I cant seem to figure out what went wrong or if I had mistakingly changed something but I have been on this for hours and hours and now I have a headache and am fed up... I need help, bad help..... You can go to my site and try to register and login and for some reason it wont let you come out of guest view to login to the user you have created... If you want to give it a try, my site is: http://www.photoclickr.com/tools.php I hope someone can help me... I am giving you php gurus a chance at solving this one!! GOOD LUCK!! Also... Here is my code... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <meta name="description" content="PhotoClickr has various services to offer for your photo needs. We offer resizing, rotating, manipulation, black and white, retouching, glamour, sketching and many more services."/> <meta name="keywords" content="photoclickr,photo,services,manipulation,retouch,resize,rotate,glamour,sketch,cartoon,photo restoration,black and white,reasonable rates,images"/> <meta name="author" content="Terri Long"/> <meta name="owner" content="support@photoclickr.com"> <meta http-equiv="expires" content="Never"> <meta http-equiv="content-language" content="English"> <meta http-equiv="vw96.object type" content="Homepage"> <meta name="rating" content="General"> <meta name="mssmarttagspreventparsing" content="true"> <meta name="ROBOTS" content="index,follow"> <meta name="REVISIT-AFTER" content="7 days"> <meta name="ROBOTS" content="ALL"> <link rel="stylesheet" type="text/css" href="style.css" media="screen"/> <title>PhotoClickr - Tools</title> </head> <body> <div class="container"> <div class="header"> <h1>We <img src="images/love.gif" alt="Love" /> quality photos!</h1> </div> <div class="navigation"> <ul> <li><a href="http://www.photoclickr.com/index.html" class="menu3">home</a></li> <li><a href="http://www.photoclickr.com/about.html" class="menu4">about</a></li> <li><a href="http://www.photoclickr.com/tools.php" class="menu5">tools</a></li> <li><a href="http://www.photoclickr.com/contact.php" class="menu6">contact</a></li> </ul></div> <br> <div align="center"><script type="text/javascript"> addthis_url = location.href; addthis_title = document.title; addthis_pub = 'mrsdestinetics'; </script> <script type="text/javascript" src="http://s7.addthis.com/js/addthis_widget.php?v=12" ></script></div> <div class="main"> </div> <div class="content"> <h1>Uploading</h1> <p>Welcome to <a href="http://www.photoclickr.com"> PhotoClickr</a>. Please take the time to register, then be sure to <b>check your email</b> to activate your account. Login and start uploading. Thank you.</p> <?php session_start(); if(file_exists("install.php")) { header('Location: install.php'); } include "mysql_data.db.php"; mysql_connect($mysqlhost, $mysqluser, $mysqlpass); mysql_select_db($mysqldb); include "functions.php"; include "user.php"; $globalvars->set_vars(); $user_dat = $user->process_user($globalvars); $template->header($globalvars); if($user_dat['loggedin'] != 1) { if($_GET['user']) { if($globalvars->settings['anonymousup'] == "yes") { switch($_GET['user']) { case upload: echo '<p align="left"><u>Guest functions - Upload image</u></p>'; $user->upload_img($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; } } switch($_GET['user']) { case register: echo '<p align="left"><u>Guest functions - Registration</u></p>'; $user->register($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case login: echo '<p align="left"><u>Guest functions - Log in</u></p>'; $user->login($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case confirm: echo '<p align="left"><u>Guest functions - Confirm account</u></p>'; $user->confirm($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; default: echo "This is not a valid action."; $exitp->exitp($user_dat, $globalvars); break; } } echo $globalvars->settings['final_guest_message']; if($globalvars->settings['display_login'] == "yes") { echo '<p><form action="' . $_SERVER['PHP_SELF'] . '?user=login" method="post" /> Username: <input type="text" name="user" /><br /> Password: <input type="password" name="pass" /><br /> <input type="submit" name="login" value="Log In" /></p> </form>'; } $exitp->exitp($user_dat, $globalvars); } // not guest, eh? include "upload.php"; $imgfunction = new uploads(); if($_GET['user']) { switch($_GET['user']) { case logout: echo '<p align="left"><u>User functions - Log out</u></p>'; $user->logout($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case confirm: echo '<p align="left"><u>Guest functions - Confirm account</u></p>'; $user->confirm($user_dat, $globalvars); $exitp->exitp($User_dat, $globalvars); break; } } if($user_dat['status'] == "suspended") { echo "Your account has been suspended. Please contact an adminstrater for more information."; $exitp->exitp($user_dat, $globalvars); } elseif($user_dat['status'] != "approved") { echo "Your account has not yet been approved or confirmed. Please check your e-mail for a <br />confirmation link, or wait until an adminstrater approves your account."; $exitp->exitp($user_dat, $globalvars); } if($_GET['user']) { switch($_GET['user']) { case profile: echo '<p align="left"><u>User functions - Edit profile</u></p>'; $user->editpro($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; } } if($_GET['action']) { switch($_GET['action']) { case upload: echo '<p align="left"><u>Upload functions - Upload file</u></p>'; $imgfunction->upload($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case imgdir: echo '<p align="left"><u>Upload functions - Browse directory</u></p>'; $imgfunction->display($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case rename: echo '<p align="left"><u>Upload functions - Rename image</u></p>'; $imgfunction->rename($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case delete: echo '<p align="left"><u>Upload functions - Delete image</u></p>'; $imgfunction->delete($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; default: echo "This is not a valid action. b"; $exitp->exitp($user_dat, $globalvars); break; } } if($user_dat['rank'] != "admin") { echo $globalvars->settings['final_global_message']; if($_GET['admin']) { echo "You can't access admin functions."; } $exitp->exitp($user_dat, $globalvars); } // Welcome, admin. include "admin.php"; $admin = new admin(); if($globalvars->settings['first_login'] == "yes") { mysql_query("UPDATE imgup_config SET first_login='no'"); echo '<script>window.location="' . $_SERVER['PHP_SELF'] . '?admin=settings"</script>'; } if($_GET['admin']) { switch($_GET['admin']) { case settings: echo '<p align="left"><u>Admin functions - Modify settings</u></p>'; $admin->settings($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case newuser: echo '<p align="left"><u>Admin functions - Create new user</u></p>'; $admin->adduser($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case displayusers: echo '<p align="left"><u>Admin functions - Display all users</u></p>'; $admin->viewusers($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case edituser: echo '<p align="left"><u>Admin functions - Edit user</u></p>'; $admin->edituser($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case ext: echo '<p align="left"><u>Admin functions - Modify settings</u></p>'; $admin->extdata($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case approve: echo '<p align="left"><u>Admin functions - Approve account</u></p>'; $admin->approve($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; default: echo "This is not a valid action."; $exitp->exitp($user_dat, $globalvars); break; } } $admin_usrdir = new usr_dir(); if($_GET['usrdir']) { switch($_GET['usrdir']) { case view: echo '<p align="left"><u>Admin functions - Browsing user directory</u></p>'; $admin_usrdir->view($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case rename: echo '<p align="left"><u>Admin functions - Rename image</u></p>'; $admin_usrdir->rename($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; case delete: echo '<p align="left"><u>Admin functions - Delete image</u></p>'; $admin_usrdir->delete($user_dat, $globalvars); $exitp->exitp($user_dat, $globalvars); break; } } echo $globalvars->settings['final_global_message']; $template->footer($user_dat, $globalvars); ?> <h3>Copyright Disclaimer</h3> <p>Please take a moment to read our copyright disclaimer <a href="disclaimer.html">here</a></p> <blockquote><p>PhotoClickr provides quality premium services at a reasonable rate.</p></blockquote> <ul> <li><i>Extensive Retouching/Scratch Removal</i></li> <li><i>Pencil Drawing/Sketching/Cartooning</i></li> <li><i>Glamour</i></li> <li><i>Manipulation/Blending</i></li> <li><i>Photo Restoration</i></li> <li><i>Magazine Covers (coming soon)</i></li> </ul> </div> <div class="code"><center>Some services as low as $1</center></div> <div align="left" class="navigation1"> <ul> <li><a href="http://www.vistaebooks.com" class="menu1">VistaEbooks</a></li> <li><a href="http://www.hotfreelayouts.biz" class="menu2">Halee's Hot Free Layouts</a></li> </ul> </div> <div align="center" class="footer"> © 2006 <a href="http://www.photoclickr.com">PhotoClickr.com</a> | Design by <a href="http://www.designcreek.com">DesignCreek</a> </div> </div> <center> <!-- Start of StatCounter Code --> <script type="text/javascript"> var sc_project=2902864; var sc_invisible=0; var sc_partition=30; var sc_security="5d291708"; </script> <script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div class="statcounter"><a class="statcounter" href="http://www.statcounter.com/"><img class="statcounter" src="http://c31.statcounter.com/2902864/0/5d291708/0/" alt="hit tracker" /></a></div></noscript> <!-- End of StatCounter Code --> </center> </body> </html> Thank you Terri p.s. I may want to add that it only works in Firefox... Sorry Quote Link to comment https://forums.phpfreaks.com/topic/69292-solved-php-combined-with-html/ Share on other sites More sharing options...
PhotoClickr Posted September 14, 2007 Author Share Posted September 14, 2007 Can anyone help??? Quote Link to comment https://forums.phpfreaks.com/topic/69292-solved-php-combined-with-html/#findComment-348637 Share on other sites More sharing options...
Psycho Posted September 14, 2007 Share Posted September 14, 2007 I'm not going to go through all of that code - especially since it appears you have done no debugging or even attempted to isolate the problem. But, I will state that session_start should be at the very top of the page, before anything is written to the browser, such as all the HTML you have. Quote Link to comment https://forums.phpfreaks.com/topic/69292-solved-php-combined-with-html/#findComment-348649 Share on other sites More sharing options...
PhotoClickr Posted September 15, 2007 Author Share Posted September 15, 2007 Well I figured it out on my own and without the session_start being at the top... Thanks for your help anyways... Quote Link to comment https://forums.phpfreaks.com/topic/69292-solved-php-combined-with-html/#findComment-348775 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.