Jump to content

squiblo

Members
  • Posts

    483
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by squiblo

  1. i have just decided to use buttons, but now i have another problem, if the form action is linked to the same page like "<form action='EXAMPLE'..." and a button is click within the form, how can i stop the page from scrolling back to the top then the button has been clicked?
  2. i have this working code... <form action="" method="POST"> <?php if (!isset($_POST['all'])){ echo "<input type='submit' name='all' value='View all categories'>"; } else { echo "<input type='submit' name='popular' value='View popular categories'>"; } ?> <?php if (!isset($_POST['all'])){ echo "<h2>Popular Categories</h2>"; } else { echo "<h2>All Categories</h2>"; } ?> but how can i change this so i do not have to use buttons, but i can use ordinary text
  3. i am getting this error...what does it mean? Notice: Undefined variable: error_login in /customers/squiblo.com/squiblo.com/httpd.www/login.php on line 290 line 282-294... if($count==1){ session_register("myusername"); session_register("mypassword"); session_register("mycompany"); header("location:index.php"); } else { $count = $error_login; $error_login = "Wrong username or password"; } } ?> and this is where i want the error echoed <?php // If result matched $myusername and $mypassword, table row must be 1 row if($count = $error_message){ echo $error_message; } ?>
  4. ok, i ended up putting the two scripts together but im still getting some problems... <form name="form1" method="POST" action=""> <table width="30%" border="0" cellspacing="5" cellpadding="0" class="signform" align="left"> <tr> <td> <?php // If result matched $myusername and $mypassword, table row must be 1 row if($count!==1){ echo "Wrong username or password"; } else { session_register("myusername"); session_register("mypassword"); header("location:profile.php"); } ?> </td> </tr> <tr> <td width="80px" align="right"> Username</td> <td><input type="text" id="myusername" name="myusername" style="width:165px;font-size:15px;"></td> </tr> <tr> <td align="right">Company</td> <td><input type="text" id="mycompany" name="mycompany" style="width:165px;font-size:15px;"></td> </tr> <tr> <td align="right">Password</td> <td><input type="password" id="mypassword" name="mypassword" style="width:165px;font-size:15px;"></td> </tr> <tr> <td align="right"></td> <td align="left">Remember Me <input type="checkbox" id="Checkbox1" name="rememberbox" value="on";><br>Forgot your password?<br><br> <input type="submit" id="Login" name="Login" value="Log in" style="height:35px;width:86px;";></td> </tr> </table> </form> <?php $host="***"; // Host name $username="***"; // Mysql username $password="***"; // Mysql password $db_name="***"; // Database name $tbl_name="***"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); if(isset($_POST['Login'])){ // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); //$_SESSION['myusername']=$dbusername; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); } ?>
  5. i just get taken to a blank page on checklogin.php
  6. what i am trying to do is, echo an error message "wrong username or password" if the user inputs the wrong login details, but i do not know how to get the variables form the checklogin.php without putting the to scripts into one.. this is to echo the error message... (dont know if that will even work, im new to php) <?php if (isset($_POST['Login'])){ if($count!==1){ echo "Wrong username or password"; } } ?> this is getting the data info... <?php $host="***"; // Host name $username="***"; // Mysql username $password="***"; // Mysql password $db_name="***"; // Database name $tbl_name="***"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); if(isset($_POST['Login'])){ // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); //$_SESSION['myusername']=$dbusername; $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "profile.php" session_register("myusername"); session_register("mypassword"); header("location:profile.php"); } } ?> and finally this is my form... <form name='form1' method='POST' action='checklogin.php'> <input type='submit' id='Login' name='Login' value='Log in'> </form> *note* that isnt the full form, i could not be bothered copying little parts lots of times from the table *note*
  7. this code enters the hit count into the whole field in my database but i just want it to be entered into a specific row of a user how can i do this? <?php session_start(); ?> <?php // Connects to your Database mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); //Adds one to the counter mysql_query("UPDATE members SET counter = counter + 1"); //Retreives the current count $count = mysql_fetch_row(mysql_query("SELECT counter FROM members")); //Displays the count on your site print "Total hits = $count[0]"; ?>
  8. thank the button type was the problem, it should have been "submit"
  9. its is still not echoing out "more blah blah blah" there are no errors
  10. hi, with this code i dont know what the action in the form should be set to for the same page and it is not echoing out "more blah blah blah" when i click the form button. <div id="pagecontent"> <table width="100%" border="0" cellspacing="20" cellpadding="0" class="pagecontent" align="left"> <tr> <td>Popular Categories </td> </tr> <tr> <td>blah blah blah <?php if (isset($_POST['more'])){ echo "more blah blah blah"; } ?> </td> </tr> <tr> <td> <form action="" method="POST"> <input type="button" name="more "value="View all categories"> </form> </td> </tr> </table> </div>
  11. that has worked perfect thanks
  12. sorry im new to php and i have not come across default_value yet and dont really understand, if im not logged in the image does not appear, but when i log in an image appears correctly.
  13. ok now im a little confused
  14. yes, i have session_start(); at the beginning of each page
  15. with this code, if the user is not logged in, i get this notice... Notice: Undefined index: mycompany in /customers/squiblo.com/squiblo.com/httpd.www/index.php on line 245 this is the code... <?php include("checklogin.php"); $company = $_SESSION['mycompany']; $query = mysql_query("SELECT * FROM members WHERE username='$company'"); if (mysql_num_rows($query)==0){ die; }else{ $row = mysql_fetch_assoc($query); $location = $row['image']; if($location == ""){ echo "<img src ='/profileimages/box.png' width='110' height='110' border='0'></a>"; }else{ echo "<img src ='$location' width='110' height='110' border='0'>"; } } ?>
  16. Hi, I am looking for someone with CSS/HTML knowledge, the task is not hard or long, its just that I am a real noob, I have only just started with CSS and my pages are only viewed properly in Firefox and in all other browsers it just looks stupid, text is all over the place, my background is useless, my CSS is very poor and needs changing. I have never paid anyone for coding before and have know idea on how much things cost but if you are interested maybe we can arrange something. ***Suggestion: a CSS freelancing section, HTML freelancing section, etc.*** This is the best place i could find to post
  17. hello. this is my first time using CSS within any of my webpages and im doing it completely wrong. 1. my webpage only looks "normal" in firefox but looks completely wrong in all other browsers. 2. i am using <br> tags to seperate my background because i cant divide it any other way this is my page... <?php session_start(); ?> <SCRIPT language="JavaScript"> <!--hide var password; var pass1=""; password=prompt('Please enter your password to view this page!',' '); if (password==pass1) alert('Password Correct! Click OK to enter!'); else { window.location="http://www.squiblo.com/index.php"; } //--> </SCRIPT> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Style-Type" content="text/css"> <meta name="description" content="Squiblo.com is currently under construction but is being worked on to provide business information where you can find business numbers, addresses, websites and rate your favourites." /> <meta name="keywords" content="business search, local search, search, United Kingdom search engine, business services, services, business directory, products, squiblo, squiblo.com, local info, mobile, company info, addresses, phone numbers, websites, local maps, maps, directions, driving directions, walking directions, car parks, toolbar, advertising, build your own website, web link, domain name" /> <title>Squibo.com - About!</title> <style type="text/css"> body { color: white; background-color: #E6E6E6; font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align: left; } div#content { width: 75%; height: 90%; background-color:#508ace; margin-top: 30px; margin-bottom: 50px; margin-left: auto; margin-right: auto; padding: 0px; border: thin solid #E6E6E6; } div#heading { font-size:72px; font-family: Impact; position:absolute; top:82px; left:180px; } div#options { color: yellow; font-size:15px; position:absolute; top:145px; left:955px; } .hr1 { color: #E6E6E6; background-color: #E6E6E6; height: 3px; position:relative; top:130px; } div#nav { font-size:15px; position:absolute; top:173px; left:180px; } div#extranav { font-size:15px; position:absolute; top:173px; left:660px; } div#logout { font-size:15px; position:absolute; top:173px; left:990px; } .hr2 { color: #E6E6E6; background-color: #E6E6E6; height: 3px; position:relative; top:150px; } div#terms { position:absolute; top:290px; left:180px; } </style> </head> <body> <div id="content"> <div id="heading"> <a href="/index.php" style="text-decoration:none"><font color=#FFFFFF> <?php echo "SQUIBLO.COM"; ?> </a></font> </div> <div id="options"> <?php if($_SESSION['mycompany']) { echo "Welcome " . ucwords(strtolower($_SESSION['mycompany'])); ?> <?php } else { echo "Sign in / Register"; } ?> </div> <div class="hr1"><hr /></div> <div id="nav"> <a href="/index.php" style="text-decoration:none"><font color=#FFFFFF> <?php echo "Home"; ?> </a></font> <?php echo "Maps"; ?> <?php echo "Catagories"; ?> <?php echo "Learn More"; ?> </div> <div id="extranav"> <a href="#" style="text-decoration:none"><font color=#FFFFFF><b> <?php if($_SESSION['mycompany']) { echo "Your Page"; ?> <?php { echo "Settings"; } ?> <?php } else { echo ""; } ?> </a></font></b></div> <div id="logout"> <a href="/logout.php" style="text-decoration:none"><font color=#FFFFFF> <?php if($_SESSION['mycompany']) { echo "[Log out]"; ?> <?php } else { echo ""; } ?> </a></font></div> <div class="hr2"><hr /></div> <div id="terms"> <div style="overflow:auto; height:250px; width:650px"> <table border="1" cellpadding="5" cellspacing="0" style="width:640px;"> <tr> <td>About Us About Us About Us About Us About Us About Us </td> </tr> </table> </div> </div> </div> </body> </html> and this is the url to the page.. http://www.squiblo.com/about.php if you click the url the page password is just a hash "#"
  18. my website is hosted with "one.com" and php.ini files are hidden and unable to change defaul php parameters is there anyother way of doing this?
  19. i dont have a clue what that means
  20. Ok, I just want my webpage to be view in Firefox because ive not yet sorted it out for all browsers and it looks really bad apart from in Firefox, so i have this little bit of code that only allows the page to be viewed by Firefox but ive tried it in my page script but i think im doing it wrong because its not working... this is so my page can only be viewed in Firefox <?php $browser = get_browser(null, true); if ($browser["browser"] == "Firefox") { // Firefox only stuff } else { // Go download a real browser. } ?> and the is my web page <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Style-Type" content="text/css"> <meta name="description" content="Squiblo.com is currently under construction but is being worked on to provide business information where you can find business numbers, addresses, websites and rate your favourites." /> <meta name="keywords" content="business search, local search, search, United Kingdom search engine, business services, services, business directory, products, squiblo, squiblo.com, local info, mobile, company info, addresses, phone numbers, websites, local maps, maps, directions, driving directions, walking directions, car parks, toolbar, advertising, build your own website, web link, domain name" /> <title>Squibo.com - Find the business information you need!</title> <style type="text/css"> body { color: white; background-color: #E6E6E6; font-size:12px; font-family: Verdana, Arial, Helvetica, sans-serif; text-align: left; } div#content { width: 75%; height: 90%; background-color:#508ace; margin-top: 30px; margin-bottom: 50px; margin-left: auto; margin-right: auto; padding: 0px; border: thin solid #E6E6E6; } div#heading { font-size:72px; font-family: Impact; position:absolute; top:82px; left:180px; } div#options { color: yellow; font-size:15px; position:absolute; top:145px; left:955px; } .hr1 { color: #E6E6E6; background-color: #E6E6E6; height: 3px; position:relative; top:130px; } div#nav { font-size:15px; position:absolute; top:173px; left:180px; } div#extranav { font-size:15px; position:absolute; top:173px; left:660px; } div#logout { font-size:15px; position:absolute; top:173px; left:990px; } .hr2 { color: #E6E6E6; background-color: #E6E6E6; height: 3px; position:relative; top:150px; } div#slogan { color: yellow; font-size:25px; position:absolute; top: 230px; left:380px; } div#searchfor { color:black; font-size:16px; position:absolute; top: 320px; left:240px; } div#companyname { color:black; font-size:16px; position:absolute; top: 320px; left:480px; } div#location { color:black; font-size:16px; position:absolute; top: 320px; left:718px; } div#homesearch { position:absolute; top: 340px; left:240px; } div#eg1 { color:#E6E6E6; position:absolute; top: 375px; left:240px; } div#eg2 { color:#E6E6E6; position:absolute; top: 375px; left:480px; } div#eg3 { color:#E6E6E6; position:absolute; top: 375px; left:718px; } .hrbreak { color: #FFFFFF; background-color: #FFFFFF; height: 2px; width: 80%; margin-left: auto; margin-right: auto; margin-top: 430px; margin-bottom: auto; } div#advertise { text-decoration:none; font-size:33px; color:white; position:absolute; top: 500px; left:280px; } div#footlinks { color: black; position:absolute; top:570px; left:230px; } </style> </head> <link REL="SHORTCUT ICON" HREF="./favicon.ico"> <body> <div id="content"> <div id="heading"> <a href="/index.php" style="text-decoration:none"><font color=#FFFFFF> <?php echo "SQUIBLO.COM"; ?> </a></font> </div> <div id="options"> <?php if($_SESSION['mycompany']) { echo "Welcome " . ucwords(strtolower($_SESSION['mycompany'])); ?> <?php } else { echo "<a href='login.php' style='text-decoration:none'><font color=#FFFF00>Sign in </a></font>/ Register"; } ?> </div> <div class="hr1"><hr /></div> <div id="nav"> <a href="/index.php" style="text-decoration:none"><font color=#FFFFFF> <?php echo "Home"; ?> </a></font> <?php echo "Maps"; ?> <?php echo "Categories"; ?> <?php echo "Learn More"; ?> </div> <div id="extranav"> <a href="#" style="text-decoration:none"><font color=#FFFFFF><b> <?php if($_SESSION['mycompany']) { echo "Your Page"; ?></a></font></b> <a href="#" style="text-decoration:none"><font color=#FFFFFF><b> <?php { echo "Settings"; } ?> <?php } else { echo ""; } ?> </a></font></b></div> <div id="logout"> <a href="/logout.php" style="text-decoration:none"><font color=#FFFFFF> <?php if($_SESSION['mycompany']) { echo "[Log out]"; ?> <?php } else { echo ""; } ?> </a></font></div> <div class="hr2"><hr /></div> <div id="slogan"> <?php echo "Find the business information you need!"; ?> </div> <div id="searchfor"> <?php echo "Search for:"; ?> </div> <div id="companyname"> <?php echo "And/or company name:"; ?> </div> <div id="location"> <?php echo "Located in:"; ?> </div> <div id="homesearch"> <form name="form1" method="post" action="checklogin.php"> <input type="text" id="categories" style="font-size:20px;"> <input type="text" id="company" style="font-size:20px;"> <input type="text" id="location" style="font-size:20px;"> <input type="submit" id="indexsearch" name="search" value="Search" style="height:35px;"> </form> </div> <div id="eg1"> <?php echo "e.g. builders, gardeners"; ?> </div> <div id="eg2"> <?php echo "e.g. Squiblo"; ?> </div> <div id="eg3"> <?php echo "e.g. country, city, postcode/zip"; ?> </div> <div class="hrbreak"<hr /></div> <a href="#" style="text-decoration:none"><font color=#FFFFFF> <div id="advertise"> <?php echo "Advertise your company with Squiblo.com"; ?> </div> </a></font> <div id="footlinks"> <?php echo "Squiblo &#169; 2009"; ?> <a href="/about.php" style="text-decoration:none"><font color=#000000> <?php echo "About Us"; ?> </a></font> <a href="/terms.php" style="text-decoration:none"><font color=#000000> <?php echo "Terms and Conditions"; ?> </a></font> <a href="/contact.php" style="text-decoration:none"><font color=#000000> <?php echo "Contact Us"; ?> </a></font> <a href="/privacy.php" style="text-decoration:none"><font color=#000000> <?php echo "Privacy"; ?> </a></font> <a href="/help.php" style="text-decoration:none"><font color=#000000> <?php echo "Help"; ?> </div> </div> </body> </html>
  21. "Sign In / Register" will only be echoed if im not logged in, so when "Sign In" is echoed I would like it to be linked to a page where i can sign in, but i cannot create this link.
  22. this is my effort, but its not working, what is the proper way to do this? <?php if($_SESSION['mycompany']) { echo "Welcome " . ucwords(strtolower($_SESSION['mycompany'])); ?> <a href="/login.php" style="text-decoration:none"><font color=#FFFF00> <?php } else { echo "Sign in </a></font>/ Register"; } ?> I only want "Sign In" to be linked
  23. sorry silly mistake
  24. ok i have this working code... <?php if($_SESSION['myusername']){ ?> yes <?php } else { ?> no <?php } ?> and i am trying to change it slightly but nothing is working for me this is what i have.. <?php if($_SESSION['myusername']) { echo ucwords(strtolower($_SESSION['myusername'])); } else { echo "Sign in / Register"; } ?> the problem there is, it always echos "Sign in / Register" if when i log in and when i am not logged in
×
×
  • 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.