Bramme
Members-
Posts
37 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Bramme's Achievements
Newbie (1/5)
0
Reputation
-
hmm, i totally forgot about htis topic. the problem has been solved... I rewrote a part of the class indeed, but also changed the order of which fucntions i'm calling in index.php, i think the problem might've been there.... dunno for sure though. Anyway, it's solved. thanks for the info though!
-
[SOLVED] Check database for fully booked session before submitting
Bramme replied to biggieuk's topic in PHP Coding Help
basic idea: confirmation.php if(isset($_POST['Submit'])) { $capacity = get the value, either from your form or your database; $placesbooked = get the value, either from your form or your database; if($capacity - $placesbooked < 0) { echo 'error!'; } else { //store the values from your form temporarily in a session (don't forget to start it!) $_SESSION['value'] = $_POST['value']; header("Location: confirm.php"); } confirm.php echo '<p>Your trip is succesfully booked</p>'; echo '<p>Your details were: <ul>'; echo '<li>'.$_SESSION['value'].'</li>'; echo '</ul>'; etc -
indeed, i'd do it with php too... when the user click the submit button, run a script that checks if it's a valid email address, then add it to a database, and then create a second form (that only you can access), with the necessary things for your email, next, loop through your database with emails and send that mail to everyone... Might get a little slow though if you have a lot of subscribers...
-
I've got a multidimensional associative array that looks like this: Array ( [cont] => Array ( [filename] => /var/www/vhosts/bramme.net/subdomains/dev/httpdocs/admin/modules/content.php [name] => 2-Content [subnav] => Add, Edit, Delete pages [dependent] => 3-Navigation ) [dashboard] => Array ( [filename] => /var/www/vhosts/bramme.net/subdomains/dev/httpdocs/admin/modules/dashboard.php [name] => 1-Dashboard [subnav] => [dependent] => ) [nav] => Array ( [filename] => /var/www/vhosts/bramme.net/subdomains/dev/httpdocs/admin/modules/navigation.php [name] => 3-Navigation [subnav] => Edit [dependent] => 2-Content ) ) A function reads a set directory and builds that array, as you can see, some files need another, indicated with the dependent file's name. Now I need to check for each array key (cont, dashboard, nav) if their dependent value (if any) matches any of the name values, thus being sure the dependent file is existent too. Instead of building a new piece of code that loops through my directory again, I thought I could just do it with !in_array, like this foreach($this->modules as $module) { if(!empty($module['dependent'])) { $dep = $module['dependent']; if(!in_array($dep, $this->modules[]['name'])) { die("Dependent file not present"); } } } but it's clearly not working. Anyone suggestions on how to do this?
-
I don't need a line specific correction here, I just need some pointers to know where to look at... Did I probably forget to mention a $this-> somewhere, could it be a typo or is it some php setting... I'm completely at a loss here, I don't know where to look at.
-
lol@"a plant" But yeah, some basic php, mysql and OO PHP should cover it... unless you'd want flash animations too...
-
Example of what's happening: class MyClass { private $items = array(); function dostuffwithitems() { do stuff; return $this->items; } function dosmthelse() { print_r($this->items); } } I did the print_r to test because my second function wasn't working, and it just echo'ed array( )... It's still empty, if I change the private var to 'boo', it prints 'boo' instead of the array I built with the first function... I've tried it with other variables too, nothing prints correctly or returns like it should... Anyone can tell me what I'm doing wrong? Full code here: http://dev.bramme.net/files/Modular.class.phps
-
ob_start; workaround?
-
are you sure the path is correct? else try with <?php $root = $_SERVER['DOCUMENT_ROOT']; $path= $root.'/uploads/'; $i = count(glob($path.'*')); echo $i; ?>
-
yes indeed. it would be much easier to extend your existing users table like this as it is now (i'm guessing) user_id | name | password as it should be user_id | name | password | a | field | for | everything | you | want | to | save. And then in your code when the user has entered the correct login and password, you should add smth like $_SESSION['userid'] = $id (where $id could be fetched from the database). Next, you redirect them all to the same page which has a table like <?php $userid = $_SESSION['userid']; $userdata = mysql_fetch_assoc(mysql_query("SELECT * FROM users WHERE user_id = $userid)); echo "<ul>\n<li>Name: $userdata['name']</li>\n<li>Field: $userdata['field']</li>\n</ul>"; ?> Something like that...