
AV
Members-
Posts
32 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
AV's Achievements

Member (2/5)
0
Reputation
-
Hey everyone, I've got really weird problem - I've done a login script which uses sessions. Everything was ok till I put my script onto the outside server (read. on localhost it worked fine). Here's the errors output: Warning: session_start() [function.session-start]: open(/tmp/sesje/sess_9ef7ad3a99063f356d9bdac7a908212f, O_RDWR) failed: No such file or directory (2) in /home/kamil/domains/kamil.vdl.pl/public_html/predleague/acp/login.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/xxx/domains/xxx/public_html/xxx/acp/login.php:4) in /home/xxx/domains/xxx/public_html/xxx/acp/login.php on line 4 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/xxx/domains/xxx/public_html/xxx/acp/login.php:4) in /home/xxx/domains/xxx/public_html/xxx/acp/login.php on line 4 Warning: Unknown: open(/tmp/sesje/sess_9ef7ad3a99063f356d9bdac7a908212f, O_RDWR) failed: No such file or directory (2) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp/sesje) in Unknown on line 0 Any help would be great
-
Thanks mate it seems I'm really tired if I make such a crappy mistakes
-
Hey everybody, I made script to add match results, it has dynamically generated dropdown menu to select teams. Here's the code: add_match.php: <form method="post" action="add_match.php"> <img src="../templates/ico/flag_red.png" alt="Alpha"> <select name="tag_a"> <option>--------------</option> <?php $result = mysql_query("SELECT * FROM clans") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo '<option value="'.$row['tag'].'" name="tag_a">'.$row['tag'].'</option>'; } ?> </select> vs. <select name="tag_b"> <option>--------------</option> <?php $result = mysql_query("SELECT * FROM clans") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo '<option value="'.$row['tag'].'" name="tag_b">'.$row['tag'].'</option>'; } ?> </select> <img src="../templates/ico/flag_blue.png" alt="Bravo"> <br /><br /> <input type="text" name="score_a" class="login"> : <input type="text" name="score_b" class="login"> <br /><br /> <input type="submit" name="submit" value="Post" class="login_button"> </form> <?php if(isset($_POST['submit'])) { $tag_a = $_POST['tag_a']; $tag_b = $_POST['tag_b']; $score_a = $_POST['score_a']; $score_b = $_POST['score_b']; if(!empty($score_a) && !empty($score_b)) { $query = mysql_query("INSERT INTO matches SET id=NULL, date=CURDATE(), team_a='$team_a', team_b='$team_b', score_a='$score_a', score_b='$score_b'") or die(mysql_error()); if($score_a > $score_b){ // ALPHA WON mysql_query("INSERT INTO clans SET won='1' WHERE='$tag_a'") or die(mysql_error()); mysql_query("INSERT INTO clans SET lost='1' WHERE='$tag_b'") or die(mysql_error()); }elseif($score_a = $score_b){ // DRAW mysql_query("INSERT INTO clans SET draw='1' WHERE='$tag_a'") or die(mysql_error()); mysql_query("INSERT INTO clans SET draw='1' WHERE='$tag_b'") or die(mysql_error()); }elseif($score_a < $score_b){ // BRAVO WON mysql_query("INSERT INTO clans SET lost='1' WHERE='$tag_a'") or die(mysql_error()); mysql_query("INSERT INTO clans SET won='1' WHERE='$tag_b'") or die(mysql_error()); } echo 'Done Successfully!'; }else{ echo 'FILL OUT ALL FIELDS, d00d!'; } } // $tag_a = team1 tag // $tag_b = team2 tag // $score_a = team1 score // etc. When executing this I get error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE='team1'' at line 1 Any ideas what's wrong? It doesn't put $tag_a and $tag_b datas into the table
-
Hello there, this is my code: $dsn = 'mysql://root:@localhost/pred'; $options = array( 'debug' => 2, 'portability' => DB_PORTABILITY_ALL, ); $db =& DB::connect($dsn, $options); if (PEAR::isError($db)) { die($db->getMessage()); } //PREPARE QUERY $sth = $db->prepare("INSERT INTO test SET id=NULL, name='John', surname='Smith' "); if (PEAR::isError($sth)) { die($sth->getMessage()); } $res =& $db->execute($sth, NULL, 'John', 'Smith'); if (PEAR::isError($res)){ die($res->getMessage()); } $db->disconnect(); I written this from manual, and I don't understand one thing. If I have already prepared query, why I have to add data (which I want to put in db) here execute($sth, NULL, 'John', 'Smith')? If I don't put it there, the script will occure an error: DB Error: mismatch. I'd appreciate if somebody could spend some time for me and explain it. Sorry for my english...
-
Thanks for your reply! But it still doesn't update the data in table
-
if(isset($_GET['modify'])){ $id = $_GET['modify']; $result2 = mysql_query("SELECT * FROM news WHERE id='$id'") or die(mysql_error()); $row = mysql_fetch_array($result2); echo "<table class='table'>"; echo "<form action='news.php' method='post'>"; echo "<tr><td>Title:</td>"; echo "<td><input type='text' value='".$row['title']."' name='title' class='login'></td></tr>"; echo "<tr><td>Content:</td><td><input type='textarea' value='".$row['content']."' cols='50' rows='20' name='content' class='login'></td></tr>"; echo "<tr><td><input type='submit' name='submit' value='OK' class='login_button'></td></tr>"; echo "</form></table>"; }else{ if(isset($_POST['submit'])){ $title = $_POST['title']; $content = $_POST['content']; $done = mysql_query("UPDATE news SET title='$title', content='$content' WHERE id='$id'") or die(mysql_error()); if(!$done){ echo 'Something gone wrong!'; }else{ echo 'Updated.'; } This is my code. When I try to correct something in the textarea (content) and push OK, the 'Updated.' appears. Problem is that data in table isn't updated. I hope you understand me, thanks in advance.
-
Is this really hard to understand that after I click the button nothing happen! Nothing change!! tgavin, I tried removing all the code, it behaves same as before
-
redarrow, it still doesn't work I tried as tgavin said, adding print_r($_POST) to the script but nothing happens. I forgot to say that the whole code I posted here it is index.php Any ideas??
-
Hi everybody, I got script alike this: <?php include('../config.php'); include('../functions.php'); session_start(); db(); ?> <?php include('../templates/header.html'); ?> <?php if(isset($_SESSION['correct'])) { echo '<div id="done">User logged as: '.$_SESSION['correct'].'</div>'; ?> <div id="menu"> <img src="../templates/images/menu.png" alt="Menu" /> <ul> <li><a href="index.php">Home</a></li> <li><a href="logout.php">Logout</a></li> </ul> </div> <div id="about"> <img src="../templates/images/manage_users.png" alt="Manage users" /> <div id="text_about"; <form method="post" action="index.php"> <table> <tr><td>New password:</td> <td><input type="text" name="new" class="login"></td></tr> <tr><td>Confirm password:</td> <td><input type="password" name="new2" class="login"></td></tr> <tr><td colspan="2" align="center"> <input type="submit" name="submit" value="Change" class="login_button"></td></tr> </table></form> <?php if(isset($_POST['submit'])) { $new = $_POST['new']; $new2 = $_POST['new2']; if($new == $new2 && !$new2=''){ $new_pass = sha1($new2); $login = $_SESSION['correct']; $result = mysql_query("UPDATE users SET pass='$new_pass' WHERE login='$login'") or die(mysql_error()); if(!$result){ echo 'Changing password phailed'; }else{ echo 'Done!'; } }else{ echo '<br />Passwords dont match!'; } } ?> </div> </div> <?php } else { echo '<div id="warning">*beep* Access denied!<br /><br />'; echo '<a href="login.php">LOG IN</a></div>'; } ?> <?php include('../templates/footer.html'); ?> The problem is that the submit button doesn't work after clicking it. Any ideas what is wrong?
-
Thank you very much guys! Do you have any clearly written tutorials for OOP in PHP5?
-
Hi all, I started to learning OOP and just on start I got an error: Fatal error: Cannot access empty property in (...)books.php on line 16 The php code: class Books{ var $cena; var $tytul; function setCena($par) { echo $this->$cena = $par; } function getCena(){ echo $this->$cena.'<br />'; } function setTytul($par){ echo $this->$tytul = $par; } function getTytul(){ echo $this->$tytul.'<br />'; } } $fizyka = new Books; $chemia = new Books; $matematyka = new Books; $fizyka->setTytul("Fizyka dla kazdego - cz. I"); $fizyka->setCena("40zl"); $chemia->setTytul("Chemia wokol nas"); $chemia->setCena("30zl"); $matematyka->setTytul("Pitagoras i ja"); $matematyka->setTytul("35zl"); //WYSWIETLAMY KSIAZKI $fizyka->getTytul(); echo"||"; $fizyka->getCena(); Tytul=title, Cena=price What do I do wrong?
-
Hi all. My first question is do you have any instructions/tutorials how to use .tpl files? Second: how may I create special div? Let's say I have a simple website, with admin panel written in php. In AP I have a field called 'special div' which after I write text there and check checkbox it appears on frontend website as red div, placed somewhere (no important where). Do you have any ideas how to do it? I don't ask for ready code, but for your concepts. Regards.
-
Hi, I have the following problem: I made two files: one javascript with count down, second with php file that executes after the time (in js) counts down. On localhost, it works very well while on my hosting it's not. No errors, just nothing. When I check php file manually it works. I have already checked chmods. Any ideas?
-
First problem is solved, but I get another one: every time I open it starts from 00:57:17. It should change dynamically, every time I refreshed page it should show time counted down. Any ideas?
-
Done, I used this one: http://www.ozerov.de/bigdump.php