Jump to content

jarv

Members
  • Posts

    325
  • Joined

  • Last visited

Everything posted by jarv

  1. Thanks TRQ, that worked! thanks also to: ginerjm
  2. Hi, my variable $SiteGallery currently equals 0 but it could equal 1 I would like to setup radio buttons to define weather it's a 0 or a 1 by writing an if statement similar to: IF SiteGallery == 1 THEN 'checked' <label>Gallery On <input type="radio" name="SiteGallery" value="1" /> </label> <label>Gallery Off <input type="radio" name="SiteGallery" value="0" /> </label> can anyone help? thanks
  3. Thank you! I was hoping for a way of doing his via cookies
  4. What? I have a php page with links, I just want to show a (*) next to the links that the user has clicked on
  5. Hi, I have a link and would like to set a cookie on a link and when a user clicks that link it then shows an * Asterix next to that link to say that they have already been there, can anyone direct me to an online tutorial for this or guide me? thanks J
  6. I have tried this and it just displays 0, 2, 4
  7. I have done what you suggested and put the mysql_query in () still getting teh same message
  8. I am passing the BookID through in the URL but I get teh following error: [06-Jun-2013 16:00:56] PHP Parse error: syntax error, unexpected '=' in /Applications/MAMP/htdocs/mrmen/getmrmen1.php on line 4 my code: <?php $BookID = $_REQUEST['BookID']; echo $BookID; mysql_query="SELECT BookID,BookTitle,BookInfo FROM mrmen WHERE BookID = $BookID"; $cur=(mysql_fetch_row); while($i=$cur) {$BookID=$i[0]; $BookTitle=$i[1]; $BookInfo=$i[2]; } ?>
  9. I have tried this and I get: [06-Jun-2013 15:39:58] PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /Applications/MAMP/htdocs/mrmen/index.php on line 11
  10. hi, I would like to display a number next to each of my books ie: Book Title 1: Mr. Tickle Book Title 2: Mr. Greedy Book Title 3: Mr. Topsy-Turvy Book Title 4: Little Miss Bossy Book Title 5: Mr. Uppity but instead (as they are being output as an array) I get: Book Title 0: Mr. Tickle Book Title 1: Mr. Greedy Book Title 2: Mr. Topsy-Turvy Book Title 3: Little Miss Bossy Book Title 4: Mr. Uppity here is my code $pagecount=0; $qry="SELECT BookID,BookTitle,BookInfo FROM mrmen"; $cur=mysql_query($qry); if(!$cur){ echo $cur.'<br />'.mysql_error(); } while($i=mysql_fetch_row($cur)) {$BookID[$pagecount]=$i[0]; $BookTitle[$pagecount]=$i[1]; $BookInfo[$pagecount]=$i[2]; $pagecount++; } for ($i=0;$i<$pagecount;$i++){ echo 'Book Title '.$i.': '.$BookTitle[$i].'<br />'; }
  11. print_r($row2) outputs an array of what is in the database I think the problem lies where I am trying to join the 2 tables I just want to check if BGimageID in Pages table is the same as BGimageID is the same as the one in bgimages table and if it is then CHECK the radio button
  12. thanks, I just changed that and still get the same error?!
  13. $sql2 = "SELECT * FROM pages INNER JOIN bgimages ON pages.BGimageID=bgimages.BGimageID"; $result2 = mysql_query($sql2); <?php while($row2 = mysql_fetch_array($result2)) { if($row2['pages.BGimageID'] == $row2['bgimages.BGimageID']){ echo '<input type="radio" name="BGimageID" value="'.$row2['BGimageID'].'" checked /><img src="../images/'.$row2['BGimage'].'" width="150" />'; } else { echo '<input type="radio" name="BGimageID" value="'.$row2['BGimageID'].'" /><img src="../images/'.$row2['BGimage'].'" width="150" />'; } } ?>
  14. Please help, I get the following php error: unexpected T_IF here is my code: echo '<input type="radio" name="BGimageID" value="'.$row2['BGimageID'].'" '.if($row2['pages.BGimageID']==$row2['bgimages.BGimageID']){ echo " checked" }' /><img src="../images/'.$row2['BGimage'].'" width="150" />';
  15. ok, changed that thanks! still not working?! All my styles are broken
  16. hi, I am going through this tutorial: http://net.tutsplus.com/tutorials/php/supercharge-your-css-with-php-under-the-hood/ I have done what you said: here is my CSS page: <?php header('Content-type=text/css'); ?> #headcontainer { background-color: #<?php echo $headcontainerbg; ?> } here is my .htaccess (in the CSS folder) AddType application/x-httpd-php .html .htm .css AddHandler application/x-httpd-php .html .htm .css AddHandler application/x-httpd-php5 .css I am importing CSS stylesheet like my others I am using MAMP locally, still nothing
  17. ok, I have changed it, I now get UNDEFINED when i try and login hi, I am using the tutorial here: http://www.9lessons.info/2009/09/php-login-page-example.html When I try and login: user: test Pass: test here: http://m.slapp.me I get 'Undefined' Why? Please help... here is my, check login page: <?php session_start(); $host="xxxx"; // Host name $username="xxxx"; // Mysql username $password="xxxx"; // Mysql password $db_name="xxx"; // Database name $tbl_name="xxxx"; // 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($_SERVER["REQUEST_METHOD"] == "POST") { // username and password sent from Form $myusername=addslashes($_POST['rsUser']); $mypassword=addslashes($_POST['rsPass']); $sql="SELECT * FROM $tbl_name WHERE rsUser='$myusername' and rsPass='$mypassword'"; $result=mysql_query($sql); $row=mysql_fetch_array($result); $active=$row['active']; $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1) { session_register("rsUser"); $_SESSION['login_user']=$myusername; header("location: http://m.slapp.me/login_success.php?msg=$msg&rsUser=$rsUser"); } else { $error="Your Login Name or Password is invalid"; } } ?> lock.php <?php $host="xxxx"; // Host name $username="xxxx"; // Mysql username $password="xxxx"; // Mysql password $db_name="xxxx"; // Database name $tbl_name="xxxx"; // 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"); session_start(); $user_check=$_SESSION['login_user']; $ses_sql=mysql_query("select username from admin where username='$user_check' "); $row=mysql_fetch_array($ses_sql); $login_session=$row['username']; if(!isset($login_session)) { header("Location: default.php"); } login page <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Slapp.Me - Daily Task System</title> <link rel="stylesheet" href="http://m.slapp.Me/demos/css/themes/default/jquery.mobile-1.2.0.css" /> <link rel="stylesheet" href="http://m.slapp.Me/demos/docs/_assets/css/jqm-docs.css"/> <script src="http://m.slapp.Me/demos/js/jquery.js"></script> <script src="http://m.slapp.Me/demos/docs/_assets/js/jqm-docs.js"></script> <script src="http://m.slapp.Me/demos/js/jquery.mobile-1.2.0.js"></script> </head> <body> <!-- Start of first page: #one --> <div data-role="page" id="one"> <header data-role="header" data-theme="b"> <h1>Slapp.Me</h1> <a href="#register" data-icon="info" class="ui-btn-left" data-rel="dialog" data-transition="pop">Register</a> <a href="#login" data-icon="gear" class="ui-btn-right" data-rel="dialog" data-transition="pop">Login</a> </header><!-- /header --> <div data-role="content" > <h2>Welcome to Slapp.Me</h2> <p>I have an <code>id</code> of "one" on my page container. I'm first in the source order so I'm shown when the page loads.</p> </div><!-- /content --> <div data-role="footer" data-theme="d"> <h4>Slapp.Me © 2012</h4> </div><!-- /footer --> </div><!-- /page one --> <!-- Start of third page: #register --> <div data-role="page" id="register"> <div data-role="header" data-theme="e"> <h1>Register</h1> </div><!-- /header --> <div data-role="content" data-theme="d"> <h2>Register to Slapp.Me</h2> <div data-role="fieldcontain"> <form id="registration" name="form1" method="post" action="http://m.slapp.Me/register-script.php"> <label for="rsUser">Username:</label> <input type="text" name="rsUser" id="rsUser" value="" /> <br /> <label for="rsPass">Password:</label> <input type="password" name="rsPass" id="rsPass" value="" /> <br /> <label for="rsEmail">Email:</label> <input type="text" name="rsEmail" id="rsEmail" value="" /> <br /> <input type="hidden" id="DateJoined" name="DateJoined" tabindex="5" value="<?php echo date("Y-m-d"); ?>" /> <br /> <button value="submit-value" name="submit" data-theme="b" type="submit" class="ui-btn-hidden" aria-disabled="false">Register</button> </form> </div> </div><!-- /content --> <div data-role="footer"> <h4>Page Footer</h4> </div><!-- /footer --> </div><!-- /page popup --> <!-- Start of third page: #login --> <div data-role="page" id="login"> <div data-role="header" data-theme="e"> <h1>Login</h1> </div><!-- /header --> <div data-role="content" data-theme="d"> <h2>Login to Slapp.Me</h2> <div data-role="fieldcontain"> <form id="login" name="form1" method="post" action="checklogin.php"> <h1>Login</h1> <input id="rsUser" name="rsUser" type="text" placeholder="Username" autofocus required> <br /> <input id="rsPass" name="rsPass" type="password" placeholder="Password" required> <br /> <input type="submit" id="submit" value="Log in"> <a href="#register" title="Register to Slapp.Me" data-rel="dialog" data-transition="pop">Register</a> </form> </div> </div><!-- /content --> <div data-role="footer"> <h4>Page Footer</h4> </div><!-- /footer --> </div><!-- /page popup --> </body> </html>
  18. Hmm, not sure, will check later... It looks like I am logged in cos I get to the next page
  19. hi, on my site: http://m.slapp.me/ When I login, user: test pass: test it checks the login against the database on a seperate page and then redirects if login successful but the URL stays the same, please help. here is my checking page: <?php ob_start(); $host="xxx"; // Host name $username="xxx"; // Mysql username $password="xxx"; // Mysql password $db_name="xxx"; // Database name $tbl_name="xxx"; // 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"); // Define $myusername and $mypassword $myusername=$_POST['rsUser']; $mypassword=$_POST['rsPass']; // 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); $sql="SELECT * FROM $tbl_name WHERE rsUser='$myusername' and rsPass='$mypassword'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $num_rows = mysql_num_rows($result); $row = mysql_fetch_array($result); // If result matched $myusername and $mypassword, table row must be 1 row if ($num_rows > 0) { session_start(); $_SESSION['login'] = "1"; $_SESSION['UserID'] = $row['UserID']; $rsUser = $row['rsUser']; header ("Location: http://m.slapp.me/login_success.php?rsUser=$rsUser"); } else { $errorMessage = "Invalid Login"; session_start(); $_SESSION['login'] = ''; } ob_end_flush(); ?> here is the page I end up on when successful <? session_start(); if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) { header ("Location: index.php"); } mysql_connect("xxx", "xxx", "xxx") or die(mysql_error()); mysql_select_db("xxx") or die(mysql_error()); $rsUser = $_REQUEST['rsUser']; $query1 = mysql_query("SELECT * FROM rstarget INNER JOIN users ON users.UserID=rstarget.UserID WHERE currentTarget = '1'"); $row1 = mysql_fetch_array($query1); $query3 = mysql_query("SELECT * FROM users WHERE rsUser = '$rsUser'"); $row3 = mysql_fetch_array($query3); $TargetID = $row1['TargetID']; $result1 = mysql_query("SELECT * FROM rstargetpictures WHERE TargetID = '$TargetID' AND PictureApproval = '1'"); $msg = $_REQUEST['msg']; ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Multi-page template</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" /> <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2434589-28']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-2434589-29']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <!-- Start of first page: #one --> <div data-role="page" id="success"> <header data-role="header"data-theme="b"> <h1>Slapp.ME</h1> <?php if($_SESSION['UserID'] == '1'){ echo '<a href="#success" data-icon="home" class="ui-btn-right">Admin</a>'; } ?> </header><!-- /header --> <div data-role="content" > Todays target is: <h2><?php echo $row1['TargetName']; ?></h2> <p><a href="#add" data-role="button" data-rel="dialog" data-transition="pop">Add Image</a></p> <p><a href="#" data-role="button" data-icon="star">Suggest new Target</a></p> <p><a href="#" data-role="button" data-icon="star">View Profile</a></p> <p><a href="#" data-role="button" data-icon="star">Logout</a></p> </div><!-- /content --> <div data-role="footer" data-theme="d"> <h4>Page Footer</h4> </div><!-- /footer --> </div><!-- /page one --> <!-- Start of third page: #add --> <div data-role="page" id="add"> <div data-role="header" data-theme="e"> <h1>Add Image</h1> </div><!-- /header --> <div data-role="content" data-theme="d"> <h2>Login to Slapp.ME</h2> <div data-role="fieldcontain"> <form id="login" name="form1" method="post" action="checklogin.php"> <label for="name">Username:</label> <input type="text" name="rsUser" id="name" value="" /> <label for="name">Password:</label> <input type="password" name="rsPass" id="name" value="" /> <br /> <button value="submit-value" name="submit" data-theme="b" type="submit" class="ui-btn-hidden" aria-disabled="false">Login</button> </form> </div> </div><!-- /content --> <div data-role="footer"> <h4>Page Footer</h4> </div><!-- /footer --> </div><!-- /page popup --> </body> </html> when logged in, the URL shows: http://m.slapp.me/checklogin.php it should be http://m.slapp.me/login_success.php as there is a redirect
  20. hi, I am about to use the multiple file upload: http://phpfileuploader.com/ There are a few issues I need to overcome... I need to be able to resize to thumbs in a seperate folder called thumbs at 100px height I'd like to rename my files with random numbers so I can upload same file name and it won't overwite?! also, I'd like to INSERT EACH image I upload into a database in my original code (single upload) I have resize to thumbs and insert in database: resize("gallery/".$FileName, 100, "thumbs/".$FileName); // Define $myusername and $mypassword $UserID=$_POST['UserID']; $PictureName=$_POST['PictureName']; $PictureDate=$_POST['PictureDate']; $TargetID=$_POST['TargetID']; // To protect MySQL injection (more detail about MySQL injection) $UserID = stripslashes($UserID); $PictureName = stripslashes($PictureName); $PictureDate = stripslashes($PictureDate); $TargetID = stripslashes($TargetID); $UserID = mysql_real_escape_string($UserID); $PictureName = mysql_real_escape_string($PictureName); $PictureDate = mysql_real_escape_string($PictureDate); $TargetID = mysql_real_escape_string($TargetID); $sql = "INSERT INTO rstargetpictures (UserID, FileName, PictureName, PictureDate, TargetID) VALUES ('$UserID', '$FileName', '$PictureName', '$PictureDate', '$TargetID')"; $msg = "New booking added"; $result = mysql_query($sql) or die('Error: ' . mysql_error() . '<br>SQL: ' . $sql); the code for the multiple uploader is too long, it's in OOPHP too!
×
×
  • 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.