-
Posts
1,216 -
Joined
-
Last visited
Everything posted by WebStyles
-
Man, around here nobody likes questions from people who haven't tried to solve the problem... you should post at least some code. anyway, here are some tips: read from text file: file_get_contents(); write to text file: file_put_contents(); increment number: $variable++; get users IP: $_SERVER['REMOTE_ADDR'];
-
"cleaniest" I can think of is just associate each record with their username and give them permissions to change just the fields where their username matches the one in the database. No need for LDAP to do that. (I'm assuming this directory is in an intranet where people can log in ? )
-
at a quick glance, it seems the email is being sent to 'me@mysite.com' as you've defined on line 8 and ignoring the email that's actually sent through the form.
-
Keep in mind that variables passed with GET method have a length limit and are always seen in the url. if you use POST they will not be seen and there's no limit. Back to your code: on page two, you have a hidden element that i not doing anything: <input type='hidden' name='lc_URL' /> Just thought I would mention that. I don't know if you'll need it later or not, but it's currently an element with just a name but no value, you're gonna need something like: <input type='hidden' name='lc_URL' value='SOME VALUE HERE'/> You also have this inside a form with no submit button. That is not going to do anything. Another thing to consider: Keep things tidy so you don't confuse yourself (and others). You're using this: <a href='gamehistory.php?lc_URL={$row['name']}'> to pass the value of 'name' across to the next page, but you call it 'lc_URL' when passing it, and 'id' when grabbing it on the next page. Just call it 'name' everywhere. Do the same in your databases... when i came out of the first one it was called name, why is it called player in the second one? Keep things simple. You now have name, lc_URL, id and player and they're all the same value. Not a good idea. you're also mixing styles a bit when you write this: (not that it's a problem, it's just not coherent) echo "<td class='h5'><a href='gamehistory.php?lc_URL={$row['name']}'>" . $row['name'] . "</a></td>"; why not use the same way of displaying the variable value? either this (my preference): echo "<td class='h5'><a href='gamehistory.php?lc_URL=" . $row['name'] . "'>" . $row['name'] . "</a></td>"; or this: echo "<td class='h5'><a href='gamehistory.php?lc_URL={$row['name']}'>{$row['name']}</a></td>"; I'm kind of confused by your <form> in the second page... things work the other way around: you place the <form> on the first page, with all the variables you need to pass to the second page and use a submit button inside it... here's an example: page1.php: echo '<form action="page2.php" method="post"> <input type="hidden" name="var1" value="valueOfVariable1"/> <input type="hidden" name="var2" value="valueOfVariable2"/> <input type="hidden" name="var3" value="valueOfVariable3"/> <input type="submit" name="submitbutton" value="Send to next page"/> </form>'; then on page2.php you could grab them all with: echo 'Variable 1 has value: '.$_POST['var1']; echo 'Variable 2 has value: '.$_POST['var2']; echo 'Variable 3 has value: '.$_POST['var3']; with this in mind, you url is correct and the value should be getting to the second page... try echo $_GET['lc_URL']; just to be sure it's getting there. If it is, then there is no entry in your database table `scorecards` where the field `player` has that value. I sort of got carried away here, sorry about that. Hope it helps though.
-
well, now it's a specific CSS question. So you're in the wrong forum. But this should help: a.button:hover {background-position: 0 -30px;}
-
how about: document.getElementsByTagName('span'); to read them all into an array, then you can get each one's content with spanList[0].innerHTML; then just reverse them (or whatever) and write them back with the same code: spanList[0].innerHTML = 'whatever';
-
What do you mean? I pressed the button (or what's left of it) and it redirected properly. The fact that it looks weird and too small is because you added class="test" to the code. Basically you now have a CSS problem, there's a specific forum for that. The button is HTML, the link code is JavaScript, and the style you're applying to the button is CSS.
-
yes, of course. If you have cpanel (for example) you probably have an option to pipe emails sent to a certain address through a php script or perl, or python, or whatever.
-
Login based on access control - cleanup code..??
WebStyles replied to azukah's topic in PHP Coding Help
you can greatly simplify that with something like this: <?php session_start(); require_once('config.php'); if (isset($_POST['user_email']) && isset($_POST['user_pw'])) { $user_email = trim($_POST['user_email']); $user_pw = trim($_POST['user_pw']); mysql_select_db($database, $makeconnection); $q="select * from `tbl_users` where `user_email` = '$user_email' and `user_pw` = '$user_pw' order by `user_role`"; while($r==mysql_fetch_assoc($q)){ $_SESSION['session_user_email'] = $user_email; $_SESSION['session_start'] = time(); if($r['user_role']=='1'){ header( "Location: index.php" ); exit(); }else{ header( "Location: test.php" ); exit(); } } //wrong credentials redirect header("Location: login.php?message=loginfailed"); } ?> but you still have some security issues there, suggest you read a bit about mysql_real_escape_string() . on the first line, what you're saying is basically: "If a $_SESSION variable does not exist, then don't start session" why? In simple terms, in any page you want to use $_SESSION variables (getting or setting) you need to have session_start() at the top before any output. Get the irony? $_SESSION never exists before you start the session. -
oh dear.... You know, you can replace almost all of that code for two blocks with something like this: $searchsplit = explode(" ", $pubname); $sql = "select * from `pusers` where `pname` like '". $pubname ."'"; foreach ($searchsplit as $k=>$v){ if(strtolower($v) != 'the' && strtolower($v) != 'and' strtolower($v) != 'of'){ if(isset($pe) && $pe ==1) $ql .= ' and '; $sql .= "`pname` like '".$v."'"; $pe = 1; } } $sql .= " order by `pname` limit ".$limit.",".$max."x";
-
(just as a reference) all variables passed through an url string (like you have) can be grabbed with $_GET['var_name']; so in this example: pagename.php?var1=Hello&var2=World echo $_GET['var1'] . ' ' . $_GET['var2']; would print "Hello World". Alternatively, all variables passed through an html form (using method="post") can be grabbed on the next page with $_POST['variable_or_field_name']; Hope this helps
-
if this is how you're creating the link: gamehistory.php?lc_URL=".$row['id'] then on gamehistory.php you can grab the id with this code: $id = $_GET['lc_URL']; now you want to use something like: mysql_query("select * from `games` where `memberID` = '$id'"); p.s. I invented the table `games` and the field `memberID` just for the purpose of an example. replace with your actual table and filed names.
-
<?php echo $row['description_'.$home_language]; ?>
-
echo "<form action='' method='post' id='edit_user' name='edit_user' ><p>ID: <input name='id' type='text' value='$row[id]' disabled='disabled' style='width:1.25em;' />"; echo "<p>Name: <input name='name' type='text' value='".$row['name']."' />"; echo "<p>Username: <input name='username' type='text' value='".$row['uname']."' />"; echo "<p>Password: <input name='password' type='text' value='N/A' disabled='disabled' style='width:1.75em;' />"; echo "<p>E-mail Address: <input name='emailAddress' type='text' value='".$row['email']."' />"; echo "<p>Account Activation: <input name='acntActivation' type='text' value='".$row['activated']."' style='width:.75em;' /> Valid Value: 0, 1."; echo "<p>Account Type: <input name='accountType' type='text' value='".$row['acntType']."' style='width:.75em;' /> Valid Value: 0, 1,2,3."; echo "<p>Account Status: <input name='accountStatus' type='text' value='".$row['acntStatus']."' style='width:.75em;' /> Valid Value: 0, 1."; echo "<p>Bandwhitch Used: <input name='bandwhitch' type='text' value='".$row['bandwhitch']."' style='width:2em;' />"; echo "<p>Notes: <textarea name='id' type='notes'>".$row['notes']."</textarea>"; echo "<p><input type='submit' value='Update User Profile' id = 'submit' name='submit' /></form>";
-
That's hardly anything to do with php. Your page formatting is HTML. There's a specific forum for that.
-
remembering a <select> choice Iis pre-selecting it. where I put the items in bold, you need ti put your if statements and select if needed.
-
text areas have the following format: <textarea name="bla bla bla"> your text here </textarea> radio groups have this format: <input type="radio" name="bla bla bla" value="whatever" id="something" checked="checked" /> and dropdowns have this format: <select name=""> <option value="somevalue">Your Text Here</option> <option value="anothervalue" selected>Your Text Here</option> </select> the parts in bold are where you need to place your conditions and variables. hope this helps.
-
change this: -Username: $userID<br> -Password: $userPassword<br><br> to this: -Username: '.$userID.'<br> -Password: '.$userPassword.'<br><br>
-
Something like this: before your loop: $cnt = 0; inside loop, at the beginning: // loop starts here $cnt++; if($cnt % 4 === 0) echo '<br />'; // rest of loop
-
Membership Page with transactions of accounts
WebStyles replied to carlito.way00's topic in PHP Coding Help
if you start the counter at 1, and increment after pulling out each row, counter will always be number_of_results+1. so if you only pull out one row, counter will say 2. (I'm just saying, maybe it's deliberate, in that case I apologize for buggin' you) -
HELP using PHP to display MYSQL database based on date
WebStyles replied to kasitzboym's topic in PHP Coding Help
well... glad you got the result you wanted, but you're extracting EVERYTHING from the database and then only showing a few... waste of resources. <?php require("connect.php"); $currentMonth = date("n"); $q=mysql_query("select * from `yearly_anouncements` where `month` = '$currentMonth'", $connect); while ($r=mysql_fetch_assoc($rq)){ echo 'Event: '.$r['event'].' (Id: '.$r['id'].')'; echo '<br />Date: 2011-'.$r['month'].'-'.$r['day']; echo '<br /><b>'.$r['display'].'</b>'; } @mysql_close($connect); ?> -
maybe with something like: <input type="button" onClick="lnk=this.form.menu;self.location=lnk.options[lnk.selectedIndex].value;" value="GO"> this is purely a javascript question, even though you have php code. Maybe if you post in the javascript forum you'll get a better result. try my code though, you never know...
-
HELP using PHP to display MYSQL database based on date
WebStyles replied to kasitzboym's topic in PHP Coding Help
how is the date stored in your database? timestamp: YYYY-MM-DD HH:MM:SS? seperate date and time? seperate day, month and year? post name of fields and format please.